Pages

Thursday, December 18, 2008

How To Allow Anonymous Comments in Lotus Connections Blogs

View Comments

Well, sort of. A customer this week asked me how to modify the blog template so that anonymous users could click on the 'Add a Link' comment. By default, the link is completely disabled until the user clicks on 'Log In', authenticates, and returns back to the blog entry.

I took it upon myself to look at the blog theme and figure out how to make this change. Since the themes for blogs are created using Velocity (an open source template engine), I took a quick peek of the Apache site to learn some things about how Velocity works.

Below are the steps I followed to get this working:

  1. Go to <WAS_PROFILE_ROOT>/installedApps/<cell_name>/Blogs.ear/blogs.war/themes/<theme name>
  2. Save a backup of _header.vm and Weblog.vm
  3. Open _header.vm with your favorite text editor
  4. Find the following line

    #if($utils.isJapanese())
    <script type="text/javascript">
    <!--
    {
    var func = window.onload;
    window.onload = function() {
    if(func) {
    func();
    }
    document.body.className = document.body.className + " lotusJapanese";
    }
    }
    //-->
    </script>
    #end


    and replace it with:

    #if($utils.isJapanese())
    <script type="text/javascript">
    <!--
    {
    var func = window.onload;
    window.onload = function() {
        if(func) {
            func();
        }
        document.body.className = document.body.className + " lotusJapanese";
    }
    }
    //-->
    </script>
    #else
    <script type="text/javascript">
    <!--
    {
    var func = window.onload;
    window.onload = function() {
        if(func) {
            func();
        }
            
        var luisBlogsUser = getCookie("blogsUser");
        if (null != luisBlogsUser && luisBlogsUser != '') {
            hideAllActionForms();
            AddWeblogEntryCommentForm.toggle('show');
            Field.focus('commentContent');
        }
    }
    }
    //-->
    </script>
    #end
    



  5. Save _header.vm
  6. Open Weblog.vm with your favorite text editor
  7. Find the following line


    <a class="disabledLink" id="AddWeblogEntryCommentLink" title="$text.get('entryview.actionmenu.loginHint')">$text.get("entryview.actionmenu.add_a_comment")</a>
    


    and replace it with:


    <a class="lotusAction" id="AddWeblogEntryCommentLink" title="$text.get('entryview.actionmenu.loginHint')" href="$url.site/roller-ui/login-redirect.jsp?redirect=$entry.permalink">$text.get("entryview.actionmenu.add_a_comment")</a>
    


  8. Save Weblog.vm
  9. Restart the Blogs server and voilá

And here's how it looks.


200812172151.jpg

When you do this change, the 'Add a Comment' link appears for anonymous users. When they click the link, they will be sent to the login page. After successfully authenticating, they are re-directed back to the blog entry with the comment form automatically expanded.

Enjoy!


blog comments powered by Disqus