(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:
Ingo Schommer 2008-08-10 23:17:51 +00:00
parent 0a4deb5c7f
commit 7ec72c8254
6 changed files with 45 additions and 9 deletions

View File

@ -112,6 +112,20 @@ abstract class ModelAdmin extends LeftAndMain {
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.
*/
@ -363,19 +377,23 @@ class ModelAdmin_CollectionController extends Controller {
* @todo push this HTML structure out into separate template
*/
function search($request) {
$filteredParams = $request->getVars();
unset($filteredParams['ctf']);
$model = singleton($this->modelClass);
$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();
$tf = new TableListField(
$this->modelClass,
$this->modelClass,
$summaryFields
);
$tf->setCustomSourceItems($results);
$tf->setPageSize($length);
$tf->setShowPagination(true);
$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)));
// implemented as a form to enable further actions on the resultset
@ -389,8 +407,16 @@ class ModelAdmin_CollectionController extends Controller {
),
new FieldSet()
);
return $form->forTemplate();
$tf->setExtraLinkParams($filteredParams);
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();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -255,8 +255,9 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
}
public function Link($action = null) {
if(!$action) $action = "index";
return "admin/security/$action/" . $this->currentPageID();
//if(!$action) $action = "index";
//return "admin/security/$action/" . $this->currentPageID();
return "admin/security/$action/";
}
public function listmembers( $baseGroup = null ) {

View File

@ -28,6 +28,10 @@ body.ModelAdmin #SearchForm_holder {
body.ModelAdmin #ResultTable_holder {
overflow:auto;
}
body.ModelAdmin #right{
overflow:auto;
}
body.ModelAdmin #right table.results {

View File

@ -100,6 +100,9 @@ jQuery(document).ready(function() {
data = formData(form);
jQuery.get(form.attr('action'), data, function(result){
jQuery('#right #ModelAdminPanel').html(result);
Behaviour.apply();
jQuery('#right #ModelAdminPanel tbody td a').click(function(){
var el = jQuery(this);
showRecord(el.attr('href'));

View File

@ -143,12 +143,14 @@ TinyMCEImageEnhancement.prototype = {
}
if($('FolderID') != null) {
if($('SecurityID')) var securityid=$('SecurityID').value;
else var securityid=null;
this.upload = new Upload(
{
fileTypes : '*.jpeg;*.jpg;*.jpe;*.png;*.gif;',
fileTypesDescription : 'Image files',
fileUploadLimit : '100',
securityID : $('SecurityID').value,
securityID : securityid,
beginUploadOnQueue : true,
buildUI : this.addListeners.bind(this),
fileQueued : this.uploadFileQueuedCallback.bind(this),

View File

@ -1,5 +1,5 @@
<div id="ModelAdminPanel">
<div id="ModelAdminPanel" style="display: auto">
<% if EditForm %>
$EditForm