mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +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/sapphire/trunk@60266 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8d0166e298
commit
935ee6d1bc
@ -17,6 +17,16 @@ class Hierarchy extends DataObjectDecorator {
|
|||||||
|
|
||||||
function augmentWrite(&$manipulation) {
|
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,
|
* Returns the children of this DataObject as an XHTML UL. This will be called recursively on each child,
|
||||||
|
@ -179,6 +179,10 @@ class SiteTree extends DataObject {
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public static $breadcrumbs_delimiter = " » ";
|
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.
|
* Return the title, description, keywords and language metatags.
|
||||||
|
*
|
||||||
|
* @todo Make generator tag dynamically determine version number (currently defaults to "2.0")
|
||||||
|
* @todo Move <title> 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|string $includeTitle Show default <title>-tag, set to false for custom templating
|
||||||
*
|
|
||||||
* @param boolean $includeTitle Show default <title>-tag, set to false for
|
* @param boolean $includeTitle Show default <title>-tag, set to false for
|
||||||
* custom templating
|
* custom templating
|
||||||
* @return string The XHTML metatags
|
* @return string The XHTML metatags
|
||||||
|
@ -48,6 +48,14 @@ class Versioned extends DataObjectDecorator {
|
|||||||
$this->liveStage = array_pop($stages);
|
$this->liveStage = array_pop($stages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function extraDbFields() {
|
||||||
|
return array(
|
||||||
|
'has_many' => array(
|
||||||
|
'Versions' => 'SiteTree',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function augmentSQL(SQLQuery &$query) {
|
function augmentSQL(SQLQuery &$query) {
|
||||||
// Get the content at a specific date
|
// Get the content at a specific date
|
||||||
if($date = Versioned::$reading_archived_date) {
|
if($date = Versioned::$reading_archived_date) {
|
||||||
@ -427,6 +435,10 @@ class Versioned extends DataObjectDecorator {
|
|||||||
return !$stagesAreEqual;
|
return !$stagesAreEqual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Versions($filter = "") {
|
||||||
|
return $this->allVersions($filter);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of all the versions available.
|
* Return a list of all the versions available.
|
||||||
* @param string $filter
|
* @param string $filter
|
||||||
|
@ -501,7 +501,7 @@ class Form extends RequestHandlingData {
|
|||||||
*/
|
*/
|
||||||
function FormName() {
|
function FormName() {
|
||||||
if($this->htmlID) return $this->htmlID;
|
if($this->htmlID) return $this->htmlID;
|
||||||
else return $this->class . '_' . str_replace('.','',$this->name);
|
else return $this->class . '_' . str_replace(array('.','/'),'',$this->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -256,7 +256,7 @@ function HtmlEditorField_dataValue_processImage($parts) {
|
|||||||
* @package forms
|
* @package forms
|
||||||
* @subpackage fields-formattedinput
|
* @subpackage fields-formattedinput
|
||||||
*/
|
*/
|
||||||
class HtmlEditorField_Toolbar extends ViewableData {
|
class HtmlEditorField_Toolbar extends RequestHandlingData {
|
||||||
protected $controller, $name;
|
protected $controller, $name;
|
||||||
|
|
||||||
function __construct($controller, $name) {
|
function __construct($controller, $name) {
|
||||||
@ -347,7 +347,7 @@ class HtmlEditorField_Toolbar extends ViewableData {
|
|||||||
function LinkForm() {
|
function LinkForm() {
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
$this->controller,
|
$this->controller,
|
||||||
"{$this->name}.LinkForm",
|
"{$this->name}/LinkForm",
|
||||||
new FieldSet(
|
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 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"),
|
new OptionsetField("LinkType", _t('HtmlEditorField.LINKTO', "Link to"),
|
||||||
@ -379,7 +379,7 @@ class HtmlEditorField_Toolbar extends ViewableData {
|
|||||||
function ImageForm() {
|
function ImageForm() {
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
$this->controller,
|
$this->controller,
|
||||||
"{$this->name}.ImageForm",
|
"{$this->name}/ImageForm",
|
||||||
new FieldSet(
|
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 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"),
|
new TreeDropdownField("FolderID", _t('HtmlEditorField.FOLDER', "Folder"), "Folder"),
|
||||||
@ -419,7 +419,7 @@ class HtmlEditorField_Toolbar extends ViewableData {
|
|||||||
function FlashForm() {
|
function FlashForm() {
|
||||||
$form = new Form(
|
$form = new Form(
|
||||||
$this->controller,
|
$this->controller,
|
||||||
"{$this->name}.FlashForm",
|
"{$this->name}/FlashForm",
|
||||||
new FieldSet(
|
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 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"),
|
new TreeDropdownField("FolderID", _t('HtmlEditorField.FOLDER'), "Folder"),
|
||||||
|
@ -495,7 +495,7 @@ Behaviour.register(
|
|||||||
|
|
||||||
|
|
||||||
urlForFieldMethod: function(methodName) {
|
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() {
|
ownerForm: function() {
|
||||||
var f = this.parentNode;
|
var f = this.parentNode;
|
||||||
|
@ -36,7 +36,7 @@ TreeDropdownField.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
helperURLBase: function() {
|
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() {
|
ownerForm: function() {
|
||||||
var f =this.parentNode;
|
var f =this.parentNode;
|
||||||
@ -129,7 +129,8 @@ TreeDropdownField.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
ajaxGetTree: function(after) {
|
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, {
|
new Ajax.Request(ajaxURL, {
|
||||||
method : 'get',
|
method : 'get',
|
||||||
onSuccess : after,
|
onSuccess : after,
|
||||||
@ -174,7 +175,10 @@ TreeDropdownField.prototype = {
|
|||||||
var ul = this.treeNodeHolder();
|
var ul = this.treeNodeHolder();
|
||||||
ul.innerHTML = 'loading...';
|
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),
|
onSuccess : this.installSubtree.bind(this),
|
||||||
onFailure : function(response) { errorMessage('error loading subtree', response); }
|
onFailure : function(response) { errorMessage('error loading subtree', response); }
|
||||||
});
|
});
|
||||||
|
@ -79,7 +79,7 @@ class SearchContext extends Object {
|
|||||||
*/
|
*/
|
||||||
protected function applyBaseTableFields() {
|
protected function applyBaseTableFields() {
|
||||||
$classes = ClassInfo::dataClassesFor($this->modelClass);
|
$classes = ClassInfo::dataClassesFor($this->modelClass);
|
||||||
$fields = array($this->modelClass.'.*');
|
$fields = array(ClassInfo::baseDataClass($this->modelClass).'.*');
|
||||||
if($this->modelClass != $classes[0]) $fields[] = $classes[0].'.*';
|
if($this->modelClass != $classes[0]) $fields[] = $classes[0].'.*';
|
||||||
//$fields = array_keys($model->db());
|
//$fields = array_keys($model->db());
|
||||||
$fields[] = $classes[0].'.ClassName AS RecordClassName';
|
$fields[] = $classes[0].'.ClassName AS RecordClassName';
|
||||||
@ -107,14 +107,14 @@ class SearchContext extends Object {
|
|||||||
$query = $model->buildSQL();
|
$query = $model->buildSQL();
|
||||||
}
|
}
|
||||||
$query->select = array_merge($query->select,$fields);
|
$query->select = array_merge($query->select,$fields);
|
||||||
|
|
||||||
$SQL_limit = Convert::raw2sql($limit);
|
$SQL_limit = Convert::raw2sql($limit);
|
||||||
$query->limit($SQL_limit);
|
$query->limit($SQL_limit);
|
||||||
|
|
||||||
$SQL_sort = (!empty($sort)) ? Convert::raw2sql($sort) : singleton($this->modelClass)->stat('default_sort');
|
$SQL_sort = (!empty($sort)) ? Convert::raw2sql($sort) : singleton($this->modelClass)->stat('default_sort');
|
||||||
$query->orderby($SQL_sort);
|
$query->orderby($SQL_sort);
|
||||||
foreach($searchParams as $key => $value) {
|
foreach($searchParams as $key => $value) {
|
||||||
if ($value != '0') {
|
//if ($value != '0') {
|
||||||
$key = str_replace('__', '.', $key);
|
$key = str_replace('__', '.', $key);
|
||||||
$filter = $this->getFilter($key);
|
$filter = $this->getFilter($key);
|
||||||
if ($filter) {
|
if ($filter) {
|
||||||
@ -122,7 +122,7 @@ class SearchContext extends Object {
|
|||||||
$filter->setValue($value);
|
$filter->setValue($value);
|
||||||
$filter->apply($query);
|
$filter->apply($query);
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
|
@ -59,6 +59,7 @@ class CsvBulkLoader extends BulkLoader {
|
|||||||
$columnMap = array_combine($columnRow, $columnRow);
|
$columnMap = array_combine($columnRow, $columnRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rowIndex = 0;
|
||||||
$rowIndex = 0;
|
$rowIndex = 0;
|
||||||
while (($row = fgetcsv($file, 0, $this->delimiter, $this->enclosure)) !== FALSE) {
|
while (($row = fgetcsv($file, 0, $this->delimiter, $this->enclosure)) !== FALSE) {
|
||||||
$rowIndex++;
|
$rowIndex++;
|
||||||
|
Loading…
Reference in New Issue
Block a user