File modification for gallery (merged from 2.1.0 branch, r42517)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42922 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-10-02 04:53:19 +00:00
parent 70db5d36a0
commit 07eafb0aaf

View File

@ -29,11 +29,7 @@ class File extends DataObject {
"Title" => "Varchar(255)",
"Filename" => "Varchar(255)",
"Content" => "Text",
"Sort" => "Int",
"PopupWidth" => "Int",
"PopupHeight" => "Int",
"Embed" => "Boolean",
'LimitDimensions' => 'Boolean'
"Sort" => "Int"
);
static $indexes = array(
"SearchFields" => "fulltext (Filename,Title,Content)",
@ -594,10 +590,13 @@ class File extends DataObject {
* be a better way of approaching this?
*/
public function instance_get($filter = "", $sort = "", $join = "", $limit="", $containerClass = "DataObjectSet", $having="") {
if($this->hasMethod('alternative_instance_get')) return $this->alternative_instance_get($filter, $sort, $join, $limit, $containerClass, $having);
$query = $this->extendedSQL($filter, $sort, $limit, $join, $having);
$baseTable = reset($query->from);
$query->select = array("$baseTable.ID","$baseTable.ClassName","$baseTable.Created","$baseTable.LastEdited","$baseTable.Name","$baseTable.Title","$baseTable.Content","$baseTable.ParentID","$baseTable.Filename","if($baseTable.ClassName,$baseTable.ClassName,'File') AS RecordClassName");
$query->select = array("$baseTable.ID","$baseTable.ClassName","$baseTable.Created","$baseTable.LastEdited","$baseTable.Name","$baseTable.Title","$baseTable.Content","$baseTable.ParentID","$baseTable.Filename","if($baseTable.ClassName,$baseTable.ClassName,'File') AS RecordClassName","$baseTable.PopupWidth","$baseTable.PopupHeight","$baseTable.Embed","$baseTable.LimitDimensions");
$records = $query->execute();
$ret = $this->buildDataObjectSet($records, $containerClass);
if($ret) $ret->parseQueryLimit($query);