BUGFIX Moving Requirements for AssetTableField, CommentTableField and MemberTableField from __construct() into FieldHolder() and renderWith(), which means inclusion closer to render time, and less side-effects by a previous Requirements::clear(), e.g. in a CTF popup. See r74919

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@74920 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-04-21 23:36:42 +00:00 committed by Sam Minnee
parent 44fcc58c35
commit 119f821b94
3 changed files with 24 additions and 9 deletions

View File

@ -18,8 +18,6 @@ class AssetTableField extends ComplexTableField {
);
function __construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") {
parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
Requirements::javascript(CMS_DIR . '/javascript/AssetTableField.js');
$SNG_file = singleton('File');
@ -38,9 +36,12 @@ class AssetTableField extends ComplexTableField {
}
function FieldHolder() {
$ret = parent::FieldHolder();
Requirements::javascript(CMS_DIR . '/javascript/AssetTableField.js');
Requirements::javascript('cms/javascript/ImageEditor/Activator.js');
return parent::FieldHolder();
return $ret;
}
function setFolder($folder) {

View File

@ -23,8 +23,14 @@ class CommentTableField extends ComplexTableField {
if(!empty($_REQUEST['CommentSearch'])) {
$this->sourceFilter[] = "( `Name` LIKE '%$search%' OR `Comment` LIKE '%$search%')";
}
}
function FieldHolder() {
$ret = parent::FieldHolder();
Requirements::javascript(CMS_DIR . '/javascript/CommentTableField.js');
return $ret;
}
function Items() {

View File

@ -109,9 +109,6 @@ class MemberTableField extends ComplexTableField {
$this->hidePassword = $hidePassword;
parent::__construct($controller, $name, $sourceClass, $fieldList);
Requirements::javascript(CMS_DIR . '/javascript/MemberTableField.js');
Requirements::javascript(CMS_DIR . "/javascript/MemberTableField_popup.js");
// search
$SQL_search = isset($_REQUEST['MemberSearch']) ? Convert::raw2sql($_REQUEST['MemberSearch']) : null;
@ -133,6 +130,15 @@ class MemberTableField extends ComplexTableField {
$this->setFieldListCsv($csvFieldList);
$this->setPageSize($this->stat('page_size'));
}
function FieldHolder() {
$ret = parent::FieldHolder();
Requirements::javascript(CMS_DIR . '/javascript/MemberTableField.js');
Requirements::javascript(CMS_DIR . "/javascript/MemberTableField_popup.js");
return $ret;
}
function sourceID() {
return ($this->group) ? $this->group->ID : 0;
@ -376,11 +382,13 @@ class MemberTableField extends ComplexTableField {
*/
class MemberTableField_Popup extends ComplexTableField_Popup {
function __construct($controller, $name, $fields, $sourceClass, $readonly=false, $validator = null) {
parent::__construct($controller, $name, $fields, $sourceClass, $readonly, $validator);
function forTemplate() {
$ret = parent::forTemplate();
Requirements::javascript(CMS_DIR . '/javascript/MemberTableField.js');
Requirements::javascript(CMS_DIR . '/javascript/MemberTableField_popup.js');
return $ret;
}
}