From: <de...@de...> - 2006-08-25 19:11:45
|
Author: MichaelDaum Date: 2006-08-25 10:10:07 -0500 (Fri, 25 Aug 2006) New Revision: 11373 Modified: twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/data/TWiki/NatSkinPlugin.txt twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin.pm twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin/DEPENDENCIES twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin/Search.pm Log: Item2816:Item2817: * first release that drops beijing and cairo support * fixed and cleaned up initialisation sequence to detect commandline context properly * removed unused IFACCESS tag * minor rewrite of the email obfuscator * fixed natsearch to properly support web.topic jumps * moved part of the documentation to NatSkin v3.0-pre5 Modified: twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/data/TWiki/NatSkinPlugin.txt =================================================================== --- twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/data/TWiki/NatSkinPlugin.txt 2006-08-25 12:51:00 UTC (rev 11372) +++ twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/data/TWiki/NatSkinPlugin.txt 2006-08-25 15:10:07 UTC (rev 11373) @@ -13,27 +13,12 @@ ---++ Description This is the supplemental plugin for the NatSkin. Its main purpose is to supply -"skin states" to control different styles and variants to be switched -dynamically while you are online. See the below for a full list of all -provided features. +"skin states" to control different styles and variations to be switched +dynamically while you are online. -This plugin tries to be maximal compatible with all past, current and upcoming -TWiki releases, namely Beijing, Cairo and Dakar (aka TWiki-4.x). Therefore some -mechanisms have been internalized that are only available since TWiki-4.0. -The plugin tries to be interface-compatible to all engines using -the =Func.pm= API. In those cases where this is _not_ possible, because needed -functions are not part of the =Func.pm= API, access functions have been added -to address the different implementations and incompatibilities (e.g. access to -topic meta data). In the future a sensible part of that will be moved over to -the TWiki:Plugins/DakarContrib package and be used by the NatSkinPlugin and similar. - The documentation of the NatSkinPlugin only covers the additional tags that have been implemented. Have a look at the NatSkin topic for more information. -This plugin is inspired by the TWiki:Plugins/GnuSkin by -TWiki:Main/JoachimNilsson and the TWiki:Plugins/PhotonSkin by -TWiki:Main/EstebanManchado (<nop>PhotonSearch) renamed to =natsearch= . - ---++ Syntax ---+++ CURREV @@ -50,61 +35,37 @@ *Syntax*: =%<nop>GETSKINSTYLE%= get the current skin style; the priority is - 1 urlparam =style=<name>=, - 2 value of the session variable =NATSKIN_STYLE= and - 3 preference value =SKINSTYLE= set in - (a) the user preferences - (b) the WebPreferences or - (c) %TWIKIWEB%.TWikiPreferences + 1 urlparam =style=<name>=, + 2 value of the session variable =NATSKIN_STYLE= and + 3 preference value =SKINSTYLE= set in + (a) the user preferences + (b) the WebPreferences or + (c) %TWIKIWEB%.TWikiPreferences ----+++ IFACCESS -*Syntax*: -<verbatim> -%IFACCESS{"<topic>" - action="..." - then="..." - else="..." - mode="..." - [then_]args="..." - else_args="..."}% -</verbatim> - -display the =then= or =else= argument depending on the access rights of the current user -to the topic =<topic>=. -=action= can be =view=, =change= or =rename= -specifying the requested access mode; -=mode= can be =text= or =include= where =text= conditionally renders the text in -the =then= and =else= arguments and =text= includes the topic in =then= or =else=; -if =then= is not specified in =include= mode then =<topic>= is included if access -is granted; - -Example: %<nop>IFACCESS{"<nop>AdminSideBar" mode="include"}% includes the -<nop>AdminSideBar if the current user has view access to this topic - ---+++ IFSKINSTATE *Syntax*: =%<nop>IFSKINSTATE{<tests> then="..." else="..."}%= conditionally returns content depending on the current skin state; <tests> can be - * =style="<name>"=: test if the current style is <name> - * =variation="<name>"=: test if the style variation is <name> - * =border="on,off,thin"=: test if the current border is on, off or "thin" - * =buttons="on,off"=: test if the web buttons are currently on or off - * =sidebar="left,right,off"=: - test if the sidebar is currently on the right, left or off - * =searchbox="top,pos1,pos2,pos3,off"=: - test if the searchbox is currently on given position or off - * =release="beijing,cairo,dakar"=: test if the twiki release this plugin is installed on - is Beijing, Cairo or Dakar - * =action="view,edit,preview,..."=: test the current topic action - * =glue="on,off"=: control wether to eat surrounding whitespaces or not - * =final="<name>"=: test if a skin state variable - called <name> is set to be changeable - or not using the the FINALPREFERENCES setting; - known names are are "style", "sidebar", "buttons", "border", "variation" or "searchbox"; - "all" tests wether you can vary the skin at all; "switches" tests of you can change at least one - of "sidebar", "buttons", "border" or "searchbox" + * =style="<name>"=: test if the current style is <name> + * =variation="<name>"=: test if the style variation is <name> + * =border="on,off,thin"=: test if the current border is on, off or "thin" + * =buttons="on,off"=: test if the web buttons are currently on or off + * =sidebar="left,right,off"=: + test if the sidebar is currently on the right, left or off + * =searchbox="top,pos1,pos2,pos3,off"=: + test if the searchbox is currently on given position or off + * =release="beijing,cairo,dakar"=: test if the twiki release this plugin is installed on + is Beijing, Cairo or Dakar + * =action="view,edit,preview,..."=: test the current topic action + * =glue="on,off"=: control wether to eat surrounding whitespaces or not + * =final="<name>"=: test if a skin state variable + called <name> is set to be changeable + or not using the the FINALPREFERENCES setting; + known names are are "style", "sidebar", "buttons", "border", "variation" or "searchbox"; + "all" tests wether you can vary the skin at all; "switches" tests of you can change at least one + of "sidebar", "buttons", "border" or "searchbox" The tag will render the "then" content if all tests evaluate to true and the "else" content otherwise. Tested strings can be regular expressions. @@ -254,10 +215,10 @@ *Syntax*: =%<nop>WEBCOMPONENT{"name"}%= display a web component. A web component "<nop>MyComponent" is searched looking for - 1 <nop>MyComponent in the current web, - 2 <nop>TWikiMyComponent in the %MAINWEB% web, - 3 <nop>TWikiMyComponent in the %TWIKIWEB% web and - 4 <nop>MyComponent in the %TWIKIWEB% web. + 1 <nop>MyComponent in the current web, + 2 <nop>TWikiMyComponent in the %MAINWEB% web, + 3 <nop>TWikiMyComponent in the %TWIKIWEB% web and + 4 <nop>MyComponent in the %TWIKIWEB% web. The WEBCOMPONENT tag will retrieve the component where it was found first. Thereby every web can define a component of its own but if it is @@ -293,242 +254,144 @@ returns "beijing", "cairo" or "dakar" depending on the TWiki engine this plugin is installed on ---++ Plugin Settings -Below are the settings which affect the behavior of the NatSkin. - * Set SHORTDESCRIPTION = Supplements the bare bones NatSkin theme for TWiki + * Set SHORTDESCRIPTION = Supplements the bare bones NatSkin theme for TWiki ----+++ CSS Styles -The NatSkin can be themed using cascading styles attached to the <nop>TWiki.NatSkin or any -other topic defined in the STYLEPATH preference variable. -This variable is a list of topics that are consulted for css attachments. The default value is -<verbatim> - * Set STYLEPATH = TWiki.NatSkin -</verbatim> -Styles are collected in the order specified. This allows to insert style contributions that are -not part of the NatSkin. For example given you uploaded NatSkin css definitions to a topic -<nop>Main.NatSkinThemesContrib you can activate them by setting the STYLEPATH to - -<verbatim> - * Set STYLEPATH = Main.NatSkinThemesContrib, TWiki.NatSkin -</verbatim> - -Css files must obey the following naming scheme to be recognized - * =<name>Style.css=: basic style definitions for style <name> - * =<name>Buttons.css=: <nop>WebButton definitions for style <name> - * =<name>Border.css=: definitions for style <name> displayed using =STYLEBORDER = on= - * =<name>Thin.css=: definitions for style <name> displayed using =STYLEBORDER = thin= - * =<name>Thin.css=: definitions for style <name> displayed using =STYLEBORDER = thin= - * =<name>Variation.css=: style variations that can be applied to any base style; this - can be used to vary a base style, e.g. to add header art or change some fonts and colours - - ----+++ Skin state configuration -The skin state is controlled by a set of variables that are configured on the user's home topic, -the WebPreferences or the [[%TWIKIWEB%.TWikiPreferences]] and are loaded into the current -session of the user. So every setting can be changed by an url parameter to take effect for the -duration of the user's session. The default values are given below - - * switch to the given style, - Base, Clean, <nop>GeorgiaBlue, Gettysburg, Independence, Kubrick, - Pattern, <nop>PlainJane, Rusty, <nop>SeaGreen, Squash or Stormy, - url param is =style= - * Set SKINSTYLE = Clean - * switch to the given style variation (<nop>PlasticLove, Subway, <nop>OrangeTunnel etc) or none, url param is =stylevariation= - * Set STYLEVARIATION = none - * change the border decoration on, off or to thin (enabling a thin blog-like page layout), - url param is =styleborder= - * Set STYLEBORDER = off - * switch on/of the web buttons in the top bar of the page, - url param is =stylebuttons= - * Set STYLEBUTTONS = off - * switch the sidebar to be displayed on the right or left side or off, - url param is =stylesidebar= - * Set STYLESIDEBAR = left - * switch the searchbox to be displayed in the topbar (top), at the top of the sidebar (pos1), in the middle of the sidebar (pos2), at the bottom of the sidebar (pos3) or off, - url param is =stylessearchbox= - * Set STYLESEARCHBOX = top - -There are a couple of special url parameters: - * =togglesidebar=: disable the sidebar for this request only. - * =style=off=: switch off any styles (simulating a non-css browser) - * =style=reset=: switch back to the user and server settings by reverting any - session preferences - * =switchstyle=next/prev=: switch to the next/previous known style - * =switchvariation=next/prev=: switch to the next/previous known style variation - -To emulate the Kubrick style on the old -[[http://binarybonsai.com][BinaryBonsai]] (not the new K2 style) then copy-paste this - -<verbatim> - * Set SKINSTYLE = Kubrick - * Set STYLEBORDER = thin - * Set STYLEBUTTONS = on - * Set STYLESIDEBAR = right - * Set STYLESVARIATION = none - * Set STYLESEARCHBOX = pos1 -</verbatim> - -to your [[%TWIKIWEB%.TWikiPreferences]]. Try out other settings using the NatSkinStyleBrowser, -or even INCLUDE it in your [[%MAINWEB%.%WIKINAME%SideBar]]. - -There are some constraints build into the NatSkin templates that try guarantee a pleasant appearance -when combining the different skin states: - * If the styleborder is "thin" the sidebar will be disabled for the edit, manage, rdiff, - natsearch, changes and search topic actions. - * The web buttons will alternate with the sidebar so that they will not be displayed - on the same side. - * If the web buttons are enabled the default [[TWikiWebSideBar][WebSideBar]] will disable the redundant - navigation to other webs. - ----+++ Email Obfuscation -The standard TWiki engine tries to obfuscate email addresses by adding a phrase to the email url (like NOSPAM) -to fool collecting web crawlers. But that is not adequate enough today as crawlers are aware of that. The solution -to that is to remove every trace of a pattern that could be an email address from the html source code and regenerate -them using javascript. Most likely, web crawlers will only parse the html and don't run a javascript interpreter -beforehand. Nevertheless the obfuscation feature can be switched on and off by adding the =OBFUSCATEEMAIL= variable -to your %TWIKIWEB%.TWikiPreferences like - - * Set OBFUSCATEEMAIL = on - ----+++ <nop>WysiwygPlugin support -When the TWiki:Plugins/WysiwygPlugin is installed on your <nop>%WIKITOOLNAME% installation -the "Edit" topicaction can be enabled to start the Kupu wysiwyg html editor instead of the -normal TWiki textarea by setting the USEWYSIWYG variable to "on" (in your %WIKIUSERNAME% topic, -WebPreferences or %TWIKIWEB%.TWikiPreferences) - - * Set USEWYSIWYG = off - -By default this value is set to "off" - ----++ Plugin Installation Instructions - * [[http://twiki.org/p/pub/Plugins/%TOPIC%/%TOPIC%.zip][Download]] the ZIP file - * Unzip it in your twiki installation directory. Content: - | *File:* | *Description:* | - | ==bin/natlogon== | logon cgi script | - | ==bin/natsearch== | search cgi script | - | ==data/TWiki/%TOPIC%.txt== | plugin topic | - | ==lib/TWiki/Plugins/NatSkinPlugin.pm== | main module | - | ==lib/TWiki/Plugins/NatSkinPlugin/Search.pm== | <nop>NatSearch module | - | ==lib/TWiki/Plugins/NatSkinPlugin/Auth.pm== | authentication module | - * If you are installing this plugin on a TWiki release prior to TWiki-4.0, then - you need the TWiki:Plugins/SessionPlugin too. - * Optionally, run ==%TOPIC%_installer.pl== to automatically check and - install other TWiki modules that this module depends on. You can also do - this step manually. - * Alternatively, manually make sure the dependencies listed in the table - below are resolved. +---++ Installation Instructions + * [[http://twiki.org/p/pub/Plugins/%TOPIC%/%TOPIC%.zip][Download]] the ZIP file + * Unzip it in your twiki installation directory. Content: + | *File:* | *Description:* | + | ==bin/natlogon== | logon cgi script | + | ==bin/natsearch== | search cgi script | + | ==data/TWiki/%TOPIC%.txt== | plugin topic | + | ==lib/TWiki/Plugins/NatSkinPlugin.pm== | main module | + | ==lib/TWiki/Plugins/NatSkinPlugin/Search.pm== | <nop>NatSearch module | + | ==lib/TWiki/Plugins/NatSkinPlugin/Auth.pm== | authentication module | + * If you are installing this plugin on a TWiki release prior to TWiki-4.0, then + you need the TWiki:Plugins/SessionPlugin too. + * Optionally, run ==%TOPIC%_installer.pl== to automatically check and + install other TWiki modules that this module depends on. You can also do + this step manually. + * Alternatively, manually make sure the dependencies listed in the table + below are resolved. %$DEPENDENCIES% - * Optionally install the TWiki:Plugins/RedDotPlugin to ease editing the sidebar navigation - * (Dakar) Visit =configure= in your TWiki installation, and enable the plugin in the {Plugins} section. - * on [[%TWIKIWEB%.TWikiPreferences]] change the SKIN variable to "nat"; - customize the default style adding the variables SKINSTYLE, STYLEBORDER, - STYLEBUTTONS and STYLESIDEBAR (see NatSkin) - * If you are using TWiki version <= 4.0.4 and want TWiki table's appearance to match - the selected style then apply this - [[%PUBURLPATH%/%TWIKIWEB%/NatSkin/TablePlugin_Core_pm.diff][TablePlugin_Core_pm.diff]] patch. - * to enable the NatSkin's logon scheme disable TWiki's <nop>LoginManager - and remove all lines containing "require valid-user" (except for the =configure= cgi script) - from the file =bin/.htaccess= - * make sure that the scripts =natlogon= and =natsearch= are recognized as cgi scripts - in your server configuration - * if you have set up ssl for your server add the following variable to your <nop>TWikiPreferences: - <verbatim> * Set HTTPSLOGON = on </verbatim> - This will prevent passwords being sent in clear-text over a possibly insecure net. - * to enable ssl as soon as you logged in use the following rewrite rules in =bin/.htaccess=: - <verbatim> + * Optionally install the TWiki:Plugins/RedDotPlugin to ease editing the sidebar navigation + * (Dakar) Visit =configure= in your TWiki installation, and enable the plugin in the {Plugins} section. + * on [[%TWIKIWEB%.TWikiPreferences]] change the SKIN variable to "nat"; + customize the default style adding the variables SKINSTYLE, STYLEBORDER, + STYLEBUTTONS and STYLESIDEBAR (see NatSkin) + * If you are using TWiki version <= 4.0.4 and want TWiki table's appearance to match + the selected style then apply this + [[%PUBURLPATH%/%TWIKIWEB%/NatSkin/TablePlugin_Core_pm.diff][TablePlugin_Core_pm.diff]] patch. + * to enable the NatSkin's logon scheme disable TWiki's <nop>LoginManager + and remove all lines containing "require valid-user" (except for the =configure= cgi script) + from the file =bin/.htaccess= + * make sure that the scripts =natlogon= and =natsearch= are recognized as cgi scripts + in your server configuration + * if you have set up ssl for your server add the following variable to your <nop>TWikiPreferences: + <verbatim> * Set HTTPSLOGON = on </verbatim> + This will prevent passwords being sent in clear-text over a possibly insecure net. + * to enable ssl as soon as you logged in use the following rewrite rules in =bin/.htaccess=: + <verbatim> RewriteEngine On RewriteCond %{SERVER_PORT} !443 RewriteCond %{QUERY_STRING} template=oopslogon RewriteRule ^(.*)$ https://%{HTTP_HOST}/bin/$1 [R,L] </verbatim> - Note, that you might need to accommodate the =/bin= url path above to your installation! + Note, that you might need to accommodate the =/bin= url path above to your installation! ---++ Plugin Info | Plugin Author: | TWiki:Main/MichaelDaum | | Copyright ©: | 2003-2006, MichaelDaum@WikiRing.com | | License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | -| Plugin Version: | v3.00-pre4 | +| Plugin Version: | v3.00-pre5 | | Change History: | <!-- versions below in reverse order --> | +| 25 Aug 2006: | first release that drops beijing and cairo support; \ + fixed and cleaned up initialisation sequence to detect commandline context properly; \ + removed unused IFACCESS tag; \ + minor rewrite of the email obfuscator; \ + fixed natsearch to properly support web.topic jumps; \ + moved part of the documentation to NatSkin; \ | 21 Aug 2006: | removed <nop>TablePlugin hack loading plugin preferences into the session store;\ instead provide proper css for twikiTables to match the current style now; \ - this needs !TablePlugin from TWiki > 4.0.4; \ - alternatively use the attached patch to it; \ + this needs !TablePlugin from TWiki > 4.0.4; \ + alternatively use the attached patch to it; \ multiple fixes to email obfuscator; \ - simplified support for localization ; \ - fixed unexpanded MAKETEXT in natsearch | + simplified support for localization ; \ + fixed unexpanded MAKETEXT in natsearch | | 15 Aug 2006: | suport for userinterface internationalization | | 04 Aug 2006: | fixed detection of the cgi action to be more robust on different apache \ configurations (rewrites, aliases);\ - implemented NATWEBLOGO to circumvent different ways of using WEBLOGO, \ - WIKITOOLNAME; \ - added a wrapper for natsearch and natlogon to be called using dakar's \ - =TWiki::UI:run()= mechanism; \ - reintroduced the dependency on the <nop>FilterPlugin which is still \ - used in one place; \ - load email obfuscator javascript only when needed | -| 28 July 2006: | This version drops the dependency on the <nop>FilterPlugin \ - and adds three new dependencies (1) <nop>FlexWebListPlugin, \ - (2) <nop>BreadCrumbsPlugin and (3) <nop>GluePlugin; %BR% \ - added =use strict;= and fixed some minor bugs showing up then; \ - removed NATLOGON, NATLOGOUT tags and replaced it with \ - NATLOGINURL, NATLOGOUTURL for more flexibility; \ - fixed check of USEWYSIWYG preference variable | -| 15 June 2006: | remove double target attribute from external urls | + implemented NATWEBLOGO to circumvent different ways of using WEBLOGO, \ + WIKITOOLNAME; \ + added a wrapper for natsearch and natlogon to be called using dakar's \ + =TWiki::UI:run()= mechanism; \ + reintroduced the dependency on the <nop>FilterPlugin which is still \ + used in one place; \ + load email obfuscator javascript only when needed | +| 28 Jul 2006: | This version drops the dependency on the <nop>FilterPlugin \ + and adds three new dependencies (1) <nop>FlexWebListPlugin, \ + (2) <nop>BreadCrumbsPlugin and (3) <nop>GluePlugin; %BR% \ + added =use strict;= and fixed some minor bugs showing up then; \ + removed NATLOGON, NATLOGOUT tags and replaced it with \ + NATLOGINURL, NATLOGOUTURL for more flexibility; \ + fixed check of USEWYSIWYG preference variable | +| 15 Jun 2006: | remove double target attribute from external urls | | 26 May 2006: | fixed error fetching the number of the last revision | | 24 May 2006: | fixed detection of style files to prevent 403 errors; \ added SETSKINSTATE; \ - added more accesskeys to topic actions; \ - added "nop" class to prevent external link detection| + added more accesskeys to topic actions; \ + added "nop" class to prevent external link detection| | 05 May 2006: | fixed table bgcolor for Independence style; \ display default <nop>WebLinks for non-public webs | | 19 Apr 2006: | use <link rel="stylesheet" ... /> instead of @import url() \ to ease the pain for js wysiwyg editors | | 11 Apr 2006: | added STYLEPATH feature; \ added style=off feature to emulate non-css browser; \ - disable email obfuscation javascript if unused | + disable email obfuscation javascript if unused | | 05 Apr 2006: | added support for dakar's <nop>TemplateLogin; \ changed semantics of NATLOGON, added NATLOGOUT;\ - fixed some grave bugs exposed by the <nop>PublishContrib | + fixed some grave bugs exposed by the <nop>PublishContrib | | 27 Mar 2006: | moved <nop>MySideBar tempaltes to <nop>NatSkin; added docu for HTTPSLOGON | | 20 Mar 2006: | multiple errors in natsearch: \ always first look into the current web, even for a global search; \ - default to local search, was global before, use g: to switch to \ - global search explicitely; \ - GO function searches in all webs; \ - display number of hits; \ - sort hit results in reverse chronological order | + default to local search, was global before, use g: to switch to \ + global search explicitely; \ + GO function searches in all webs; \ + display number of hits; \ + sort hit results in reverse chronological order | | 13 Mar 2006: | dont remove leading and trailing whitespaces from web components | | 11 Mar 2006: | removed MYSIDEBAR tag; \ new web component search path; \ - new sidebar construction logic using <nop>WebLinks; \ - docu restructuring; \ - packaging using <nop>BuildContrib | + new sidebar construction logic using <nop>WebLinks; \ + docu restructuring; \ + packaging using <nop>BuildContrib | | 22 Feb 2006: | removed GROUPSUMMARY, ALLUSERS and registrationHandle \ which where only used on the <nop>NatsWiki installation, moved into \ - a plugin of its own; \ - fixed initPlugin not to return 0, disable the plugin if not used with thet NatSkin \ - on a per handler base | + a plugin of its own; \ + fixed initPlugin not to return 0, disable the plugin if not used with thet NatSkin \ + on a per handler base | | 21 Feb 2006: | externalized the IFDEFINED family into a plugin of its own and \ added a new dependency for it | | 15 Feb 2006: | properly detect scripted mode on Dakar | | 14 Feb 2006: | moved FORMATLIST to TWiki:Plugins/FilterPlugin; \ added dependency on it; \ fixed uninitialized variables with perl-5.8.8; \ - added escape chars to IFDEFINED; \ - don't switch off using an atom skin | + added escape chars to IFDEFINED; \ + don't switch off using an atom skin | | 03 Feb 2006: | added escape chars (percnt, dollar) to IFACCESS to make it more useful;\ fixed detection of a Dakar engine; \ - fixed default REDDOT in the MySideBarTemplate | + fixed default REDDOT in the MySideBarTemplate | | 26 Jan 2006: | docu fixes | | 23 Jan 2006: | fixed natlogn; \ fixed FORMATLIST to expandCommonVariables of the format result | | 09 Jan 2006: | removed local sandbox; added dependency on <nop>DakarContrib; \ - added variable expansion to IFDEFINED; \ - added cleanup code if the <nop>AliasPlugin is not installed; \ - improved natsearch customization; \ - w3c fixes in the <nop>MySideBarTemplate | + added variable expansion to IFDEFINED; \ + added cleanup code if the <nop>AliasPlugin is not installed; \ + improved natsearch customization; \ + w3c fixes in the <nop>MySideBarTemplate | | 06 Dec 2005: | switching off the plugin if the skin is not NatSkin | | 05 Dec 2005: | skin state variables respect FINALPREFERENCES settings; \ added WEBCOMPONENT | @@ -539,8 +402,8 @@ added custom templates for the <nop>BlackListPlugin's error messages | | 10 Nov 2005: | added switchvariation urlparam; \ work arround bug in Dakar (nested calls to getRenderedVersion()); \ - fixed duplicate target/class in external links; \ - improved <nop>MySideBarTemplate using Twisties | + fixed duplicate target/class in external links; \ + improved <nop>MySideBarTemplate using Twisties | | 09 Nov 2005: | fixed wrong call to =expandCommonVariables()= ... doh | | 08 Nov 2005: | fixed use of uninitialized variables; https links to the same site are not external once | | 02 Nov 2005: | added OBFUSCATEEMAIL flag to switch off this feature | @@ -552,11 +415,11 @@ | 20 Oct 2005: | improved external link detection | | 10 Oct 2005: | added switchstyle feature to cycle thru all installed skin styles| | 09 Oct 2005: | rewrite of skin state: support switching border, \ - sidebar, webbuttons and style independently; \ - rewrite of the email obfuscator; \ - improved skin style browser | + sidebar, webbuttons and style independently; \ + rewrite of the email obfuscator; \ + improved skin style browser | | 27 Sep 2005: | added conditional content tags IFSKINSTATE and IFDEFINED; \ - added web button support | + added web button support | | 30 Aug 2005: | added external link detection; fixed IFSKINSTYLE; \ added style support for the TWiki:Plugins/TablePlugin | | 26 Aug 2005: | new NatSkin-2.0 release | @@ -569,5 +432,5 @@ | Appraisal: | TWiki:Plugins/%TOPIC%Appraisal | --- TWiki:Main/MichaelDaum - 21 Aug 2006 +-- TWiki:Main/MichaelDaum - 25 Aug 2006 Modified: twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin/DEPENDENCIES =================================================================== --- twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin/DEPENDENCIES 2006-08-25 12:51:00 UTC (rev 11372) +++ twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin/DEPENDENCIES 2006-08-25 15:10:07 UTC (rev 11373) @@ -1,5 +1,5 @@ TWiki::Plugins::SpreadSheetPlugin,>=1.018,perl,Required. Download and install from TWiki:Plugins/SpreadSheetPlugin -TWiki::Plugins::RedDotPlugin,>=1.25,perl,Recommended; Download from TWiki:Plugins/RedDotPlugin +TWiki::Plugins::RedDotPlugin,>=1.35,perl,Recommended; Download from TWiki:Plugins/RedDotPlugin TWiki::Plugins::FlexWebListPlugin,>=0.07,perl,Required; Download from TWiki:Plugins/FlexWebListPlugin TWiki::Plugins::BreadCrumbsPlugin,>=0.01,perl,Required; Download from TWiki:Plugins/BreadCrumbsPlugin TWiki::Plugins::FilterPlugin,>=0.94,perl,Required; Download from TWiki:Plugins/FilterPlugin Modified: twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin/Search.pm =================================================================== --- twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin/Search.pm 2006-08-25 12:51:00 UTC (rev 11372) +++ twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin/Search.pm 2006-08-25 15:10:07 UTC (rev 11373) @@ -26,6 +26,7 @@ $sandbox $specialCharPattern); use URI::Escape; use TWiki::Plugins::NatSkinPlugin; + $debug = 0; # toggle me $specialCharPattern = qr/([^\\])([\$\@\%\&\#\'\`\/])/o; @@ -116,11 +117,10 @@ # construct the list of webs to search in my @webList = ($theWeb); if ($options =~ /g/) { - @webList = TWiki::Func::getPublicWebList(); + @webList = sort TWiki::Func::getPublicWebList(); @webList = grep (/^$includeWeb$/, @webList) if $includeWeb; @webList = grep (!/^$excludeWeb$/, @webList) if $excludeWeb; @webList = grep (!/^$theWeb$/, @webList); - @webList = sort @webList; unshift @webList, $theWeb; } #writeDebug("webList=" . join(',', @webList)); @@ -136,9 +136,9 @@ # (3.1) try a topic search # (3.2) fallback to content search my ($results, $nrHits); - if ($theSearchString =~ /^[A-Z]/) { + if ($theSearchString =~ /^[A-Z]/) { if ($theSearchString =~ /^(.*)\.(.*?)$/) { # Special web.topic notation - $theWeb = $1; + @webList = ($1); $theSearchString = $2; } Modified: twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin.pm =================================================================== --- twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin.pm 2006-08-25 12:51:00 UTC (rev 11372) +++ twiki/branches/TWikiRelease04x00/twikiplugins/NatSkinPlugin/lib/TWiki/Plugins/NatSkinPlugin.pm 2006-08-25 15:10:07 UTC (rev 11373) @@ -30,13 +30,13 @@ $baseWeb $baseTopic $currentWeb $currentTopic $currentUser $VERSION $RELEASE $debug $isGuest $defaultWikiUserName $isEnabled - $useSpamObfuscator $isBeijing $isDakar $isCairo - $query $urlHost + $useEmailObfuscator $isBeijing $isDakar $isCairo + $query $defaultSkin $defaultVariation $defaultStyleSearchBox $defaultStyle $defaultStyleBorder $defaultStyleSideBar $defaultStyleButtons %maxRevs - $hasInitKnownStyles $hasInitSkinState + $doneInit $doneInitKnownStyles $doneInitSkinState %knownStyles %knownVariations %knownBorders @@ -57,7 +57,7 @@ $ENDWW = qr/$|(?=[\s\,\.\;\:\!\?\)])/m; $VERSION = '$Rev$'; -$RELEASE = '3.00-pre4'; +$RELEASE = '3.00-pre5'; # TODO generalize and reduce the ammount of variables $defaultSkin = 'nat'; @@ -95,7 +95,7 @@ $isCairo = 1; } } - writeDebug("isDakar=$isDakar isBeijing=$isBeijing isCairo=$isCairo"); + #writeDebug("isDakar=$isDakar isBeijing=$isBeijing isCairo=$isCairo"); # check skin my $skin = TWiki::Func::getSkin(); @@ -115,21 +115,30 @@ $isEnabled = 1; } - &doInit(); + $doneInit = 0; + $doneInitKnownStyles = 0; + $doneInitSkinState = 0; + $doneHeader = 0; + $nrEmails = 0; + %emailCollection = (); + %maxRevs = (); - writeDebug("done initPlugin"); + #writeDebug("done initPlugin"); return 1; } ############################################################################### sub doInit { - writeDebug("called doInit"); + return if $doneInit; + $doneInit = 1; + #writeDebug("called doInit"); + $query = &TWiki::Func::getCgiQuery(); + # get skin state from session - $hasInitKnownStyles = 0; - $hasInitSkinState = 0; &initKnownStyles(); + &initSkinState(); $defaultWikiUserName = &TWiki::Func::getDefaultUserName(); $defaultWikiUserName = &TWiki::Func::userToWikiName($defaultWikiUserName, 1); @@ -139,49 +148,41 @@ #writeDebug("defaultWikiUserName=$defaultWikiUserName, wikiUserName=$wikiUserName, isGuest=$isGuest"); my $isScripted; - $query = &TWiki::Func::getCgiQuery(); if ($isDakar) { - $isScripted = &TWiki::Func::getContext()->{'command_line'}; + $isScripted = &TWiki::Func::getContext()->{'command_line'}?1:0; + #writeDebug("isScripted=$isScripted"); } else { $isScripted = defined $query; } - $useSpamObfuscator = &TWiki::Func::getPreferencesFlag('OBFUSCATEEMAIL'); - if ($useSpamObfuscator) { + $useEmailObfuscator = &TWiki::Func::getPreferencesFlag('OBFUSCATEEMAIL'); + if ($useEmailObfuscator) { if ($isScripted || !$query) { # are we in cgi mode? - $useSpamObfuscator = 0; # batch mode, i.e. mailnotification - #writeDebug("no query ... batch mode"); + $useEmailObfuscator = 0; # batch mode, i.e. mailnotification + #writeDebug("no email obfuscation: batch mode"); } else { # disable during register context - my $theAction = getCgiAction(); my $theSkin = $query->param('skin') || TWiki::Func::getSkin(); my $theContentType = $query->param('contenttype'); - if ($theAction =~ /^(register|mailnotif)/ || + if ($skinState{'action'} =~ /^(register|mailnotif)/ || $theSkin =~ /^rss/ || $theContentType) { - $useSpamObfuscator = 0; + $useEmailObfuscator = 0; } - writeDebug("useSpamObfuscator=$useSpamObfuscator"); } } - $nrEmails = 0; - %emailCollection = (); - $doneHeader = 0; - writeDebug("useSpamObfuscator=$useSpamObfuscator"); + #writeDebug("useEmailObfuscator=$useEmailObfuscator"); - $urlHost = &TWiki::Func::getUrlHost(); - %maxRevs = (); - - writeDebug("done doInit"); + #writeDebug("done doInit"); } ############################################################################### sub initKnownStyles { - return if $hasInitKnownStyles; + return if $doneInitKnownStyles; - writeDebug("called initKnownStyles"); - $hasInitKnownStyles = 1; + #writeDebug("called initKnownStyles"); + $doneInitKnownStyles = 1; %knownStyles = (); %knownVariations = (); %knownBorders = (); @@ -228,12 +229,12 @@ ############################################################################### sub initSkinState { - return if $hasInitSkinState; + return if $doneInitSkinState; - $hasInitSkinState = 1; + $doneInitSkinState = 1; %skinState = (); - writeDebug("called initSkinState"); + #writeDebug("called initSkinState"); my $theStyle; my $theStyleBorder; @@ -330,7 +331,6 @@ } # handle style - &initKnownStyles(); my $prefStyle = &TWiki::Func::getPreferencesValue('SKINSTYLE') || $defaultStyle; $prefStyle =~ s/^\s*(.*)\s*$/$1/go; @@ -497,14 +497,6 @@ $skinState{'variation'} = $firstVari if $state == 1; } - # handle release - $skinState{'release'} = lc &getReleaseName(); - - # handle action - if ($query) { # are we in cgi mode? - $skinState{'action'} = getCgiAction(); - } - # store sticky state into session &TWiki::Func::setSessionValue('SKINSTYLE', $skinState{'style'}) if $doStickyStyle; @@ -519,6 +511,10 @@ &TWiki::Func::setSessionValue('STYLESEARCHBOX', $skinState{'searchbox'}) if $doStickySearchBox; + # misc + $skinState{'release'} = lc &getReleaseName(); + $skinState{'action'} = getCgiAction(); + # temporary toggles $theToggleSideBar = 'off' if $theRaw; $theToggleSideBar = 'off' if $skinState{'border'} eq 'thin' && @@ -545,11 +541,8 @@ $currentTopic = $_[1]; $currentWeb = $_[2]; - &initSkinState(); # this might already be too late but there is no - # handler between initPlugin and beforeCommonTagsHandler - # which only matters if you've got a SessionPlugin and the - # TablePlugin installed which most probably is only the - # case on a cairo installation + &doInit(); # delayed init not _possible_ during initPlugin + $_[0] =~ s/%SETSKINSTATE{(.*?)}%/&renderSetSkinStyle($1)/geo; # conditional content @@ -557,7 +550,6 @@ while ($_[0] =~ s/(\s*)%IFSKINSTATETHEN{(?!.*%IFSKINSTATETHEN)(.*?)}%\s*(.*?)\s*%FISKINSTATE%(\s*)/&renderIfSkinStateThen($2, $3, $1, $4)/geos) { # nop } - $_[0] =~ s/%IFACCESS{(.*?)}%/&renderIfAccess($1)/geo;# deprecated $_[0] =~ s/%NATLOGINURL%/&renderLoginUrl()/geo; $_[0] =~ s/%NATLOGOUTURL%/&renderLogoutUrl()/geo; $_[0] =~ s/%WEBLINK%/renderWebLink()/geos; @@ -584,21 +576,21 @@ $_[0] =~ s/%NATMAXREV%/'1.'.&getMaxRevision()/geo; # spam obfuscator - if ($useSpamObfuscator) { + if ($useEmailObfuscator) { $_[0] =~ s/\[\[mailto\:([a-zA-Z0-9\-\_\.\+]+\@[a-zA-Z0-9\-\_\.]+\..+?)(?:\s+|\]\[)(.*?)\]\]/&renderEmailAddrs([$1], $2)/ge; $_[0] =~ s/$STARTWW(?:mailto\:)?([a-zA-Z0-9\-\_\.\+]+\@[a-zA-Z0-9\-\_\.]+\.[a-zA-Z0-9\-\_]+)$ENDWW/&renderEmailAddrs([$1])/ge; } if (!$doneHeader && !$isDakar && $nrEmails) { - my $oldUseSpamObfuscator = $useSpamObfuscator; - $useSpamObfuscator = 0; + my $oldUseEmailObfuscator = $useEmailObfuscator; + $useEmailObfuscator = 0; if($_[0] =~ s/<\/head>/&renderEmailObfuscator() . '<\/head>'/geo) { #writeDebug("wrote email obfuscator"); $doneHeader = 1; # } else { # writeDebug("no email obfuscator code"); } - $useSpamObfuscator = $oldUseSpamObfuscator; + $useEmailObfuscator = $oldUseEmailObfuscator; } $_[0] =~ s/%WEBCOMPONENT{(.*?)}%/&renderWebComponent($1)/geo; } @@ -624,76 +616,14 @@ endRenderingHandler(@_); - if ($useSpamObfuscator && $nrEmails) { - $useSpamObfuscator = 0; + if ($useEmailObfuscator && $nrEmails) { + $useEmailObfuscator = 0; &TWiki::Func::addToHEAD('EMAIL_OBFUSCATOR', &renderEmailObfuscator()); - $useSpamObfuscator = 1; + $useEmailObfuscator = 1; } } ############################################################################### -# deprecated -sub renderIfAccess { - my $args = shift; - - my $theWebTopic = - &TWiki::Func::extractNameValuePair($args) || - &TWiki::Func::extractNameValuePair($args, 'topic') || ''; - - my $theAction = - &TWiki::Func::extractNameValuePair($args, 'action') || 'view'; - - my $theThen = - &TWiki::Func::extractNameValuePair($args, 'then') || $theWebTopic; - - my $theElse = - &TWiki::Func::extractNameValuePair($args, 'else') || ''; - - - my $theMode = - &TWiki::Func::extractNameValuePair($args, 'mode') || ''; - - my $theThenArgs = - &TWiki::Func::extractNameValuePair($args, 'args') || - &TWiki::Func::extractNameValuePair($args, 'then_args') || ''; - - my $theElseArgs = - &TWiki::Func::extractNameValuePair($args, 'else_args') || ''; - - - my $theTopic = $currentTopic; - my $theWeb = $currentWeb; - - if ($theWebTopic =~ /^(.*)\.(.*?)$/) { - $theWeb = $1; - $theTopic = $2; - } elsif ($theWebTopic) { - $theTopic = $theWebTopic; - } - - my $wikiName = &TWiki::Func::getWikiUserName(); - my $hasAccess = &TWiki::Func::checkAccessPermission($theAction, - $wikiName, '', $theTopic, $theWeb); - - if ($theMode eq 'include') { - if ($theThen) { - $theThen = '%INCLUDE{"' . $theThen . '" ' . $theThenArgs . '}%'; - } - if ($theElse) { - $theThen = '%INCLUDE{"' . $theElse . '" ' . $theElseArgs . '}%'; - } - } - - if ($hasAccess) { - &escapeParameter($theThen); - return TWiki::Func::expandCommonVariables($theThen, $currentTopic, $currentWeb); - } else { - &escapeParameter($theElse); - return TWiki::Func::expandCommonVariables($theElse, $currentTopic, $currentWeb); - } -} - -############################################################################### # take the REQUEST_URI, strip off the PATH_INFO from the end, the last word # is the action; this is done that complicated as there may be different # paths for the same action depending on the apache configuration (rewrites, aliases) @@ -1227,11 +1157,11 @@ #writeDebug("called renderEmailAddrs(".join(", ", @$emailAddrs).", $linkText)"); - my $emailKey = '_email'.$nrEmails; + my $emailKey = '_wremoId'.$nrEmails; $nrEmails++; $emailCollection{$emailKey} = [$emailAddrs, $linkText]; - my $text = "<span class=\"natEmail\" id=\"$emailKey\">$emailKey</span>"; + my $text = "<span id=\"$emailKey\">$emailKey</span>"; #writeDebug("result: $text"); return $text; @@ -1243,11 +1173,11 @@ #writeDebug("called renderEmailObfuscator()"); my $text = "\n". + '<script type="text/javascript" src="%PUBURLPATH%/%TWIKIWEB%/NatSkin/obfuscator.js"></script>'."\n". '<script type="text/javascript">'."\n". - '<!--'."\n"; - - $text .= "function initObfuscator() {\n"; - $text .= " var addrs = new Array();\n"; + "<!--\n". + "function initEMO() {\n". + " var emoas = new Array();\n"; foreach my $emailKey (sort keys %emailCollection) { my $emailAddrs = $emailCollection{$emailKey}->[0]; my $linkText = $emailCollection{$emailKey}->[1]; @@ -1257,15 +1187,15 @@ my $theAccount = $1; my $theSubDomain = $2; my $theTopDomain = $3; - $text .= " addrs[$index] = new Array('$theSubDomain','$theAccount','$theTopDomain');\n"; + $text .= " emoas[$index] = new Array('$theSubDomain','$theAccount','$theTopDomain');\n"; $index++ } - $text .= " writeEmailAddrs(addrs, '$linkText', '$emailKey');\n"; - $text .= " delete addrs; addrs = new Array();\n"; + $text .= " wremo(emoas, '$linkText', '$emailKey');\n"; + $text .= " delete emoas; emoas = new Array();\n"; } - $text .= "}\n"; - $text .= "//-->\n</script>\n"; - $text .= '<script type="text/javascript" src="%PUBURLPATH%/%TWIKIWEB%/NatSkin/obfuscator.js"></script>'."\n"; + $text .= "}\n". + "addLoadEvent(initEMO);\n". + "//-->\n</script>\n"; return $text; } @@ -1402,6 +1332,7 @@ my $addClass = 0; my $text = $thePrefix.$theUrl; + my $urlHost = &TWiki::Func::getUrlHost(); my $httpsUrlHost = $urlHost; $httpsUrlHost =~ s/^http:\/\//https:\/\//go; |