Pages

Friday, October 22, 2010

Single Copy XPages Design - SCXD - Lotus Notes 8.5.2

I recently stumbled upon a brand new feature of Lotus Notes 8.5.2.

It is about Single Copy XPages Design. Following URL Has exhaustive description about the same and it seems quite interesting too...

http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Single_Copy_XPage_Design

Hope this helps :)

Thursday, October 21, 2010

Opening Documents from Views in a different tab on the same XPage

I happened to perform an R&D on how to open up documents on new tabs with in the same XPage when you click on links in XPage views.

I searched for ideas over the net and I got the idea of using Dojo tabs as Dojo is shipped with XPages.

After an exhaustive search for the resources on web I arrived at the desired results.

Following is an abstract of how I got the same to work on XPages.

Create a Form, map it to a View and  create a few documents.
Now Create an XPage and bind the same to your form and map all the test fields that you have on your form to the xpage
Now Create an other XPage and put the following code into it

  Step 1: Enclose the following style imports to an XPage
        @import "../resources/dojo.css"; 
        @import "../dijit/themes/tundra/tundra.css";

  Step 2: Include the dojo.xd.js into the XPage using the following script tag
    <script type="text/javascript" src="dojo.xd.js"
        djConfig="parseOnLoad: true">
    </script>
   
  Step 3: Add the following scripts to the XPage
        dojo.require("dojo.parser");
        dojo.require("dijit.layout.ContentPane");
        dojo.require("dijit.layout.TabContainer");
        dojo.require("dijit.form.Button"); dojo.require("dojo.widget");       


Step 4: Put the following html on the page
    <h1>Tab Container </h1>
    <div id="mainTabContainer" dojoType="dijit.layout.TabContainer"
        style="width:500px;height:500px">
        <div id="tab1" dojoType="dijit.layout.ContentPane"
            title="Open Docs in New Tab" selected="true">
        </div>
        <div id="tab2" dojoType="dijit.layout.ContentPane"
            title="Normal Way">
        </div>
    </div>

Now DRAG AND DROP your View into the DIV WITH ID "tab1".



Now switch to the data tab of the same column and key in the following code, as shown in the following figure,

-----------------------------------
"<a href='#' onclick='addTab(\""+rowData.getColumnValue("Name")+"\",\""+
rowData.getUniversalID()+"\")'>"+rowData.getColumnValue("Name")+"</a>"

-----------------------------------

Now create a Server script library by the name, commonFunctions and include the same on to your XPage.
Put the following function into that script library and save the same.

------------------------------------

function addTab(tabTitle,unid){

    var url="http://andromeda/dojo/XPageDojoTabsTest.nsf/openform.xsp?documentId="+    unid +"&action=editDocument";
    var tabs = dijit.byId("mainTabContainer");
   
    var pane = new dijit.layout.ContentPane({
        title:tabTitle,
        content:"<iframe border='0px solid #ffffff' frameborder='0' src='"+url+"'> </iframe>",
        closable:true
    });
   
    tabs.addChild(pane);
    tabs.selectChild(pane);
}

------------------------------------

Once this is complete you are good to go... Preview your XPage on the Browser or the Notes Client and click on the links that appear in the view.
When you click on the links you can visuallize the documents getting opened on new tabs,
There you go, a POC...

Hope this helps :)

Tuesday, October 19, 2010

Binding Richtext Fields and File Upload Controls in XPages

The following is a simple POC that describes how file upload controls on XPages work when bound to Rich text fields in Notes Forms.

Create a Simple form with 2 Rich Text fields and bind them to two file upload controls respectively on a Xpage as shown in the following figure and save them.


Now Preview the XPage, add a couple of attachments and Save the XPage


The code that I used in the upload button here is - currXPDoc.save() where currXPDoc is my datasource's name

Thus a document gets saved in the back end. Opening the same will help you find the attachments embedded into their respective richtext fields as follows,

Hope this helps :)



Wednesday, October 6, 2010

Running Scheduled Agents from Server Console

When working with scheduled agents, we often tend to run the agent by right clicking it and clicking on run or calling it on a button click before we schedule it. It may not work always, cos scheduled agents will have a lot of issues that are not associated with a normal agent which may run properly with your security permissions when you run it.

For example you may have a role enabled for you on the ACL where as your server may not.
So Scheduled when they run automatically will run with server rights over the database and hence may result in different results.

So the best way I know to test the working of a scheduled agent is by running it through the following command,

Tell Amgr Run "DatabasePath" 'AgentName'

Mind the usage of the single and the double quotes. They must not be changed.

Hope this helps :)

Monday, October 4, 2010

Expanding and Collapsing Categories in a XPage View

For expanding and Collapsing category entries in an XPage,
   Go the all properties section of the XPage, Navigate to Data -> Data -> Expand Level as illustrated in the following figure

Specifying 0 here will collapse all entries and 1 will expand the same.

Also in case of a view containing multiple category columns, 1 will expand the first level categories with the other levels like 2nd or 3rd or so on collapsed.

Like wise specifying 2 here will expand the first category as well as the second category where as the 3rd or 4th or so on will be collapsed

Using a session scoped variable or a request scoped variable we can probably compute this on button clicks which might be handy for the end users...

Hope this helps :)