elofgren: Replace the 'Reorder...' button with a 'Allow drag & drop reordering' checkbox as per:

http://www.silverstripe.com/google-summer-of-code-forum/flat/1636?showPost=1859#post1859  
(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42078 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-16 15:00:08 +00:00
parent 9fcd82f172
commit b456ca5829
3 changed files with 16 additions and 19 deletions

View File

@ -12,8 +12,7 @@ SiteTreeHandlers.controller_url = 'admin';
var _HANDLER_FORMS = { var _HANDLER_FORMS = {
addpage : 'Form_AddPageOptionsForm', addpage : 'Form_AddPageOptionsForm',
deletepage : 'deletepage_options', deletepage : 'deletepage_options'
sortitems : 'sortitems_options'
}; };
@ -437,24 +436,23 @@ function fixHeight_left() {
SiteTree.applyTo('#sitetree'); SiteTree.applyTo('#sitetree');
/** /**
* Reorganise action * Reorganise action checkbox
*/ */
ReorganiseAction = Class.create(); ReorganiseAction = Class.create();
ReorganiseAction.applyTo('#sortitems'); ReorganiseAction.applyTo('#sortitems');
ReorganiseAction.prototype = { ReorganiseAction.prototype = {
initialize: function () { initialize: function () {
this.getElementsByTagName('button')[0].onclick = returnFalse; this.isDraggable = false;
Observable.applyTo($(_HANDLER_FORMS[this.id]));
}, },
onclick : function() { onclick : function() {
if(treeactions.toggleSelection(this)) { if (this.isDraggable == false) {
$('sitetree').makeDraggable(); $('sitetree').makeDraggable();
this.isDraggable = true;
} else {
$('sitetree').stopBeingDraggable();
this.isDraggable = false;
} }
},
onclose : function() {
$('sitetree').stopBeingDraggable();
} }
} }

View File

@ -133,13 +133,12 @@ $lang['en_US']['CMSMain_left.ss']['DELETE'] = array(
'Delete...', 'Delete...',
PR_HIGH PR_HIGH
); );
$lang['en_US']['CMSMain_left.ss']['REORDER'] = array( $lang['en_US']['CMSMain_left.ss']['ENABLEDRAGGING'] = array(
'Reorder...', 'Allow drag & drop reordering',
PR_HIGH PR_HIGH
); );
$lang['en_US']['CMSMain_left.ss']['SELECTPAGESDEL'] = 'Select the pages that you want to delete and then click the button below'; $lang['en_US']['CMSMain_left.ss']['SELECTPAGESDEL'] = 'Select the pages that you want to delete and then click the button below';
$lang['en_US']['CMSMain_left.ss']['DELETECONFIRM'] = 'Delete the selected pages'; $lang['en_US']['CMSMain_left.ss']['DELETECONFIRM'] = 'Delete the selected pages';
$lang['en_US']['CMSMain_left.ss']['DRAGPAGES'] = 'To reorganise your site, drag the pages around as desired.';
$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']['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:'; $lang['en_US']['CMSMain_left.ss']['KEY'] = 'Key:';
$lang['en_US']['CMSMain_left.ss']['ADDEDNOTPUB'] = 'Added to the draft site and not published yet'; $lang['en_US']['CMSMain_left.ss']['ADDEDNOTPUB'] = 'Added to the draft site and not published yet';

View File

@ -11,7 +11,6 @@
<ul id="TreeActions"> <ul id="TreeActions">
<li class="action" id="addpage"><button><% _t('CREATE','Create...',PR_HIGH); %></button></li> <li class="action" id="addpage"><button><% _t('CREATE','Create...',PR_HIGH); %></button></li>
<li class="action" id="deletepage"><button><% _t('DELETE','Delete...',PR_HIGH); %></button></li> <li class="action" id="deletepage"><button><% _t('DELETE','Delete...',PR_HIGH); %></button></li>
<li class="action" id="sortitems"><button><% _t('REORDER','Reorder...',PR_HIGH); %></button></li>
<!-- <li class="action" id="duplicate"><a href="#">Duplicate</a></li> <!-- <li class="action" id="duplicate"><a href="#">Duplicate</a></li>
Sam: this should be put into the Create area, I think, so we don't stuff up the layout --> Sam: this should be put into the Create area, I think, so we don't stuff up the layout -->
</ul> </ul>
@ -34,6 +33,11 @@
<div> <div>
<input class="action" type="submit" value="Go" /> <input class="action" type="submit" value="Go" />
</div> </div>
<div class="field dropdown nolabel" style="margin-top: 4px;">
<span class="middleColumn">
<input type="checkbox" id="sortitems" /> <label for="sortitems"><% _t('ENABLEDRAGGING','Allow drag &amp; drop reordering', PR_HIGH); %></label>
</span>
</div>
</form> </form>
<% end_control %> <% end_control %>
@ -46,10 +50,6 @@
</div> </div>
</form> </form>
<form class="actionparams" id="sortitems_options" style="display: none">
<p id="sortitems_message" style="margin: 0"><% _t('DRAGPAGES','To reorganise your site, drag the pages around as desired.'); %></p>
</form>
<% control DuplicatePagesOptionsForm %> <% control DuplicatePagesOptionsForm %>
<form class="actionparams" id="duplicate_options" style="display: none" action="admin/duplicateSiteTree"> <form class="actionparams" id="duplicate_options" style="display: none" action="admin/duplicateSiteTree">
<p><% _t('SELECTPAGESDUP','Select the pages that you want to duplicate, whether it\'s children should be included, and where you want the duplicates placed'); %></p> <p><% _t('SELECTPAGESDUP','Select the pages that you want to duplicate, whether it\'s children should be included, and where you want the duplicates placed'); %></p>