mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
(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:
parent
f16a4e9492
commit
c1a7419f36
@ -405,7 +405,7 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
$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->setHTMLID("Form_SearchForm_" . $this->modelClass);
|
||||
$clearAction->useButtonTag = true;
|
||||
@ -451,10 +451,9 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function search($request) {
|
||||
$form = $this->ResultsForm();
|
||||
|
||||
return $form->forTemplate();
|
||||
function search($request, $form) {
|
||||
$resultsForm = $this->ResultsForm($form->getData());
|
||||
return $resultsForm->forTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -464,10 +463,9 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
*
|
||||
* @return SQLQuery
|
||||
*/
|
||||
function getSearchQuery() {
|
||||
function getSearchQuery($searchCriteria) {
|
||||
$context = singleton($this->modelClass)->getDefaultSearchContext();
|
||||
|
||||
return $context->getQuery($this->request->getVars());
|
||||
return $context->getQuery($searchCriteria);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -475,7 +473,7 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
*
|
||||
* @return Form
|
||||
*/
|
||||
function ResultsForm() {
|
||||
function ResultsForm($searchCritera) {
|
||||
$model = singleton($this->modelClass);
|
||||
$summaryFields = $model->summaryFields();
|
||||
$resultAssembly = $_REQUEST['ResultAssembly'];
|
||||
@ -489,7 +487,7 @@ class ModelAdmin_CollectionController extends Controller {
|
||||
$this->modelClass,
|
||||
$summaryFields
|
||||
);
|
||||
$tf->setCustomQuery($this->getSearchQuery());
|
||||
$tf->setCustomQuery($this->getSearchQuery($searchCriteria));
|
||||
$tf->setPageSize($this->parentController->stat('page_length'));
|
||||
$tf->setShowPagination(true);
|
||||
$tf->setPermissions(array_merge(array('view','export'), $model->stat('results_permissions')));
|
||||
|
@ -72,8 +72,9 @@ jQuery(document).ready(function() {
|
||||
var data = {};
|
||||
jQuery('*[name]', scope).each(function(){
|
||||
var t = jQuery(this);
|
||||
var val = (t.attr('type') == 'checkbox') ? (t.attr('checked') == true) ? 1 : 0 : t.val();
|
||||
data[t.attr('name')] = val;
|
||||
if(t.attr('type') != 'checkbox' || t.attr('checked') == true) {
|
||||
data[t.attr('name')] = t.val();
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user