mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT: Correct issue with SiteTree filtering not persisting and add drop down for page type and clear button. Part of a re-work of the search system
@todo: Tests, speed optimisation, proper connection of filtering with tree control checkboxes git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@76779 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
dad1e68bcf
commit
29ab106af8
@ -39,7 +39,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
'dialog',
|
'dialog',
|
||||||
'duplicate',
|
'duplicate',
|
||||||
'duplicatewithchildren',
|
'duplicatewithchildren',
|
||||||
'filtersitetree',
|
|
||||||
'getpagecount',
|
'getpagecount',
|
||||||
'getversion',
|
'getversion',
|
||||||
'publishall',
|
'publishall',
|
||||||
@ -55,6 +54,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
'AddPageOptionsForm',
|
'AddPageOptionsForm',
|
||||||
'SiteTreeAsUL',
|
'SiteTreeAsUL',
|
||||||
'getshowdeletedsubtree',
|
'getshowdeletedsubtree',
|
||||||
|
'getfilteredsubtree',
|
||||||
'batchactions'
|
'batchactions'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -74,7 +74,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return array(
|
return array(
|
||||||
'Title' => _t('CMSMain.TITLEOPT', 'Title', 0, 'The dropdown title in CMSMain left SiteTreeFilterOptions'),
|
'Title' => _t('CMSMain.TITLEOPT', 'Title', 0, 'The dropdown title in CMSMain left SiteTreeFilterOptions'),
|
||||||
'MenuTitle' => _t('CMSMain.MENUTITLEOPT', 'Navigation Label', 0, 'The dropdown title in CMSMain left SiteTreeFilterOptions'),
|
'MenuTitle' => _t('CMSMain.MENUTITLEOPT', 'Navigation Label', 0, 'The dropdown title in CMSMain left SiteTreeFilterOptions'),
|
||||||
'ClassName' => _t('CMSMain.PAGETYPEOPT', 'Page Type', 0, "The dropdown title in CMSMain left SiteTreeFilterOptions"),
|
|
||||||
'Status' => _t('CMSMain.STATUSOPT', 'Status', 0, "The dropdown title in CMSMain left SiteTreeFilterOptions"),
|
'Status' => _t('CMSMain.STATUSOPT', 'Status', 0, "The dropdown title in CMSMain left SiteTreeFilterOptions"),
|
||||||
'MetaDescription' => _t('CMSMain.METADESCOPT', 'Description', 0, "The dropdown title in CMSMain left SiteTreeFilterOptions"),
|
'MetaDescription' => _t('CMSMain.METADESCOPT', 'Description', 0, "The dropdown title in CMSMain left SiteTreeFilterOptions"),
|
||||||
'MetaKeywords' => _t('CMSMain.METAKEYWORDSOPT', 'Keywords', 0, "The dropdown title in CMSMain left SiteTreeFilterOptions")
|
'MetaKeywords' => _t('CMSMain.METAKEYWORDSOPT', 'Keywords', 0, "The dropdown title in CMSMain left SiteTreeFilterOptions")
|
||||||
@ -186,6 +185,17 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return $tree;
|
return $tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getfilteredsubtree() {
|
||||||
|
// Get the tree
|
||||||
|
$tree = $this->getSiteTreeFor($this->stat('tree_class'), $_REQUEST['ID'], null, 'cmsMainMarkingFilterFunction');
|
||||||
|
|
||||||
|
// Trim off the outer tag
|
||||||
|
$tree = ereg_replace('^[ \t\r\n]*<ul[^>]*>','', $tree);
|
||||||
|
$tree = ereg_replace('</ul[^>]*>[ \t\r\n]*$','', $tree);
|
||||||
|
|
||||||
|
return $tree;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the SiteTree columns that can be filtered using the the Site Tree Search button as a DataObjectSet
|
* Returns the SiteTree columns that can be filtered using the the Site Tree Search button as a DataObjectSet
|
||||||
*/
|
*/
|
||||||
@ -204,43 +214,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
$dateField = new CalendarDateField('SiteTreeFilterDate');
|
$dateField = new CalendarDateField('SiteTreeFilterDate');
|
||||||
return $dateField->Field();
|
return $dateField->Field();
|
||||||
}
|
}
|
||||||
|
public function SiteTreeFilterPageTypeField() {
|
||||||
/**
|
$types = SiteTree::page_type_classes(); array_unshift($types, 'All');
|
||||||
* Returns a filtered Site Tree
|
$optionsetField = new DropdownField('ClassName', 'ClassName', array_combine($types, $types), 'Any');
|
||||||
*/
|
return $optionsetField->Field();
|
||||||
public function filtersitetree() {
|
|
||||||
// Pre-cache sitetree version numbers for querying efficiency
|
|
||||||
Versioned::prepopulate_versionnumber_cache("SiteTree", "Stage");
|
|
||||||
Versioned::prepopulate_versionnumber_cache("SiteTree", "Live");
|
|
||||||
|
|
||||||
$className = 'SiteTree';
|
|
||||||
$rootID = null;
|
|
||||||
$obj = $rootID ? $this->getRecord($rootID) : singleton($className);
|
|
||||||
$obj->setMarkingFilterFunction('cmsMainMarkingFilterFunction');
|
|
||||||
$obj->markPartialTree();
|
|
||||||
|
|
||||||
if($p = $this->currentPage()) $obj->markToExpose($p);
|
|
||||||
|
|
||||||
// getChildrenAsUL is a flexible and complex way of traversing the tree
|
|
||||||
$siteTree = $obj->getChildrenAsUL("", '
|
|
||||||
"<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" .
|
|
||||||
"<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" " . (($child->canEdit() || $child->canAddChildren()) ? "" : "class=\"disabled\"") . " title=\"' . _t('LeftAndMain.PAGETYPE') . '".$child->class."\" >" .
|
|
||||||
($child->TreeTitle()) .
|
|
||||||
"</a>"
|
|
||||||
'
|
|
||||||
,$this, true);
|
|
||||||
|
|
||||||
// Wrap the root if needs be.
|
|
||||||
|
|
||||||
if(!$rootID) {
|
|
||||||
$rootLink = $this->Link() . '0';
|
|
||||||
$siteTree = "<ul id=\"sitetree\" class=\"tree unformatted\"><li id=\"record-0\" class=\"Root nodelete\"><a href=\"$rootLink\">" .
|
|
||||||
_t('LeftAndMain.TREESITECONTENT',"Site Content",PR_HIGH,'Root node on left') . "</a>"
|
|
||||||
. $siteTree . "</li></ul>";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $siteTree;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateDataTreeHints() {
|
public function generateDataTreeHints() {
|
||||||
@ -1255,6 +1232,7 @@ $filterCache = array();
|
|||||||
|
|
||||||
// TODO: Find way to put this in a class
|
// TODO: Find way to put this in a class
|
||||||
function cmsMainMarkingFilterFunction($node) {
|
function cmsMainMarkingFilterFunction($node) {
|
||||||
|
global $filterCache;
|
||||||
// Expand all nodes
|
// Expand all nodes
|
||||||
// $node->markingFinished();
|
// $node->markingFinished();
|
||||||
|
|
||||||
@ -1278,6 +1256,11 @@ function cmsMainMarkingFilterFunction($node) {
|
|||||||
$failed_filter = true;
|
$failed_filter = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Check the ClassName
|
||||||
|
if (!empty($_REQUEST['ClassName']) && $_REQUEST['ClassName'] != 'Any') {
|
||||||
|
if ($node->ClassName != $_REQUEST['ClassName']) $failed_filter = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Now check if a specified Criteria attribute matches
|
// Now check if a specified Criteria attribute matches
|
||||||
foreach (CMSMain::T_SiteTreeFilterOptions() as $key => $value)
|
foreach (CMSMain::T_SiteTreeFilterOptions() as $key => $value)
|
||||||
{
|
{
|
||||||
|
@ -464,10 +464,18 @@ class LeftAndMain extends Controller {
|
|||||||
* @param $childrenMethod The method to call to get the children of the tree. For example,
|
* @param $childrenMethod The method to call to get the children of the tree. For example,
|
||||||
* Children, AllChildrenIncludingDeleted, or AllHistoricalChildren
|
* Children, AllChildrenIncludingDeleted, or AllHistoricalChildren
|
||||||
*/
|
*/
|
||||||
function getSiteTreeFor($className, $rootID = null,
|
function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $filterFunction = null) {
|
||||||
$childrenMethod = "AllChildrenIncludingDeleted") {
|
// Default childrenMethod
|
||||||
|
if (!$childrenMethod) $childrenMethod = 'AllChildrenIncludingDeleted';
|
||||||
|
|
||||||
|
// Get the tree root
|
||||||
$obj = $rootID ? $this->getRecord($rootID) : singleton($className);
|
$obj = $rootID ? $this->getRecord($rootID) : singleton($className);
|
||||||
|
|
||||||
|
// Mark the nodes of the tree to return
|
||||||
|
if ($filterFunction) $obj->setMarkingFilterFunction($filterFunction);
|
||||||
$obj->markPartialTree(30, $this, $childrenMethod);
|
$obj->markPartialTree(30, $this, $childrenMethod);
|
||||||
|
|
||||||
|
// Ensure current page is exposed
|
||||||
if($p = $this->currentPage()) $obj->markToExpose($p);
|
if($p = $this->currentPage()) $obj->markToExpose($p);
|
||||||
|
|
||||||
// getChildrenAsUL is a flexible and complex way of traversing the tree
|
// getChildrenAsUL is a flexible and complex way of traversing the tree
|
||||||
|
@ -371,14 +371,15 @@ ul.tree span.untranslated a:visited {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#left form.actionparams div.SearchCriteria {
|
#left form.actionparams div.SearchCriteria {
|
||||||
width: 40%;
|
width: 28%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
#left form.actionparams input.SearchCriteria {
|
#left form.actionparams input.SearchCriteria, #left form.actionparams #InputSiteTreeFilterClassName select {
|
||||||
width: 43%;
|
width: 60%;
|
||||||
float: left;
|
float: left;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
#left form.actionparams #InputSiteTreeFilterDate .calendar {
|
#left form.actionparams #InputSiteTreeFilterDate .calendar {
|
||||||
margin-left: -96px;
|
margin-left: -96px;
|
||||||
|
@ -357,17 +357,25 @@ body.stillLoading select {
|
|||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
#SearchBox #SiteTreeSearchTerm {
|
#SearchControls {
|
||||||
padding: 1px 0 2px 0;
|
float: left;
|
||||||
|
position: relative;
|
||||||
|
margin-top:2px;
|
||||||
|
}
|
||||||
|
#SearchControls label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#SearchControls select#SiteTreeFilterAddCriteria {
|
||||||
|
width: 8.8em;
|
||||||
|
padding:1px 0; margin:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#searchIndicator {
|
#searchIndicator {
|
||||||
display: none;
|
display: none;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
background: #EFEFEF url(../images/network-save.gif) no-repeat;
|
background: #EFEFEF url(../images/network-save.gif) no-repeat;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 145px;
|
left: 95px;
|
||||||
top: 2px;
|
top: 2px;
|
||||||
}
|
}
|
||||||
#searchIndicator.loading {
|
#searchIndicator.loading {
|
||||||
@ -379,13 +387,6 @@ body.stillLoading select {
|
|||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
#addCriteria {
|
|
||||||
float: left;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
#addCriteria label {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#sitetree_ul, ul#sitetree {
|
#sitetree_ul, ul#sitetree {
|
||||||
padding: 3px 0 0 3px;
|
padding: 3px 0 0 3px;
|
||||||
clear: left;
|
clear: left;
|
||||||
|
@ -129,9 +129,9 @@ ShowDeletedPagesAction.prototype = {
|
|||||||
|
|
||||||
onclick : function() {
|
onclick : function() {
|
||||||
if(this.checked) {
|
if(this.checked) {
|
||||||
SiteTreeHandlers.loadTree_url = SiteTreeHandlers.controller_url + '/getshowdeletedsubtree';
|
$('sitetree').setCustomURL(SiteTreeHandlers.controller_url+'/getshowdeletedsubtree');
|
||||||
} else {
|
} else {
|
||||||
SiteTreeHandlers.loadTree_url = SiteTreeHandlers.controller_url + '/getsubtree';
|
$('sitetree').clearCustomURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can't update the tree while it's draggable; it gets b0rked.
|
// We can't update the tree while it's draggable; it gets b0rked.
|
||||||
@ -141,13 +141,8 @@ ShowDeletedPagesAction.prototype = {
|
|||||||
__makeDraggableAfterUpdate = true;
|
__makeDraggableAfterUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = SiteTreeHandlers.loadTree_url + '?ID=0&ajax=1';
|
$('sitetree').reload({
|
||||||
if($('LangSelector')) url += "&locale=" + $('LangSelector').value;
|
onSuccess: function() {
|
||||||
|
|
||||||
var request = new Ajax.Request(url, {
|
|
||||||
onSuccess: function(response) {
|
|
||||||
$('sitetree').innerHTML = response.responseText;
|
|
||||||
SiteTree.applyTo($('sitetree'));
|
|
||||||
if(__makeDraggableAfterUpdate) $('sitetree').makeDraggable();
|
if(__makeDraggableAfterUpdate) $('sitetree').makeDraggable();
|
||||||
},
|
},
|
||||||
onFailure: function(response) {
|
onFailure: function(response) {
|
||||||
@ -158,6 +153,107 @@ ShowDeletedPagesAction.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show only drafts checkbox click action
|
||||||
|
*/
|
||||||
|
showonlydrafts = Class.create();
|
||||||
|
showonlydrafts.applyTo('#publishpage_show_drafts');
|
||||||
|
showonlydrafts.prototype = {
|
||||||
|
onclick : function() {
|
||||||
|
if(this.checked) {
|
||||||
|
$('sitetree').setCustomURL(SiteTreeHandlers.controller_url+'/getfilteredsubtree', {Status:'Saved'});
|
||||||
|
} else {
|
||||||
|
$('sitetree').clearCustomURL();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('sitetree').reload({
|
||||||
|
onSuccess: function() {
|
||||||
|
statusMessage(ss.i18n._t('CMSMAIN.FILTEREDTREE'),'good');
|
||||||
|
},
|
||||||
|
onFailure: function(response) {
|
||||||
|
errorMessage(ss.i18n.sprintf(
|
||||||
|
ss.i18n._t('CMSMAIN.ERRORFILTERPAGES'),
|
||||||
|
response.responseText
|
||||||
|
));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Control the site tree filter
|
||||||
|
*/
|
||||||
|
SiteTreeFilterForm = Class.create();
|
||||||
|
SiteTreeFilterForm.applyTo('form#search_options');
|
||||||
|
SiteTreeFilterForm.prototype = {
|
||||||
|
initialize: function() {
|
||||||
|
var self = this;
|
||||||
|
Form.getElements(this).each(function(el){
|
||||||
|
if (el.type == 'submit') el.onclick = function(){self.clicked = $F(this); console.log(self.clicked)};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onsubmit: function() {
|
||||||
|
var filters = $H();
|
||||||
|
|
||||||
|
if (this.clicked == 'Search') {
|
||||||
|
Form.getElements(this).each(function(el){
|
||||||
|
if (el.type == 'text') {
|
||||||
|
if ($F(el)) filters[el.name] = $F(el);
|
||||||
|
}
|
||||||
|
else if (el.type == 'select-one') {
|
||||||
|
if ($F(el) && $F(el) != 'All') filters[el.name] = $F(el);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Form.getElements(this).each(function(el){
|
||||||
|
if (el.type == 'text') $(el).clear();
|
||||||
|
else if (el.type == 'select-one') el.value = 'All';
|
||||||
|
});
|
||||||
|
document.getElementsBySelector('.SearchCriteriaContainer', this).each(function(el){
|
||||||
|
Element.hide(el);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filters.keys().length) {
|
||||||
|
// Set new URL
|
||||||
|
$('sitetree').setCustomURL(SiteTreeHandlers.controller_url + '/getfilteredsubtree', filters);
|
||||||
|
|
||||||
|
// Disable checkbox tree controls that currently don't work with search.
|
||||||
|
// @todo: Make them work together
|
||||||
|
if ($('sitetree').isDraggable) $('sitetree').stopBeingDraggable();
|
||||||
|
document.getElementsBySelector('.checkboxAboveTree input[type=checkbox]').each(function(el){
|
||||||
|
el.value = false; el.disabled = true;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Reset URL to default
|
||||||
|
$('sitetree').clearCustomURL();
|
||||||
|
|
||||||
|
// Enable checkbox tree controls
|
||||||
|
document.getElementsBySelector('.checkboxAboveTree input[type=checkbox]').each(function(el){
|
||||||
|
el.disabled = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
$('SiteTreeSearchButton').className = $('SiteTreeSearchClearButton').className = 'hidden';
|
||||||
|
$('searchIndicator').className = 'loading';
|
||||||
|
|
||||||
|
$('sitetree').reload({
|
||||||
|
onSuccess : function(response) {
|
||||||
|
$('SiteTreeSearchButton').className = $('SiteTreeSearchClearButton').className = 'action';
|
||||||
|
$('searchIndicator').className = '';
|
||||||
|
statusMessage('Filtered tree','good');
|
||||||
|
},
|
||||||
|
onFailure : function(response) {
|
||||||
|
errorMessage('Could not filter site tree<br />' + response.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Criteria Drop-down onchange action which allows more criteria to be shown
|
* Add Criteria Drop-down onchange action which allows more criteria to be shown
|
||||||
*/
|
*/
|
||||||
@ -207,37 +303,6 @@ batchactionsclass.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Show only drafts checkbox click action
|
|
||||||
*/
|
|
||||||
showonlydrafts = Class.create();
|
|
||||||
showonlydrafts.applyTo('#publishpage_show_drafts');
|
|
||||||
showonlydrafts.prototype = {
|
|
||||||
onclick : function() {
|
|
||||||
if (0 == $('SiteTreeIsFiltered').value) {
|
|
||||||
// Show all items in Site Tree again
|
|
||||||
new Ajax.Request( 'admin/filterSiteTree?Status=Saved&ajax=1', {
|
|
||||||
onSuccess: function( response ) {
|
|
||||||
$('sitetree_ul').innerHTML = response.responseText;
|
|
||||||
Behaviour.apply($('sitetree_ul'));
|
|
||||||
$('SiteTreeIsFiltered').value = 1;
|
|
||||||
$('batchactions').multiselectTransform();
|
|
||||||
statusMessage(ss.i18n._t('CMSMAIN.FILTEREDTREE'),'good');
|
|
||||||
},
|
|
||||||
onFailure : function(response) {
|
|
||||||
errorMessage(ss.i18n.sprintf(
|
|
||||||
ss.i18n._t('CMSMAIN.ERRORFILTERPAGES'),
|
|
||||||
response.responseText
|
|
||||||
));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
batchActionGlobals.unfilterSiteTree();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// batchActionGlobals is needed because calls to observeMethod doesn't seem to preserve instance variables so a Prototype can't be used
|
// batchActionGlobals is needed because calls to observeMethod doesn't seem to preserve instance variables so a Prototype can't be used
|
||||||
batchActionGlobals = {
|
batchActionGlobals = {
|
||||||
selectedNodes: { },
|
selectedNodes: { },
|
||||||
|
@ -27,6 +27,48 @@ var TreeContextMenu = null;
|
|||||||
*/
|
*/
|
||||||
TreeAPI = Class.create();
|
TreeAPI = Class.create();
|
||||||
TreeAPI.prototype = {
|
TreeAPI.prototype = {
|
||||||
|
|
||||||
|
setCustomURL: function(url, arguments) {
|
||||||
|
this.customURL = url;
|
||||||
|
this.customArguments = $H(arguments);
|
||||||
|
},
|
||||||
|
|
||||||
|
clearCustomURL: function() {
|
||||||
|
this.customURL = this.customArguments = null;
|
||||||
|
},
|
||||||
|
|
||||||
|
url: function(args) {
|
||||||
|
var args = $H(args).merge(this.customArguments);
|
||||||
|
|
||||||
|
var url = this.customURL ? this.customURL : SiteTreeHandlers.loadTree_url;
|
||||||
|
url = url + (url.match(/\?/) ? '&' : '?') + args.toQueryString();
|
||||||
|
|
||||||
|
console.log('Loading tree from ' + url);
|
||||||
|
return url;
|
||||||
|
},
|
||||||
|
|
||||||
|
reload: function(options) {
|
||||||
|
this.innerHTML = 'Loading...';
|
||||||
|
|
||||||
|
var args = {ajax:1, ID:0};
|
||||||
|
if ($('Form_EditForm_Locale')) args.local = $('Form_EditForm_Locale').value;
|
||||||
|
|
||||||
|
url = this.url(args);
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
new Ajax.Request(url, {
|
||||||
|
onSuccess: function(response){
|
||||||
|
self.innerHTML = response.responseText;
|
||||||
|
self.castAsTreeNode(self.firstChild);
|
||||||
|
if (options.onSuccess) options.onSuccess(response);
|
||||||
|
},
|
||||||
|
onFailure: function(response){
|
||||||
|
errorMessage('error loading tree', response);
|
||||||
|
if (options.onError) options.onError(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the given code on the each tree node with the given index.
|
* Perform the given code on the each tree node with the given index.
|
||||||
* There could be more than one :-)
|
* There could be more than one :-)
|
||||||
@ -177,11 +219,11 @@ TreeNodeAPI.prototype = {
|
|||||||
this.cuedNewNodes[this.cuedNewNodes.length] = node;
|
this.cuedNewNodes[this.cuedNewNodes.length] = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var args = {ajax:1, ID:this.getIdx()};
|
||||||
|
if ($('Form_EditForm_Locale')) args.local = $('Form_EditForm_Locale').value;
|
||||||
|
|
||||||
|
url = this.tree.url(args);
|
||||||
|
|
||||||
var url = SiteTreeHandlers.loadTree_url;
|
|
||||||
url += (url.match(/\?/)) ? '&' : '?';
|
|
||||||
url += 'ajax=1&ID=' + this.getIdx();
|
|
||||||
if($('Form_EditForm_Locale')) url += "&locale=" + $('Form_EditForm_Locale').value;
|
|
||||||
new Ajax.Request(url, {
|
new Ajax.Request(url, {
|
||||||
onSuccess : this.installSubtree.bind(this),
|
onSuccess : this.installSubtree.bind(this),
|
||||||
onFailure : this.showSubtreeLoadingError
|
onFailure : this.showSubtreeLoadingError
|
||||||
@ -481,30 +523,3 @@ ReorganiseAction.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Control the site tree filter
|
|
||||||
*/
|
|
||||||
SiteTreeFilterForm = Class.create();
|
|
||||||
SiteTreeFilterForm.applyTo('form#search_options');
|
|
||||||
SiteTreeFilterForm.prototype = {
|
|
||||||
onsubmit: function() {
|
|
||||||
$('SiteTreeSearchButton').className = 'hidden';
|
|
||||||
$('searchIndicator').className = 'loading';
|
|
||||||
Ajax.SubmitForm(this, null, {
|
|
||||||
onSuccess : function(response) {
|
|
||||||
$('SiteTreeIsFiltered').value = 1;
|
|
||||||
$('SiteTreeSearchButton').className = '';
|
|
||||||
$('searchIndicator').className = '';
|
|
||||||
$('sitetree_ul').innerHTML = response.responseText;
|
|
||||||
Behaviour.apply($('sitetree_ul'));
|
|
||||||
statusMessage('Filtered tree','good');
|
|
||||||
},
|
|
||||||
onFailure : function(response) {
|
|
||||||
errorMessage('Could not filter site tree<br />' + response.responseText);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -147,7 +147,7 @@ $lang['en_US']['CMSMain']['VISITRESTORE'] = array(
|
|||||||
$lang['en_US']['CMSMain_dialog.ss']['BUTTONNOTFOUND'] = 'Couldn\'t find the button name';
|
$lang['en_US']['CMSMain_dialog.ss']['BUTTONNOTFOUND'] = 'Couldn\'t find the button name';
|
||||||
$lang['en_US']['CMSMain_dialog.ss']['NOLINKED'] = 'Can\'t find window.linkedObject to send the button click back to the main window';
|
$lang['en_US']['CMSMain_dialog.ss']['NOLINKED'] = 'Can\'t find window.linkedObject to send the button click back to the main window';
|
||||||
$lang['en_US']['CMSMain_left.ss']['ADDEDNOTPUB'] = 'Added to the draft site and not published yet';
|
$lang['en_US']['CMSMain_left.ss']['ADDEDNOTPUB'] = 'Added to the draft site and not published yet';
|
||||||
$lang['en_US']['CMSMain_left.ss']['ADDSEARCHCRITERIA'] = 'Add Criteria...';
|
$lang['en_US']['CMSMain_left.ss']['ADDSEARCHCRITERIA'] = 'Add Criteria';
|
||||||
$lang['en_US']['CMSMain_left.ss']['BATCHACTIONS'] = array(
|
$lang['en_US']['CMSMain_left.ss']['BATCHACTIONS'] = array(
|
||||||
'Batch Actions',
|
'Batch Actions',
|
||||||
PR_HIGH
|
PR_HIGH
|
||||||
@ -174,6 +174,7 @@ $lang['en_US']['CMSMain_left.ss']['NEW'] = 'new';
|
|||||||
$lang['en_US']['CMSMain_left.ss']['OPENBOX'] = 'click to open this box';
|
$lang['en_US']['CMSMain_left.ss']['OPENBOX'] = 'click to open this box';
|
||||||
$lang['en_US']['CMSMain_left.ss']['PAGEVERSIONH'] = 'Page Version History';
|
$lang['en_US']['CMSMain_left.ss']['PAGEVERSIONH'] = 'Page Version History';
|
||||||
$lang['en_US']['CMSMain_left.ss']['PUBLISHCONFIRM'] = 'Publish the selected pages';
|
$lang['en_US']['CMSMain_left.ss']['PUBLISHCONFIRM'] = 'Publish the selected pages';
|
||||||
|
$lang['en_US']['CMSMain_left.ss']['CLEAR'] = 'Clear';
|
||||||
$lang['en_US']['CMSMain_left.ss']['SEARCH'] = array(
|
$lang['en_US']['CMSMain_left.ss']['SEARCH'] = array(
|
||||||
'Search',
|
'Search',
|
||||||
PR_HIGH
|
PR_HIGH
|
||||||
|
@ -28,9 +28,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<input type="hidden" id="SiteTreeIsFiltered" value="0" />
|
<input type="hidden" id="SiteTreeIsFiltered" value="0" />
|
||||||
<div id="SearchBox">
|
<div id="SearchBox">
|
||||||
<input type="text" id="SiteTreeSearchTerm" name="SiteTreeSearchTerm" />
|
<div class="SearchCriteria">Text:</div>
|
||||||
<div id="searchIndicator"> </div>
|
<input type="text" id="SiteTreeSearchTerm" class='SearchCriteria' name="SiteTreeSearchTerm" />
|
||||||
<input type="submit" id="SiteTreeSearchButton" class="action" value="<% _t('SEARCH') %>" title="<% _t('SEARCHTITLE','Search through URL, Title, Menu Title, & Content') %>" />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="ContainerSiteTreeFilterDate" class="SearchCriteriaContainer" style="display:none" >
|
<div id="ContainerSiteTreeFilterDate" class="SearchCriteriaContainer" style="display:none" >
|
||||||
@ -38,6 +37,11 @@
|
|||||||
<div id="InputSiteTreeFilterDate">$SiteTreeFilterDateField</div>
|
<div id="InputSiteTreeFilterDate">$SiteTreeFilterDateField</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id='ContainerSiteTreeFilterClassName' class='SearchCriteriaContainer' style="display:none">
|
||||||
|
<div id="TextSiteTreeFilterClassName" class="SearchCriteria">Page type: </div>
|
||||||
|
<div id="InputSiteTreeFilterClassName">$SiteTreeFilterPageTypeField</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<% control SiteTreeFilterOptions %>
|
<% control SiteTreeFilterOptions %>
|
||||||
<div id="Container$Column" class="SearchCriteriaContainer" style="display:none">
|
<div id="Container$Column" class="SearchCriteriaContainer" style="display:none">
|
||||||
<div id="Text$Column" class="SearchCriteria">$Title:</div>
|
<div id="Text$Column" class="SearchCriteria">$Title:</div>
|
||||||
@ -45,14 +49,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end_control %>
|
<% end_control %>
|
||||||
|
|
||||||
<div id="addCriteria">
|
<div id='SearchControls'>
|
||||||
<select id="SiteTreeFilterAddCriteria">
|
<select id="SiteTreeFilterAddCriteria">
|
||||||
<option value=""><% _t('ADDSEARCHCRITERIA','Add Criteria...') %></option>
|
<option value=""><% _t('ADDSEARCHCRITERIA','Add Criteria') %></option>
|
||||||
<option value="SiteTreeFilterDate"><% _t('EDITEDSINCE','Edited Since') %></option>
|
<option value="SiteTreeFilterDate"><% _t('EDITEDSINCE','Edited Since') %></option>
|
||||||
|
<option value="SiteTreeFilterClassName">Page type</option>
|
||||||
<% control SiteTreeFilterOptions %>
|
<% control SiteTreeFilterOptions %>
|
||||||
<option value="$Column">$Title</option>
|
<option value="$Column">$Title</option>
|
||||||
<% end_control %>
|
<% end_control %>
|
||||||
</select>
|
</select>
|
||||||
|
<div id="searchIndicator"> </div>
|
||||||
|
<input type="submit" id="SiteTreeSearchClearButton" class="action" value="<% _t('CLEAR') %>" title="<% _t('CLEARTITLE','Clear the search and view all items') %>" />
|
||||||
|
<input type="submit" id="SiteTreeSearchButton" class="action" value="<% _t('SEARCH') %>" title="<% _t('SEARCHTITLE','Search through URL, Title, Menu Title, & Content') %>" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user