2006-03-27

Domino: Extend Authentication For Websites, Single Sign-on and Persistent Sessions

Ever wanted to be able to authenticate users on your Domino Web Server using a Web Service, against a MySQL database, a text file or some other external source? Or how about changing the default Domino behaviour so that user sessions remain active for days or weeks. It's easy and I'll show you how using Apache Tomcat and a simple Java Servlet.

More >

Notes - Web: Ajax Drag-n-Drop Sorting of Documents

«Imagine the following situation - say you've got a set of documents which are all children of one container document. From within this parent container document you want to be able to quickly change the order in which the child documents appear. Sound familiar?»

More >

Tools: Yahoo! UI Library

«The Yahoo! User Interface Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, HTML and AJAX. The UI Library Utilities facilitate the implementation of rich client-side features by enhancing and normalizing the developer's interface to important elements of the browser infrastructure (such as events, in-page HTTP requests and the DOM.»

More >

Domino: ajax picklist (either for names.nsf or other dbs)

«One of the things which has bugged me for a long time is getting a good name picker.(...)So the requirements:
.A generic popup window which allows a user to select one or many values from a very large view (100,000 documents plus)
.It has to perform well
.It has to be cross browser compatable (at least IE and Firefox)
.It has to be easily re-usable»


More >

***


«I needed a name picker for a project I'm working on. After looking at various solutions available I couldn't find one I was happy with and decided to the revisit the approach and write my own. (...) What I've tried to move away from is the convention that a Name Picker must, for some reason, be a popup window.»


More >

Domino: Ajax Powered Login

«Getting tired of ugly Domino login forms or faceless browser pop up dialogs? Once again showing a flair for melding various techniques, Mark Barton brings us an elegant, cutting edge modal login interface utilizing DHTML, Ajax, and JSON JavaScript notation.»
More >

2006-01-12

Notes - LotusScript: function returning a notes document

Problem:
Even though the document is instatiated inside the function it is not returned to the calling code.
 
Explanation:
You're probably declaring and setting the value of the NotesDocument's parent database inside the function, which is outside the scope of the calling function. As a result, although you return the right document, the containing database is no longer open.

You can either pass the database *and* the document and pass them both back, or you can declare the database globally
.

 

2005-12-30

Notes - Web: Alignment of Checkboxes on the Web

This can be done by adding some HTML around the checkbox field, like this:

<table cellspacing="0" cols="5" cellpadding="0" border="0" valign="top" rows="1"><tbody><tr><td><br />

Checkbox Field

</td></tr></tbody></table>


Don't forget to mark this code as Pass-Thru HTML.

And now, on the checkbox field choices, this should be added to the end of the choice where the list should break to a new column:

</td><td valign="top">


Example of list:
-------------
apple | a
orange | or
strawberry [</td><td valign="top">] | s
pineapple | p
banana | b
other [</td><td valign="top">] | o
-----------------------

2005-12-29

Notes - Web: select all javascript function for checkboxes (multivalue too)

function selectAll(fieldname, bFlag) {
  var checkField = document.forms[0].elements[fieldname];
  if (checkField.length)
   {
     for (i=0; i<checkField.length; i++)
        {
           if (checkField[i].checked)
            {
               checkField[i].checked = bFlag;
           }
      }
   }
  else if (checkField.checked)
    {
       checkField.checked = bFlag;
   }
}

2005-12-27

Windows - ActiveX: ActiveX is enabled on IE but does not work

Other possible symptoms:

- unable to access MMC console (access rights message error, although having administrator rights) and/or unable to save a new one ("MMC cannot save the console");
- windows update not working or crashing the IE browser;
- msn messenger unable to connect.

Solution:
Go to Start -> Run and write: regsvr32 MSXML3.dll and click OK.

2005-12-14

Notes - client: hide-when for layers

To hide a layer in the notes client, select the layer's Anchor as it was text and use the text's hide-when tab on the properties dialog box to control the appearance and disappearance of the layer.

2005-12-06

Notes - Client: View autoframe

The view autoframe property only works for the Web, but for the client there's the following workaround (undocumented feature and only works for the database default frameset):

. Create a Frameset with only one Frame and call this Frame NotesView and select any view;
. In the database default Frameset, open the previously created Frameset in one of it's frames.

Now, when opening a view (through a link, for example), the database will force the default frameset to open "around" the view.

2005-11-25

Notes - Lotus Script: Replace Substring

Function ReplaceSubstring(sourcestr As String, fromstr As String, tostr As String) As String
   ' This function replaces characters in a string. Take all the occurrences of "fromstr"
   ' in the source string and replace them with "tostr"
   Dim tempstr As String
   Dim convstr As String
   Dim i As Long
   Dim length As Long
   tempstr = sourcestr
   If Len(fromstr) = 0 Then
      ReplaceSubstring = sourcestr
      Exit Function
   End If
   If Instr(tostr, fromstr) <> 0 Then ' If, for example, "\" is being replaced with "\\"
      ' Find a character (or set) that is not in the source string.
      ' Try the extended characters (over 128 ASCII)
      i = 128
      length = 1
      convstr = ""
      While convstr = ""
         If Instr(tempstr, String$(length, Chr$(i))) = 0 Then convstr = String$(length, Chr$(i))
         i = i + 1
         If i = 256 Then ' If all the extended characters were in there
            length = length + 1 ' Start over, but try 2 extended characters (or 3 or 4)
            i = 128
         End If
      Wend
      ' Go through tempstr twice - once replacing fromstr with the computed
      ' string, then replacing the computed string with tostr
      While Instr(tempstr, fromstr) <> 0
         tempstr = Left(tempstr, Instr(tempstr, fromstr)-1) & convstr _
         & Mid(tempstr, Instr(tempstr, fromstr)+Len(fromstr))
      Wend
      While Instr(tempstr, convstr) <> 0
         tempstr = Left(tempstr, Instr(tempstr, convstr)-1) & tostr _
         & Mid(tempstr, Instr(tempstr, convstr)+Len(convstr))
      Wend
   Else ' It's a normal replace substring call - fromstr is not part of tostr
      While Instr(tempstr, fromstr) <> 0
         tempstr = Left(tempstr, Instr(tempstr, fromstr)-1) & tostr _
         & Mid(tempstr, Instr(tempstr, fromstr)+Len(fromstr))
      Wend
   End If
   ReplaceSubstring = tempstr
End Function

2005-11-14

Notes - Web: bypassing the $$Return field

To avoid the processing of the $$Return field, save the document with the command:
@Command([FileSave])

If using Javascript then instead of using document.forms[0].submit(), create a button with the above formula and give it an id (ex:bt_save) and then on the submit script do:
 
document.all.bt_save.click()

 


The url of the document will be the original one (http://server_name//database_name/form_name?OpenForm), with "&Seq=1" (2,3,...) appended in the end.

2005-11-11

Notes - Web: simulate notes client continue=false behaviour on web save

Form:
(Server_Name e Path_Info are CGI fields)


. field SaveOptions=0
. field $$Return= "[http://" + Server_Name + @Left(Path_Info;"nsf") + "nsf/0/"+ @Text(@DocumentUniqueID) + "?OpenDocument]"



WebQuerySaveAgent:
(if the validation fails, then the doc will not be saved because of the SaveOptions field value)

if (validateForm) doc.SaveOptions=1



Form - onload:
(optionally)
if (document.all.field_error.value!="") alert("Document not saved. \n Errors:" + document.all.field_error.value)


2005-11-10

Web - Js: generic form validation function

function isSomethingSelected( obj ){
    for (var r=0; r < obj.length; r++){
     if ( obj[r].checked ) return true;
  }
}

/*--- form validation--- */
function checkRequiredField(sFname)
  {
   field = self.document.getElementById(sFname);
   sType = field.type.toLowerCase();
   var bOk = true;

   switch (sType)
   {
    case "text":
    case "textarea" :
     if (field.value=="") bOk=false;
     break;
    case "checkbox":
    case "radio":
     if ( !field[0]) { //handle single item group first
      if ( !field.checked ) bOk=false;
     }
     else
     {
      if (!isSomethingSelected(field)) bOk=false;
     }
     break;
    case "select-one":
     if (field.selectedIndex == 0) bOk= false;
     break;
    case "select-multiple":
     if (field.selectedIndex == -1) bOk=false;
     break;
    default:
     break;
   }
  return bOk;
}

2005-11-09

Web - Js: including javascript stored in a separate file

<script type="text/javascript" src="/file_path/file_name.js"></script>

Web - CSS: including style sheets stored in a separate file

<link="stylesheet" type="text/css" media="print" href="/file_path/file_name.css"/>

<style type="text/css" media="screen">@import "/path_file/path_name.css"; </style>

DOM: window.open

Gecko DOM Reference

Syntax
WindowObjectReference = window.open(strUrl, strWindowName [, strWindowFeatures]);

Web - CSS: how to make a "fake" link

.linkClass
{

text-decoration : underline;
cursor : hand;
}

Notes - Web: document link in html view

"<a href=\"0/" +@Text(@DocumentUniqueID)+"\">" + field_name + “</a>”