Anyone who has used Domino (a.k.a Lotus Notes) to produce and serve documents using the HTTP service will know all about the problem that I am about to describe. Have pity on me fellow monks and help me out if you can!

There is a feature in Lotus Notes called a 'twisty' which is basically a control that allows a section of a document to be hidden or shown. The easiest way to think about this is a <readmore> tag. A twisty can contain further twisty sections etc. This works fine in a Lotes Notes client since the whole document is loaded and there are functions that allow you to expand all of the twisty sections.

In a web client (served by Domino R5) however the implementation of a twisty is less straight forward. The document that is outside of the twisty is displayed with each twisty being a link back to the original document. Each link has a set of arguments that describe which sections of the document should be shown. The argument structure looks something like:

ExpandSection=2,1,1_1

This shows that sections 1, 2 and the first section inside of section 1 are expanded. Showing all of the sections is simply a question of constructing the correct argument. The problem is that the sections do not always start at 1 (there are often sections that are hidden from public view) and that there are an unknown number of sections, sub-sections, sub-sub-sections etc.

My proposed solution
I want to create a CGI script that acts as a lightweight proxy for Domino pages. The idea being that I can append the actual location of the content (full Domino URL) and do the twisty expansion by analysing the links in the document and requesting further documents until all of the twisties are expanded. The user (in this case the 'user' is actually a search engine spider) will just see the whole document without having to expand any twisties.

My first step has been to use LWP and HTML::LinkExtor to get the document from Domino and get the links. The further steps that I need to take are to process the links in order to compile the arguments for the new URL. This step will be repeated until the document is expanded. I will add additional functionality to handle authorization (basic and cookie based) when I get over the link parsing. The code so far is lifted from the HTML::LinkExtor POD and looks like this:

sub getLinks { my $url = shift; my $ua = LWP::UserAgent->new; my $p = HTML::LinkExtor->new(\&callback); # Request document and parse it as it arrives my $res = $ua->request(HTTP::Request->new(GET => $url), sub {$p->parse($_[0])}); print $res->code; # Expand all image URLs to absolute ones my $base = $res->base; @links = map { $_ = url($_, $base)->abs; } @links; return @links; } sub callback { my($tag, %attr) = @_; return if $tag ne 'a'; push(@links, values %attr); }

Naturally - I have the usual feelings that a) this has been done before and b) there is a good chance that there is code out there already that solves the problem. Any help and advice is appreciated.

The real answer to the problem is to install and use Domino R6 which (as far as my research tells me) represents twisty sections as <DIV> sections with JavaScript doing the expanding / collapsing on the client browser. This solution is not available to me at this time since the number of Domino R5 servers is large and an upgrade is not planned for some time.

Thanks in advance.


In reply to Domino Twisty Expansion using Lightweight Proxy by inman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.