mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
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:
parent
40e3f96ce8
commit
e30f92a2f8
@ -313,9 +313,16 @@ HTML;
|
|||||||
if(!$record->canEdit()) {
|
if(!$record->canEdit()) {
|
||||||
$form->makeReadonly();
|
$form->makeReadonly();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
return $form;
|
$form = new Form(
|
||||||
|
$this,
|
||||||
|
"EditForm",
|
||||||
|
new FieldSet(),
|
||||||
|
new FieldSet()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -395,18 +395,21 @@ JS;
|
|||||||
$readonlyFields = $form->Fields()->makeReadonly();
|
$readonlyFields = $form->Fields()->makeReadonly();
|
||||||
$form->setFields($readonlyFields);
|
$form->setFields($readonlyFields);
|
||||||
}
|
}
|
||||||
|
} elseif ($id == 0) {
|
||||||
return $form;
|
|
||||||
} if ($id == 0) {
|
|
||||||
$siteConfig = SiteConfig::current_site_config();
|
$siteConfig = SiteConfig::current_site_config();
|
||||||
$form = new Form($this, "EditForm", $siteConfig->getFormFields(), $siteConfig->getFormActions());
|
$form = new Form($this, "EditForm", $siteConfig->getFormFields(), $siteConfig->getFormActions());
|
||||||
$form->loadDataFrom($siteConfig);
|
$form->loadDataFrom($siteConfig);
|
||||||
return $form;
|
return $form;
|
||||||
} else if($id) {
|
} else {
|
||||||
return new Form($this, "EditForm", new FieldSet(
|
$form = new Form(
|
||||||
new LabelField('PageDoesntExistLabel',_t('CMSMain.PAGENOTEXISTS',"This page doesn't exist"))), new FieldSet());
|
$this,
|
||||||
|
"EditForm",
|
||||||
|
new FieldSet(),
|
||||||
|
new FieldSet()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,21 +55,28 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
$record = DataObject::get_by_id($this->stat('tree_class'), $id);
|
$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(
|
$form = new Form($this, "EditForm", $fields, $actions);
|
||||||
new FormAction('addmember',_t('SecurityAdmin.ADDMEMBER','Add Member')),
|
$form->loadDataFrom($record);
|
||||||
new FormAction('save',_t('SecurityAdmin.SAVE','Save'))
|
|
||||||
);
|
|
||||||
|
|
||||||
$form = new Form($this, "EditForm", $fields, $actions);
|
if(!$record->canEdit()) {
|
||||||
$form->loadDataFrom($record);
|
$readonlyFields = $form->Fields()->makeReadonly();
|
||||||
|
$form->setFields($readonlyFields);
|
||||||
if(!$record->canEdit()) {
|
}
|
||||||
$readonlyFields = $form->Fields()->makeReadonly();
|
} else {
|
||||||
$form->setFields($readonlyFields);
|
$form = new Form(
|
||||||
|
$this,
|
||||||
|
"EditForm",
|
||||||
|
new FieldSet(),
|
||||||
|
new FieldSet()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
|
@ -1,30 +1,61 @@
|
|||||||
<h2><% _t('FOLDERS','Folders') %></h2>
|
<div id="treepanes">
|
||||||
<div id="treepanes" style="overflow-y: auto;">
|
<h3>
|
||||||
<ul id="TreeActions">
|
<a href="#"><% _t('FOLDERS','Folders') %></a>
|
||||||
<li class="action" id="addpage"><button><% _t('CREATE','Create') %></button></li>
|
</h3>
|
||||||
<li class="action" id="deletepage"><button><% _t('DELETE','Delete') %></button></li>
|
|
||||||
<li class="action" id="filesystemsync">
|
<div>
|
||||||
<button title="<% _t('FILESYSTEMSYNC_DESC', 'SilverStripe maintains its own database of the files & 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.') %>">
|
<div id="TreeActions">
|
||||||
<% _t('FILESYSTEMSYNC','Look for new files') %>
|
|
||||||
</button>
|
<ul>
|
||||||
</li>
|
<li>
|
||||||
</ul>
|
<a href="#TreeActions-create">
|
||||||
<div style="clear:both;"></div>
|
<% _t('CREATE','Create',PR_HIGH) %>
|
||||||
<form class="actionparams" id="addpage_options" style="display: none" action="admin/assets/addfolder">
|
</a>
|
||||||
<div>
|
</li>
|
||||||
<input type="hidden" name="ParentID" />
|
<li>
|
||||||
<input class="action" type="submit" value="<% _t('GO','Go') %>" />
|
<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 & 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>
|
</div>
|
||||||
</form>
|
|
||||||
|
|
||||||
$DeleteItemsForm
|
<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>
|
||||||
|
|
||||||
<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 & drop reordering', PR_HIGH) %></label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
$SiteTreeAsUL
|
<div class="checkboxAboveTree">
|
||||||
|
<input type="checkbox" id="sortitems" />
|
||||||
|
<label for="sortitems">
|
||||||
|
<% _t('ENABLEDRAGGING','Allow drag & drop reordering', PR_HIGH) %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="sitetree_ul">
|
||||||
|
$SiteTreeAsUL
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="#TreeActions-create">
|
<a href="#TreeActions-create" id="addpage">
|
||||||
<% _t('CREATE','Create',PR_HIGH) %>
|
<% _t('CREATE','Create',PR_HIGH) %>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#TreeActions-search">
|
<a href="#TreeActions-search" id="search">
|
||||||
<% _t('SEARCH','Search',PR_HIGH) %>
|
<% _t('SEARCH','Search',PR_HIGH) %>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#TreeActions-batchactions">
|
<a href="#TreeActions-batchactions" id="batchactions">
|
||||||
<% _t('BATCHACTIONS','Batch Actions',PR_HIGH) %>
|
<% _t('BATCHACTIONS','Batch Actions',PR_HIGH) %>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -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>
|
|
@ -1,7 +1,25 @@
|
|||||||
<h2><% _t('COMMENTS', 'Comments') %></h2>
|
|
||||||
|
|
||||||
<div id="treepanes">
|
<div id="treepanes">
|
||||||
|
<h3>
|
||||||
|
<a href="#"><% _t('COMMENTS', 'Comments') %></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
<div id="sitetree_holder">
|
<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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -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>
|
|
@ -2,14 +2,10 @@
|
|||||||
<h1>$ApplicationName</h1>
|
<h1>$ApplicationName</h1>
|
||||||
<p>
|
<p>
|
||||||
<% _t('WELCOMETO','Welcome to') %> $ApplicationName!
|
<% _t('WELCOMETO','Welcome to') %> $ApplicationName!
|
||||||
<% _t('CHOOSEPAGE','Please choose a page from the left.') %>
|
<% _t('CHOOSEPAGE','Please choose an item from the left.') %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<% if EditForm %>
|
|
||||||
$EditForm
|
$EditForm
|
||||||
<% else %>
|
|
||||||
<form id="Form_EditForm" action="admin/EditForm" method="post" enctype="multipart/form-data">
|
|
||||||
</form>
|
|
||||||
<% end_if %>
|
|
||||||
|
|
||||||
<div class="notice-wrap"></div>
|
<div class="notice-wrap"></div>
|
@ -1,30 +1,48 @@
|
|||||||
<h2><% _t('SECGROUPS','Security Groups') %></h2>
|
<div id="treepanes">
|
||||||
|
<h3>
|
||||||
|
<a href="#"><% _t('SECGROUPS','Security Groups') %></a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
<div id="treepanes" style="overflow-y: auto;">
|
<div>
|
||||||
<ul id="TreeActions">
|
<div 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>
|
|
||||||
|
|
||||||
<form class="actionparams" id="deletegroup_options" style="display: none" action="admin/security/deleteitems">
|
<ul>
|
||||||
<p><% _t('SELECT','Select the pages that you want to delete and then click the button below') %></p>
|
<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>
|
||||||
|
|
||||||
<input type="hidden" name="csvIDs" />
|
<div id="TreeActions-create">
|
||||||
<input type="submit" value="<% _t('DELGROUPS','Delete the selected groups') %>" class="action delete" />
|
<form class="actionparams" id="addgroup_options" action="admin/security/addgroup">
|
||||||
</form>
|
<input type="hidden" name="ParentID" />
|
||||||
|
<input class="action" type="submit" value="<% _t('GO','Go') %>" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form class="actionparams" id="sortitems_options" style="display: none" action="">
|
<div id="TreeActions-delete">
|
||||||
<p id="sortitems_message" style="margin: 0"><% _t('TOREORG','To reorganise your site, drag the pages around as desired.') %></p>
|
<form class="actionparams" id="deletegroup_options" style="display: none" action="admin/security/deleteitems">
|
||||||
</form>
|
<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>
|
||||||
|
|
||||||
|
<div class="checkboxAboveTree">
|
||||||
|
<input type="checkbox" id="sortitems" /> <label for="sortitems"><% _t('ENABLEDRAGGING','Allow drag & drop reordering', PR_HIGH) %></label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
$SiteTreeAsUL
|
||||||
|
|
||||||
<div class="checkboxAboveTree">
|
|
||||||
<input type="checkbox" id="sortitems" /> <label for="sortitems"><% _t('ENABLEDRAGGING','Allow drag & drop reordering', PR_HIGH) %></label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
$SiteTreeAsUL
|
|
||||||
</div>
|
</div>
|
@ -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>
|
|
Loading…
Reference in New Issue
Block a user