Welcome to Squishdot Websites Squishdot How-To Newbies
 about
 search
 post article
 Documentation
 Mailing Lists
 Bug Tracking
 Development
 Installation
 Upgrading
 Download
 admin
 rdf

 main


Displaying links/actions according to whom is surfing the site
How-To Posted by Silvio Casagrande on Thursday June 12, 04:01AM, 2003
from the starting-to-get-zopenized dept.

I didn't want anyone to do actions like Add a Posting or Reply in my weblog. I wanted a restricted set of links/actions for the Anonymous User. Here you can read how I did it.

Subject: contextual content presentation in Squishdot

Subject: contextual content presentation in Squishdot

Change the content presentation according to the user logged into the weblog.

Example: When surfing an Squishdot site, some management funtions are visible to any user, like Post an Article or Manage. If you are an Anonymous User and click on one of these links you get the JavaScript login dialog. It's kind of annoying for casual browsers of the site. I wanted to show to the Anonymous User a restricted set of links.

I do not want the Anonymous User to see the following links/actions:

  • Post Article
  • Admin
  • rdf
  • Reply

Objects That were modified:

  • bottom_items
  • leftbox_items
  • index_html
  • posting_html
  • search_form
  • site_footer
  • showSearchResults

Changes: First I wanted to restrict two navigational objects:

  • leftbox_items
  • bottom_items

    which are TinyTables objects.

The idea is to reference to a slot with all the links/actions if the user is NOT Anonymous, or display instead a slot with only the links/actions you want to display.

Steps to use the restricted TinyTables objects:

Following steps describe how to use the restricted TinyTables objects and in what Squishdot objects I did the changes.

1st Step
Copy both objects and paste into the Squishdot parent folder, and change the name to something like:
  • leftbox_items_restricted
  • bottom_items_restricted
2nd Step
Edit and delete the links that you don't want to show to the Anonymous User in the TinyTable object. For example my leftbox_items_restricted has only:

"search", "/searchForm", 1

"about", "/About", 1

in the data control. Save changes.

3rd Step
The idea is to go to the objects where leftbox_items and bottom_items are referenced and check before displaying them who is surfing the weblog. If the surfer is Anonymous User display the *_resticted TinyTable object instead of the original object.

I used a dtml-let and dtml-if... blocks to get the user name and check for Anonymous User ::

4th Step
In the objects:
  • index_html
  • posting_html
  • search_form
  • site_footer
  • showSearchResults
  • searchForm

I looked for the block where the contents of leftbox_items or bottom_items are displayed, and embeded that block in a conditional block, for example in index_html:

                        &nbsp;<a href="' <dtml-if relurl><dtml-var site_url ></dtml-if><dtml-var urlname>"></a><br>

                        &nbsp;<a href="<dtml-var site_url >/../index_html">up a level</a><br>
                        &nbsp;<a href="<dtml-var site_url >/searchForm">search</a><br>

                        &nbsp;<a href="<dtml-if relurl><dtml-var site_url ></dtml-if><dtml-var urlname>"></a><br>

                        &nbsp;<a href="<dtml-var site_url >/../index_html">up a level</a><br>
                        &nbsp;<a href="<dtml-var site_url >/addPostingForm">post article</a><br>
                        &nbsp;<a href="<dtml-var site_url >/searchForm">search</a><br>
                        &nbsp;<a href="<dtml-var site_url >/manage">admin</a><br>

Note that I mantain the display logic used in Squishdot just in case the TinyTable product is not installed.

Changing the Reply link/action

I do not want the Anonymous User to hit the Reply link/action. Instead I wanted the action to be a sendmail link/action.

In the posting_html object look for the statement:

        <b>The Fine Print:</b> The following comments are owned by whoever posted them. <br>

And add the following statements:

                ( Send comments to <a href="mailto:<dtml-var email>?subject=Acerca%20de%20
                <dtml-var title>&body=<dtml-varsite_url>"></a> )

                ( <a href="addPostingForm">Reply</a> )<br>

As a newbie to Zope and Squishdot, I still want to improve a lot of things in my code. Next objectives are:

  • a way to define the blogsurfer variable at the Squishdot site level. Using a dtml-let in each object to define the variable makes the final code a bit un-readeable
  • some way, perhaps using ZPT to manage contextual displaying of objects according to the user who is surfing the weblog

Hope this help you improve the navigation of your Squishdot site!

Any comments are welcome and appreciate!

<  |  >

 

Related Links
  • Articles on How-To
  • Also by Silvio Casagrande
  • Contact author
  • The Fine Print: The following comments are owned by whoever posted them.
    ( Reply )

    Powered by Zope  Squishdot Powered
      "Any system that depends on reliability is unreliable." -- Nogg's Postulate
    All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest ©1999 Butch Landingin, ©2000-2002 Chris Withers.