Tag Archives: openntf

Adding OpenNTF extensions the simple way into your IBM Notes client

There is several ways how to add extensions into the IBM Notes client. But the best and simplest way that I have found is to do it this way.

Download the prefered Addon in my case I select the OpenNTF IBM XPages extension library, download the latest version to your computer. Unzip the file in your prefered location, Unzip the zipfile called updateSiteOpenNTF-designer.zip in a new folder.

In you Notes client create a new database in a folder on the server I call mine Client Updatessites and in the New database dialog select advanced templates and Eclipse Update site (9)

New database

Give the database a name of that you like.

Open the database and click on Import Local update site find the site.xml in the client update site folder. (important it has to be the client update site) follow the steps when importing.

import update site

You might say, wait this is like installing this on the server, yes it is but we are adding client code in this case.

When you are done, go to the action menu and select show url:s a dialog appears.

Select the second option nrpc:// press the copy button besides this row.

Second step, importing the site into the client

On the right and side in you client there is a my Widget section

My widget

Click on the three lines at the right side

install features

Now select Configure a widget from and then select Features and Plugins in a update site

screen00049

paste the copied Url press load and press next selecting what you want to install , give the widget a good explaining name and finish.

you will also after a while get the approve install dialogs where you approve the installation.

After this your extension is ready to be used after a restart of the client. But the best thing is that you will get an icon in the “my Widget” section and if your right click that icon you can remove it. Send it to a collegue and an email or publish it to a widget catalog.

Easy simple administration of OpenNTF and other addons in the IBM Notes client & designer

 

Moving on with Excel Export part 6 : But now we Import

The previous 5 steps in this series (part 1 part 2 part 3 part 4 part 5) has been getting data out to excel in different ways this part will show you how to get data back into Domino again thru your XPage, this will give you the possibility to roundtrip data handling. Export all customers mark the rows you have changed and re import the data. Because Apache POI is installed on the server as an OSGI we have access to these classes in all java code on the server and that is what I’m going to show you today and how to upload an Excel file and read some data from a cell.

In the example database for POI4XPages there is a class you really need and that is the ImportAction this is needed to open up a workbook of a xlsx file you don’t need it if you are only using xls. This class is used for changing the classpath of the jvm and some security stuff so you don’t need to modify the java.policy file on your server (Thanks Christian for pointing this out)

We start with some OpenNTF data in Excel

screen300

We create an java class

public String getData(java.io.File file,Integer row,Integer cell){

try {

 String inputFile = file.getPath();

 String CellVal=””;

 ImportAction ioAction = new ImportAction();

 HashMap<String, String> hsCurrent = new HashMap<String, String>();

 hsCurrent.put(“FILE”, inputFile);

 workbook = ioAction.run(null, hsCurrent);

 if (ioAction.hasError()) {

   Exception exLst = ioAction.getLastException();

   throw(exLst);

 }else{

 Sheet worksheet=workbook.getSheetAt(0); 

 Row rowdata = worksheet.getRow(row);

 Cell celldata = rowdata.getCell(cell);

 CellVal= celldata.getStringCellValue();

}

return CellVal;

}catch(Exception e){

return “”;

}}

lets look at the parts of this class

 ImportAction ioAction = new ImportAction();

 HashMap<String, String> hsCurrent = new HashMap<String, String>();

 hsCurrent.put(“FILE”, inputFile);

 workbook = ioAction.run(null, hsCurrent);

 if (ioAction.hasError()) {

   Exception exLst = ioAction.getLastException();

}

This is the magic call the the ImportAction class that will create a Excel POI workbook Object.

The following rows will get the first sheet in the excel file get the first row and the first cell and return the string

Sheet worksheet=workbook.getSheetAt(0); 

 Row rowdata = worksheet.getRow(row);

 Cell celldata = rowdata.getCell(cell);

 CellVal= celldata.getStringCellValue();

Now we need to create the XPage to enable the upload of the Excel file

screen301

The interesting part is behind the read button onclick event

importPackage(com.xpagedeveloper)

var con = facesContext.getExternalContext();

var request:com.sun.faces.context.MyHttpServletRequestWrapper = con.getRequest();

var map:java.util.Map = request.getParameterMap();

var fileDataName = getClientId(“fileUpload1”) ;

var fileData:com.ibm.xsp.http.UploadedFile = map.get( fileDataName );

if( fileData == null ){

return;

}

var tempFile:java.io.File = fileData.getServerFile();

var Excel=new com.xpagedeveloper.ExcelData()

viewScope.data=Excel.getData(tempFile,0,0)

We get the uploaded file in fileData and retrieve the actual file using fileData.getServerFile() remember that this file is a server based temp file and with that I mean that you will not get the same same on the file as it was when the user uploaded it. And next I create an object of my class and call the getData function with the java io file object the row and the cell number remember that this has a zero based index so 0,0 is actual row 1 and cell 1, this is the result I get when running the code against the Excel sheet

screen302

If you are going to loop thru a full excel sheet you probably need to rewrite the code but this will give you a hint where to begin.

2014 a year of change

Looking back at 2014, I see the year that XPages really got accepted as the primary language for Domino.
IBM Bluemix got launched and the response was no XPage support in Bluemix, but in the last 2 months we saw that IBM had changed their minds and now there are talking of some kind of support for xPages apps in Bluemix. Great IBM that will get the community to start using the service even more if you can deploy your apps in a real scalable App Engine. The Domino OpenNTF API, evolved and have lot’s of great features like the graph database implementation.

My 2014 has been almost only XPages Development both internal with our application suite, custom applications for different companies and adding more customers to QNova:s application cloud  that has been a real success for the company I work for. My board work with OpenNTF has just started, lots of things to understand and I hope to be able to contribute even more in 2015.

Hope you all out there have a great holiday and come back in 2015 with new contribution power because we all can do more if we do it together.

 

Some minor updates to SmallTalk and TinyMce editor

I have today released some small updates to SmallTalk and the tinyMce editor custom control.

SmallTalk needed some polishing to the attachment upload working in the client.

And for the tinyMce control I did some changes in the init scripts because they gave some strange js
errors in older internet explorer browsers so now it should work in IE7 also.

Enjoy 

Check out the new version of Small Talk live Demo

Openntf has enabled to so you can test some of the applications live
check it out here Link 

If you like what you see and I think you do you can get your own copy here Link

Read more what new in Small Talk –> Link

 Small Talk moves the internal communication to new limits, everybody knows everything and that’s instant!!

New interesting openntf project

I found this interesting project on openntf.org yeasterday Ruby in XPages if you don’t know what this is it’s an implementation so you can write Ruby code inside an XPage. You might say I don’t know Ruby so how can this be of interest to me.

I don’t either know Ruby but I think the project it self has other interesting things because it shows how to implement another language into XPages, perhaps node.js, PHP or ASP.Net. 

Another post about the possibilites to expand XPages was posted by Sven Hasselbach awhile ago show a way to write lotusscript code inside an xpage –>Post  (use Chome or Rockmelt to get the post in english)