API CHANGE Returning empty form from getEditForm() method in CMSMain, AssetAdmin, SecurityAdmin to avoid an <% if %> condition in the template. The previous placeholder text is now always stored alongside the form template. This also allows for easier class overloading with different URLs, as the form action is no longer hardcoded in the template placeholder form.

BUGFIX Adjusted AssetAdmin_left.ss, CommentAdmin_left.ss
MINOR Removed CommentAdmin_right.ss, SecurityAdmin_right.ss - inherits a more generic LeftAndMain_right.ss instead
MINOR Merged CommentAdmin_SiteTree.ss template back into CommentAdmin_left.ss

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92705 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 03:15:00 +00:00
parent 40e3f96ce8
commit e30f92a2f8
11 changed files with 165 additions and 124 deletions

View File

@ -313,9 +313,16 @@ HTML;
if(!$record->canEdit()) {
$form->makeReadonly();
}
return $form;
} else {
$form = new Form(
$this,
"EditForm",
new FieldSet(),
new FieldSet()
);
}
return $form;
}
/**

View File

@ -395,18 +395,21 @@ JS;
$readonlyFields = $form->Fields()->makeReadonly();
$form->setFields($readonlyFields);
}
return $form;
} if ($id == 0) {
} elseif ($id == 0) {
$siteConfig = SiteConfig::current_site_config();
$form = new Form($this, "EditForm", $siteConfig->getFormFields(), $siteConfig->getFormActions());
$form->loadDataFrom($siteConfig);
return $form;
} else if($id) {
return new Form($this, "EditForm", new FieldSet(
new LabelField('PageDoesntExistLabel',_t('CMSMain.PAGENOTEXISTS',"This page doesn't exist"))), new FieldSet());
} else {
$form = new Form(
$this,
"EditForm",
new FieldSet(),
new FieldSet()
);
}
return $form;
}

View File

@ -55,21 +55,28 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
$record = DataObject::get_by_id($this->stat('tree_class'), $id);
}
if(!$record) return false;
if($record) {
$fields = $record->getCMSFields();
$fields = $record->getCMSFields();
$actions = new FieldSet(
new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')),
new FormAction('save',_t('SecurityAdmin.SAVE','Save'))
);
$actions = new FieldSet(
new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')),
new FormAction('save',_t('SecurityAdmin.SAVE','Save'))
);
$form = new Form($this, "EditForm", $fields, $actions);
$form->loadDataFrom($record);
$form = new Form($this, "EditForm", $fields, $actions);
$form->loadDataFrom($record);
if(!$record->canEdit()) {
$readonlyFields = $form->Fields()->makeReadonly();
$form->setFields($readonlyFields);
if(!$record->canEdit()) {
$readonlyFields = $form->Fields()->makeReadonly();
$form->setFields($readonlyFields);
}
} else {
$form = new Form(
$this,
"EditForm",
new FieldSet(),
new FieldSet()
);
}
return $form;

View File

@ -1,30 +1,61 @@
<h2><% _t('FOLDERS','Folders') %></h2>
<div id="treepanes" style="overflow-y: auto;">
<ul id="TreeActions">
<li class="action" id="addpage"><button><% _t('CREATE','Create') %></button></li>
<li class="action" id="deletepage"><button><% _t('DELETE','Delete') %></button></li>
<li class="action" id="filesystemsync">
<button title="<% _t('FILESYSTEMSYNC_DESC', 'SilverStripe maintains its own database of the files &amp; images stored in your assets/ folder. Click this button to update that database, if files are added to the assets/ folder from outside SilverStripe, for example, if you have uploaded files via FTP.') %>">
<% _t('FILESYSTEMSYNC','Look for new files') %>
</button>
</li>
</ul>
<div style="clear:both;"></div>
<form class="actionparams" id="addpage_options" style="display: none" action="admin/assets/addfolder">
<div>
<input type="hidden" name="ParentID" />
<input class="action" type="submit" value="<% _t('GO','Go') %>" />
<div id="treepanes">
<h3>
<a href="#"><% _t('FOLDERS','Folders') %></a>
</h3>
<div>
<div id="TreeActions">
<ul>
<li>
<a href="#TreeActions-create">
<% _t('CREATE','Create',PR_HIGH) %>
</a>
</li>
<li>
<a href="#TreeActions-delete">
<% _t('DELETE','Delete',PR_HIGH) %>
</a>
</li>
<li>
<a href="#" title="<% _t('FILESYSTEMSYNC_DESC', 'SilverStripe maintains its own database of the files &amp; images stored in your assets/ folder. Click this button to update that database, if files are added to the assets/ folder from outside SilverStripe, for example, if you have uploaded files via FTP.') %>">
<% _t('FILESYSTEMSYNC','Look for new files') %>
</a>
</li>
</ul>
<div id="TreeActions-create">
<form class="actionparams" id="addpage_options" action="admin/assets/addfolder">
<div>
<input type="hidden" name="ParentID" />
<input class="action" type="submit" value="<% _t('GO','Go') %>" />
</div>
</form>
</div>
</form>
$DeleteItemsForm
<form class="actionparams" id="sortitems_options" style="display: none">
<p id="sortitems_message" style="margin: 0"><% _t('TOREORG','To reorganise your folders, drag them around as desired.') %></p>
</form>
<div class="checkboxAboveTree">
<input type="checkbox" id="sortitems" /> <label for="sortitems"><% _t('ENABLEDRAGGING','Allow drag &amp; drop reordering', PR_HIGH) %></label>
<div id="TreeActions-delete">
<form class="actionparams" id="deletepage_options" style="display: none" action="admin/assets/deletefolder">
<p><% _t('SELECTTODEL','Select the folders that you want to delete and then click the button below') %></p>
<div>
<input type="hidden" name="csvIDs" />
<input type="submit" value="<% _t('DELFOLDERS','Delete the selected folders') %>" class="action delete" />
</div>
</form>
</div>
</div>
$SiteTreeAsUL
<div class="checkboxAboveTree">
<input type="checkbox" id="sortitems" />
<label for="sortitems">
<% _t('ENABLEDRAGGING','Allow drag &amp; drop reordering', PR_HIGH) %>
</label>
</div>
<div id="sitetree_ul">
$SiteTreeAsUL
</div>
</div>
</div>

View File

@ -2,17 +2,17 @@
<ul>
<li>
<a href="#TreeActions-create">
<a href="#TreeActions-create" id="addpage">
<% _t('CREATE','Create',PR_HIGH) %>
</a>
</li>
<li>
<a href="#TreeActions-search">
<a href="#TreeActions-search" id="search">
<% _t('SEARCH','Search',PR_HIGH) %>
</a>
</li>
<li>
<a href="#TreeActions-batchactions">
<a href="#TreeActions-batchactions" id="batchactions">
<% _t('BATCHACTIONS','Batch Actions',PR_HIGH) %>
</a>
</li>

View File

@ -1,15 +0,0 @@
<ul id="sitetree" class="tree unformatted">
<li id="$ID" class="Root"><a><strong><% _t('COMMENTS', 'Comments') %></strong></a>
<ul>
<li id="record-approved" <% if Section=approved %>class="current"<% end_if %>>
<a href="$baseURL/admin/comments/showtable/approved" title="<% _t('CommentAdmin_SiteTree.ss.APPROVED', 'Approved') %>"><% _t('CommentAdmin_SiteTree.ss.APPROVED', 'Approved') %> ($NumModerated)</a>
</li>
<li id="record-unmoderated" <% if Section=unmoderated %>class="current"<% end_if %>>
<a href="$baseURL/admin/comments/showtable/unmoderated" title="<% _t('CommentAdmin_SiteTree.ss.AWAITMODERATION', 'Awaiting Moderation') %>"><% _t('CommentAdmin_SiteTree.ss.AWAITMODERATION', 'Awaiting Moderation') %> ($NumUnmoderated)</a>
</li>
<li id="record-spam">
<a href="$baseURL/admin/comments/showtable/spam" title="<% _t('CommentAdmin_SiteTree.ss.SPAM', 'Spam') %>" <% if Section=spam %>class="current"<% end_if %>><% _t('CommentAdmin_SiteTree.ss.SPAM', 'Spam') %> ($NumSpam)</a>
</li>
</ul>
</li>
</ul>

View File

@ -1,7 +1,25 @@
<h2><% _t('COMMENTS', 'Comments') %></h2>
<div id="treepanes">
<h3>
<a href="#"><% _t('COMMENTS', 'Comments') %></a>
</h3>
<div id="sitetree_holder">
<% include CommentAdmin_SiteTree %>
<ul id="sitetree" class="tree unformatted">
<li id="$ID" class="Root"><a><strong><% _t('COMMENTS', 'Comments') %></strong></a>
<ul>
<li id="record-approved" <% if Section=approved %>class="current"<% end_if %>>
<a href="$baseURL/admin/comments/showtable/approved" title="<% _t('CommentAdmin_SiteTree.ss.APPROVED', 'Approved') %>"><% _t('CommentAdmin_SiteTree.ss.APPROVED', 'Approved') %> ($NumModerated)</a>
</li>
<li id="record-unmoderated" <% if Section=unmoderated %>class="current"<% end_if %>>
<a href="$baseURL/admin/comments/showtable/unmoderated" title="<% _t('CommentAdmin_SiteTree.ss.AWAITMODERATION', 'Awaiting Moderation') %>"><% _t('CommentAdmin_SiteTree.ss.AWAITMODERATION', 'Awaiting Moderation') %> ($NumUnmoderated)</a>
</li>
<li id="record-spam">
<a href="$baseURL/admin/comments/showtable/spam" title="<% _t('CommentAdmin_SiteTree.ss.SPAM', 'Spam') %>" <% if Section=spam %>class="current"<% end_if %>><% _t('CommentAdmin_SiteTree.ss.SPAM', 'Spam') %> ($NumSpam)</a>
</li>
</ul>
</li>
</ul>
</div>
</div>

View File

@ -1,12 +0,0 @@
<div id="form_actions_right" class="ajaxActions">
</div>
<% if EditForm %>
$EditForm
<% else %>
<form id="Form_EditForm" action="admin/comments?executeForm=EditForm" method="post" enctype="multipart/form-data">
<p><% _t('WELCOME1', 'Welcome to the') %> $ApplicationName <% _t('WELCOME2', 'comment management. Please select a folder in the tree on the left.') %></p>
</form>
<% end_if %>
<div class="notice-wrap"></div>

View File

@ -2,14 +2,10 @@
<h1>$ApplicationName</h1>
<p>
<% _t('WELCOMETO','Welcome to') %> $ApplicationName!
<% _t('CHOOSEPAGE','Please choose a page from the left.') %>
<% _t('CHOOSEPAGE','Please choose an item from the left.') %>
</p>
</div>
<% if EditForm %>
$EditForm
<% else %>
<form id="Form_EditForm" action="admin/EditForm" method="post" enctype="multipart/form-data">
</form>
<% end_if %>
$EditForm
<div class="notice-wrap"></div>

View File

@ -1,30 +1,48 @@
<h2><% _t('SECGROUPS','Security Groups') %></h2>
<div id="treepanes" style="overflow-y: auto;">
<ul id="TreeActions">
<li class="action" id="addgroup"><button><% _t('CREATE','Create') %></button></li>
<li class="action" id="deletegroup"><button><% _t('DEL','Delete') %></button></li>
</ul>
<div style="clear:both;"></div>
<form class="actionparams" id="addgroup_options" style="display: none" action="admin/security/addgroup">
<input type="hidden" name="ParentID" />
<input class="action" type="submit" value="<% _t('GO','Go') %>" />
</form>
<div id="treepanes">
<h3>
<a href="#"><% _t('SECGROUPS','Security Groups') %></a>
</h3>
<form class="actionparams" id="deletegroup_options" style="display: none" action="admin/security/deleteitems">
<p><% _t('SELECT','Select the pages that you want to delete and then click the button below') %></p>
<div>
<div id="TreeActions">
<ul>
<li>
<a href="#TreeActions-create">
<% _t('CREATE','Create',PR_HIGH) %>
</a>
</li>
<li>
<a href="#TreeActions-delete">
<% _t('DELETE','Delete',PR_HIGH) %>
</a>
</li>
</ul>
<div id="TreeActions-create">
<form class="actionparams" id="addgroup_options" action="admin/security/addgroup">
<input type="hidden" name="ParentID" />
<input class="action" type="submit" value="<% _t('GO','Go') %>" />
</form>
</div>
<div id="TreeActions-delete">
<form class="actionparams" id="deletegroup_options" style="display: none" action="admin/security/deleteitems">
<p><% _t('SELECT','Select the pages that you want to delete and then click the button below') %></p>
<input type="hidden" name="csvIDs" />
<input type="submit" value="<% _t('DELGROUPS','Delete the selected groups') %>" class="action delete" />
</form>
</div>
</div>
<input type="hidden" name="csvIDs" />
<input type="submit" value="<% _t('DELGROUPS','Delete the selected groups') %>" class="action delete" />
</form>
<form class="actionparams" id="sortitems_options" style="display: none" action="">
<p id="sortitems_message" style="margin: 0"><% _t('TOREORG','To reorganise your site, drag the pages around as desired.') %></p>
</form>
<div class="checkboxAboveTree">
<input type="checkbox" id="sortitems" /> <label for="sortitems"><% _t('ENABLEDRAGGING','Allow drag &amp; drop reordering', PR_HIGH) %></label>
</div>
<div class="checkboxAboveTree">
<input type="checkbox" id="sortitems" /> <label for="sortitems"><% _t('ENABLEDRAGGING','Allow drag &amp; drop reordering', PR_HIGH) %></label>
$SiteTreeAsUL
</div>
$SiteTreeAsUL
</div>

View File

@ -1,12 +0,0 @@
<div id="form_actions_right" class="ajaxActions">
</div>
<% if EditForm %>
$EditForm
<% else %>
<form id="Form_EditForm" action="admin/security?executeForm=EditForm" method="post" enctype="multipart/form-data">
<p><% _t('WELCOME1','Welcome to the',50,'Followed by application name') %> $ApplicationName <% _t('WELCOME2','security admininistration section. Please choose a group from the left.',50) %></p>
</form>
<% end_if %>
<div class="notice-wrap"></div>