added restore option to wiki page
This commit is contained in:
parent
1497c991a1
commit
301b815e3a
7 changed files with 120 additions and 3 deletions
|
|
@ -22,10 +22,13 @@
|
|||
- Fixed a bug with RSS feed generation and attachments.
|
||||
- fix: notifications from postings
|
||||
- Refactored the autocommit system to fix the notifications bug above.
|
||||
- fix: Security Update: Cross-Site Scripting Vulnerability
|
||||
- fixed corner case which causes the user profile to not load in cases where
|
||||
custom forms do not work or are broken. It now skips these and throws a
|
||||
warning
|
||||
- fix: Added javascript confirmation for deleting wiki pages.
|
||||
- Made wiki page deletes more visable/useful from recent changes.
|
||||
- fix: Wiki Deleting Pages
|
||||
- fix: Collaboration rss broken (perlDreamer Consulting, LLC)
|
||||
|
||||
|
||||
|
|
|
|||
30
docs/upgrades/templates-7.3.5/wiki-front-page.tmpl
Normal file
30
docs/upgrades/templates-7.3.5/wiki-front-page.tmpl
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#WikiFrontTmpl000000001
|
||||
<tmpl_if session.var.adminOn><p><tmpl_var controls></p></tmpl_if>
|
||||
<tmpl_if displayTitle><h2><tmpl_var title></h2></tmpl_if>
|
||||
|
||||
<tmpl_var description>
|
||||
<h3><tmpl_var searchLabel></h3>
|
||||
<tmpl_var searchFormHeader><tmpl_var searchQuery><tmpl_var searchSubmit><tmpl_var searchFormFooter>
|
||||
<br />
|
||||
|
||||
<div style="float: left; width: 50%;">
|
||||
<h3><a href="<tmpl_var recentChangesUrl>"><tmpl_var recentChangesLabel></a></h3>
|
||||
<ul><tmpl_loop recentChanges>
|
||||
<li>
|
||||
<tmpl_if isAvailable>
|
||||
<a href="<tmpl_var url>"><tmpl_var title></a>
|
||||
<tmpl_else>
|
||||
<tmpl_var title> (<tmpl_var actionTaken>)
|
||||
</tmpl_if>
|
||||
</li>
|
||||
</tmpl_loop></ul>
|
||||
</div>
|
||||
<div style="float: left;">
|
||||
<h3><a href="<tmpl_var mostPopularUrl>"><tmpl_var mostPopularLabel></a></h3>
|
||||
<ol><tmpl_loop mostPopular>
|
||||
<li><a href="<tmpl_var url>"><tmpl_var title></a></li>
|
||||
</tmpl_loop></ol>
|
||||
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
|
||||
19
docs/upgrades/templates-7.3.5/wiki-recent-changes.tmpl
Normal file
19
docs/upgrades/templates-7.3.5/wiki-recent-changes.tmpl
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#WikiRCTmpl000000000001
|
||||
<h2><tmpl_var title></h2>
|
||||
|
||||
<ul><tmpl_loop recentChanges>
|
||||
<li>
|
||||
<tmpl_if isAvailable>
|
||||
<a href="<tmpl_var url>"><tmpl_var title></a> - <tmpl_var actionTaken> on <tmpl_var date> by <tmpl_var username>
|
||||
<tmpl_else>
|
||||
<tmpl_var title> - <tmpl_var actionTaken> on <tmpl_var date> by <tmpl_var username>
|
||||
<tmpl_if canAdminister>
|
||||
( <a href="<tmpl_var restoreUrl>"><tmpl_var restoreLabel></a> )
|
||||
</tmpl_if>
|
||||
</tmpl_if>
|
||||
</li>
|
||||
</tmpl_loop></ul>
|
||||
|
||||
<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 wikiHomeUrl>"><tmpl_var wikiHomeLabel></a></div>
|
||||
|
||||
|
||||
|
|
@ -352,6 +352,16 @@ sub www_getHistory {
|
|||
return $self->processTemplate($var, $self->getWiki->get('pageHistoryTemplateId'));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub www_restoreWikiPage {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient unless $self->getWiki->canAdminister;
|
||||
$self->publish;
|
||||
return $self->www_view;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_showConfirmation ( )
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ sub appendMostPopular {
|
|||
my $limit = shift || $self->get("mostPopularCount");
|
||||
my $rs = $self->session->db->read("select distinct(asset.assetId) from asset left join WikiPage on WikiPage.assetId=asset.assetId
|
||||
where lineage like ? and lineage<>? and revisionDate = (select max(revisionDate) from WikiPage where assetId = asset.assetId)
|
||||
and state='published'
|
||||
order by views desc limit ?", [$self->get("lineage").'%', $self->get("lineage"), $limit]);
|
||||
while (my ($id) = $rs->array) {
|
||||
my $asset = WebGUI::Asset->new($self->session, $id, "WebGUI::Asset::WikiPage");
|
||||
|
|
@ -39,18 +40,31 @@ sub appendMostPopular {
|
|||
sub appendRecentChanges {
|
||||
my $self = shift;
|
||||
my $var = shift;
|
||||
my $limit = shift || $self->get("recentChangesCount");
|
||||
my $limit = shift || $self->get("recentChangesCount") || 50;
|
||||
my $rs = $self->session->db->read("select asset.assetId, revisionDate from assetData left join asset on assetData.assetId=asset.assetId where
|
||||
lineage like ? and lineage<>? order by revisionDate desc limit ?", [$self->get("lineage").'%', $self->get("lineage"), $self->get("recentChangesCount")]);
|
||||
while (my ($id, $version) = $rs->array) {
|
||||
my $asset = WebGUI::Asset->new($self->session, $id, "WebGUI::Asset::WikiPage", $version);
|
||||
my $user = WebGUI::User->new($self->session, $asset->get("actionTakenBy"));
|
||||
my $specialAction = '';
|
||||
my $isAvailable = 1;
|
||||
# no need to i18n cuz the other actions aren't
|
||||
if ($asset->get('state') =~ m/trash/) {
|
||||
$isAvailable = 0;
|
||||
$specialAction = 'Deleted';
|
||||
}
|
||||
elsif ($asset->get('state') =~ m/clipboard/) {
|
||||
$isAvailable = 0;
|
||||
$specialAction = 'Cut';
|
||||
}
|
||||
push(@{$var->{recentChanges}}, {
|
||||
title=>$asset->getTitle,
|
||||
url=>$asset->getUrl,
|
||||
actionTaken=>$asset->get("actionTaken"),
|
||||
restoreUrl=>$asset->getUrl("func=restoreWikiPage"),
|
||||
actionTaken=>$specialAction || $asset->get("actionTaken"),
|
||||
username=>$user->username,
|
||||
date=>$self->session->datetime->epochToHuman($asset->get("revisionDate"))
|
||||
date=>$self->session->datetime->epochToHuman($asset->get("revisionDate")),
|
||||
isAvailable=>$isAvailable,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -342,6 +356,8 @@ sub view {
|
|||
addPageUrl=>$self->getUrl("func=add;class=WebGUI::Asset::WikiPage"),
|
||||
recentChangesUrl=>$self->getUrl("func=recentChanges"),
|
||||
recentChangesLabel=>$i18n->get("recentChangesLabel"),
|
||||
restoreLabel => $i18n->get("restoreLabel"),
|
||||
canAdminister => $self->canAdminister,
|
||||
};
|
||||
my $template = $self->{_frontPageTemplate};
|
||||
$self->appendSearchBoxVars($var);
|
||||
|
|
@ -379,6 +395,8 @@ sub www_recentChanges {
|
|||
searchUrl=>$self->getUrl("func=search"),
|
||||
mostPopularUrl=>$self->getUrl("func=mostPopular"),
|
||||
mostPopularLabel=>$i18n->get("mostPopularLabel"),
|
||||
restoreLabel => $i18n->get("restoreLabel"),
|
||||
canAdminister => $self->canAdminister,
|
||||
wikiHomeUrl=>$self->getUrl,
|
||||
};
|
||||
$self->appendRecentChanges($var);
|
||||
|
|
|
|||
|
|
@ -163,8 +163,24 @@ our $HELP = {
|
|||
'name' => 'date',
|
||||
'description' => 'recent changes date',
|
||||
},
|
||||
{
|
||||
'name' => 'restoreUrl',
|
||||
'description' => 'recent changes restore url',
|
||||
},
|
||||
{
|
||||
'name' => 'isAvailable',
|
||||
'description' => 'recent changes is available',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name=>'canAdminister',
|
||||
description => 'canAdminister'
|
||||
},
|
||||
{
|
||||
name=>'retoreLabel',
|
||||
description => 'restoreLabel'
|
||||
},
|
||||
],
|
||||
fields => [
|
||||
],
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ our $I18N = {
|
|||
addPageLabel=>{message=>q|Add a new page.|, lastUpdated=>0},
|
||||
wikiHomeLabel=>{message=>q|Wiki Home|, lastUpdated=>0},
|
||||
|
||||
'restoreLabel' => {
|
||||
message => q|Restore|,
|
||||
lastUpdated => 0,
|
||||
context => q|label to restore the page back from the trash or clipboard|,
|
||||
},
|
||||
|
||||
'filter code' => {
|
||||
message => q|Filter Code|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -277,11 +283,26 @@ our $I18N = {
|
|||
lastUpdated => 1165790228,
|
||||
},
|
||||
|
||||
'canAdminister' => {
|
||||
message => q|A boolean indicating whether the current user can administer the wiki.|,
|
||||
lastUpdated => 1165790228,
|
||||
},
|
||||
|
||||
'recent changes title' => {
|
||||
message => q|The title of the recently changed page.|,
|
||||
lastUpdated => 1165790228,
|
||||
},
|
||||
|
||||
'recent changes restore url' => {
|
||||
message => q|The url to restore this page back to viewing status from the clipboard/trash.|,
|
||||
lastUpdated => 1165790228,
|
||||
},
|
||||
|
||||
'recent changes is page available' => {
|
||||
message => q|A boolean indicating whether the page is available for viewing or in the trash/clipboard.|,
|
||||
lastUpdated => 1165790228,
|
||||
},
|
||||
|
||||
'recent changes url' => {
|
||||
message => q|The url of the recently changed page.|,
|
||||
lastUpdated => 1165790228,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue