357 Lotus blogs updated hourly. Who will post next? Home | Downloads | Events | Pods | Blogs | Search | myPL | About 
 
Latest 7 Posts
MWLUG 2014 Slide Deck – Write once, run anywhere: Angular.js in XPages.
Tue, Sep 2nd 2014 23
Going to MWLUG 2014? You need to buy these guys a beer as well….
Sun, Aug 24th 2014 179
Going to MWLUG 2014? Buy Dave Leedy a beer
Sun, Aug 24th 2014 344
Chart Directives and Dynamic Binding – MWLUG 2014 preview
Wed, Aug 20th 2014 202
Accessing the original element when using Select2-focus
Sun, Aug 17th 2014 154
Angular in XPages #8 – Directives (did someone say plugins?)
Sun, Aug 10th 2014 177
Working on my MWLUG2014 presentation
Wed, Aug 6th 2014 208
Top 10
Arguably the most dangerous thing you could ever do in XPages – let other people use your eval() in their SSJS
Tue, Jun 18th 2013 1256
Why learning JavaScript is more critical to XPage developers than Java
Wed, Mar 26th 2014 1000
An open letter to Mr. NotesIn9
Wed, Apr 2nd 2014 662
Adding custom HTTP headers to Domino R9 using IBM HTTP Server (IHS)
Sun, Apr 20th 2014 628
Angular.js in XPages #1 – Using the right IDE for development
Sun, Apr 27th 2014 560
WebSockets comes to XPages!! Awesome – Awesome – Awesome
Tue, May 20th 2014 557
EXTJS in XPages #13: Totaling your columns with a groupingSummary
Sun, Jun 30th 2013 544
EXTJS in XPages #14 – Grid editing and saving data via REST CRUD
Thu, Aug 1st 2013 542
And the gloves are off……
Mon, Mar 31st 2014 540
Angular.js in XPages #6 – A People Manager CRUD application
Sun, Jun 1st 2014 484


jQuery in XPages #7 – Pines Notify
MarkyRoden    

In this article I will demonstrate how to implement a cool notification technique using Pines Notify.  This small (7k min) js library provides a wealth of flexibility and a feature set second to none. It can use multiple different CSS libraries (bootstrap, jQueryUI and others) so integration into your site is quick and simple.

Introduction

Pines Notify is a notification popup capability which is easily integrated into a website. Like most jQuery plugins there is a methods to instantiate the capability and the ability to pass in multiple parameters.  There are certainly other popup style plugins but this is easy to grasp and the examples are very good.

We are going to look at how to make some complex function popups like these…

Examples of Pines Notify popups

Examples of Pines Notify popups

Demonstration

There are two demonstration pages this week

The first demonstration is a basic port of the Pines Notify buttons from the original example into an XPage.

The second demonstration shows how the Pines Notify could be used in a real application

Download 

Click on the link to download the complete jQuery in XPages demonstration database (including Pines Notify).

Pines Notify

Pines Notify provides a basic shell for popup creation and the capability for multiple custom configurations. A “popup” by default is created on the top right of the screen and disappears after a fixed period of time. The the position, CSS, length of time shown, transparency, contents, callbacks and other features can be controlled through the use of parameters. There are too many to mention in one article but they can all be seen at the example website.

Sample Notification

Sample Notification

Adding Pines Notify to an XPage

The Pines Notify download contains the .js files (readbale and minified) and a basic css file. These are easily added to our database as files in the WebContent folder.

Adding Pines Notify js and css fields to our database

Adding Pines Notify js and css fields to our database

Once we have added the js and css files to the database they can be added to our XPage as a resource(s)

	<xp:this.resources>
		<xp:script src="js/jquery.pnotify.min.js" clientSide="true"></xp:script>
		<xp:styleSheet href="css/jquery.pnotify.default.css"></xp:styleSheet>
	</xp:this.resources>

jQuery UI and jQuery

Pines Notify uses the jQuery library and jQuery UI CSS for display. These are added to the XPage as additional resources

	<xp:this.resources>
		<xp:script src="js/jquery-1.7.1.min.js" clientSide="true"></xp:script>
		<xp:styleSheet href="css/jquery.custom-theme/images/jquery-ui-1.8.18.custom.css"></xp:styleSheet>
	</xp:this.resources>

Using Pines Notify

Pines Notify has a basic format for activating. Here is a sample button from the website:

<button class="btn source" onclick="$.pnotify({
 	pnotify_title: 'Regular Notice',
 	pnotify_text: 'Check me out! I'm a notice.'
});">Regular Notice</button>

In this format the button does not work correctly when added to an XPage as it causes a page refresh when clicked. To turn this into an functioning button we must use an <xp:button> like this one

<xp:button value="xPages Lower Timer" id="button1" styleClass="btn source">
<xp:eventHandler event="onclick" submit="false">
	<xp:this.script>
		<![CDATA[$.pnotify({
			pnotify_title: 'Regular Notice',
		 	pnotify_text: 'Check me out! I'm a notice.'
		});]]>
	</xp:this.script>
</xp:eventHandler>
</xp:button>

The Pines Notify examples website gives us the code we need to create each button

Taking the sample code from the Pines Notify examples page

Taking the sample code from the Pines Notify examples page

And to convert this to our XPages button we just need to copy and paste this code and insert it into the <![CDATA[ code section above. Using this we can quickly and easily convert the examples into functioning XPages buttons.

Pinning Notifications

By default all Notifications have the ability to "pin" them to the screen. Should they contain information the user wishes to retain, they can do so

Pinning your notification

Pinning your notification

Closing Notifications

By default all notifications can be closed before they fade out using the X in the notification

Stacking notifications

Pines Notify notifications always stack on top of each other, so you never have to worry about position or overlaying issues, they will organize themselves nicely.

Showing all notifications

By default there is a bar added to the screen which allows user to see the last and/or all previous notifications.

Showing all previous notificaitons

Showing all previous notificaitons

Working this into XPages functionality

Javascript alert boxes have been used since the start of the web but they require a user click and an unnecessary interaction from the user if the point of the notification is just that – to notify the user of something.

In our XPages applications we could potentially notify the user after:

  • Successful REST update from the server
  • partialRefresh completion
  • form submission
  • Pager completion
  • General application workflow progress
  • Validation failure

really the possibilities are endless and really up to you the developer.

Examples

My demonstration site examples page has illustrated a number of buttons taken directly from the website and I have also added some notifications to the other jQuery in XPages examples (linked in through the menu).

On my second Demonstration page There are 4 simple examples of real application uses for Pines Notify

Dojo Toaster Widget

On the XPages server without the need for jQuery you can use the dojo toaster widget to provide a notification capability. You should take a look at Chris Toohey’s well written article on Mastering the Dojo Toaster for XPages to get a comparison.

Thanks

To Alan Hurt for pointing me in the direction of this plugin :)




---------------------
http://xomino.com/2012/04/24/jquery-in-xpages-7-pines-notify/
Apr 24, 2012
70 hits



Recent Blog Posts
23


MWLUG 2014 Slide Deck – Write once, run anywhere: Angular.js in XPages.
Tue, Sep 2nd 2014 1:05p   Mark Roden
Here is the slide deck for those interested – thank you to everyone who attended the presentation and I look forward to talking more on the subject in the future. http://www.slideshare.net/MarkRoden/angularjs-in-xpages [read] Keywords: xpages
179


Going to MWLUG 2014? You need to buy these guys a beer as well….
Sun, Aug 24th 2014 8:07p   Mark Roden
—->>>> Richard Moy [read] Keywords:
344


Going to MWLUG 2014? Buy Dave Leedy a beer
Sun, Aug 24th 2014 5:37p   Mark Roden
Yeah I know I have rattled on about this before but it holds as true today as it does any other day before. Here is a list of reasons you should buy Dave Leedy a beer in case you were wondering… 1) really? You need a list?? Shame on you…. 2) NotesIn9 has helped you – One of those videos by Dave, John, John, Brian, Chris, Graham, Jeremy, Mark, Mark, Paul, Peter, Steve, Tim, Chris, Paul, Josh, Dan, Niklas, Michael, Russ, Serdar, Sean, Mark, Brad, Frederick, Steve, Richard, Kathy, [read] Keywords: ibm community
202


Chart Directives and Dynamic Binding – MWLUG 2014 preview
Wed, Aug 20th 2014 7:13p   Mark Roden
Although not directly related to the purpose of the presentation I am going to demonstrate how to use an Angular.js chart directive to bind to the application service data and create dynamic charting within the application. Changing the Zip for 1 Marky not only updates the data displayed – but also because of the data bind – auto-magically updates the chart While this in itself does not directly relate to the write once and run anywhere nature of the presentation – it d [read] Keywords: application
154


Accessing the original element when using Select2-focus
Sun, Aug 17th 2014 7:36p   Mark Roden
In the application we are currently working on I wanted to add an ajax call to a JSON service, but only for certain fields. Rather than go through the application and add the code to every element I used a delegated focus event for the field with an attribute of  “help_fieldName”. The following HTML represents the code on the form: UK US Global First Name Last Name The following jQuery code makes it work. The getHelp function shows/hides [read] Keywords: ajax application xml
177


Angular in XPages #8 – Directives (did someone say plugins?)
Sun, Aug 10th 2014 8:08p   Mark Roden
In this article I will discuss Angular Directives and why they are near and dear to my heart Directives Directives in Angular are modular pieces of functionality which in some cases are very analogous to plugins in jQuery. According to the Angular documentation… “At a high level, directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS’s HTML compiler ($compile) to attach a specified behavior to that DOM element or [read] Keywords: xpages application css
208


Working on my MWLUG2014 presentation
Wed, Aug 6th 2014 8:04p   Mark Roden
Just wanted to show a work in progress – screenshots of what I am working on for MWLUG2014. Part of the presentation is showing how to make your Angular applications portable. My sample app will be the one I created as part of the Angular in XPages series. I will walk through the code and demonstrate how I can take this stand alone application and insert it into this bootstrap demo dashboard application creating this fully functional component capability within the dashboard With [read] Keywords: xpages application applications




326


Angular.js in XPages #7 – Writing better code using Services
Sun, Aug 3rd 2014 6:01p   Mark Roden
In this article I will discuss a better programming practice for Angular.js than was demonstrated in the previous articles within this series. I have mentioned before, part of the purpose this blog is very much a “learning in progress” for me. Without going through the previous articles I would not have been able to get to this point and write “better code”. Hopefully with that understanding, those of you who have been along for the ride will appreciate this and grow w [read] Keywords: agent lotusscript xpages application twitter
299


Taking back productivity in Domino Designer (a NotesIn9 production)
Tue, Jul 29th 2014 3:27p   Mark Roden
Yeah it has been a while (over 18 months) since the last time I did a NotesIn9 video but it finally happened again. NotesIn9 149:  Database Resources and Design Definition Doesn’t sound very exciting does it? Dave needs to work on his attention grabbing heading show names. I would have called it something more like this – but then who am I to complain – it is not my show after all ;) NotesIn9 149:  Taking back productivity in Domino Designer  This video revolves around som [read] Keywords: domino notes xpages database eclipse
252


The consummate Champion
Thu, Jul 24th 2014 8:42p   Mark Roden
As Russ Maher said today in Hey Who got the Handsome Champion it is an honor and a privilege to not only be recognized by IBM as a Champion for ICS 2014, but you also get some very cool stuff. Thanks to Amanda Bauman and Oliver Heinz for organizing “the champions” and all the gear. I just wonder what I am going to do with all of it :) Seriously though, I am very humbled to be an IBM Champion ! Thank you to everyone who nominated me and made this possible :) [read] Keywords: ibm




Created and Maintained by Yancy Lent - About - Blog Submission - Suggestions - Change Log - Blog Widget - Advertising - Mobile Edition