Merged in pre-2.3-oct08 branch

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@66082 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Will Rossiter 2008-11-17 23:03:39 +00:00
parent ae38956c29
commit fe0ac4e990
5 changed files with 101 additions and 13 deletions

View File

@ -581,7 +581,10 @@ class ModelAdmin_CollectionController extends Controller {
new HeaderField('SearchResultsHeader',_t('ModelAdmin.SEARCHRESULTS','Search Results'), 2), new HeaderField('SearchResultsHeader',_t('ModelAdmin.SEARCHRESULTS','Search Results'), 2),
$tf $tf
), ),
new FieldSet() new FieldSet(
new FormAction("goBack", _t('ModelAdmin.GOFORWARD', "Back")),
new FormAction("goForward", _t('ModelAdmin.GOFORWARD', "Forward"))
)
); );
// Include the search criteria on the results form URL, but not dodgy variables like those below // Include the search criteria on the results form URL, but not dodgy variables like those below
@ -589,6 +592,8 @@ class ModelAdmin_CollectionController extends Controller {
unset($filteredCriteria['ctf']); unset($filteredCriteria['ctf']);
unset($filteredCriteria['url']); unset($filteredCriteria['url']);
unset($filteredCriteria['action_search']); unset($filteredCriteria['action_search']);
if(isset($filteredCriteria['Investors__PEFirm__IsPECMember']) && !$filteredCriteria['Investors__PEFirm__IsPECMember']) unset($filteredCriteria['Investors__PEFirm__IsPECMember']);
$form->setFormAction($this->Link() . '/ResultsForm?' . http_build_query($filteredCriteria)); $form->setFormAction($this->Link() . '/ResultsForm?' . http_build_query($filteredCriteria));
return $form; return $form;
} }

View File

@ -7,6 +7,16 @@ class FilesystemPublisher extends StaticPublisher {
protected $destFolder; protected $destFolder;
protected $fileExtension; protected $fileExtension;
protected static $static_base_url = null;
/**
* Set a different base URL for the static copy of the site.
* This can be useful if you are running the CMS on a different domain from the website.
*/
static function set_static_base_url($url) {
self::$static_base_url = $url;
}
/** /**
* @param $destFolder The folder to save the cached site into * @param $destFolder The folder to save the cached site into
* @param $fileExtension The file extension to use, for example, 'html'. If omitted, then each page will be placed * @param $fileExtension The file extension to use, for example, 'html'. If omitted, then each page will be placed
@ -24,7 +34,8 @@ class FilesystemPublisher extends StaticPublisher {
//$base = Director::absoluteURL($this->destFolder); //$base = Director::absoluteURL($this->destFolder);
//$base = preg_replace('/\/[^\/]+\/\.\./','',$base) . '/'; //$base = preg_replace('/\/[^\/]+\/\.\./','',$base) . '/';
//Director::setBaseURL($base);
if(self::$static_base_url) Director::setBaseURL(self::$static_base_url);
$files = array(); $files = array();
$i = 0; $i = 0;
@ -83,7 +94,8 @@ class FilesystemPublisher extends StaticPublisher {
} }
}*/ }*/
} }
Director::setBaseURL(null);
if(self::$static_base_url) Director::setBaseURL(null);
//Debug::show(array_keys($files)); //Debug::show(array_keys($files));
//Debug::show(array_keys($missingFiles)); //Debug::show(array_keys($missingFiles));

View File

@ -1,20 +1,20 @@
.group { .contentPanel .group {
display: inline; display: inline;
margin-left: 2px; margin-left: 2px;
} }
.middleColumn { .contentPanel .middleColumn {
margin-bottom: 2px; margin-bottom: 2px;
} }
.link { .contentPanel .link {
text-decoration: none; text-decoration: none;
margin-left: 2px; margin-left: 2px;
} }
.tree_holder { .contentPanel .tree_holder {
display: inline; display: inline;
} }
#NewFolderName { .contentPanel #NewFolderName {
width: 120px; width: 120px;
margin-top: 0; margin-top: 0;
} }

View File

@ -85,8 +85,16 @@ $(document).ready(function() {
*/ */
$('#SearchForm_holder .tab form:not(#Form_ImportForm)').submit(function () { $('#SearchForm_holder .tab form:not(#Form_ImportForm)').submit(function () {
var $form = $(this); var $form = $(this);
$('#ModelAdminPanel').fn('startHistory', $(this).attr('action'), $(this).formToArray());
$('#ModelAdminPanel').load($(this).attr('action'), $(this).formToArray(), standardStatusHandler(function(result) { $('#ModelAdminPanel').load($(this).attr('action'), $(this).formToArray(), standardStatusHandler(function(result) {
__lastSearch = $form; if(!this.future || !this.future.length) {
$('#Form_EditForm_action_goForward, #Form_ResultsForm_action_goForward').hide();
}
if(!this.history || this.history.length <= 1) {
$('#Form_EditForm_action_goBack, #Form_ResultsForm_action_goBack').hide();
}
$('#form_actions_right').remove(); $('#form_actions_right').remove();
Behaviour.apply(); Behaviour.apply();
// Remove the loading indicators from the buttons // Remove the loading indicators from the buttons
@ -136,10 +144,11 @@ $(document).ready(function() {
* Table record handler for search result record * Table record handler for search result record
* @todo: Shouldn't this be part of TableListField? * @todo: Shouldn't this be part of TableListField?
*/ */
$('#right #Form_ResultsForm tbody td a') $('#right #Form_ResultsForm tbody td a:not(.deletelink)')
.livequery('click', function(){ .livequery('click', function(){
$(this).parent().parent().addClass('loading'); $(this).parent().parent().addClass('loading');
var el = $(this); var el = $(this);
$('#ModelAdminPanel').fn('addHistory', el.attr('href'));
$('#ModelAdminPanel').fn('loadForm', el.attr('href')); $('#ModelAdminPanel').fn('loadForm', el.attr('href'));
return false; return false;
}); });
@ -161,8 +170,16 @@ $(document).ready(function() {
/** /**
* RHS panel Back button * RHS panel Back button
*/ */
$('#Form_EditForm_action_goBack').livequery('click', function() { $('#Form_EditForm_action_goBack, #Form_ResultsForm_action_goBack').livequery('click', function() {
if(__lastSearch) __lastSearch.trigger('submit'); $('#ModelAdminPanel').fn('goBack');
return false;
});
/**
* RHS panel Back button
*/
$('#Form_ResultsForm_action_goForward').livequery('click', function() {
$('#ModelAdminPanel').fn('goForward');
return false; return false;
}); });
@ -257,9 +274,63 @@ $(document).ready(function() {
loadForm: function(url, successCallback) { loadForm: function(url, successCallback) {
$('#right #ModelAdminPanel').load(url, standardStatusHandler(function(result) { $('#right #ModelAdminPanel').load(url, standardStatusHandler(function(result) {
if(typeof(successCallback) == 'function') successCallback.apply(); if(typeof(successCallback) == 'function') successCallback.apply();
if(!this.future || !this.future.length) {
$('#Form_EditForm_action_goForward, #Form_ResultsForm_action_goForward').hide();
}
if(!this.history || this.history.length <= 1) {
$('#Form_EditForm_action_goBack, #Form_ResultsForm_action_goBack').hide();
}
Behaviour.apply(); // refreshes ComplexTableField Behaviour.apply(); // refreshes ComplexTableField
})); }));
},
startHistory: function(url, data) {
this.history = [];
$(this).fn('addHistory', url, data);
},
/**
* Add an item to the history, to be accessed by goBack and goForward
*/
addHistory: function(url, data) {
// Combine data into URL
if(data) {
if(url.indexOf('?') == -1) url += '?' + $.param(data);
else url += '&' + $.param(data);
}
// Add to history
if(this.history == null) this.history = [];
this.history.push(url);
// Reset future
this.future = [];
},
goBack: function() {
if(this.history && this.history.length) {
if(this.future == null) this.future = [];
var currentPage = this.history.pop();
var previousPage = this.history[this.history.length-1];
this.future.push(currentPage);
$(this).fn('loadForm', previousPage);
}
},
goForward: function() {
if(this.future && this.future.length) {
if(this.future == null) this.future = [];
var nextPage = this.future.pop();
this.history.push(nextPage);
$(this).fn('loadForm', nextPage);
}
} }
}); });
/** /**

View File

@ -39,7 +39,7 @@ if((typeof tinyMCE != 'undefined')) {
safari_warning : false, safari_warning : false,
relative_urls : true, relative_urls : true,
verify_html : true, verify_html : true,
valid_elements : "+a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],-td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align],-span[class|align],-pre[class|align],address[class|align],-h1[id|dir|class|align],-h2[id|dir|class|align],-h3[id|dir|class|align],-h4[id|dir|class|align],-h5[id|dir|class|align],-h6[id|dir|class|align],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir]", valid_elements : "+a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],-td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align],-span[class|align],-pre[class|align],address[class|align],-h1[id|dir|class|align],-h2[id|dir|class|align],-h3[id|dir|class|align],-h4[id|dir|class|align],-h5[id|dir|class|align],-h6[id|dir|class|align],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],iframe[align<bottom?left?middle?right?top|class|frameborder|height|id|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style|title|width]",
extended_valid_elements : "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],script[src|type],object[width|height|type|data],param[value|name]" extended_valid_elements : "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],script[src|type],object[width|height|type|data],param[value|name]"
}); });
} }