-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/unclecheese/silverstripe-…
- Loading branch information
Showing
15 changed files
with
1,831 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
|
||
class DashboardItemEditForm extends Extension | ||
{ | ||
|
||
|
||
public function updateItemEditForm($form) { | ||
if($id = $this->owner->request->getVar('ID')) { | ||
Injector::inst()->get("CMSMain")->setCurrentPageID($id); | ||
$form->Fields()->push(new HiddenField('ID','', $id)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
* @author Uncle Cheese <[email protected]> | ||
*/ | ||
class DashboardSectionEditorPanel extends DashboardPanel { | ||
|
||
|
||
private static $db = array ( | ||
'ParentID' => 'Int', | ||
|
@@ -24,8 +24,8 @@ class DashboardSectionEditorPanel extends DashboardPanel { | |
|
||
|
||
private static $configure_on_create = true; | ||
|
||
|
||
|
||
|
||
public function getLabel() { | ||
|
@@ -78,7 +78,7 @@ protected function getHierarchy($parentID, $level = 0) { | |
if($children->exists()) { | ||
foreach($children as $child) { | ||
$indent=""; | ||
for($i=0;$i<$level;$i++) $indent .= " "; | ||
for($i=0;$i<$level;$i++) $indent .= " "; | ||
if($child->AllChildren()->exists()) { | ||
$text = $child->Title; | ||
$options[$child->ID] = empty($text) ? "<em>$indent Untitled</em>" : $indent.$text; | ||
|
@@ -110,24 +110,26 @@ protected function getPageTypes() { | |
|
||
public function getConfiguration() { | ||
$fields = parent::getConfiguration(); | ||
$fields->push(DropdownField::create("ParentID","Section", $this->getHierarchy(0)) | ||
->addExtraClass("no-chzn") | ||
$fields->push(TreeDropdownField::create("ParentID","Section","SiteTree") | ||
->setFilterFunction(function($node){ | ||
return SiteTree::get()->filter("ParentID", $node->ID)->exists(); | ||
}) | ||
); | ||
$fields->push(DropdownField::create("Subject", "Page type", $this->getPageTypes()) | ||
->addExtraClass("no-chzn") | ||
); | ||
$fields->push(TextField::create("Count",_t('DashboardRecentEdits.COUNT','Number of pages to display'))); | ||
$fields->push(TextField::create("Count",_t('DashboardRecentEdits.COUNT','Number of pages to display'))); | ||
return $fields; | ||
} | ||
|
||
|
||
|
||
public function getPrimaryActions() { | ||
if(!$this->Subject || !$this->ParentID) return false; | ||
$actions = parent::getPrimaryActions(); | ||
$actions = parent::getPrimaryActions(); | ||
$actions->push(DashboardPanelAction::create( | ||
$this->CreatePageLink(), | ||
sprintf(_t('Dashboard.CREATENEW','Create new %s'),$this->SubjectSingularName()), | ||
$this->CreatePageLink(), | ||
sprintf(_t('Dashboard.CREATENEW','Create new %s'),$this->SubjectSingularName()), | ||
"good" | ||
)); | ||
return $actions; | ||
|
@@ -140,10 +142,10 @@ public function getSecondaryActions() { | |
$actions = parent::getSecondaryActions(); | ||
$actions->push(DashboardPanelAction::create( | ||
$this->ViewAllLink(), | ||
sprintf(_t('Dashboard.VIEWALL','View all %s'),$this->SubjectPluralName()) | ||
sprintf(_t('Dashboard.VIEWALL','View all %s'),$this->SubjectPluralName()) | ||
)); | ||
return $actions; | ||
|
||
} | ||
|
||
|
||
|
@@ -155,15 +157,15 @@ public function SectionItems() { | |
'ClassName' => $this->Subject | ||
)) | ||
->limit($this->Count) | ||
->sort("LastEdited DESC"); | ||
->sort("LastEdited DESC"); | ||
$ret = ArrayList::create(array()); | ||
foreach($set as $r) { | ||
$ret->push(ArrayData::create(array( | ||
'Title' => $r->Title, | ||
'EditLink' => Injector::inst()->get("CMSPagesController")->Link("edit/show/{$r->ID}") | ||
))); | ||
} | ||
return $ret; | ||
return $ret; | ||
} | ||
|
||
|
||
|
@@ -174,7 +176,7 @@ public function SubjectSingularName() { | |
|
||
|
||
public function SubjectPluralName() { | ||
return Injector::inst()->get($this->Subject)->i18n_plural_name(); | ||
return Injector::inst()->get($this->Subject)->i18n_plural_name(); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.