Showing posts with label iNotes. Show all posts
Showing posts with label iNotes. Show all posts

Friday, 14 November 2014

Add Disclaimer to Mail Signature in IBM SmartCloud Notes (Custom Implementation)

Requirement:

A company disclaimer is required to be added to all the Emails sent across the organization and outside using SmartCloud Notes Client and iNotes.

Challenge:

SmartCloud Notes doesn’t support functionality of Message Disclaimer.

 

Solution:

This solution is a work around and not really a Cloud based integration.

We’ll be using a LotusScript Agent to modify the Mail Signature for Notes Client, iNotes – Plain Text and iNotes – Rich Text and append the Disclaimer for all users.

Assumption:

The Administrator has access to all the MailFiles in SmartCloud Notes via Template Modification.

 

Code:

Option Public
Option Declare

Const DISCLAIMER = |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Disclaimer :
This e-mail and any attachments thereto are intended for the sole use of the recipient(s) named above and may contain information that is confidential and/or proprietary to the ABC Pvt. Ltd. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication, or dissemination in any form) by persons other than the intended recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete it.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
Sub Initialize
    Dim s As New NotesSession
    Dim docP As NotesDocument
    Dim db As NotesDatabase
    Dim dociNotes As NotesDocument
    Set db = s.CurrentDatabase
    Set docP = db.GetProfileDocument("CalendarProfile")
    Set dociNotes = db.Getprofiledocument("iNotesProfile")
    If docP.SignatureInserted Then 'Avoid repeated insert of signature
        'Plain Text Signature
        docP.Signature_1 = docP.Signature_1(0) & Chr(10) & DISCLAIMER
        'HTML iNotes Signature
        dociNotes.HTMLSignature = dociNotes.HTMLSignature(0) & Chr(10) & DISCLAIMER
        'Notes RichText Signature
        Dim rtItem As New NotesRichTextItem(docP, "Signature_Rich")
        Call rtItem.appendtext(DISCLAIMER)
        docP.SignatureInserted = True
        Call docP.Save(True,False)
        Call dociNotes.save(True, False)
    End If
End Sub

Sunday, 6 July 2014

Customize Domino Login Form to allow only Email Address

Default Domino Login Form allows multiple variants of Username to login:

  • Notes Common Name
  • Notes Canonical Name
  • Notes Abbreviated Name
  • Email Address etc.

If administrator wants to restrict usage of email address only, then following customization can be used:

Assuming SSO is configured on Domino Server and Domcfg.nsf is deployed on server, we’ll create a custom login form:

  1. Open Domcfg.nsf in Domino Designer.
  2. Create a copy of “$$LoginUserForm” Form and rename it. For e.g. “DEMOLoginUserForm”.
  3. Open the newly created form and modify the “Username” field as shown below. Change the name of field to “User” in first and last tab of Field Properties.
    image
  4. Goto the “onChange” Event of “User” field and add following code:
    return onSelectEmail()
  5. Goto the “JSHeader” section of Form and add following code (Please update the domain name in code appropriately): function onSelectEmail(){
             if(document.getElementById('User').value=="") {
                 alert("Please enter username first");
                        document.getElementById('User').focus();
                        return false;
             }
                  document.getElementById('Username').value=document.getElementById('User').value+"@demo.com";
                  return true;
      }
  6. Add the Domain name in front of User field as shown in image above.
  7. Add following code as “Pass thru HTML” in the next line after User field:
    <input name="Username" id="Username" type="hidden">
  8. The form is ready now !
  9. Now open Domcfg.nsf in Domino Admin client and set the mapping for this new form:
    image
  10. That’s all !
    image

 

Let me know if you face any issues.. I’ll be happy to assist.

     

     

     

Monday, 8 April 2013

iNotes Deployment in HA Mode with Multiple Clusters using Apache Reverse Proxy - Part 2

In continuation to my first post: http://xpagesera.blogspot.in/2013/03/inotes-deployment-in-ha-mode-with.html

In the last post, we tried setting up the Apache Reverse Proxy with Multiple Domino Clusters. Last week, we successfully implemented Apache Reverse Proxy in a unique way: 

Cluster size: 7 servers - 6 Mail Servers and 1 Admin Server. This setup ensures that all password changes are immediately available to all Servers. 

User's Mail file is available on either Server 1, 3, 5 OR Server 2, 4, 6. In this configuration 4 servers are in DC and 2 servers in DR. We want all traffic to land on Server 1 - 4 (DC). In case none of the DC Servers are available, then it should redirect request to Server 5, 6 (DR).

Instead of relying on the Domino Cluster Information, we have written Rules in Apache httpd.conf file to determine which Load Balancer Group a particular request should be redirected to. 

First, the formula used for Apache field in iNotes Web Redirect database: 

nodecookievalue:= @Name([CN];@NameLookup([NoUpdate];@UserName;"MailServer"));

clustercookievalue:=@DbLookup("":"";@Subset(@DbName;1):"names.nsf";"($ServersLookup)";nodecookievalue;"clustername");

nodecookie:=@SetHTTPHeader("Set-Cookie";"inotesses="+@LowerCase(nodecookievalue));

@Success

This field will write Cookie values inotesses: Mail Server Name in lowercase. 

Second, Check if below modules are present & loaded in Apache Reverse Proxy

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

LoadModule proxy_http_module modules/mod_proxy_http.so

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

LoadModule proxy_connect_module modules/mod_proxy_connect.so

Third, in the httpd.conf file, add Rules to redirect user request to only that server where user's mailfile is present.

<VirtualHost *:443>

ServerName webmail.demo.com

ProxyRequests off

SSLEngine On

SSLProxyEngine On

RewriteEngine On

SSLCertificateFile    /etc/apache2/ssl/webmail.crt

SSLCertificateKeyFile /etc/apache2/ssl/webmail.key

SSLCertificateChainFile /etc/apache2/ssl/chain.crt

ProxyPreserveHost On

<Proxy balancer://Cluster1/>

# loadfactor is added to ensure equal requests are sent to server01 and server02, while server03 will have lowest priority.

BalancerMember https://server01.demo.com:443/ route=server01 loadfactor=50

BalancerMember https://server03.demo.com:443/ route=server03 loadfactor=50

 BalancerMember https://server05.demo.com:443/ route=server03 loadfactor=1

ProxySet lbmethod=byrequests

</Proxy>

<Proxy balancer://Cluster2/>

BalancerMember https://server02.demo.com:443/ route=server02 loadfactor=50

BalancerMember https://server04.demo.com:443/ route=server04 loadfactor=50

 BalancerMember https://server06.demo.com:443/ route=server03 loadfactor=1

ProxySet lbmethod=byrequests

</Proxy>

ProxyPass / balancer://Cluster1/ stickysession=inotesses nofailover=Off

ProxyPassReverse / https://server01.demo.com/

ProxyPassReverse / https://server03.demo.com/

 

ProxyPass / balancer://Cluster2/ stickysession=inotesses nofailover=Off

ProxyPassReverse / https://server02.demo.com/

ProxyPassReverse / https://server04.demo.com/

 

RewriteCond %{HTTP_COOKIE} inotesses=server01 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster1/$1 [P]

 

RewriteCond %{HTTP_COOKIE} inotesses=server02 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster2/$1 [P]

 

RewriteCond %{HTTP_COOKIE} inotesses=server03 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster1/$1 [P]

 

RewriteCond %{HTTP_COOKIE} inotesses=server04 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster2/$1 [P]

</VirtualHost>

 

Now, Stop & start httpd service.

Monday, 3 December 2012

iNotes Customization: Perform Server side check before sending emails

This blog is dedicated to Lotus iNotes 8.5 Customization to ensure that some Server side checks can be performed before emails is sent out.. The iNotes Customization documentation has certain examples but not complete to demonstrate this exact scenario..

Special thanks to Eric W. Spencer, IBM for providing wonderful insight for the same.

Steps to follow:

1. Setup Forms85_x.nsf: Instructions on creating the Extension Forms File are in the Lotus iNotes Administrator documentation. The topic can be found in Domino and Notes info center here.

2. Edit Custom_JS_Lite Subform in Forms85_x.nsf

Setup a flag "hAgentSend" in each new Email Document that is created. The starting code is there to pick the current UI Form ids and then create an Input element and add it to current Mail form.

function Custom_Scene_PostLoad_Lite( s_SceneName, bInEditMode ){
    if ((s_SceneName || '').split(':')[1] == 'EdT' && s_SceneName.indexOf('$new') !== -1 ) {
        var oMailInfo = EKc.prototype.EYl[s_SceneName];

            var oElem = AAA.EcK.getElementById(s_SceneName.split(':')[0]);

            var sContentId = oElem.getAttribute('com_ibm_dwa_ui_mailinfo_contentid');

            var oContent = AAA.Fkb().getContent(sContentId);

        // Get the current UI document
        var oMainDoc = AAA.EcK;
        // Get the current backend document ID
        var sDocUnid = oContent.sId;
        // Get the current UI form
        var oForm = oMainDoc.getElementById( 'e-pageui-' + sDocUnid ) || {};
   
        var oInput = oMainDoc.createElement('INPUT');
        oInput.setAttribute('name','hAgentSend');
        oInput.setAttribute('id','hAgentSend');
        oInput.setAttribute('type','hidden');
        oForm.appendChild(oInput);

    }
}

Now, set the code to call an Agent from server using AJAX and enable Mail send functionality only in Callback function of AJAX response:

function Custom_Scene_PreSubmit_Lite( s_SceneName, bInEditMode ){
    if  (s_SceneName == "memo") {

        // Get the current backend document ID
        var oContent = AAA.Fkb().EdI.get('T').oPrev;
        var sDocUnid = AAA.Fkb().EdI.get('T').oPrev.sId;

        // Get the current UI document
        var oMainDoc = AAA.EcK;

        // Get the current UI form
        var oForm = oMainDoc.getElementById( 'e-pageui-' + sDocUnid );

        // If the agent is sending the memo, just send
        if (oForm["hAgentSend"]) {
            if (oForm["hAgentSend"].value == "true")
                return true;
        }
   
        // do any checking here and set up xhr to run agent..............
        url= window.location.protocol + "//" + window.location.hostname + "/inotes/forms85_x.nsf/agCheckGroupAccess?OpenAgent";
http_request = false;
if (window.XMLHttpRequest) { // Mozilla
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
    http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}

        //setting mail send on AJAX Call
        http_request.onreadystatechange  = function()
{
    if(http_request.readyState  == 4)
    {
        if(http_request.status  == 200) {    // success

            var resp = http_request.responseText;
    if(resp.indexOf("true") !== -1)
        bOkayToSend = true;
            // Get response info from agent and do any necessary processing
            // Decide if it's okay to send the memo
            // ...

            if (bOkayToSend) {

                // okay to send the memo
           
                // Get the current backend document ID
                var sDocUnid = AAA.Fkb().EdI.get('T').oPrev.sId;
           
                // Get the current UI document
                var oMainDoc = AAA.EcK;
           
                // Get the current UI form
                var oForm = oMainDoc.getElementById( 'e-pageui-' + sDocUnid );
           
                // Set the flag that says memo is being sent
                oForm["hAgentSend"].value = true;
               
                // Send the memo
                setTimeout("AAA.DSq.ELU(null, 'e-actions-mailedit', 'EbK', {sAction: 'a-send'})", 1000);
            }
            else {
                // put up some kind of error message
                alert("invalid email");
            }
        }
    }
}
       
        //Send AJAX Request
        http_request.open('POST', url, true);
        http_request.send();
       
        // Return false to prevent email from getting sent now
        return false;
    }

    return true;
}

The agent should return a value of "true" to enable the mail send.. Here is the code for the smallest agent:

Option Public
Option Declare

Sub Initialize
   
    MsgBox "Running Agent: iNotes Mail Send"
   
    Print "true"
   
End Sub

Reference Documents:

1. http://www-10.lotus.com/ldd/dominowiki.nsf/dx/The_basics_of_iNotes_customization

2. http://www-10.lotus.com/ldd/dominowiki.nsf/dx/manipulating-data-in-inotes-lite-forms

If required I can publish the modified Forms85_x.nsf here as well.. Please let me know.

Friday, 13 April 2012

High Availability for Lotus iNotes Installation

High Availability for Lotus iNotes Installation

I am looking for various options available for achieving High Availability with Lotus iNotes installation. The article outlines the options available, work that Domino experts have done and the best option that suits my requirement.

Following available options are possible:

1. ICM (Internet Cluster Manager): ICM only provides initial redirect to correct Domino Web Server. But once user has opened a webpage and server goes down, user has to manually switch the URL to point to the other server or browse the ICM URL again.
http://www-12.lotus.com/ldd/doc/domino_notes/Rnext/help6_admin.nsf/c1f2605b7be6a95985256b870069c0a8/36fd13678096637585256c1d0039a59b?OpenDocument

2. Hardware based Load Balancer

3. Software based Load Balancer: 

Following two options are possible with Domino: Websphere Edge Proxy Server and Apache Web Server. In this article, we'll use Apache Web Server for Reverse Proxy and Load Balancer configuration. 

It seems like Daniel has already done all the hard work.. He has published a great series on the same topic !! The article is in Spanish, but can easily be translated in English via Google Translate. Please copy the code from Original version only.. 

http://www.noteros.com/inotes-apache-reverse-proxy/

http://www.noteros.com/inotes-con-reverse-proxy-apache-parte-2/

http://www.noteros.com/inotes-con-reverse-proxy-apache-parte-3/

http://www.noteros.com/inotes-con-reverse-proxy-apache-parte-4/

I setup the following piece of code in httpd.conf: 

I setup two Domino Clusters as follows: 

Cluster1 - Server1, Server2

Cluster2 - Server3, Server4

<Proxy balancer://Cluster1/>

BalancerMember http://server1.demo.com:80/ route=Server1

BalancerMember http://server2.demo.com:80/ route=Server2

ProxySet lbmethod=byrequests

</Proxy>

 

<Proxy balancer://Cluster2/>

BalancerMember http://server3.demo.com:80/ route=Server3

BalancerMember http://server4.demo.com:80/ route=Server4

ProxySet lbmethod=byrequests

</Proxy>

 

ProxyPass / balancer://Cluster1/ stickysession=inotesses nofailover=Off

ProxyPassReverse / http://server1.demo.com/ 

ProxyPassReverse / http://server2.demo.com/ 

 

ProxyPass / balancer://Cluster2/ stickysession=inotesses nofailover=Off

ProxyPassReverse / http://server3.demo.com/ 

ProxyPassReverse / http://server4.demo.com/ 

 

RewriteCond %{HTTP_COOKIE} _clusterses=Cluster1 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster1/$1 [P]

 

RewriteCond %{HTTP_COOKIE} _clusterses=Cluster2 [NC]

RewriteRule ^/((mail|iNotes|icons|domjava)/.*)$ balancer://Cluster2/$1 [P]

 

Reference:

https://www.ibm.com/developerworks/mydeveloperworks/blogs/gvkempen/entry/configuring_inotes_reversed_proxy_using_apache_on_ubuntu?lang=en

http://www-10.lotus.com/ldd/dominowiki.nsf/dx/using-apache-as-a-reverse-proxy-and-load-balancer-for-domino-clustered-servers

http://www.ibm.com/developerworks/lotus/library/inotes-avail/index.html

http://www-10.lotus.com/ldd/dominowiki.nsf/dx/iNotes_High_Availability_Configuration#Why+prefer+Load+Balancer+to+ICM+solution

http://socialaboration.blogspot.in/2010/09/ubuntu-as-inotes-reverse-proxybalancer.html