Tags:
create new tag
, view all tags

Question

I would like to create a TWiki addon that does not display the ability to edit pages if a user is not logged in. I am currently using DragonSkin, and I know that I could just add a hack into the source of TWiki, but I wanted to make it an addon so that I could have a variable set in each web, to determine whether it is on or not. Thank you for any help you can offer as to how I might go about doing this, or if it is already implemented.

Environment

TWiki version: TWikiRelease01Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian Linux Stable
Web server: Apache 1.3
Perl version: 5.6.1
Client OS: MS Windows XP, Debian Linux Stable,
Web Browser: Mozilla Firefox

-- ScottJohnson - 22 Sep 2004

Answer

You could change the skin to use some SpreadSheetPlugin magic to show a conditionally "Login" or "Edit".

Write this:
%CALC{$IF($EXACT(%WIKINAME%,TWikiGuest),<a href="%SCRIPTURLPATH%/viewauth/%WEB%/%TOPIC%">Login</a>,<a href="%EDITURL%">Edit</a>)}%

To get this:
Login

If you want to make this depend on a Set REQUIRE_LOGIN = on WebPreferences setting you can change the condition to:
$AND($EXACT(%REQUIRE_LOGIN%,on),$EXACT(%WIKINAME%,TWikiGuest))

-- PeterThoeny - 23 Sep 2004

Thank you for your help. I'll see if I can get it to work. I greatly appreciate it.

-- ScottJohnson - 24 Sep 2004

Would it be possible to disable the entire Header and Footer like it is done on the Homepage of TWiki.org, For example even if i am logged in, TWiki.org does not show any Login or Edit etc. Furthermore, would there be a way to put this on a Topic level, so individual Topics can either show or hide these fields depending from Login.

-- WolfgangAlper - 02 Feb 2005

You can set a skin on an individual topic with this setting: (print skin example)

  • Set SKIN = print

Note that this requires TWikiRelease01Sep2004 or later. Also, make sure to Set TOPICOVERRIDESUSER = on in the TWiki.TWikiPreferences.

See example at Sandbox.PerTopicSkinTest

-- PeterThoeny - 03 Feb 2005

You can have a look at the css definitions of the skin you are using. PatternSkin for example has a div named twikiToolBar with the edit attach etc buttons at the top. You can add a style to a topic (perhaps as an included topic):

.twikiToolBar {display:none;} 

inside <style></style> tags. See for example HideToolBarTest.

-- ArthurClemens - 03 Feb 2005

Peter, Arthur - Thank you both very much for your answers. These directions will certainly help to get the customization done.

-- WolfgangAlper - 03 Feb 2005

A new question showed up. Would it be possible to set a skin specific to a group rather than to a user?
I.e.

  • default skin for myweb = customskin
  • skin for members of group AuthorGroup = customskin1
  • skin for members of group PowerGroup = customskin2
  • etc.

P.S. Maybe i should have opened a new topic for this. If you think it makes sense I will certainly do so.

-- WolfgangAlper - 22 Feb 2005

A new question topic is preferred.

-- PeterThoeny - 23 Feb 2005

New topic created: HowToSetSkinSpecificToGroup

-- WolfgangAlper - 23 Feb 2005

Topic revision: r10 - 2005-02-23 - WolfgangAlper
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by PerlIdeas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.