• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5500: add css classes to actions that require change permission

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal New   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

That way, a skin can annotate them based on compound css classes..

 
$ svn diff templates/twiki.moveabletype.tmpl templates/viewtopicactionbuttons.tmpl pub/TWiki/MoveableTypeDesign/TWiki.css
Index: templates/twiki.moveabletype.tmpl
===================================================================
--- templates/twiki.moveabletype.tmpl    (revision 158)
+++ templates/twiki.moveabletype.tmpl    (working copy)
@@ -67,7 +67,7 @@
 
 %{ **************************************************************************************************************************************************************************** }%
 %{ ******************************************* }%
-%TMPL:DEF{"bodystart"}%<body class="layout-%TMPL:P{moveabletypecolumns}% %CONTEXT{escape}%">
+%TMPL:DEF{"bodystart"}%<body class="layout-%TMPL:P{moveabletypecolumns}% %CONTEXT{escape}% %IF{"'%BASEWEB%.%BASETOPIC%' allows 'change'" then="hasChangePermission"}%">
    <div id="container">
       <div id="container-inner" class="pkg">%TMPL:END%
 %{ ******************************************* }%
Index: templates/viewtopicactionbuttons.tmpl
===================================================================
--- templates/viewtopicactionbuttons.tmpl    (revision 158)
+++ templates/viewtopicactionbuttons.tmpl    (working copy)
@@ -1,17 +1,17 @@
 %TMPL:DEF{"topicactionbuttons"}%%TMPL:P{"action_activatable_edit_or_create"}%%TMPL:P{"action_activatable_attach"}%%TMPL:P{"action_printable"}%%TMPL:P{"action_revisions"}%%TMPL:P{"action_backlinks_simple"}%%TMPL:P{"action_raw_or_view"}%%TMPL:P{"action_activatable_raw_edit"}%%TMPL:P{"activatable_more"}%%TMPL:END%
 
 
-%TMPL:DEF{"create_topic_link"}%<span><a href='%SCRIPTURL{"edit"}%/%WEB%/%TOPIC%?t=%GMTIME{"$epoch"}%%TMPL:P{"url_param_editaction"}%%IF{"context TinyMCEPluginEnabled" else=";nowysiwyg=1"}%' rel='nofollow' %MAKETEXT{"title='Create new topic' accesskey='c'>&Create"}%</a></span>%TMPL:END%
+%TMPL:DEF{"create_topic_link"}%<span class="requiresChangePermission"><a href='%SCRIPTURL{"edit"}%/%WEB%/%TOPIC%?t=%GMTIME{"$epoch"}%%TMPL:P{"url_param_editaction"}%%IF{"context TinyMCEPluginEnabled" else=";nowysiwyg=1"}%' rel='nofollow' %MAKETEXT{"title='Create new topic' accesskey='c'>&Create"}%</a></span>%TMPL:END%
 
 
-%TMPL:DEF{"edit_topic_link"}%<span><a href='%SCRIPTURL{"edit"}%/%WEB%/%TOPIC%?t=%GMTIME{"$epoch"}%%TMPL:P{"url_param_editaction"}%%IF{"context TinyMCEPluginEnabled" then="" else=";nowysiwyg=1"}%' rel='nofollow' %MAKETEXT{"title='Edit this topic text' accesskey='e'>&Edit"}%</a></span>%TMPL:END%
+%TMPL:DEF{"edit_topic_link"}%<span class="requiresChangePermission"><a href='%SCRIPTURL{"edit"}%/%WEB%/%TOPIC%?t=%GMTIME{"$epoch"}%%TMPL:P{"url_param_editaction"}%%IF{"context TinyMCEPluginEnabled" then="" else=";nowysiwyg=1"}%' rel='nofollow' %MAKETEXT{"title='Edit this topic text' accesskey='e'>&Edit"}%</a></span>%TMPL:END%
 
-%TMPL:DEF{"raw_edit_link"}%<span><a href='%SCRIPTURL{"edit"}%/%WEB%/%TOPIC%?t=%GMTIME{"$epoch"}%;nowysiwyg=1' rel='nofollow' %MAKETEXT{"title='Raw Edit this topic text' accesskey='w'>Ra&w edit"}%</a></span>%TMPL:END%
+%TMPL:DEF{"raw_edit_link"}%<span class="requiresChangePermission"><a href='%SCRIPTURL{"edit"}%/%WEB%/%TOPIC%?t=%GMTIME{"$epoch"}%;nowysiwyg=1' rel='nofollow' %MAKETEXT{"title='Raw Edit this topic text' accesskey='w'>Ra&w edit"}%</a></span>%TMPL:END%
 
 %TMPL:DEF{"view_topic_link"}%<span><a href='%SCRIPTURL{"view"}%/%WEB%/%TOPIC%' rel='nofollow' %MAKETEXT{"title='View topic' accesskey='v'>&View topic"}%</a></span>%TMPL:END%
 
 
-%TMPL:DEF{"attach_link"}%<span><a href='%SCRIPTURLPATH{"attach"}%/%WEB%/%TOPIC%' rel='nofollow' %MAKETEXT{"title='Attach an image or document to this topic' accesskey='a'>&Attach"}%</a></span>%TMPL:END%
+%TMPL:DEF{"attach_link"}%<span class="requiresChangePermission"><a href='%SCRIPTURLPATH{"attach"}%/%WEB%/%TOPIC%' rel='nofollow' %MAKETEXT{"title='Attach an image or document to this topic' accesskey='a'>&Attach"}%</a></span>%TMPL:END%
 
 
 %TMPL:DEF{"more_link"}%<span><a href='%SCRIPTURLPATH{"oops"}%/%WEB%/%TOPIC%?template=oopsmore&param1=%MAXREV%&param2=%CURRREV%' rel='nofollow' %MAKETEXT{"title='Delete or rename this topic; set parent topic; view and compare revisions' accesskey='m'>&More topic actions"}%</a></span>%TMPL:END%
@@ -30,9 +30,9 @@
 %TMPL:DEF{"backlinks_link"}%<span><a href='%SCRIPTURLPATH{"oops"}%/%WEB%/%TOPIC%?template=backlinksweb' rel='nofollow' %MAKETEXT{"title='Search the [_1] Web for topics that link to here' accesskey='b'>&Backlinks" args="<nop>%WEB%"}%</a></span>%TMPL:END%
 
 
-%TMPL:DEF{"history_rdiff_link"}%<span><a href='%SCRIPTURLPATH{"rdiff"}%/%WEB%/%TOPIC%?type=history' rel='nofollow' %MAKETEXT{"title='View total topic history' accesskey='h'>&History"}%</a></span>%TMPL:END%
+%TMPL:DEF{"history_rdiff_link"}%<span class="requiresChangePermission"><a href='%SCRIPTURLPATH{"rdiff"}%/%WEB%/%TOPIC%?type=history' rel='nofollow' %MAKETEXT{"title='View total topic history' accesskey='h'>&History"}%</a></span>%TMPL:END%
 
-%TMPL:DEF{"history_history_link"}%<span><a href='%SCRIPTURLPATH{"oops"}%/%WEB%/%TOPIC%?template=oopshistory' rel='nofollow' %MAKETEXT{"title='View total topic history' accesskey='h'>&History"}%</a></span>%TMPL:END%
+%TMPL:DEF{"history_history_link"}%<span class="requiresChangePermission"><a href='%SCRIPTURLPATH{"oops"}%/%WEB%/%TOPIC%?template=oopshistory' rel='nofollow' %MAKETEXT{"title='View total topic history' accesskey='h'>&History"}%</a></span>%TMPL:END%
 
 
 %TMPL:DEF{"raw_link"}%<span><a href='%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%?raw=on%REVARG%' rel='nofollow' %MAKETEXT{"title='View raw text without formatting' accesskey='r'>&Raw View"}%</a></span>%TMPL:END%
@@ -107,4 +107,4 @@
 
 %TMPL:DEF{"action_revisions"}%%TMPL:P{"revisions"}%%TMPL:P{"sep"}%%TMPL:END%
 
-%TMPL:DEF{"revisions"}%<span>%TMPL:P{context="HistoryPluginEnabled" then="history_history" else="history_rdiff"}%: %TMPL:P{context="CompareRevisionsAddonPluginEnabled" then="revisions_compare" else="revisions_rdiff"}%</span>%TMPL:END%
\ No newline at end of file
+%TMPL:DEF{"revisions"}%<span>%TMPL:P{context="HistoryPluginEnabled" then="history_history" else="history_rdiff"}%: %TMPL:P{context="CompareRevisionsAddonPluginEnabled" then="revisions_compare" else="revisions_rdiff"}%</span>%TMPL:END%
Index: pub/TWiki/MoveableTypeWikiRingNetDesign/TWiki.css
===================================================================
--- pub/TWiki/MoveableTypeDesign/TWiki.css    (revision 158)
+++ pub/TWiki/MoveableTypeDesign/TWiki.css    (working copy)
@@ -1274,6 +1274,14 @@
     display:none;
 }
 
+/*don't show change topic actions if the user is not allowed to CHANGE*/
+.requiresChangePermission {
+    display:none;
+}
+.hasChangePermission .requiresChangePermission {
+    display:inline;
+}
+
 fieldset{
     border-width: 3px 1px;
     border-style: solid;
Index: data/TWiki/WebTopicViewTemplate.txt
===================================================================
--- data/TWiki/WebTopicViewTemplate.txt   (revision 158)
+++ data/TWiki/WebTopicViewTemplate.txt   (working copy)
@@ -23,5 +23,7 @@
 %ICON{arrowbright}% [[%SCRIPTURLPATH{"view"}%/%BASEWEB%/WebSearch?scope=topic;search=%BASETOPIC%][%MAKETEXT{"List more similar topic in this web"}%]] %BR% 
 %ICON{arrowbright}% [[%SCRIPTURLPATH{"view"}%/%BASEWEB%/WebSearch?scope=topic;web=all;search=%BASETOPIC%][%MAKETEXT{"Search similar topics in all public webs"}%]]
 
+<div  class="requiresChangePermission">
 ---+++ %MAKETEXT{"Do you wish to create the topic [_1]?" args="'%BASETOPIC%'"}%
 %ICON{arrowbright}% [[%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%?create=on&newtopic=%BASETOPIC%&template=WebCreateNewTopic&topicparent=%URLPARAM{"topicparent"}%][%MAKETEXT{"Create '[_1]'" args="<nop>%BASETOPIC%"}%]]
+</div>





not sure if this is a 4.2.1 thing - though i'll be using it from now on.

-- TWiki:Main/SvenDowideit - 04 Apr 2008

BTW, this is somewhat related to my using %CONTEXT% to prime my html body's css classes, though I did add the extra IF because there is no 'hasChangePermission' etc context.

Yes, I'm contemplating adding those contexts.

-- TWiki:Main.SvenDowideit - 04 Apr 2008

To align the CSS class name, use prefix twiki: twikiRequiresChangePermission.

-- TWiki:Main.ArthurClemens - 04 Apr 2008

roight you are sir! :} thanks for the pointer.

-- TWiki:Main.SvenDowideit - 05 Apr 2008

ItemTemplate
Summary add css classes to actions that require change permission
ReportedBy TWiki:Main.SvenDowideit
Codebase

SVN Range TWiki-5.0.0, Thu, 03 Apr 2008, build 16612
AppliesTo Engine
Component

Priority Normal
CurrentState New
WaitingFor

Checkins

TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2008-04-05 - SvenDowideit
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback