(merged from branches/roa. use "svn log -c <changeset> -g <module-svn-path>" for detailed commit message)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@60330 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-08-11 03:03:52 +00:00
parent f16a4e9492
commit c1a7419f36
2 changed files with 11 additions and 12 deletions

View File

@ -405,7 +405,7 @@ class ModelAdmin_CollectionController extends Controller {
$clearAction = new ResetFormAction('clearsearch', _t('ModelAdmin.CLEAR_SEARCH','Clear Search')) $clearAction = new ResetFormAction('clearsearch', _t('ModelAdmin.CLEAR_SEARCH','Clear Search'))
) )
); );
$form->setFormAction(Controller::join_links($this->Link(), "search")); //$form->setFormAction(Controller::join_links($this->Link(), "search"));
$form->setFormMethod('get'); $form->setFormMethod('get');
$form->setHTMLID("Form_SearchForm_" . $this->modelClass); $form->setHTMLID("Form_SearchForm_" . $this->modelClass);
$clearAction->useButtonTag = true; $clearAction->useButtonTag = true;
@ -451,10 +451,9 @@ class ModelAdmin_CollectionController extends Controller {
* *
* @return string * @return string
*/ */
function search($request) { function search($request, $form) {
$form = $this->ResultsForm(); $resultsForm = $this->ResultsForm($form->getData());
return $resultsForm->forTemplate();
return $form->forTemplate();
} }
/** /**
@ -464,10 +463,9 @@ class ModelAdmin_CollectionController extends Controller {
* *
* @return SQLQuery * @return SQLQuery
*/ */
function getSearchQuery() { function getSearchQuery($searchCriteria) {
$context = singleton($this->modelClass)->getDefaultSearchContext(); $context = singleton($this->modelClass)->getDefaultSearchContext();
return $context->getQuery($searchCriteria);
return $context->getQuery($this->request->getVars());
} }
/** /**
@ -475,7 +473,7 @@ class ModelAdmin_CollectionController extends Controller {
* *
* @return Form * @return Form
*/ */
function ResultsForm() { function ResultsForm($searchCritera) {
$model = singleton($this->modelClass); $model = singleton($this->modelClass);
$summaryFields = $model->summaryFields(); $summaryFields = $model->summaryFields();
$resultAssembly = $_REQUEST['ResultAssembly']; $resultAssembly = $_REQUEST['ResultAssembly'];
@ -489,7 +487,7 @@ class ModelAdmin_CollectionController extends Controller {
$this->modelClass, $this->modelClass,
$summaryFields $summaryFields
); );
$tf->setCustomQuery($this->getSearchQuery()); $tf->setCustomQuery($this->getSearchQuery($searchCriteria));
$tf->setPageSize($this->parentController->stat('page_length')); $tf->setPageSize($this->parentController->stat('page_length'));
$tf->setShowPagination(true); $tf->setShowPagination(true);
$tf->setPermissions(array_merge(array('view','export'), $model->stat('results_permissions'))); $tf->setPermissions(array_merge(array('view','export'), $model->stat('results_permissions')));

View File

@ -72,8 +72,9 @@ jQuery(document).ready(function() {
var data = {}; var data = {};
jQuery('*[name]', scope).each(function(){ jQuery('*[name]', scope).each(function(){
var t = jQuery(this); var t = jQuery(this);
var val = (t.attr('type') == 'checkbox') ? (t.attr('checked') == true) ? 1 : 0 : t.val(); if(t.attr('type') != 'checkbox' || t.attr('checked') == true) {
data[t.attr('name')] = val; data[t.attr('name')] = t.val();
}
}); });
return data; return data;
} }