diff --git a/core/model/Hierarchy.php b/core/model/Hierarchy.php index b5156f172..2a424e176 100644 --- a/core/model/Hierarchy.php +++ b/core/model/Hierarchy.php @@ -17,6 +17,16 @@ class Hierarchy extends DataObjectDecorator { function augmentWrite(&$manipulation) { } + + function extraDbFields() { + return array( + 'has_many' => array( + 'Children' => 'SiteTree', + 'StageChildren' => 'SiteTree', + 'LiveChildren' => 'SiteTree', + ) + ); + } /** * Returns the children of this DataObject as an XHTML UL. This will be called recursively on each child, diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 5481fc5d9..2539292b3 100644 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -179,6 +179,10 @@ class SiteTree extends DataObject { * @var string */ public static $breadcrumbs_delimiter = " » "; + + static $searchable_fields = array( + 'Title', + ); /** @@ -738,8 +742,11 @@ class SiteTree extends DataObject { /** * Return the title, description, keywords and language metatags. + * + * @todo Make generator tag dynamically determine version number (currently defaults to "2.0") + * @todo Move tag in separate getter for easier customization and more obvious usage + * * @param boolean|string $includeTitle Show default <title>-tag, set to false for custom templating - * * @param boolean $includeTitle Show default <title>-tag, set to false for * custom templating * @return string The XHTML metatags diff --git a/core/model/Versioned.php b/core/model/Versioned.php index 52f0790c8..7559162fc 100755 --- a/core/model/Versioned.php +++ b/core/model/Versioned.php @@ -48,6 +48,14 @@ class Versioned extends DataObjectDecorator { $this->liveStage = array_pop($stages); } + function extraDbFields() { + return array( + 'has_many' => array( + 'Versions' => 'SiteTree', + ) + ); + } + function augmentSQL(SQLQuery &$query) { // Get the content at a specific date if($date = Versioned::$reading_archived_date) { @@ -427,6 +435,10 @@ class Versioned extends DataObjectDecorator { return !$stagesAreEqual; } + function Versions($filter = "") { + return $this->allVersions($filter); + } + /** * Return a list of all the versions available. * @param string $filter diff --git a/forms/Form.php b/forms/Form.php index 3f146ab50..ca48a0dc5 100644 --- a/forms/Form.php +++ b/forms/Form.php @@ -501,7 +501,7 @@ class Form extends RequestHandlingData { */ function FormName() { if($this->htmlID) return $this->htmlID; - else return $this->class . '_' . str_replace('.','',$this->name); + else return $this->class . '_' . str_replace(array('.','/'),'',$this->name); } /** diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index 66c77d664..c4493f75d 100755 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -256,7 +256,7 @@ function HtmlEditorField_dataValue_processImage($parts) { * @package forms * @subpackage fields-formattedinput */ -class HtmlEditorField_Toolbar extends ViewableData { +class HtmlEditorField_Toolbar extends RequestHandlingData { protected $controller, $name; function __construct($controller, $name) { @@ -347,7 +347,7 @@ class HtmlEditorField_Toolbar extends ViewableData { function LinkForm() { $form = new Form( $this->controller, - "{$this->name}.LinkForm", + "{$this->name}/LinkForm", new FieldSet( new LiteralField('Heading', '<h2><img src="cms/images/closeicon.gif" alt="'._t('HtmlEditorField.CLOSE', 'close').'" title="'._t('HtmlEditorField.CLOSE', 'close').'" />'._t('HtmlEditorField.LINK', 'Link').'</h2>'), new OptionsetField("LinkType", _t('HtmlEditorField.LINKTO', "Link to"), @@ -379,7 +379,7 @@ class HtmlEditorField_Toolbar extends ViewableData { function ImageForm() { $form = new Form( $this->controller, - "{$this->name}.ImageForm", + "{$this->name}/ImageForm", new FieldSet( new LiteralField('Heading', '<h2><img src="cms/images/closeicon.gif" alt="'._t('HtmlEditorField.CLOSE', 'close').'" title="'._t('HtmlEditorField.CLOSE', 'close').'" />'._t('HtmlEditorField.IMAGE', 'Image').'</h2>'), new TreeDropdownField("FolderID", _t('HtmlEditorField.FOLDER', "Folder"), "Folder"), @@ -419,7 +419,7 @@ class HtmlEditorField_Toolbar extends ViewableData { function FlashForm() { $form = new Form( $this->controller, - "{$this->name}.FlashForm", + "{$this->name}/FlashForm", new FieldSet( new LiteralField('Heading', '<h2><img src="cms/images/closeicon.gif" alt="'._t('HtmlEditorField.CLOSE', 'close').'" title="'._t('HtmlEditorField.CLOSE', 'close').'" />'._t('HtmlEditorField.FLASH', 'Flash').'</h2>'), new TreeDropdownField("FolderID", _t('HtmlEditorField.FOLDER'), "Folder"), diff --git a/javascript/FieldEditor.js b/javascript/FieldEditor.js index a8c88197b..29cd0e00c 100755 --- a/javascript/FieldEditor.js +++ b/javascript/FieldEditor.js @@ -495,7 +495,7 @@ Behaviour.register( urlForFieldMethod: function(methodName) { - return this.ownerForm().action + '&action_callfieldmethod=1&fieldName=' + 'Fields' + '&ajax=1&methodName=' + methodName + '&NewID=' + this.numNewFields; + return this.ownerForm().action + '/field/Fields/' + methodName + '?NewID=' + this.numNewFields; }, ownerForm: function() { var f = this.parentNode; diff --git a/javascript/TreeSelectorField.js b/javascript/TreeSelectorField.js index f3da5cbc5..3467e79f9 100755 --- a/javascript/TreeSelectorField.js +++ b/javascript/TreeSelectorField.js @@ -36,7 +36,7 @@ TreeDropdownField.prototype = { }, helperURLBase: function() { - return this.ownerForm().action + '&action_callfieldmethod=1&fieldName=' + this.inputTag.name + '&ajax=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''); + return this.ownerForm().action + '/field/' + this.inputTag.name + '/'; }, ownerForm: function() { var f =this.parentNode; @@ -129,7 +129,8 @@ TreeDropdownField.prototype = { }, ajaxGetTree: function(after) { - var ajaxURL = this.helperURLBase() + '&methodName=gettree&forceValues=' + this.inputTag.value; + var ajaxURL = this.helperURLBase() + 'gettree?forceValues=' + this.inputTag.value; + ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''; new Ajax.Request(ajaxURL, { method : 'get', onSuccess : after, @@ -174,7 +175,10 @@ TreeDropdownField.prototype = { var ul = this.treeNodeHolder(); ul.innerHTML = 'loading...'; - new Ajax.Request(this.options.dropdownField.helperURLBase() + '&methodName=getsubtree&SubtreeRootID=' + this.getIdx(), { + var ajaxURL = this.options.dropdownField.helperURLBase() + 'getsubtree?&SubtreeRootID=' + this.getIdx(); + ajaxURL += $('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''; + + new Ajax.Request(ajaxURL, { onSuccess : this.installSubtree.bind(this), onFailure : function(response) { errorMessage('error loading subtree', response); } }); diff --git a/search/SearchContext.php b/search/SearchContext.php index f06745851..bb1778a60 100644 --- a/search/SearchContext.php +++ b/search/SearchContext.php @@ -79,7 +79,7 @@ class SearchContext extends Object { */ protected function applyBaseTableFields() { $classes = ClassInfo::dataClassesFor($this->modelClass); - $fields = array($this->modelClass.'.*'); + $fields = array(ClassInfo::baseDataClass($this->modelClass).'.*'); if($this->modelClass != $classes[0]) $fields[] = $classes[0].'.*'; //$fields = array_keys($model->db()); $fields[] = $classes[0].'.ClassName AS RecordClassName'; @@ -107,14 +107,14 @@ class SearchContext extends Object { $query = $model->buildSQL(); } $query->select = array_merge($query->select,$fields); - + $SQL_limit = Convert::raw2sql($limit); $query->limit($SQL_limit); $SQL_sort = (!empty($sort)) ? Convert::raw2sql($sort) : singleton($this->modelClass)->stat('default_sort'); $query->orderby($SQL_sort); foreach($searchParams as $key => $value) { - if ($value != '0') { + //if ($value != '0') { $key = str_replace('__', '.', $key); $filter = $this->getFilter($key); if ($filter) { @@ -122,7 +122,7 @@ class SearchContext extends Object { $filter->setValue($value); $filter->apply($query); } - } + //} } return $query; diff --git a/tools/CsvBulkLoader.php b/tools/CsvBulkLoader.php index 5d4c17d64..66c0dd64f 100644 --- a/tools/CsvBulkLoader.php +++ b/tools/CsvBulkLoader.php @@ -59,6 +59,7 @@ class CsvBulkLoader extends BulkLoader { $columnMap = array_combine($columnRow, $columnRow); } + $rowIndex = 0; $rowIndex = 0; while (($row = fgetcsv($file, 0, $this->delimiter, $this->enclosure)) !== FALSE) { $rowIndex++;