Tuesday, June 21, 2011

Tip for those working with Database events in 8.5.x designer

If you're working with Open/Close events, it's quite cumbersome when you want to test your code. You have to close the app in both Domino Designer and Notes. I used to close the designer every time I wanted to test modified code.

During a chat, Tim Tripcony mentioned that you could close the apps in Designer from the Package Explorer. In Package Explorer, each app is shown as a project. To release the app from Designer, simply right click the project, and select close project. No need to remove the app from Designer or close Designer to release the app from memory.

Share and enjoy! :)

Creating your own keyboard shortcuts in Domino Designer

File -> Preferences --> General -> Keys

I currently have two custom keyboard shortcuts, Alt + b to build a single project, and Alt + c to close a project in Package Explorer.

Friday, June 17, 2011

One editable area can be used multiple times in a Custom Control

Not sure how many now this, but an editable area (xp:callback) can be used multiple times inside a custom control.

If you have an editable area with fields, you can put the field several places in the custom control (same facetName). I'm currently working on a custom control that lets the user edit/add documents. Inside a repeat control, I show the existing documents. Below that, the user can add documents.

E.g.
..
<xp:repeat>
..
<!-- View and edit existing fields -->
<xp:callback facetName="fields" disableTheme="true" />
..
</xp:repeat>
..
<!-- Create new document -->
<xp:callback facetName="fields" disableTheme="true" />
..
I also discovered that currentDocument seems to point to the "closest" document data source.

Monday, June 13, 2011

Simple API tester - SSJS bugs remain

A couple of years ago I blogged about bugs in Array.splice, String.match with global modifier, and String.replace with function as parameter.

I did a little test on the current beta of 8.5.3. Guess what. Two years later, the bugs still haven't been fixed.

I made a small API tester utility that you can set up tests for the API/expected result. In the demoapp, there are tests for the bugs that I'm aware of. I also added a couple of tests for inconsistencies in the @-functions api.

It's quite simple to set up for JS/ECMAScript tests. Do the test in Firebug or a similar JS console. Copy/paste the expression, and the result into the fields in the XPage. Run test to see if the result is what should be expected. Note that SSJS follows ECMA-262 Edition 3. Firefox also follows this standard, but has features from JavaScript 1.8.x (according to wikipedia) that SSJS doesn't have.

>> Download API Tester

Disclaimer:
This is beta software from IBM and does not represent a commitment, promise or legal obligation by IBM to deliver, in a future release of Notes/Domino or Lotus Notes Traveler, any material, code or functionality described/shown in this presentation.

Friday, June 10, 2011

Another release of the API Inspector

Changes
* Possibility to select XPage to inspect
* No longer a custom control - One XPage to inspect them all!
* Links to the XPages API for XPages classes


You can download the latest release from OpenNTF

Screenshots


Thursday, June 9, 2011

New release of the XPages API Inspector

You can download it from OpenNTF.

Changes:
* Tweaked the user interface
* Now requires 8.5.2 or higher (Process data without validation)
* Removed dijit.form.Textarea from the expression area, and made a simple resize function instead (due to refresh issues)
* Previous expressions are stored/can be selected from a combo box
* SSJS Code and CSS moved into a library/stylesheet for easier maintenance

Screenshots



Wednesday, June 8, 2011

Enabling template inheritance per design element on new design elements

The new design elements (everything that you have to edit through Package Explorer) don't have an interface to set template inheritance on them.

You can enable this functionality with a little hack.

Create a view that shows all design elements. Set the first column formula to $Title. This makes it easier to find the design element you're looking for.

Set the $Class field on the design element document to the template you want it to inherit from. You can do this using a formula agent, or a plugin like Formul8.

That's about it. I'm not sure how the refresh task handles compiling of your java code, but since it seems to work when the design task refreshes an entire application from a template, I'm not surprised if everything works as you expect it to do.

Per design element inheritance enables you to have a central repository for things like message bundles. If you want to change a typo in a label (e.g. Adress -> Address), you can change this in the repository, and all applications that "subscribes" to this bundle will be updated with the fix.

Share and enjoy!

Tuesday, June 7, 2011

Trying to find ntrigger.dll for 64 bit server - Trigger Happy/Audit Manager

I'm trying to implement Audit Manager on a 64bit domino server.

I've hammered my friend Google with every keyword I can think of, but it doesn't look like anyone has successfully made a 64bit version of the ntrigger.dll/published it.

I managed to compile a 64bit version, but it crashes the server after it's initialized.

If anyone has managed to make a working 64bit version of the dll, I would be very happy if you could send it to me (tvaland at gmail)/contribute it to OpenNTF.

Thanks in advance :)

Monday, June 6, 2011

Simple helper function to get path to an application

I use this when generating URLs in SSJS. The reason that protocol/hostname is added is so that the generated urls work with xp:link.

If an xp:link url starts with /, it generates the path to the current application at the start of the url. If you want to link to another app/page on the current server you either have to make an html link (<a>), hard code the path, or use something like this function.

// Returns absolute path (including protocol/hostname) to the current application
// or specified [database]
function getAppPath( db:NotesDatabase ){
try {
var currentUrl = context.getUrl();
var hostname = currentUrl.getHost();
var protocol = currentUrl.getScheme();

db = db || database;
return protocol + '://' + hostname + '/' + db.getFilePath().replace( /\\/g, '/' );
} catch( e ){ /* Exception handling */ }
}