Question
I would like to be able to disable the History feature and back links for topics in a Web for certain users (
TWikiGuest, for example). I realize this may not be a fully-wiki thing to do, but it would cut down on problems in a few ways, such as reducing backup time and space needed, and reducing visibility of exploits and errors after they've been addressed. I'd not want to hide the history from _all_users, only from specific users or groups.
I haven't been able to find much information on controlling the visibility of the History aspect. Is this possible?
Thank you.
Environment
--
JohnDeStefano - 17 Oct 2006
Answer
I have written a new how-to:
I want to remove the History button from the bottom
.
Next you need to figure out how to apply a skin for a certain user: in the user topic, write
(name of your custom skin, see above PatternSkinCustomization topic for instructions)
--
ArthurClemens - 18 Oct 2006
Great; thanks! Two questions based on that updated page:
If I wanted to use the customized template file in conjuntion with a script (such as
PublishContrib), would it suffice to alter only that one file, and then pass the file to the script as a "skin"? For example, if you were to customize "view.myskin.tmpl", which makes calls to the Pattern skin, could you simply say "skin=myskin" to incorporate both your custom changes and the original skin traits?
Also, where in the custom template does a before/after topc text definition ("aftertextcomments") need to be? I stuck it at the end of the file, but my custom text doesn't seem to get picked up. Maybe I just have the syntax wrong, or that template definition must be placed in a certain order in the template?
--
JohnDeStefano - 23 Oct 2006
If you include the original Pattern view template using
%INCLUDETMPL{}%, the original skin traits are preserved.
For a release version of pattern skin you will need a different syntax (the doc update refers to a new version in SVN - sorry for witholding that relevant information):
%TMPL:DEF{"beforetext"}%This is the text before%TMPL:END%
Then try
?cover=myskin
--
ArthurClemens - 23 Oct 2006
My first line in the custom template is:
%TMPL:INCLUDE{"view.pattern"}%
Does that still work? Or should I replace it with
%INCLUDETMPL{}%?
I think the syntax for "aftercontents" is still the same: I have:
%TMPL:DEF{"aftertextcontents"}%text here%TMPL:END%
...which seems to match what you've added above. I've also got a link in my text though... are "a" anchor links okay, or would that break the template?
--
JohnDeStefano - 23 Oct 2006
Use:
%TMPL:INCLUDE{"view.pattern"}%
%TMPL:DEF{"aftertext"}%text here and a link http://twiki.org and a link [[%WEB%.%HOMETOPIC%]] %TMPL:END%
--
ArthurClemens - 23 Oct 2006
Changing aftertextcontents to just aftertext, and changing the link format from
to
[[][]] worked for the preview; thanks for that. But strangely, when I tried to use the template as a publishing skin for
PublishContrib (which works fine with pattern), it published a page full of blank paragraph tags. Maybe it needs to be called out differently than
skin=myskin, or additional template files are needed aside from view.myskin.tmpl ?
--
JohnDeStefano - 24 Oct 2006
While I'm at it... how would you hide the attachments twisties? I can't seem to find the right template to null out in the custom file.
--
JohnDeStefano - 24 Oct 2006
attachtables.pattern.tmpl
--
ArthurClemens - 24 Oct 2006
Then shouldn't this hide the attachments show/hide twisties:
%TMPL:DEF{"attachtables"}%%TMPL:END%
I've tried both that and a TEMP:P definition. I apologize if I'm missing something obvious.
--
JohnDeStefano - 24 Oct 2006
Unfortunately that does not work.
attachtables is not inserted by a view template but read and interpreted by
Attach.pm. So the only option is to duplicate the file to
attachtables.myskin.tmpl and remove the Twisty there.
--
ArthurClemens - 24 Oct 2006
That's not a problem at all; works fine. One more question on your
HowTo, and I'll leave you alone (I hope!): if I want to remove the Personal element of the leftbar, but not the entire left bar... well, I thought this might work and can't figure out why not:
%TMPL:INCLUDE{"leftbar"}%#patternLeftBarPersonal{display:none;}%%TMPL:END%
--
JohnDeStefano - 24 Oct 2006
Your syntax is not legal: you are mixing template syntax and CSS syntax. Either edit WebLeftBarLogin (to remove it entirely, is better), or write the style in
viewleftbar.myskin.tmpl (to hide from view):
%TMPL:DEF{"leftbardimensions"}%
#patternLeftBarPersonal{display:none;}
#patternOuter {
margin-left:12em;
}
#patternLeftBar {
width:12em;
margin-left:-12em;
}%TMPL:END%
--
ArthurClemens - 24 Oct 2006
Hmmm... I wasn't sure where to find the WebLeftBarLogin, so I added the above to a new custom viewleftbar template (actually, just added the patternLeftBarPersonal style declaration just above the existing patternOuter style), and it seems to blow away the entire left bar, instead of just the personal/login section.
--
JohnDeStefano - 24 Oct 2006
WebLeftBarLogin is TWiki.WebLeftBarLogin, or the file
data/TWiki/WebLeftBarLogin.txt.
If you use CSS to hide the element, I would use
.patternLeftBarPersonalContent, otherwise the login link is gone
Write this in
viewleftbar.myskin.tmpl:
%TMPL:INCLUDE{"viewleftbar.pattern"}%
%TMPL:DEF{"leftbardimensions"}%.patternLeftBarPersonalContent{display:none;}
#patternOuter {
margin-left:12em;
}
#patternLeftBar {
width:12em;
margin-left:-12em;
}%TMPL:END%
--
ArthurClemens - 24 Oct 2006
Strange: replacing the current leftbardimensions code with the code above (which, I think, only adds the
PersonalContent style and includes viewleftbar.pattern) still removes the whole left bar!
FWIW, here's why I'm trying to do all this: I need to create a read-only HTML archive of our TWiki. Of course, it would be silly to see the top and bottom wiki buttons on the HTML version (since they either do nothing, or point to a bad link after the HTML transform), and I'd also like to hide the user name and login are (no need for anonymous readers of the HTML version to see that info). I'm trying to create a custom skin that does all this; with you're help, I've been able to get very close. The last issue is the login area, and getting the HTML transform script (
PublishContrib) to recognize the custom skin (on last attempt, it spit out nothing but a bunch of empty para tags).
It sounds like removing data/TWiki/WebLeftBarLogin.txt would certainly accomplish this... but I'd like to leave that in place for users of the actual TWiki.
--
JohnDeStefano - 25 Oct 2006
Here are the literal contents of my custom viewleftbar template file... it seems to ignore the
PersonalContent style (none) completely, as it is displayed in the resulting skin. Maybe you can spot something tht I can't:
# more viewleftbar.anon.tmpl
%{ to include a left bar on a page, just include this template in the page template }%
%TMPL:DEF{"leftbar"}%<div id="patternLeftBar"><div id="patternClearHeaderLeft"></div>
<div id="patternLeftBarContents">
%TMPL:P{"webleftbarindicator"}%
%TMPL:P{"webleftbar"}%</div><!-- /patternLeftBarContents--></div><!-- /patternLeftBar-->%TMPL:END%
%TMPL:DEF{"webleftbarindicator"}%<div class="patternWebIndicator"><b><a href="%SCRIPTURLPATH{"view"}%/%WEB%/%HOMETOPIC%"><nop>%WEB%</a></b></div>%TMPL:END%
%TMPL:DEF{"webleftbar"}%%INCLUDE{"%WEB%.WebLeftBar"}%%TMPL:END%
%TMPL:DEF{"startleftbarwrapper"}%<div id="patternWrapper">%TMPL:END%
%TMPL:INCLUDE{"viewleftbar.pattern"}%
%TMPL:DEF{"leftbardimensions"}%.patternLeftBarPersonalContent{display:none;}
#patternOuter {
margin-left:12em;
}
#patternLeftBar {
width:12em;
margin-left:-12em;
}%TMPL:END%
%TMPL:DEF{"endleftbarwrapper"}%</div><!-- /patternWrapper-->%TMPL:END%
--
JohnDeStefano - 03 Nov 2006
To follow up on my efforts today: I am able to remove the Jump and Search fields from the top header by adding
.patternMetaMenu{display:none;} to the topbardimensions definition in my custom viewtopbar template, but I still cant hide the username/login field from the left bar.
--
JohnDeStefano - 03 Nov 2006
Finally... the definition has to be
patternLeftBarPersonal{display:none;},
not patternLeftBarPersonal*Content*. That does the trick.
Now, if I can ever figure out a way to omit specific (unpublished) Web links from being listed in the Webs leftbar, I'll be all sorted.
Thanks for the leads.
--
JohnDeStefano - 03 Nov 2006