Merged from 2.3

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@76270 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-05-06 06:37:45 +00:00
parent 7dd4e4284c
commit 182d1061a9
8 changed files with 60 additions and 9 deletions

View File

@ -820,8 +820,11 @@ JS;
// encode the message to appear in the body of the email
$archiveURL = Director::absoluteBaseURL() . $record->URLSegment . '?archiveDate=' . $record->obj('LastEdited')->URLDatetime();
$archiveEmailMessage = urlencode( $this->customise( array( 'ArchiveDate' => $record->obj('LastEdited'), 'ArchiveURL' => $archiveURL ) )->renderWith( 'ViewArchivedEmail' ) );
// Ensure that source file comments are disabled
SSViewer::set_source_file_comments(false);
$archiveEmailMessage = urlencode( $this->customise( array( 'ArchiveDate' => $record->obj('LastEdited'), 'ArchiveURL' => $archiveURL ) )->renderWith( 'ViewArchivedEmail' ) );
$archiveEmailMessage = preg_replace( '/\+/', '%20', $archiveEmailMessage );
$fields->push( new HiddenField( 'ArchiveEmailMessage', '', $archiveEmailMessage ) );

View File

@ -37,7 +37,7 @@ abstract class ModelAdmin extends LeftAndMain {
*
* @var array|string
*/
protected static $managed_models = null;
public static $managed_models = null;
/**
* More actions are dynamically added in {@link defineMethods()} below.
@ -56,12 +56,12 @@ abstract class ModelAdmin extends LeftAndMain {
/**
* @param string $collection_controller_class Override for controller class
*/
protected static $collection_controller_class = "ModelAdmin_CollectionController";
public static $collection_controller_class = "ModelAdmin_CollectionController";
/**
* @param string $collection_controller_class Override for controller class
*/
protected static $record_controller_class = "ModelAdmin_RecordController";
public static $record_controller_class = "ModelAdmin_RecordController";
/**
* Forward control to the default action handler
@ -88,14 +88,14 @@ abstract class ModelAdmin extends LeftAndMain {
*
* @var array
*/
protected static $model_importers = null;
public static $model_importers = null;
/**
* Amount of results showing on a single page.
*
* @var int
*/
protected static $page_length = 30;
public static $page_length = 30;
/**
* Class name of the form field used for the results list. Overloading this in subclasses
@ -628,6 +628,7 @@ class ModelAdmin_CollectionController extends Controller {
$this->modelClass,
$summaryFields
);
$tf->setCustomQuery($this->getSearchQuery($searchCriteria));
$tf->setPageSize($this->parentController->stat('page_length'));
$tf->setShowPagination(true);

View File

@ -67,7 +67,7 @@ body.ModelAdmin #ResultTable_holder {
}
body.ModelAdmin #right{
overflow:auto;
overflow:auto !important;
}
body.ModelAdmin #right #ModelAdminPanel {

View File

@ -43,7 +43,7 @@ if((typeof tinyMCE != 'undefined')) {
verify_html : true,
use_native_selects : true, // fancy selects are bug as of SS 2.3.0
valid_elements : "+a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],-td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align|style],-span[class|align],-pre[class|align],address[class|align],-h1[id|dir|class|align],-h2[id|dir|class|align],-h3[id|dir|class|align],-h4[id|dir|class|align],-h5[id|dir|class|align],-h6[id|dir|class|align],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir]",
extended_valid_elements : "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value]"
extended_valid_elements : "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]"
});
}

View File

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

View File

@ -11,6 +11,7 @@ class LeftAndMainTest extends FunctionalTest {
// @todo fix controller stack problems and re-activate
//$this->autoFollowRedirection = false;
CMSMenu::populate_menu();
}
/**

27
tests/ModelAdminTest.php Normal file
View File

@ -0,0 +1,27 @@
<?php
class ModelAdminTest extends FunctionalTest {
static $fixture_file = 'cms/tests/ModelAdminTest.yml';
function testModelAdminOpens() {
$this->autoFollowRedirection = false;
$this->logInAs('admin');
$this->assertTrue((bool)Permission::check("ADMIN"));
$this->assertEquals(200, $this->get('ModelAdminTest_Admin')->getStatusCode());
}
}
class ModelAdminTest_Admin extends ModelAdmin {
static $url_segment = 'testadmin';
public static $managed_models = array(
'ModelAdminTest_Contact',
);
}
class ModelAdminTest_Contact extends DataObject {
static $db = array(
"Name" => "Varchar",
"Phone" => "Varchar",
);
}

19
tests/ModelAdminTest.yml Normal file
View File

@ -0,0 +1,19 @@
ModelAdminTest_Contact:
sam:
Name: Sam
Phone: 021 123 456
ingo:
Name: ingo
Phone: 04 987 6543
Member:
admin:
FirstName: admin
Group:
admin:
Title: Admin
Members: =>Member.admin
Permission:
admin:
Code: ADMIN
Group: =>Group.admin