elofgren: NEW FEATURE: Add 'Show only changed pages' checkbox above 'Publish the selected pages'

button under 'Bulk Actions'. Note: Pages that have children will always be 
shown in case, their children have been changed. 
Suggested here: http://www.silverstripe.com/silverstripe-development/flat/3799?showPost=4092#post4092 
(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42087 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-16 15:20:02 +00:00
parent a56657fb83
commit 54b428e6d3
3 changed files with 47 additions and 15 deletions

View File

@ -114,21 +114,7 @@ search.prototype = {
},
popupClosed : function() {
$(_HANDLER_FORMS.search).stopObserving(this.o2);
// Reload the site tree if it has been filtered
if ($('SiteTreeIsFiltered').value == 1) {
// Show all items in Site Tree again
new Ajax.Request( 'admin/SiteTreeAsUL' + '&ajax=1', {
onSuccess: function( response ) {
$('sitetree_ul').innerHTML = response.responseText;
Behaviour.apply();
$('SiteTreeIsFiltered').value = 0;
statusMessage('Unfiltered tree','good');
},
onFailure : function(response) {
errorMessage('Could not unfilter site tree<br />' + response.responseText);
}
});
}
batchActionGlobals.unfilterSiteTree();
}
}
@ -174,6 +160,33 @@ batchactions.prototype = {
}
}
/**
* Show only drafts checkbox click action
*/
showonlydrafts = Class.create();
showonlydrafts.applyTo('#publishpage_show_drafts');
showonlydrafts.prototype = {
onclick : function() {
if (0 == $('SiteTreeIsFiltered').value) {
// Show all items in Site Tree again
new Ajax.Request( 'admin/filterSiteTree?Status=Saved&ajax=1', {
onSuccess: function( response ) {
$('sitetree_ul').innerHTML = response.responseText;
Behaviour.apply();
$('SiteTreeIsFiltered').value = 1;
statusMessage('Filtered tree to only show changed pages','good');
},
onFailure : function(response) {
errorMessage('Could not filter tree to only show changed pages<br />' + response.responseText);
}
});
} else {
batchActionGlobals.unfilterSiteTree();
}
}
}
// batchActionGlobals is needed because calls to observeMethod doesn't seem to preserve instance variables so a Prototype can't be used
batchActionGlobals = {
selectedNodes: { },
@ -240,6 +253,23 @@ batchActionGlobals = {
}
}
return csvIDs;
},
unfilterSiteTree : function() {
// Reload the site tree if it has been filtered
if ($('SiteTreeIsFiltered').value == 1) {
// Show all items in Site Tree again
new Ajax.Request( 'admin/SiteTreeAsUL' + '&ajax=1', {
onSuccess: function( response ) {
$('sitetree_ul').innerHTML = response.responseText;
Behaviour.apply();
$('SiteTreeIsFiltered').value = 0;
statusMessage('Unfiltered tree','good');
},
onFailure : function(response) {
errorMessage('Could not unfilter site tree<br />' + response.responseText);
}
});
}
}
}

View File

@ -155,6 +155,7 @@ $lang['en_US']['CMSMain_left.ss']['EDITEDSINCE'] = 'Edited Since';
$lang['en_US']['CMSMain_left.ss']['ADDSEARCHCRITERIA'] = 'Add Criteria...';
$lang['en_US']['CMSMain_left.ss']['SELECTPAGESACTIONS'] = 'Select the pages that you want to change &amp; then click an action:';
$lang['en_US']['CMSMain_left.ss']['DELETECONFIRM'] = 'Delete the selected pages';
$lang['en_US']['CMSMain_left.ss']['SHOWONLYCHANGED'] = 'Show only changed pages';
$lang['en_US']['CMSMain_left.ss']['PUBLISHCONFIRM'] = 'Publish the selected pages';
$lang['en_US']['CMSMain_left.ss']['SELECTPAGESDUP'] = 'Select the pages that you want to duplicate, whether it\'s children should be included, and where you want the duplicates placed';
$lang['en_US']['CMSMain_left.ss']['KEY'] = 'Key:';

View File

@ -73,6 +73,7 @@
<form class="actionparams" style="border:0" id="publishpage_options" action="admin/publishitems">
<div>
<input type="hidden" name="csvIDs" />
<input type="checkbox" id="publishpage_show_drafts" /> <label for="publishpage_show_drafts"><% _t('SHOWONLYCHANGED','Show only changed pages'); %></label>
<input type="submit" id="action_publish_selected" value="<% _t('PUBLISHCONFIRM','Publish the selected pages'); %>" />
</div>
</form>