MINOR More extension points in CMSMain (specifically to allow for 'locale' query parameter and language drop down of the 'translatable' extension)

This commit is contained in:
Ingo Schommer 2012-05-15 21:30:32 +02:00
parent 20af440694
commit c185c737dd
2 changed files with 20 additions and 2 deletions

View File

@ -134,18 +134,24 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
* @return string * @return string
*/ */
public function Link($action = null) { public function Link($action = null) {
return Controller::join_links( $link = Controller::join_links(
$this->stat('url_base', true), $this->stat('url_base', true),
$this->stat('url_segment', true), // in case we want to change the segment $this->stat('url_segment', true), // in case we want to change the segment
'/', // trailing slash needed if $action is null! '/', // trailing slash needed if $action is null!
"$action" "$action"
); );
$this->extend('updateLink', $link);
return $link;
} }
public function LinkPages() { public function LinkPages() {
return singleton('CMSPagesController')->Link(); return singleton('CMSPagesController')->Link();
} }
public function LinkPagesWithSearch() {
return $this->LinkWithSearch($this->LinkPages());
}
public function LinkTreeView() { public function LinkTreeView() {
return $this->LinkWithSearch(singleton('CMSMain')->Link('treeview')); return $this->LinkWithSearch(singleton('CMSMain')->Link('treeview'));
} }
@ -187,10 +193,12 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
'q' => (array)$this->request->getVar('q'), 'q' => (array)$this->request->getVar('q'),
'ParentID' => $this->request->getVar('ParentID') 'ParentID' => $this->request->getVar('ParentID')
); );
return Controller::join_links( $link = Controller::join_links(
$link, $link,
array_filter(array_values($params)) ? '?' . http_build_query($params) : null array_filter(array_values($params)) ? '?' . http_build_query($params) : null
); );
$this->extend('updateLinkWithSearch', $link);
return $link;
} }
function LinkPageAdd() { function LinkPageAdd() {
@ -226,6 +234,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
Versioned::prepopulate_versionnumber_cache("SiteTree", "Live"); Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
$html .= $this->getSiteTreeFor($this->stat('tree_class')); $html .= $this->getSiteTreeFor($this->stat('tree_class'));
$this->extend('updateSiteTreeAsUL', $html);
return $html; return $html;
} }
@ -236,6 +246,12 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
return $this->request->getVar('q'); return $this->request->getVar('q');
} }
public function ExtraTreeTools() {
$html = '';
$this->extend('updateExtraTreeTools', $html);
return $html;
}
function SearchForm() { function SearchForm() {
// get all page types in a dropdown-compatible format // get all page types in a dropdown-compatible format
$pageTypes = SiteTree::page_type_classes(); $pageTypes = SiteTree::page_type_classes();

View File

@ -10,6 +10,8 @@
<% _t('CMSMain.EditTree', 'Edit Tree') %> <% _t('CMSMain.EditTree', 'Edit Tree') %>
</button> </button>
$ExtraTreeTools
<div class="center"> <div class="center">
<% if TreeIsFiltered %> <% if TreeIsFiltered %>
<div class="cms-tree-filtered"> <div class="cms-tree-filtered">