(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:
Ingo Schommer 2008-08-10 23:35:11 +00:00
parent 8d0166e298
commit 935ee6d1bc
9 changed files with 48 additions and 14 deletions

View File

@ -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,

View File

@ -179,6 +179,10 @@ class SiteTree extends DataObject {
* @var string
*/
public static $breadcrumbs_delimiter = " &raquo; ";
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 <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 $includeTitle Show default <title>-tag, set to false for
* custom templating
* @return string The XHTML metatags

View File

@ -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

View File

@ -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);
}
/**

View File

@ -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"),

View File

@ -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;

View File

@ -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); }
});

View File

@ -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;

View File

@ -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++;