Managing JavaScript Libraries in Domino
Using a JavaScript toolkit, such as Dojo or YUI, represents a problem for us Domino developers — how do we roll out a solution that relies on so many external files?!
The preferred option is to get FTP access to the Domino server's HTML directory and store the files there. This isn't always possible though and represents problems of its own.
The more obvious solution is to import all the files in to our NSF database using Domino Designer. The problem here is that there can be dozens - if not hundreds - of files to import. We could of course import them folder by folder and rename each File Resource to represent the original directory structure. This is a laborious task though and not one I'd want undertake again, having already done so once for TinyMCE and all its files.
Well, help is at hand in the form of WebDAV. Yesterday YoGi posted a comment here saying that he used WebDAV to import and manage the files from YUI in his NSF files. WebDAV was something I tried ages ago, had no luck with and gave up on. Prompted by YoGi's success I went and tried it again and I'm happy to report that it was a doddle. In very little time at all I had all the files imported in to a NSF file with their original folder structure intact. Domino even puts images and stylesheets in to the right parts of the design for you.
Here are the fully loaded NSFs for you to download:
- Dojo Toolkit 0.3.1 in Domino (800k Zip file, 4mb unzipped)
- Yahoo! UI Library 0.11.4 in Domino (400k Zip file, 3mb Unzipped)
Implementing either toolkit on your Domino server is now really easy. Although there are still options to consider. Do you include all the files in the same NSF or do you keep them all in their own database somewhere on the server. If you keep them all in their own NSF with an open ACL then you can share with other projects. If you do this you'll need to be careful about version control. WebDAV makes it easy to update the whole toolkit in one go when a new version is released. Doing this can break other projects which rely on the files though. Much better is to have all files in /libraries/yui-0-11-4.nsf and then create a new database at /libraries/yui-0-11-5.nsf when needed. This way you can upgrade projects on a one-by-one basis.
By the end of the week I'll have a Rough Cut article up here describing how to setup WebDAV on Domino and import all the files using Windows Explorer.
We also use a lot of JS files in our web application. Since the application is used by a large number of users, performance is really important to us. We found that we got better performance if we put static JS files in the domino\html directory.
For deployment of the JS files we now use a different approach: we store all the files in a ZIP file and add it to the template. A LS agent will deploy the JS files to the correct html directory when installing the application. That way, no FTP or WebDAV access is needed.
I look forward to the WebDAV article though. Just like you I experimented a bit with it a couple of years ago, didn't like it then and forgot about it.
Mark
You're right Mark. Definitely best to keep files in the HTML folder. Escpecially for the sake of performance. Not always an option though.
Looking forward to the rough cut, Jake. My problems with webdav came down to not being versed with IIS enough to get things to work the way they seem to be documented. And it seemed to require a Domino server be handy as well, something else that frustrated my efforts as I don't maintain one constantly and often repurpose the box where I do stand one up... though that may be something I can start getting to grips with with VMware or something similar.
AWWWW Mannn. I just did this for dojo last week by hand
Doh!
Hi Jake, I'm trying to use a dojodropdowndate picker.
But as a domino field and a html input tag, is a different thing i'm kinda struggling.
What I'm currently trying is this.
onclick="document.getElementById('deadline').value = dojo.byId('dojodeadline').date;"
adding this line of code into the other tag in html properties of the submit button.
I'ts all good being able to use dojo now i've found the \Data\domino\html folder. but I need a way to translate the dojo widget info into submitable domino field data.
Can you show us how to do that next time :D
Cheers.
Just noticed your time is 10:00 on your server, and now its 16:00 and you're based in the uk too.
just noticed your hosting co, is in usa :D sorry.
{Link}
This is a link of what I'm not trying to do, basically both field must say the date.
Once the data copies to the domino field, i can make that field a hidden field and just display the dojo field.
Hi Joseph. Well, I just took my first real look at Dojo by trying to use the date picker on a Domino form. While the widget looks cool I just don't get it with the implementation and can't get it working. The documentation online just doesn't make sense/exist either. I've given up.
That just what I can't stand about Domino, I must know everything about everything, to get a proper app running. I can't just build my way up this easily.
I'm very interested in Dojo's accordion widget. However, I'm not sure how to trap for it programmatically.
What I'm after is a way to use javascript to force an accordion element open when I'm validating a form prior to its being submitted.
Have you done this, Jake? Anyone else do something similar?
Thanks
--Steve Lacher
I have tried to build one application using Dojo framework in Domino but didnt work. Facing problem in loading js and css.
I have download the Dojo Toolkit 0.3.1 in Domino NSF but not found any example except the file and the css.
Can anyone provide me the nsf with forms and other examples so that I can start with the dojo?
Thanks!!
-Abhijeet
Hi All,
I've downloaded both the nsf files. I'm a beginer to DOJO. There are no forms in the nsf to get a demo of how to use dojo in the database .... Pls help.
Thanks in Advance.
I too have been beaten by the dojo documentation into giving up on adding this to a notes/web app. However, with rumours of it being added to the 8.5 server build I went searching and found this fantastic example. Link Big thanks to Tony Palmer for posting this.