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

View File

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