do not show edit tab in the wiki page unless you can edit it

This commit is contained in:
Colin Kuskie 2008-11-24 04:56:32 +00:00
parent f228561aa9
commit 241dcf7e8b
5 changed files with 103 additions and 0 deletions

View file

@ -57,6 +57,7 @@
- fixed #9130: fixed: Rich editor creates root <p> tag even when set to use <br />
- fixed: DataForm times out when exporting large data sets
- fixed: DataForm entry data field is too small
- fixed #4213: Can see "edit" tab even tho i am not logged in
7.6.3
- improved performance of file uploads

View file

@ -0,0 +1,93 @@
#WikiPageTmpl0000000001
#title: Default Wiki Page
#url: default-wiki-page
#menutitle:
#namespace: WikiPage
<tmpl_if session.var.adminOn><p><tmpl_var controls></p></tmpl_if>
<h2><tmpl_var title></h2>
<div id="wikipage" class="yui-navset">
<ul class="yui-nav">
<li class="selected"><a href="#wikipagecontent"><em><tmpl_var viewLabel></em></a></li>
<tmpl_if canEdit><li><a href="#wikipageedit"><em><tmpl_var editLabel></em></a></li></tmpl_if>
</ul>
<div class="yui-content">
<div id="wikipagecontent">
<div><tmpl_var content></div>
<p>^International(keywords,Asset);: <tmpl_loop keywordsLoop><a href="<tmpl_var url>"><tmpl_var
keyword></a> </tmpl_loop></p>
<div class="wikipagecomments"><tmpl_var comments></div>
</div>
<tmpl_if canEdit><div id="wikipageedit"><tmpl_var editContent></div></tmpl_if>
</div>
</div>
<script type="text/javascript">
( function() {
var tabView = new YAHOO.widget.TabView('wikipage');
tabView.on('contentReady', function() {
tabView.addTab(new YAHOO.widget.Tab({
label: '<tmpl_var historyLabel>',
dataSrc: '<tmpl_var historyUrl>',
cacheData: true
}));
});
})();
</script>
<div style="padding: 8px;"><a href="<tmpl_var searchUrl>"><tmpl_var searchLabel></a> | <a href="<tmpl_var
mostPopularUrl>"><tmpl_var mostPopularLabel></a> | <a href="<tmpl_var recentChangesUrl>"><tmpl_var
recentChangesLabel></a> | <a href="<tmpl_var wikiHomeUrl>"><tmpl_var wikiHomeLabel></a></div>
~~~
<link rel="stylesheet" type="text/css" href="^Extras(yui/build/tabview/assets/tabview.css);" />
<script type="text/javascript" src="^Extras(yui/build/yahoo/yahoo-min.js);"></script>
<script type="text/javascript" src="^Extras(yui/build/event/event-min.js);"></script>
<script type="text/javascript" src="^Extras(yui/build/dom/dom-min.js);"></script>
<script type="text/javascript" src="^Extras(yui/build/connection/connection-min.js);"></script>
<script type="text/javascript" src="^Extras(yui/build/element/element-beta-min.js);"></script>
<script type="text/javascript" src="^Extras(yui/build/tabview/tabview-min.js);"></script>
<style type="text/css">
#wikipage.yui-navset .yui-nav li a {
border:1px solid #000; /* label and content borders */
}
#wikipage.yui-navset .yui-content {
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
#wikipage.yui-navset .yui-nav .selected a {
background-color:black; /* active tab, tab hover, and content bgcolor */
color: white;
border-bottom-width:0; /* no bottom border for active tab */
padding-bottom:1px; /* to match height of other tabs */
}
#wikipage.yui-navset-top .yui-nav .selected a {
border-bottom:0; /* no bottom border for active tab */
padding-bottom:1px; /* to match height of other tabs */
}
#wikipage.yui-navset-top .yui-content {
margin-top:-1px; /* for active tab overlap */
}
#wikipage .yui-content {
padding-top:1em;
padding-bottom:1em;
}
#wikipage .loading {
background-image:url(^Extras(yui/examples/tabview/img/loading.gif););
background-position:center center;
background-repeat:no-repeat;
}
#wikipage .loading * {
display:none;
}
</style>

View file

@ -346,6 +346,7 @@ sub view {
editContent => $self->getEditForm,
allowsAttachments => $self->getWiki->get("allowAttachments"),
comments => $self->getFormattedComments(),
canEdit => $self->canEdit,
content => $self->getWiki->autolinkHtml(
$self->scrubContent,
{skipTitles => [$self->get('title')]},

View file

@ -56,6 +56,9 @@ our $HELP = {
{ name => 'editLabel',
description => 'editLabel variable',
},
{ name => 'canEdit',
description => 'canEdit variable',
},
{ name => 'historyLabel',
description => 'historyLabel variable',
},

View file

@ -118,6 +118,11 @@ our $I18N =
lastUpdated => 1166047618,
},
'canEdit variable' => {
message => q|A boolean that indicates whether the current user can edit a page, or not.|,
lastUpdated => 1227501828,
},
'historyLabel variable' => {
message => q|An internationalized label to go with historyUrl.|,
lastUpdated => 1166047618,