mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
(merged from branches/roa. use "svn log -c <changeset> -g <module-svn-path>" for detailed commit message)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@60264 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
0a4deb5c7f
commit
7ec72c8254
@ -112,6 +112,20 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
Requirements::javascript('cms/javascript/ModelAdmin.js');
|
Requirements::javascript('cms/javascript/ModelAdmin.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* overwrite the static page_length of the admin panel,
|
||||||
|
* should be called in the project _config file.
|
||||||
|
*/
|
||||||
|
static function set_page_length($length){
|
||||||
|
self::$page_length = $length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the static page_length of the admin, default as 30
|
||||||
|
*/
|
||||||
|
static function get_page_length(){
|
||||||
|
return self::$page_length;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Add mappings for generic form constructors to automatically delegate to a scaffolded form object.
|
* Add mappings for generic form constructors to automatically delegate to a scaffolded form object.
|
||||||
*/
|
*/
|
||||||
@ -363,19 +377,23 @@ class ModelAdmin_CollectionController extends Controller {
|
|||||||
* @todo push this HTML structure out into separate template
|
* @todo push this HTML structure out into separate template
|
||||||
*/
|
*/
|
||||||
function search($request) {
|
function search($request) {
|
||||||
|
$filteredParams = $request->getVars();
|
||||||
|
unset($filteredParams['ctf']);
|
||||||
$model = singleton($this->modelClass);
|
$model = singleton($this->modelClass);
|
||||||
$context = $model->getDefaultSearchContext();
|
$context = $model->getDefaultSearchContext();
|
||||||
$results = $context->getResults($request->getVars(), null, array('start'=>0, 'limit'=>$this->parentController->stat('page_length')));
|
$length = $this->parentController->stat('page_length');
|
||||||
|
$results = $context->getResults($request->getVars());
|
||||||
$summaryFields = $model->summaryFields();
|
$summaryFields = $model->summaryFields();
|
||||||
|
|
||||||
$tf = new TableListField(
|
$tf = new TableListField(
|
||||||
$this->modelClass,
|
$this->modelClass,
|
||||||
$this->modelClass,
|
$this->modelClass,
|
||||||
$summaryFields
|
$summaryFields
|
||||||
);
|
);
|
||||||
$tf->setCustomSourceItems($results);
|
$tf->setCustomSourceItems($results);
|
||||||
|
$tf->setPageSize($length);
|
||||||
|
$tf->setShowPagination(true);
|
||||||
$tf->setPermissions(array('view'));
|
$tf->setPermissions(array('view'));
|
||||||
$url = '<a href=\"' . Director::absoluteBaseURL() . 'admin/crm/' . $this->modelClass . '/$ID/edit\">$value</a>';
|
$url = '<a href=\"' . $this->Link() . '/$ID/edit\">$value</a>';
|
||||||
$tf->setFieldFormatting(array_combine(array_keys($summaryFields), array_fill(0,count($summaryFields), $url)));
|
$tf->setFieldFormatting(array_combine(array_keys($summaryFields), array_fill(0,count($summaryFields), $url)));
|
||||||
|
|
||||||
// implemented as a form to enable further actions on the resultset
|
// implemented as a form to enable further actions on the resultset
|
||||||
@ -389,8 +407,16 @@ class ModelAdmin_CollectionController extends Controller {
|
|||||||
),
|
),
|
||||||
new FieldSet()
|
new FieldSet()
|
||||||
);
|
);
|
||||||
|
$tf->setExtraLinkParams($filteredParams);
|
||||||
return $form->forTemplate();
|
|
||||||
|
if(isset($_POST['paginate']) && $_POST['paginate']==1){
|
||||||
|
$response = $tf->renderWith("TableListField");
|
||||||
|
FormResponse::update_dom_id($tf->id(), $response);
|
||||||
|
FormResponse::set_non_ajax_content($response);
|
||||||
|
return FormResponse::respond();
|
||||||
|
}else{
|
||||||
|
return $form->forTemplate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -255,8 +255,9 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function Link($action = null) {
|
public function Link($action = null) {
|
||||||
if(!$action) $action = "index";
|
//if(!$action) $action = "index";
|
||||||
return "admin/security/$action/" . $this->currentPageID();
|
//return "admin/security/$action/" . $this->currentPageID();
|
||||||
|
return "admin/security/$action/";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listmembers( $baseGroup = null ) {
|
public function listmembers( $baseGroup = null ) {
|
||||||
|
@ -28,6 +28,10 @@ body.ModelAdmin #SearchForm_holder {
|
|||||||
|
|
||||||
body.ModelAdmin #ResultTable_holder {
|
body.ModelAdmin #ResultTable_holder {
|
||||||
overflow:auto;
|
overflow:auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.ModelAdmin #right{
|
||||||
|
overflow:auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.ModelAdmin #right table.results {
|
body.ModelAdmin #right table.results {
|
||||||
|
@ -100,6 +100,9 @@ jQuery(document).ready(function() {
|
|||||||
data = formData(form);
|
data = formData(form);
|
||||||
jQuery.get(form.attr('action'), data, function(result){
|
jQuery.get(form.attr('action'), data, function(result){
|
||||||
jQuery('#right #ModelAdminPanel').html(result);
|
jQuery('#right #ModelAdminPanel').html(result);
|
||||||
|
|
||||||
|
Behaviour.apply();
|
||||||
|
|
||||||
jQuery('#right #ModelAdminPanel tbody td a').click(function(){
|
jQuery('#right #ModelAdminPanel tbody td a').click(function(){
|
||||||
var el = jQuery(this);
|
var el = jQuery(this);
|
||||||
showRecord(el.attr('href'));
|
showRecord(el.attr('href'));
|
||||||
|
@ -143,12 +143,14 @@ TinyMCEImageEnhancement.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($('FolderID') != null) {
|
if($('FolderID') != null) {
|
||||||
|
if($('SecurityID')) var securityid=$('SecurityID').value;
|
||||||
|
else var securityid=null;
|
||||||
this.upload = new Upload(
|
this.upload = new Upload(
|
||||||
{
|
{
|
||||||
fileTypes : '*.jpeg;*.jpg;*.jpe;*.png;*.gif;',
|
fileTypes : '*.jpeg;*.jpg;*.jpe;*.png;*.gif;',
|
||||||
fileTypesDescription : 'Image files',
|
fileTypesDescription : 'Image files',
|
||||||
fileUploadLimit : '100',
|
fileUploadLimit : '100',
|
||||||
securityID : $('SecurityID').value,
|
securityID : securityid,
|
||||||
beginUploadOnQueue : true,
|
beginUploadOnQueue : true,
|
||||||
buildUI : this.addListeners.bind(this),
|
buildUI : this.addListeners.bind(this),
|
||||||
fileQueued : this.uploadFileQueuedCallback.bind(this),
|
fileQueued : this.uploadFileQueuedCallback.bind(this),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
<div id="ModelAdminPanel">
|
<div id="ModelAdminPanel" style="display: auto">
|
||||||
|
|
||||||
<% if EditForm %>
|
<% if EditForm %>
|
||||||
$EditForm
|
$EditForm
|
||||||
|
Loading…
Reference in New Issue
Block a user