Hosted By

Contact Me

Misc Links

OpenNTF BlogSphere LotusGeek CoComment Custom Button

Ads by Google

Welcome to keithstric.com!

I hope you find this site useful in some way or another. I strive to bring you all sorts of geeky information and solutions to your most frustrating of issues with the occasional rant on whatever topic, technical reviews and weblog. You'll also find many products that I've developed and make available for you to use however you like. So, grab a cup of coffee, sit down and visit for a while.

SnTT: Sectioned XPages Menu

06/29/2010 10:40 AM By Keith Strickland
>I recently completed my first "Production" XPages application. Messing with the XPages calendar really helped but I learned that too long away from something after just learning it is bad. But anyways, while researching for said application I came across the IBM Lotus User Interface Developer Documentation site. I don't know where or how I found it but it contains a wealth of information on the oneUI classes with examples using them. On this site I found a Menu with Sections and the app needed a sectioned navigational menu. Since I was using the XPages Framework for this application (BTW, this is a great package and makes it VERY easy to come up with a very nice looking, functional app very quickly) I decided to just make a few modifications to add the required navigational menu. I sent these changes over to Steve Castledine for inclusion in the XPages Framework. Whether or not he'll use it, I don't know, but hopefully he will.

To make this I created a new custom control and called it ccSectionSideMenu. This very closely resembles the ccSideMenu custom control within the XPages Framework.

Now, to support the computed field in the code above, I had to make some changes to the xpUtil Server Javascript script libaray. These are the 2 functions I added:


And I modified the createFromProperties function and just added this code in between Side Bar and Footer Column blocks:

I really can't take a lot of credit for all the Javascript code I listed above. This code was just adapted from other functions and code blocks already in that script library. So I guess Steve Castledine and/or Niklas Heidloff wrote this code and really deserve the credit as all I did was re-task it to meet my needs. But the last piece of this puzzle is the layout.properties file. I added the following:

#Side Bar Menu Sections
sideBarSectionMenu.title=Section1,Section2
sideBarSectionMenu.link=Section1.xsp,Section2.xsp
sideBarSectionMenu1.title=subMenu1.1,subMenu1.2,subMenu1.3
sideBarSectionMenu1.link=subMenu1-1.xsp,subMenu1-2.xsp,subMenu1-3.xsp
sideBarSectionMenu2.title=subMenu2.1,subMenu2.2,subMenu2.3
sideBarSectionMenu2.link=subMenu2-1.xsp,subMenu2-2.xsp,subMenu2-3.xsp

This just sets up the data to be parsed and turned into the sectioned menu and follows the same format as the footer columns section.

Here's what you end up with:
sectionedMenu.jpg

And that's it, hopefully you'll get some mileage out of this. I didn't have time to give it twisty support where the menus collapse when you close the section, but I do plan on adding that in the future when time permits or the absolute need arises. But as long as you don't have a ton of menu items to display this actually works really well. Enjoy!


SnTT: XPages Calendar Control (Part 5), adding data to the day view...

03/18/2010 5:06 PM By Keith Strickland

If you recall we left off from Part 4 with a blank day and week view. Well, through much gritting and knashing of teeth I've finally got some data on the day view. Now before I go any farther, I would like to thank a few people whom without I'm sure I would still be sitting here scratching my head trying to figure out how to do this:

  • Nathan Freeman for pointing me to an Article by Jeremy Hodge on embedding data within an XPage in order to make it accessible via client side JavaScript
  • Jeremy Hodge for this article and also cluing me in on using the dojo.addOnLoad function
  • Steve Castledine for showing me that @DbLookup, sessionScope.get("whatever") works with client side javascript that is on an XPage
  • Julian Buss for this wiki article

In order to set some guidelines of what we're trying to accomplish:

  • Build a day view calendar with the times down the left side of the page and entry data for a specific day on the right
  • Entries should show duration like the Notes Mail Calendar using a rectangle
  • Entry rectangles should be as wide as the calendar unless there is more than 1 entry for an hour, then they should be side by side but still take up the entire width of the calendar

So, let's get started. First we need to define a few dojo resources. So, in the properties for the custom control navigate to the All Properties tab and add 4 resources:

  • dojox.gfx
  • dojox.gfx.move
  • dojox.gfx.shape
  • dojo.Colors
It should end up looking like this:
calendar-ccCalDayResources.jpg

We just need to get some data now and then we can start working on the function that will build all our entries. Go take a look at a post by Jeremy Hodge and then scroll down the comments where he replies to me and explains how to build a heirachial XML type data structure from the entries. Well, this is the precise method I used. I added a repeat control and then added my "tags" within this repeat with their values. I added a view to the data sources of the ccCalDay control and also defined a "keys" and set "exact match" to true so that the view would only contain the entries for this day:


Here's the source for the repeat which builds all of our data:

I guess instead of defining a view as the data source, I should probably do this via a Property Definition, but I just needed to get this thing working as I've been getting frustrated with trying to figure out pixel counts and such.

So, that gives us our data for all the entries. Now it's just a matter of getting this data when the day.xsp XPage loads and doing something with it. In the source of the ccCalDay custom control at the bottom I've added the following javascript to run a javascript function after the page loads.

The addOnLoadFunc is a function in the XPCalendarClient javascript library which is added as a source to the ccCalDay custom control. This function is the work horse of the day view and is what builds all the minute divs, sets the styles and adds the rectangles to the page.

So, I'm just going to briefly explain each of the loops inside this function. I'm sure there is a better way than how I've done this but at the moment this is the best I've come up with. So to start with we've got to get all the data we produced in the repeat above. The data above is contained within a div with an id of "contextual", we get all the nodes within the contextual div.

Next up we just get a couple more variables and get into our first loop. With this loop we get everything we need, start date/time, end date/time, duration, subject, tool tip, start hour, end hour, starting minutes, the hours the entry spans, the div id for this entry and lastly the number of divs that should be in the dayTimeMinutesContainer div. Now I know there is a problem here, because of something in this loop one of the limitations of this is that it only supports up to 2 different entries in any hour. I'm sure it's because of how I'm handling it so I just need to fix it. But here is the loop:

Next up we loop through all the entries we gathered above and build all the divs.

Ok, we now set the style of all the dayTimeMinutes-hour divs for each hour that only has one entry. I do this for single entry hours only, because it's easier to figure out where the dayTimeMinutes div will be placed on the page and how wide it will be if we only have to deal with containers which contain more than one dayTimeMinutes div. But in setting the style for the dayTimeMinutes divs we get the dayTimeMinutesContainer coordinates so we can determine exactly where on the page the dayTimeMinutes div will be placed. We have to determine it's location because it has a position of "absolute" and the dayTimeMinutesContainer has a position of relative. This allows us to place the dayTimeMinutes div anywhere on the page we want. But, we see how wide the dayTimeMinutesContainer is and also get it's X coordinates and pass that on to the style for the dayTimeMinutes div. While we're looping through all the entries we determine if a container has more than 1 div and if so, we just record that in another array.

Now we loop through the multiDivs array and set the style and determine the width of the dayTimeMinutes divs.

OK, the last loop will determine the Y coordinates of the div and then place a dojox.gfx surface on the page within the appropriate dayTimeMinutes div. This surface is what will hold the rectangle that represents the entry and duration. We also set a dojo color which in our case will be a gradient.

And that's it really. You should end up with something like this:
calendar-day-entries.jpg

UPDATE: I've added the demo application to the downloads section. Also, I forgot to mention, this works with all browsers except IE. I believe this may be a limitation with dojo.gfx, but more research will need to be done to determine this exactly.


SnTT: XPages Calendar Control (Part 4), adding day and week views

03/01/2010 5:05 PM By Keith Strickland

In our last sessions we created a blank monthly calendar, then put some data on the calendar and last we made it reusable so we can use it in any application. While this is all well and good, we need to be able to see the breakdown of times on a daily and weekly basis. So in this SnTT we will be adding blank day and week views. I'm doing blank views because I can't quite figure out how to place entries so that they span the correct amount of time. If anyone has any ideas about this please speak up as I'm stumped as to where to go next. I was thinking that maybe Dojo could help out here but I haven't had the time to sit down and actually try anything yet. As of this release there is also an OpenNTF project for this of which I'm looking for people to contribute and be a part of the development of this project. Like I said before, I'm going to need people smarter than myself.

OK, so I started with making a couple of new XPages (day and week) and dragging the required XPages Framework elements onto the page, save and close. I then created a new custom control and called it ccCalDay. This control will have the following features/requirements

  • Navigate forward/back a day
  • Be able to configure the hours display (12 or 24)
  • At a later date, be able to add data to the view
  • Clicking the Month View sidebar link should take us to the selected month view
  • Clicking the Week View sidebar link should take us to the selected week view

We've now got our requirements so lets start putting this all together. I added a panel and called it "container". This panel holds the entire day view calendar. I added 2 other panels within the container panel and called those dayNavContainer and dayHoursContainer. Now that we've got our layout we can proceed. In order to display the proper day, we'll need some variables from the Month View calendar. I changed all the viewScope variables in the previous SnTTs to now be sessionScope variables instead of viewScope. This allows us to pass the date back and forth between different views. It also allows us to just manipulate one date at a time to change everything on a page. So, in the ccCalDay custom control, BeforePageLoad event we've got this:


If you recall, in our menu for each day on the monthly calendar we have a function which builds a list and we pass the day in a URL parameter. This is what allows us to define a specific day, we then just use the month and year from the "dispDate" sessionScope variable and then recompute all the other variables even though they aren't needed for the day view. I do this so if you go back to the month view we still have these values to build the monthly calendar, no matter how many days you navigate through on the day view. Also, I've built an array based on a property definition of all the times we want to display.

Now for the navigation, we want to be able to navigate forward or back by 1 day. This should be a fairly simple process but it did give me quite a bit of grief. Per Jeremy Hodge I tried setting the dispDate sessionScope varible like:
sessionScope.put("dispDate", sessionScope.get("dispDate").setDate(3));
but never could get this to work, along with several other methods I tried with using the set???? method of a Javascript Date, so that is one of the reasons why I had such a hard time with the navigation. I was also having some issues with the onClick event of the navigation links, the onClick code was firing at page load and incrementing/decrementing the sessionScope variables. I addressed that in this post. Just as an FYI, don't use the All Properties tab to edit event code, it screws things up. OK, now for the navigation we have a link that goes back 1 day, a computed field which displays the current date we're looking at and then another link to go forward 1 day. The back 1 day link has this onClick event code:


All this does is check the current day date, if it's 1, then we check if the month is 0 (Jan), if it is then we decrement the year by 1 and set the date to 12/31. If the month isn't 0 then we just decrement the month by 1. If the day isn't 1 we just decrement the day by 1. Once all of that is done, we set all the sessionScope variables.

For the date display, it's really simple:

For the day forward link, it's pretty much the same as the back link with the exception that we check if the day is the last day of the month and if it's the last month of the year.

The only thing left here is to build the table which contains all the different times. I defined a property definition for the timeHourFormat to be either 12 or 24. If you set it to 12, the times go from 12:00 AM to 11:59 PM. If you define 24 you get hours from 0 to 24. I also build a 4 row table within each data column which don't really contain anything right now. I'm hoping that by assigning these rows an id that we can place a div and have it span the proper amount of time. But this will probably change as I learn more about placing divs in specific spots on a page. So, at the top of the day view I display the date, week day, month and year, just like on the Notes Mail calendar day view. I use 3 separate computed fields so that we can place them where we want them and control their font sizes independently. The code for these are really straight foward and I'm not going to go into detail about these:

Big Date Number:


Big Week Day:


Big Month Year:


Then the remaining rows which are contained within a computed field which is contained within a repeat object:


All this does is loop through and build each row of the table based on the timeVar. timeVar is defined as the "collectionName" in the repeat control which is set to repeat 24 times. Then in each data column, build a 4 row table (for 0 min, 15 min, 30 min, 45 min).

And that's it for the day view of the calendar. You should end up with something looking like this:
dayView.jpg
Continue Reading for the week view....


Continue Reading...

SnTT: XPages Calendar Control (Part 3), making it reusable

02/09/2010 1:24 PM By Keith Strickland

In our previous posts we've created a blank calendar and then added some data to it. While this is all well and good, it's not very reusable in it's current state. It's quite dependent on a view being formatted a particular way. What if you already have a view with the data you want to put on the calendar and don't want to change that view? Well, this is what we're going to address today. With these changes the calendar really takes on the form of something useful and not something that only works on your machine.

In this SnTT I will show you how to make your calendar more reusable and we'll also add the framework for some navigation to each cell to open up a day view, week view and month view (the month view may be redundant and I haven't yet decided on if we need to keep it). Also being addressed here is if you want text other than what is in the calendar to show up in the dojo tool tip. As a bonus, we'll also do the blank view with an editable area so you can use your own custom control to display data.

So, with the requirements defined for this session, we're now ready to begin. Looking at the code for the dayCells computed field on the ccCalendar custom control, you'll notice our view name is hard coded along with the column values. This is where the problem lies, we want this to be configurable. We can use "Property Definitions" to address this issue. Property Definitions allow us to define our own properties for a custom control. These get stored in the "compositeData" object(?) and are available for you to use anywhere within that custom control.
Calendar-PropertyDefinition.jpg

Here we need to define some properties for the following:

  • The View Name - lookupViewName - String
  • The Data Column - lookupViewDataCol - Integer
  • The Column that contains the UNID - lookupViewUNIDCol - Integer
  • The Column that contains the Tool Tip text - lookupViewToolTipCol - Integer
  • The text that will used in the lookupViewToolTipCol if no Tool Tip text is available - NoTooltipText - String
You should end up with something like this:
Calendar-PropertiesDone.jpg

Now, open the default XPage, highlight the ccCalendar custom control (it'll be under facets) and fill in the properties we defined. Except here you can use values for your own view instead of the one included in this DB:
Calendar-PropertiesValues.jpg

Once you save and close and view the calendar in the browser, it should look exactly like it did when we left off from Part 2 of the SnTT. The only difference is that the tool tips will now be populated with whatever is in the column defined for the tool tips.

With these changes, the calendar takes on a more useful role, we can now use views we've already designed and just change the properties to match each view. But what if you want to design your own custom control to display data the way you want it displayed? In this case, we can use an Editable Area instead of putting all the data computation within a computed field on the calendar itself. This will allow us to put a custom control onto the editable area on the XPage instead of within the ccCalendar custom control. So, to support this, in the sample database (located in the downloads section) I've added another custom control called ccCalendarEditable. I've modified the dayCells computed field to only spit out the html to begin the column and include the number for the day and start the div which contains all the data for that particular day. We also changed the name of this computed field to beginTD. You'll notice also, that now the day is included within a span instead of a div and also that there is a function call that is within another span. I will get to this shortly.

I added another computed field named endTD which contains the code closing the column and data div.

Now, in between these 2 computed fields I've added an Editable Area and gave it a Name of calData and a Facet Name of calData:
EditableAreaOutline.jpg

When we drag this custom control (ccCalendarEditable) onto a new XPage I think I did find a bug which I discussed in my previous blog entry about being able to drop a custom control onto an editable area which is contained within a repeat. Since this is the case we'll have to hand code the embedding of the custom control I created to contain the data onto the facet within the XPage. This is a simple process and shouldn't cause too much headache. But, I created a new custom control called ccCalData. This control basically contains the code we removed from the dayCells computed field and put into a computed field on the ccCalData custom control. I did it this way to really just show the ability of being able to split up the data and design a little bit more. Also, please forgive my lack of a useful naming convention, since I'm just now really getting started with XPages I haven't really come up with a naming convention I use all the time. But to hand code the embedding of the ccCalData custom control onto the XPage this is the format. Notice the "xp:key" item defines the name of the Editable Area (calData in our case):

So, we now have 2 different ways to make our calendar more reusable. You can use @DbLookups to a view that you've already designed and just change the properties to return the data you want on the calendar or you can design your own custom control to drop onto the calendar. Also, in the case of this sample db the calendar should look at react exactly the same as it did when we left off with part 2. Either way makes this much more useful. Now, in preparation for having a "day view" and "week view" I've added a small drop down menu to allow you to switch views. Read on...


Continue Reading...

SnTT: XPages Blank Calendar Control (Part 2), adding data

02/06/2010 11:18 AM By Keith Strickland

The other day I showed you how to make a custom control for an empty calendar. While neat it really isn't very useful unless you can put some data on it. So today's SnTT is to put some data on the calendar. Also, it seems there was a bug in the original code for the month "forward" and "back" links which caused the calendar to do some weird things, but no worries, that has now been fixed and is available in the download.

Now, on adding data. We're not concerning ourselves yet with durations, we'll have to tackle that later down the road and I'm sure I'll have to tap into some people who are smarter than myself. Right now we're only concerned with putting data within the appropriate day, having it formatted correctly and not enlarging the cell to fit the data but instead having a scrollbar available to scroll through the entries. We also want a dojo tooltip to show up when we hover our mouse over an entry so we can see any text that gets cut off. To accomplish this, the contents of a cell are made up of several divs. We use divs so that everything spans the entire width of the cell:

  • A div containing the number which is the day
  • A div containing all the entries for that day
  • A div for each entry
  • A div for the text of a tool tip

With our goal now defined we can start coding a little bit. I created a form called calEnt with just a few fields on it:

  • StartDate (we'll get to the EndDate/Time at some other point in the future)
  • StartTime
  • Subject
I also created a view called luDates with 4 columns:
  • StartDate - Sorted Ascending - This is text and not a date as it seems that the server side javascript @DbLookup can't lookup a date, it must be a string
  • StartTime - Sorted Ascending
  • Subject
  • Unique ID

Now we need to get some data and put it on the calendar. We'll do this in the computed field which we had named in our previous SnTT named "dayCells". To support this we had to add a couple of script libraries, one for Server Side Javascript and another for Client Side Javascript. The functions in the Server Side Javascript Library came from the article Work with DbColumn and DbLookup on the You at Notes website. I had to tweak the requestScope scoped variable check to also include the field (or in our case column) to ensure that there is 2 different requestScope variables. The functions in that library ensure that DbColumn and DbLookup calls are returned as an array, this is quite useful. The Client Side Javascript Library is for a function to handle the onClick event of a calendar entry. I'm not going to go into the code of these functions as they are available in the download.

In the dayCells computed field we start building the table cell with all the divs. Just note you need to change the view name with whatever view name you use in the DbLookupArray calls. You should end up with something like this:

Now we need a form to display our calendar entry in another custom control. This is just a simple form with 4 fields on it. I haven't really made it pretty or anything I just wanted to ensure that it worked, we can make it pretty later. So, I created a custom control with the same fields as the CalEnt form with the exception I added a computed field which contains the UNID of the document we're displaying. This is really just there for troubleshooting purposes but I thought I would list it to show how to get data from a parameter in the URL. I'm passing the UNID of the document we clicked on in the calendar to the URL because since we hand coded the div which contains the data from the view, client side javascript is used to navigate to the "entry" XPage via an onClick event, so we pass the UNID via an URL parameter:

We also need to bind our new custom control to the form. You do this in the Data section of the custom control:
BindAForm.png

And in the document ID field we add our param code again as Server Side Javascript:

You should now have a calendar that has data on it that is clickable which opens up the corresponding document. Next up is configuring our XPage so that the dojo tool tips pop up whenever you hover the mouse over an entry. So, since our calendar control is on the default XPage we need to set some properties here to make the dojo tool tips work. On the default XPage All Properties section of the XPage Properties, set the dojoParseOnLoad = True, dojoTheme = True. Also add a resource and pick dojoModule and for the name set it to dijit.Tooltip. Also under the styleClass property define Tundra as the styleClass. It should look like this:
calendar-dojo-properties.jpeg

And, that's it. You should now end up with this:
calendar-dojo.jpeg

I'm sure there is a better way to handle the binding of data to the calendar, but as I'm really just now starting to really delve into XPages I haven't quite figured out everything I can do yet. So, if you have a better way, please speak up.


SnTT: XPages Blank Calendar Control (Part 1)

02/04/2010 12:41 PM By Keith Strickland

While at LotusPhere I was searching for a way to create a Calendar using XPages to try and duplicate a Calendar View in the Notes Client. As I've said earlier, I believe this was a big part of XPages that was left out or just forgotten about. Well, I finally broke down and tried creating a Calendar Control on my own. Well I can't really say I did it on my own as I used the tutorials over on Declan's site and I had to enlist some help from Declan to solve a problem with the first row of the calendar. So, without further ado, let's get into it shall we...

First I had decided that I wanted to do this with a table instead of spans as it makes sense to do it that way as in my eyes that's what a calendar is, a table. Also I wanted to be able to navigate the months with links at the top of the table and maybe in the future a dojo calendar control somewhere. I've listed all the steps here in the order that I did things, while this may not make sense to some people it's what made sense to me. I guess I probably should've listed these steps in the order that they fall within the code, but I figured it best to go about how I did it. At the end of the article I will include all of the source code so it's just a copy and paste afair.

NOTE: Seems some of the strings within this document in the text areas are being screwed with for some reason. I will place an example DB in the downloads section shortly. Of particular note, the <[CDATA[ tags should read <[![CDATA

So, I started putting this thing together by starting with the Calendar table in a panel with the header and then the starting row of the actual calendar:

Next up is getting the blank cells that will appear when the starting date isn't a Sunday. This requires us to get some information when the page is loaded. We need to know what month, year, the day the 1st falls on and how many days are in the month. We do this with some viewScope variables in the "beforePageLoad" event of the control:

Once the blanks are figured out we just need to start filling in the blank days of the calendar. This is just a computed field inside a repeat function:

Now we need to cycle through the days and place them within a TD and include the day number. There are a couple of things of special note here.

  1. The computed field that adds the closing and opening tags for the rows, this needs to come BEFORE the first entry of the week, NOT AFTER!
  2. In the computed field that puts the day number in the cell, you need to add 1 to the day because the days are zero based. If you don't do this the first will actually read zero
  3. Also, we don't need any logic to figure out the contents of the cell since we're determining if a new row is needed in the first computed field within this repeat

Last part of the calendar table is the blank days after the end of the month when the last day isn't on Saturday and then close the final row of the table. This is accomplished with another repeat control and a computed field:

Finally we need to add a Title Header to the top of the calendar to show the month and then a couple of links to navigate forward and back. This is accomplished using 2 links and a computed field. The month which is displayed in the computed field is determined from the contents of an array which contains all the months and we then use the viewScope.dispCalMonth variable minus 1. The links change the viewScope variables to use the correct date. All of this is placed inside a panel:

Now, to put all of this together:

So, I hope you find this control useful. The next steps (which I haven't quite figured out yet) are to put some data from a view onto the calendar and to add some more functionality to try and match that which is found in a notes calendar view. I am also wanting to put a calendar control somewhere on the page so you can pick a particular date that may be more than a year or so in the past/future.

UPDATE: OK, I think I've got all the formatting stuff fixed. I had to use HTML Encoding on all the items. I'll still put an example db in the downloads section. I also added a screen shot to the read more section.


Continue Reading...

SnTT: Put Google Site Search Results in the Content pane of BlogSphere

12/21/2009 10:06 AM By Keith Strickland
QuickImage

As you are probably aware of, I've been revamping keithstric.com. In that revamp I wanted to add a Google Custom Search (CSE) engine to search only my site. Making the CSE was easy enough with the wizard Google supplies but, I didn't like the way that it either redirected you to a google page or you had to submit the search to another dedicated page on your site. So I set on the quest of getting the results to show up where the content of my website usually shows up. Below I list all the things I tried and then what finally succeeded.

First I tried the default of showing the results on a google hosted page. I just didn't like that at all, I could customize it a little bit but not really.

Next, I tried having the results show up in an article type document, however, the url that gets appended to the search results page starts with "?", seems Domino didn't like this at all and kept dying with an error 500. I tried all sorts of ways to prevent the "?" from being the start of the appended URL to no avail. I did some research on what the subject and it seems when a url contains a "?" Domino expects a domino url extension (i.e. OpenDocument, OpenView or whatever) to come right after the question mark, if it's not what Domino expects, it throws an error 500. To get around it you can create a rewrite rule, but with this blog being hosted by Prominic, I really didn't want to go this route. So, this didn't work...

The last option for displaying the results from a Google Custom Search engine is to display the results as an element. This actually worked with no changes really needing to be made as far as just displaying the results. However, the results just pushed the rest of the blogs content down below the search results. While this worked, I didn't really like it, I think only the search results should show up. But I really liked that the results were "wrapped" within my website. So, how to make it so that when someone performs a search the div which contains the website content is hidden and only the search results are shown? Well, I messed with this for quite a while and never could get it to "really" work. I could hide the div which contained the content but not when the "Search" button was clicked. So I had to post a question over on the Google Custom Search Implementation Forum. The guy that answered didn't leave his actual name, only "omr" is his username and is who really got this to work and who deserves the credit for it.

Now we just need to put this within BlogSphere and we're ready to go. So without further rambling...

  • First, setup your CSE to only search your site. When you do this if you go through all the options in the wizard you should find your "CSE ID" which is a long number which basically identifies your CSE.
  • Once you get your CSE ID we're ready to put everything in BlogSphere.
Click the "Read More" link...


Continue Reading...

SnTT: Using the Google Charts class to put Charts in a Lotus Notes application

04/29/2009 4:11 PM By Keith Strickland

The other day I posted about a Google Charts class I created to make it easier to put a Google Chart in your Lotus Notes/Domino application. Well, this SnTT will show you how you can incorporate this class and display some pretty charts in the Lotus Notes client. I've done other articles about using charts in your Lotus Notes applications, but I think this is probably the easiest and most elegant way of showing a chart. But, let's get to it shall we...

OK, we'll keep this simple so this article will fit within the 65k limit of lookups and such. But we'll need the following:

  • A form to display the chart on inside a Microsoft Web Browser control. Actually this could probably be a page without any ill effects
  • A form to store our HTML in
  • Some views properly sorted to get our data from
  • A view to store our HTML form in sorted by UNID
  • About an hour to put all of this together
  • A server to place this db on, this does not work locally!

Now, we'll start with our first form and call it GoogleCharts. We need to put a Computed field called SaveOptions and give it a value of "0". We then place a Microsoft Web Browser control on the form with the properties displayed below:
google-chart-browser-properties.jpg

The "SizeBelowFields" property will make the browser take up the entire window. I do this because I usually open these types of things within a frame and I want it to take up the whole frame so it looks nice. So, this is all that's needed for this form.

We now need another form which we'll call HTML. This form will contain 1 field named GoogleHTML. This should be hidden from web browsers. Now add below that field (ensure no hide-when is enabled) a computed text item with a value of "GoogleHTML" and mark it as Pass-Thru HTML and that's it for this form.

OK, let's create our view that will hold the HTML documents. This view should have a selection criteria of "SELECT Form="HTML"" and have one column with a formula of "@Text(@DocumentUniqueID)" and sort it ascending.

So our framework is there, we just need a view that we will get the data from that we want to use to populate our chart(s). Since we want to keep this simple we'll just create 2 views, one for categories (luCategories) and one for data (luData). The categories view will contain 5 documents so our chart isn't too cluttered and then the (luData) view will contain the data that we will get the raw numbers from.

Keep reading for the rest of this...


Continue Reading...

SnTT: Display inline HTML images in the Notes 8.0.1 client

01/07/2009 6:32 PM By Keith Strickland

I've been working on a reservations application for my employer and one of the requirements was for a picture to be provided of a resource and for that picture to show up in the reservation. Now that sounds like a simple enough request but unfortunately it's easier said than done, or so it seems. Now, the normal way to do this is to create a "Computed Text" area with a value containing an tag with the appropriate URL to the image. But, this doesn't really work, you get a red box with an X in it instead of the image. Also, whenever you open the document in edit mode the picture shows up. Also, if you right click the red box and select "Show Images" the picture shows up just fine. So, what's the deal?

I found this post in the Notes 8 forum which explains it quite nicely. It seems you have to include a Computed for Display field on your form named "$DelayedImagesOK" with a value of "OK". Once this field is present the images will show up all of the time without having to edit the document or select "Show Images" from a menu.

But I thought that was pretty cool, plus it kept me from having to figure out how to do it with MIME


SnTT: Flash charts in Lotus Notes

03/07/2008 12:06 PM By Keith Strickland

This week I've been working on getting amCharts to work in a dashboard I'm working on. I was pointed to amCharts and the inkling of how to accomplish this by the sample database from the LotusPhere 2008 session BP210: Reports, Charts and Graphs in IBM Lotus Notes over on Julian Robichaux 's site. In this SnTT, I want to show you another way to implement this functionality into your applications. It gives your applications a nice professional look and keeps the customer's boss happy with nice pretty charts.

charting.jpg

The dashboard is a form with a drop down box to pick the information you want to see and then a "Go" button to go out and get the pertinent numbers, create/update an XML file/document and then display 2 charts in a Microsoft Web Browser control embedded on the form. One chart is a bar chart with the hard numbers and the other is a pie chart which shows the percentages the numbers represent. The idea here was that I would display this information in a nice looking dialog box. However I couldn't get this to work. I spoke with Nathan Freeman because I knew he had worked with the Microsoft Web Browser control quite a few times and he informed me in a dialog box that the auto-run did not work for ole objects. I attempted to get it to work by using the PostOpen event to no avail. So, I ended up just displaying it as a normal form.

But to get this to work here's the path I followed, I'll also post a demo database in case my ramblings turn into just that, rambling...


Continue Reading...

SnTT: Build a Java String array from a view column

09/27/2007 4:02 PM By Keith Strickland

OK, more Java stuff today. Since I've been messing with Java I've found the need to build several arrays from the values of a view column. I assume it's probably common practice to build views just for lookups of keywords, to populate drop down boxes, etc. The problem is that the Notes Java classes don't provide something like @DbColumn which would be nice, but understandable that it's not there (at least that I know of). But I came up with this Java method and it seems to fit the bill whenever I need this sort of information.

Click the Read More link to see the code...


Continue Reading...

SnTT: Java Method for building a checkbox dialog

09/10/2007 11:25 AM By Keith Strickland

Like I said earlier, I've been messing with Java more and more here lately, mainly to build graphs using JFree Chart. In just about every statistics report I'm doing I provide a checkbox for the user to select what data they want to display. So, I've built a Java Method/Function whatever you want to call it, that will simplify the task of putting a JCheckboxes in a JPanel with an instruction label and footer text with OK and Cancel buttons (See Screenshot).

constCheckBox-Java.jpg

The idea here is to build an array of strings, determine a window title, label text and if needed footer text and pass that to the method which will then loop through the array and build the JPanel according to the information you pass. you can see the example here. The constCheckBox method will then spit out a dialog which should look something like the one above. One of the stipulations of this thing is that the "chkBoxes" variable (from the sample code) has to be declared as a global variable something like "JCheckBox chkBoxes[];" above the notes main section.

OK, so I can't post the code , it's too big to post all the HTML for the formatting and stuff . So, it's available over in the downloads section

So hopefully this will be of use to someone other than myself. I know I didn't go into much explanation of the actual code I think I mainly posted it as a reference to myself to see how to do this sort of thing in the future as I imagine this kind of functionality is used quite often. I kinda like this Java stuff, it's starting to make more sense .

Keith

SnTT: ExcelData Class update

08/13/2007 10:37 AM By Keith Strickland

Instead of storing the ExcelData Class in 2 static pages, I've exported it to an LSS file. You can find it over in the Latest Downloads section. I've added some more functionality to it and hopefully it'll be useful to someone other than myself. There is some funkyness in the constructor for determining the filename being used, but it does work. I've also included some documentation on the class that was created using Mindjet Mindmanager 5.0.

I know this is a pretty lame SnTT but, it's been awhile since I posted one and figured it was time I posted something.

Keith

SNTT: Notes Client Breadcrumbs...

06/04/2007 10:28 AM By Keith Strickland
QuickImage

I've been doing a lot of work recently where the customer wants everything to stay within one window. For example, user clicks the All documents view and the view contents show in the right side frame, the user then opens a document and it is displayed in the right side frame. Now this is where the problem comes in, when we close the document how do we know where we just came from? So now you either have to do some magic I couldn't find documented anywhere or set an environment variable each time a navigation change is made so you know where to go back to. With more than just a few navigation choices this can get out of hand real quick, especially taking into consideration any embedded views on documents and the like. So, trying to come up with a solution to this dilemma I remembered bread crumbs being all the rage quite a while ago to be included in the navigation structure of web sites/pages. I know there were quite a few heated debates on what the bread crumb should contain, should it contain the shortest path to the content you're currently looking at, or, should it contain the path you took to get to the content you're currently looking at? Without rehashing old debates, it's much easier to populate an environment variable with the path the user took to get to where they're currently at within the notes client.

So how do we include bread crumbs in our notes applications? First we need to determine how the bread crumbs are to function...

  1. Bread crumbs should be populated in an environment variable (This is the only way I know to do this, please let me know if there is a better way)
  2. Environment Variable should be formatted like "Home-Choice1-Choice2-Choice3". We must format it like this because you can not include a text list with @SetEnvironment.
    If you use a text list for value, only the first value in the list is used; the rest are ignored.
  3. Anytime a "Close" button is clicked (to close a document or whatever) you should go back to the last visited location
  4. Anytime the Home choice is opened all the bread crumbs should be cleared, so the environment variable would only contain "Home"
  5. Bread crumbs can appear as a selection of different hotspots, but this may require a very complex hide/when for all the different locations in a table of some sort which I'm not going to cover in this SNTT.
So, with this criteria we can start to imagine how to put this type of thing together.

But on to how we can do this. Go ahead and create your navigation and basic design structures (pages, outlines, framesets, etc). I'm using a 3 frame frameset, with the top frame being the banner, left frame being named "Nav" and right frame being named "View". Next we'll be setting up the environment variable to be populated when we open a document, view or document containing an embedded view. So, determine which views are going to be a part of your navigation, with the exception of your "Home" view and modify the QueryOpenDocument, PostOpen and Target Frame (Double Click) events. I'm using 3 views in my navigation which will be accessed via an embedded outline on a page. The views are vForm1, vForm2 and HomeView. There are 2 other views also called (embeddedView) and (All Documents) which are used as an embedded view in a form and for document lookups.

BreadCrumb Demo.gif

Continue Reading...

SnTT: Highlight the active field - Part Deux

04/27/2007 9:31 AM By Keith Strickland
QuickImage

This is a follow-up post to my SnTT post I did this past Tuesday. Nathan Freeman made this comment which directed me to a better way to do this. Nathan says...

The first thing I'd wanna try is using a pair of nested tables, with both borders turned entirely off, but with the inner table having an outside border of 2px all the way around. Then set the outer table to use a background IMAGE, where the image is computed. Then you just need two small GIFs that Notes can stretch to fit.

Now, I had to read Nathan's comment about a 1/2 dozen times before I understood what he was saying but once I opened up designer it was quite obvious. The only difference is I didn't use 2 images, I set a 1px border on the inside table and had the outside table use a computed background image only when the field within had focus. In the interest of brevity I will only post the differences between this technique and the one I posted about the other day.

So, start with creating a 1 column, 1 row, fit with margins table (Outside table). Then create another table inside this one with the same properties (Inside Table). Once this is done, modify the Outside table properties 2nd tab like below. You'll also want to hide the lines in the outside table which are above and below the inside table or you'll get a BIG orange border on the top and bottom of the inside table when the field is in focus:
FieldHighlightOutTableProp2.jpg

Now modify the 3rd tab properties and define a computed background image for the table:
FieldHighlightOutTableProp3.jpg

Here is the formula I used @If(Highlight = "FirstName";"SunnyHighLightBackground.gif";""). Notice I don't have a background image if the Highlight field doesn't equal FirstName? This is one of the places I didn't do exactly like Nathan said. I tried it, but didn't like the large 2px border when the field wasn't in focus.
FieldHighlightOutTableProp3Fomula.jpg

On the 4th tab I kept the 2px outside top and bottom borders so everything is still spaced nicely.

Now, on the Inside table, set the following table properties.Here is another place I strayed from Nathan's advice. I'm using a 1px border here with a lighter color than the background image above. This actually works pretty well since the colors are pretty close to one another you don't notice this border when the field is in focus and the background image is being displayed.
FieldHighlightInTableProp2.jpg

Again I set the background color of the Inside table to white to match the field's background color.
FieldHighlightInTableProp3.jpg

And on the 4th tab of the Inside Table properties box set the outside border to 2px all the way around
FieldHighlightInTableProp4.jpg

And that's it for the table properties. Now, onto the field...


Continue Reading...

SnTT: Highlight the active field

04/23/2007 4:08 PM By Keith Strickland
QuickImage UPDATE: Removed the Entering event code from the Highlighted field, not required for this technique

I haven't done a Show-n-Tell Thursday Tuesday in a couple of weeks so I figured it time to do one. Earlier this week I was browsing the web and came across a website (Sorry, can't figure out which one it was) where the field that the cursor is currently in, that field had a blue highlighting around the border of the field. I thought that was pretty cool and figured we should be able to emulate the same thing in a Notes form. Now, whether or not this particular tip works on the web, I don't know, but theoretically it should, but I haven't tried it.

When I first started trying to do this I was thinking I could use an technique from Chris Blatnick on making programmable tables, but since the border style of a table is for the entire table this wouldn't work. So I had to come up with something else.

To get an idea of what I'm talking about here take a look at the screenshot below. Notice how the Middle Initial field has a darker, wider border than the other fields? Well that is the active field where my cursor currently resides. Now as I move through the fields, whichever field my cursor is in will have that bigger, brighter border.
Highlighted-Field.jpg
For some of the more talented folks out there with photoshop or something similar you could make a border image that glows or something like that.

Now to do this really isn't that difficult. We just have to add 2 1 column, 1 row tables with a right side margin so the table doesn't stretch all the way over to the right side border and 2 fields for each editable field that you want the highlighted border around and then a hidden control field. You could also use an environment variable in the notes.ini file to accomplish this which may be faster. I used a field called HighLight. We'll start with the table. Create a 1 column, 1 row table that fits with margins and change the following:

On the 2nd Tab make the "Cell Border Style" Solid and pick a color
Field-Highlight-TableProp1.jpg

On the 3rd Tab pick a color for the background. I would suggest using the same color as your field background, in my case white
Field-Highlight-TableProp2.jpg

On the 4th tab make the Border Style "Solid" and pick your color. If you're the talented type with photoshop make it "Image" and point it to your border image. Also, give yourself a top and bottom outside border to keep the spacing nice
Field-Highlight-TableProp3.jpg

Finally on the 5th tab setup your right side margin. In my case I set it to .550"
Field-Highlight-TableProp4.jpg

Next is to put your field in the table we just created. Make a new field that is "Native OS Style" and set the width to 100 "Fit to Window%". I named this field "Middle"
Field-Highlight-FieldProp1.jpg

On the 2nd field properties tab, give the field a border of "None" and uncheck "Allow multiple lines" (this will not allow the users to press 'Enter' while in the field)
Field-Highlight-FieldProp2.jpg

Set the Text Properties of the table to the following to hide the field:
Field-Highlight-TextProp1.jpg


Continue Reading...

SnTT: An Excel Class

02/13/2007 7:19 PM By Keith Strickland

Here’s a Show-n-Tell Thursday for an Excel class that I’ve been messing around with. When I started it I really didn’t know what I was doing, I still don’t fully know if I know what I’m doing or not <img src="http://www.keithstric.com/A55BAC/keithstric.nsf/emoticons/KSTD-76UQW9/$File/22.gif"> . But, I really needed an excuse to start messing around with some Object Oriented Programming in LotusScript since I attended a lot of sessions at LotusPhere concerning it. So, I busted out the old class I started a few months ago. I’m really not going to explain all this as it’s really, really simple. So, keep reading to see the code, oh yeah, please forgive the AWFUL formatting, I used the lsToHTML tool over at Julian’s website, but it seems the version of Wordpress I’m running really don’t like it that much, so, it looks bad, but don’t let that leave you with a sour taste in your mouth for Julian’s tool, it just doesn’t work for this version of Wordpress…

OK, I gave up on posting the code inside this post, so, I just put it in it’s own html file here.

, ,


SnTT: Making a Back button for the Notes Client

12/05/2006 8:15 PM By Keith Strickland

I’m working on a database to track who clicks buttons which are sent out via e-mail. I’ve got a frameset with 3 frames. One frame has the header at the top, the left side frame contains the views and the right side frame contains the documents in the views and we’re also opening documents in this frame. The problem is when you close an opened document it closes the whole database, no good. So, we need a back button to go back to the view which we came from, which is the topic for this week’s Show-n-Tell Thursday. I searched high and low for the solution here and couldn’t find one anywhere. I finally decided to write the view name to a field when the document opens and then use the @Command([OpenView];ViewName) command. This kinda worked, however using the NotesView.QueryOpenDocument event to populate the field caused the document to open in it’s own window, so not such a good solution. I then populated the field from the NotesDocument.ParentView property during the NotesDocument.PostOpen event. This was however not working and leaving the field blank, but when I clicked the back button I went back to the view from where I came. This gave me an idea, let’s try @Command([OpenView];”") and see what happens. This works, it takes me back to the view from where I came from. Cool. So, after a half day trying to figure this out, here’s what I came up with for my back button:

@Do(@SetTargetFrame("Content"); @Command([OpenView];""))

This seems to have worked just fine from a document, however I don’t know if it’ll work for anything else. I hope someone gets some use out of this.

Keith


SnTT: Using the Log Analysis tool

11/22/2006 7:34 PM By Keith Strickland

I haven’t been posting very often of late and while I haven’t been posting I have come up with some good post ideas. Of course I finished the 2 part series of moving users within the hierarchy and today I bring you a Show-n-Tell Thursday post about using the Log Analysis tool within the Notes Administrator client. If you’ve ever started looking for a particular event within the log, say a certain failure that happened on 11/21/2006 but you don’t know what time it happened, then the log analysis tool is for you. With this tool it is easy to find a particular event when you don’t know what time it happened. Heck, if you’re patient you don’t even need to know what day it happened.

  1. Lets start by opening up the Notes Administrator client and pick the server whose log you want to search
  2. Navigate to the Server tab\Analysis tab and choose Miscellaneous Events
  3. Now expand the Tools\Analyze toolbar over on the right of your Administrator client and pick Log
  4. Pick the beginning and ending date(s) and times(s)
  5. Pick what your wanting to search for. You can choose words to search for a phrase or one of the other items
  6. Once you’re done specifying the search criteria click OK and it’ll start searching
  7. When the search is complete you can see everything it found listed by date/time

Animated Log Analysis

Now, if you ever want to go back over those results they are saved and you can get to them by clicking the Log Analysis Results view in the log from the Administration Client. This makes it easy to come up with a list of things to investigate and correct which is always a good thing, especially during down time like the upcoming holidays.

Log Analysis Results

You can even save your query. When you pick your search criteria and before you click OK, click the Queries tab over on the left of the dialog, check the “Save this query as” checkbox and give it a name. This way you can come back and just run the saved query instead of having to re-invent the wheel on that complex query you made. Pretty cool.

Log Analysis Save Query

I hope you find this tip useful and I’ll try to keep them coming, I’ve gotta catch up from slacking off here lately

Keith


AdminP Class - Completing the MoveUserInHierarchy

11/21/2006 2:37 PM By Keith Strickland

A while back I promised to do a Show-n-Tell Thursday article about the MoveUserInHierarchyComplete method which is part of the NotesAdministrationProcess class of LotusScript. Well, I finally broke down and finished it. This method will allow you to create your own agent to complete the move of people in-mass to another certifier, which if you’ve ever looked at tools to do this you know that they are very costly. So, when this method is used in conjunction with this method you have yourself a very nice solution for moving people, it’s just up to you to create yourself a view to categorize people the way you want them to make moving them easier.

So, let’s get on with it shall we? This is actually a little less complicated that using the MoveUserInHierarchy method. But first we need to set some properties of the NotesAdministrationProcess.

  1. UseCertificateAuthority = True/False - We need to define if we’re using the Certificate Authority or not. I spoke about this in the previous SnTT post.
  2. CertificateAuthorityOrg = /New/Certifier/US - This should be the new certificate the user is being moved to
  3. CertifierFile = c:\path\to\new\certifier\cert.id - If you’re not using the Certficate Authority then you’ll have to tell AdminP where your cert.id file is
  4. CertifierPassword = secret - If you’re not using the Certificate Authority then you’ll have to define the password for cert.id

That is all the preliminary adminP properties that we’ll need for this request. Next we’ll have to get the NoteID (not the UNID) of the original request. You can do that any way you like. Me personally, I loop through all the requests for whatever person I’m moving to determine which one is the original. The action for the request should read “Move Person’s Name in Hierarchy” and the ProxyAction field should = “6″.

Now, all that’s left since we’ve set our preliminary properties and gotten the NoteID of the original request is to call the complete move like this:
compMoveNoteID = adminP.MoveUserInHierarchyComplete(noteID)

And that is all there is to it, pretty simple huh? I’ll try and get some code out here that I use to do this from the User Administration Utility.

Keith

Here’s some of that code I promised…




Dim ses As New NotesSession
Dim db As NotesDatabase
Dim adminDB As NotesDatabase
Dim adminView As NotesView
Dim adminDocCol As NotesdocumentCollection
Dim adminDoc As NotesDocument
Dim adminP As NotesAdministrationProcess
Dim noteID As String
Dim compNoteID As String
Dim j As Integer‘Get all the databases, views and document collections
set db = ses.CurrentDatabase
Set adminP = ses.CreateAdministrationProcess(db.Server)
Set adminDB = New NotesDatabase(db.Server,“admin4.nsf”)
Set adminView = adminDB.GetView(“All Requests by Name”)

‘Get the Note ID of the request in the admin4 database. This only works if there isn’t an already processed request.
Set adminDocCol = adminView.GetAllDocumentsByKey(“John Doe/old/cert/US”)
‘Loop through all the adminp requests for the user and get the proper request
For j = 1 To adminDocCol.Count
Set adminDoc = adminDocCol.GetNthDocument(j)
If adminDoc.ProxyAction(0) = “6″ Then
noteID = adminDoc.NoteID
End If
Next

‘Complete the move
If certValues(22) = “Yes” Then
adminp.UseCertificateAuthority = True
adminp.CertificateAuthorityOrg = “/new/cert/US”
Else
adminp.UseCertificateAuthority = False
adminp.CertifierFile = “c:\path\to\new\cert.id”
adminp.CertifierPassword = “secret”
End If

compNoteID = adminP.MoveUserInHierarchyComplete(noteID)

This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.


Continue Reading...

AdminP Class - Moving a user to a new Certifier

08/21/2006 6:52 PM By Keith Strickland

I’m kinda new to the Show-n-Tell Thursday crowd and figured my first one should be pretty useful, albeit late. I can’t promise to have one out every Thursday, but I’ll try and do as many as possible. Today I’m writing about using the NotesAdministrationProcess and the MoveUserInHierarchyRequest method. This method will submit a “Move Person’s Name in Hierarchy | 6″ AdminP request. This method also has a followup method that must be run in order to complete the “Move” request which is the MoveUserInHierachyComplete method.

Now, the equivalent of this is to do a rename, choose move user and once the move request is complete, go into the admin4.nsf database and complete the move there. This requires you to do each user one at a time. But with some determination you can write your own script using the 2 methods above and move several people at a time. This beats spending hundreds of dollars for each user in the address book on a third party solution. As a matter of fact this is how I came up with this post. While at LotusPhere 2006 I looked at several tools to move many users at once to a different certifier. All of the tools I found were very expensive with the least expensive being about $200 per user in the address book, not pretty and not popular with the company bean counters. With a little bit of effort and admin privledges the spending of that money can be avoided.
Now, let’s get on with it. This post will be in 2 separate posts, the first one (this one) will cover the MoveUserInHierarchyRequest. This method is pretty straight forward but does require some attention. First off, we need to define some properties of the NotesAdministrationProcess.

  • UseCertificateAuthority = True/False - We need to define if we’re using a Certificate Authority or not. If you’re not, I highly recommend it as it’s a very simple and elegant way to handle user registrations and it makes things much easier on your administrators.
  • CertifierFile = c:\path\to\cert.id - If you’re not using the Certificate Authority then you’ll have to tell AdminP where your cert.id file is.
  • CertifierPassword = secret - If you’re not using the Certificate Authority then you’ll have to define the password for cert.id.
  • CertificateAuthorityOrg = /Existing/Certifier/US - This should be the user that is being moved existing certifier.

And that is all the preliminary adminP properties that will need to be set. Next off is to call the method and pass along some certain values in order to complete the request. So, here we go with that…
noteID = adminP.MoveUserInHierarchyRequest(”John Doe/Existing/Certifier/US”,”/New/Certifier/US”,False) - The False is whether or not to allow a primary name change for the user

Now, this should return the Note ID of the request in admin4.nsf. However I haven’t been able to get this to work, even by trying to go directly to admin4.nsf, lookup the request and get it that way. Getting the Note ID manually seems that the request hasn’t shown up in the view yet. Maybe I’m missing something somewhere but it seems that all of the adminP requests in the NotesAdministrationProcess class are “supposed” to return a Note ID, but none do, which makes it impossible to write code that will ensure that the request was submitted properly. Maybe someone knows something about this?

Now, you should be able to go to the admin4.nsf database and see your request in your preferred view. It’ll be of type “Move Person’s Name in Hierarchy” with an alias of “6″. You should also see a request in the “Name Move Requests” view of admin4.nsf

Now there are 2 ways to complete the move.

  1. Do it the “Lotus Preferred” way by manually going into admin4.nsf and completing the move
  2. Write an agent that uses the MoveUserInHierarchyComplete method, we’ll discuss this next week.

So, I hope this at least makes you aware that this functionality is available as of version R6 of Lotus Notes/Domino and that with a little effort there is no need on spending thousands of dollars on a third party solution just to move users to a different certifier.

Keith

OK, I’ve added some code to this. I hope you find this useful:

dim ses as New NotesSession
dim serverName as NotesName
dim userNotName as NotesName
dim admin4 as NotesDatabase
dim adminDocCol as NotesDocumentCollection
dim j as integer
dim adminp as NotesAdministrationProcess
dim adminpNoteID as String
dim newCertName as String
dim flag as Variant
dim adminDoc as NotesDocument
dim adminView as NotesView

‘Check if a request has already been submitted and is awaiting completion
Set serverName = New NotesName(db.Server)
Set userNotName = New NotesName(“John Doe/old/cert/US”)

‘get the adminp database and see if a request has already been submitted.
Set admin4 = New NotesDatabase(serverName.Abbreviated,“admin4.nsf”)
Set adminView = admin4.GetView(“All Requests by Name”)
Set adminDocCol = adminView.GetAllDocumentsByKey(userNotName.Abbreviated)
For j = 1 To adminDocCol.Count
Set adminDoc = adminDocCol.GetNthDocument(j)
If adminDoc.ProxyAction(0) = “6″ Then ‘a request has already been submitted.
flag = Messagebox(“A request of this type is currently awaiting completion for “ + userNotName.Abbreviated + “.”,0+48+0+0,“Already Requested”)
Exit Sub
End If
Next

’setup the admin process on this server
Set adminp = ses.CreateAdministrationProcess(serverName.Abbreviated)

‘do the request
‘Determine if the CA Process is being used. If not, detach the cert.id file. If so, then use the appropriate properties
If using a certificate authority Then
adminp.UseCertificateAuthority = True
Else
adminp.UseCertificateAuthority = False
adminp.CertifierFile = “c:\path\to\old\cert.id”
adminp.CertifierPassword = “secret”
End If

adminp.CertificateAuthorityOrg = “/old/cert/US”
newCertName = “/new/cert/US”

adminpNoteID = adminp.MoveUserInHierarchyRequest(“John Doe/old/cert/US”,newCertName,False)

This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.


Subscribe to keithstric.com

OpenNTF

Disclaimer

The opinions and ideas posted on keithstric.com are not necessarily the opinions and ideas of my employer. The solutions, techniques and code provided here are not guaranteed or warranted in any way and are free for you to use at your own risk.