Xpages: Loading…. (images and masking)

On November 10, 2009, in Uncategorized, by Mark Hughes

Sometimes for various reasons, clicking on links in in X-page, or refreshing a view or a page may take several seconds to complete. So that users do not keep clicking on the button, or think the browser is not working, i have added a “loading image” and a mask to show people that the page is working, just a little slow.

I hope someone shows me a better way to do this… but here is my attempt.

1. In the css file for the page add

<span style="color: rgb(0, 0, 255);">div</span><span style="color: rgb(204, 102, 51);">.loading</span> {<br />   <span style="color: rgb(0, 0, 255);">background-image</span>: url(ajax-loader<span style="color: rgb(204, 102, 51);">.gif</span>);<br />   <span style="color: rgb(0, 0, 255);">background-repeat</span>: no<span style="color: rgb(0, 96, 128);">-repeat;</span><br />   <span style="color: rgb(0, 0, 255);">background-position</span>: <span style="color: rgb(0, 96, 128);">center;</span><br />   <span style="color: rgb(0, 0, 255);">background-color</span>:<span style="color: rgb(0, 96, 128);">black;</span><br />}

2. Add a JavaScript library and name it loading, then add these lines

dojo.require(<span style="color: rgb(0, 96, 128);">'dijit.Dialog'</span>)<br /><br /><span style="color: rgb(0, 0, 255);">function</span> loading() {<br />   underlay = <span style="color: rgb(0, 0, 255);">new</span> dijit.DialogUnderlay({<span style="color: rgb(0, 96, 128);">'class'</span>: <span style="color: rgb(0, 96, 128);">'loading'</span>});<br />   underlay.show();<br />}<br /><span style="color: rgb(0, 0, 255);">function</span> stoploading(){<br />   underlay.hide()<br />   }

3. Insert the JavaScript library loading on the page under the resources section

Now to implement this in a button that does not do a “full update”

1. In the outline on the button expand the button and click on event handler, then clcik the all properties tab.

image

2. in the onStart event enter loading()

3. in the onComplete enter stoploading()

Now to implement this in a button that does a “full update”

1. In the onClick event, choose the client tab, then enter in loading()

image

Now to implement this in view column link

1. First we have to change how it open a document, click on the onClick event.

2. Create an action on the server side to execute a script.

3. set the script to:

doc = viewEntry.getDocument();<br />applicationScope.docid1 =  doc.getUniversalID();<br />

4. Create another action to open a new page, put in the page name to open, then edit document, then document id should be computed to

applicationScope.docid1

image

5. On the Client tab, enter in loading()

All of these will produce a mask covering the whole screen with a loading image in the middle like

image

image

 

Xpages: Web Dashboards made easy, I Love X-pages!!

On November 6, 2009, in Uncategorized, by Mark Hughes

On a recent project, a simple one at that, an executive wanted an overview dashboard to show totals from many different views on one page. I started thinking about how i would do this in the

Notes client…
I could make a form with computed fields and create an agent or query open LS code to get the values and set the fields values.
I could create computed fields and do it with formula language but what a pain that would be.
The old way on the web
I would to use a webquery open agent and set the values, or compute formula on the fields.
Xpages…

Well in X-pages i am allowed to create a computed field and use SSJS to compute the value. It is like having a computed field on a client based notes form and setting the value to LS, which of course you cant do.
i wrote three lines of code per field
db = session.getCurrentDatabase()
view1 = db.getView(‘On Site’)
view1.getEntryCount()

or it could be like
db = session.getCurrentDatabase()
view1 = db.getView(‘On Site’)
dc1 = view1.getAllDocumentsByKey(‘test’)
dc1.getCount()


and of course you can do a
db = session.getCurrentDatabase()
view1 = db.getView(‘On Site’)

dc1= view1.getAllDocumentsByKey(‘test’)
doc = dc1.getFirstDocument()
total = 0
while(doc != null)
{
total = doc.getItemValueDouble(‘amount’) + total
set doc = dc1.getNextDocument(doc)
}

total.valueOf()

X-pages made this easy web development, compared to what i had to do in the past
 

It has been noticed by management lately that IE is a horrible browser, i have known this for a long time. It is big, it is slow, and it does not support many web standards. Since we might start standardizing on the iPhone as the business phone over the blackberry, the thought occurred to use Safari 4 as the default browser in our company, otherwise maybe FF35 would be just as good or better.

A couple of questions that maybe only the enterprise would care about.
1. Can you set the update software to poll an internal server for the Safari Updates? So every client does not go to the internet to get the new downloads.
2. Can you set policies to control custom settings or setup options?
3. Does Lotus support Safari for inotes?
Thanks for any help anyone can provide
Update: It appears there is an Apple Software Update Server that can be run on a mac mini that will update even the windows machines apple software.