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@60227 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
39f7ba95bf
commit
689c34400b
@ -35,6 +35,7 @@ class AssetAdmin extends LeftAndMain {
|
|||||||
'save',
|
'save',
|
||||||
'savefile',
|
'savefile',
|
||||||
'uploadiframe',
|
'uploadiframe',
|
||||||
|
'UploadForm',
|
||||||
'deleteUnusedThumbnails' => 'ADMIN'
|
'deleteUnusedThumbnails' => 'ADMIN'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ abstract class GenericDataAdmin extends LeftAndMain {
|
|||||||
'getResults',
|
'getResults',
|
||||||
'save',
|
'save',
|
||||||
'show',
|
'show',
|
||||||
|
'CreationForm',
|
||||||
|
'ExportForm',
|
||||||
|
'SearchForm',
|
||||||
);
|
);
|
||||||
|
|
||||||
public $filter;
|
public $filter;
|
||||||
|
@ -35,7 +35,8 @@ class LeftAndMain extends Controller {
|
|||||||
'printable',
|
'printable',
|
||||||
'save',
|
'save',
|
||||||
'show',
|
'show',
|
||||||
'Member_ProfileForm'
|
'Member_ProfileForm',
|
||||||
|
'EditorToolbar',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,7 +121,9 @@ class LeftAndMain extends Controller {
|
|||||||
Requirements::javascript('jsparty/tree/tree.js');
|
Requirements::javascript('jsparty/tree/tree.js');
|
||||||
Requirements::css('jsparty/tree/tree.css');
|
Requirements::css('jsparty/tree/tree.css');
|
||||||
|
|
||||||
|
/*
|
||||||
Requirements::javascript('jsparty/tabstrip/tabstrip.js');
|
Requirements::javascript('jsparty/tabstrip/tabstrip.js');
|
||||||
|
*/
|
||||||
Requirements::css('jsparty/tabstrip/tabstrip.css');
|
Requirements::css('jsparty/tabstrip/tabstrip.css');
|
||||||
|
|
||||||
Requirements::css('cms/css/TinyMCEImageEnhancement.css');
|
Requirements::css('cms/css/TinyMCEImageEnhancement.css');
|
||||||
|
@ -354,16 +354,18 @@ class ModelAdmin_CollectionController extends Controller {
|
|||||||
$model = singleton($this->modelClass);
|
$model = singleton($this->modelClass);
|
||||||
$searchKeys = array_intersect_key($request->getVars(), $model->searchable_fields());
|
$searchKeys = array_intersect_key($request->getVars(), $model->searchable_fields());
|
||||||
$context = $model->getDefaultSearchContext();
|
$context = $model->getDefaultSearchContext();
|
||||||
$results = $context->getResults($searchKeys, 0, $this->parentController->stat('page_length'));
|
$results = $context->getResults($searchKeys, null, array('start'=>0, 'limit'=>$this->parentController->stat('page_length')));
|
||||||
$output = "";
|
$output = "<h2>" . _t('ModelAdmin.SEARCHRESULTS','Search Results') . "</h2>\n";
|
||||||
|
|
||||||
|
|
||||||
if ($results) {
|
if ($results) {
|
||||||
$output .= "<table>";
|
$output .= "<table class=\"results\">";
|
||||||
foreach($results as $row) {
|
foreach($results as $row) {
|
||||||
$uri = Director::absoluteBaseUrl();
|
$uri = Director::absoluteBaseUrl();
|
||||||
$output .= "<tr title=\"{$uri}admin/crm/{$this->modelClass}/{$row->ID}/edit\">";
|
$output .= "<tr title=\"{$uri}admin/crm/{$this->modelClass}/{$row->ID}/edit\">";
|
||||||
foreach($model->searchable_fields() as $key=>$val) {
|
foreach($model->searchable_fields() as $key=>$val) {
|
||||||
$output .= "<td>";
|
$output .= "<td>";
|
||||||
$output .= $row->getField($key);
|
$output .= $row->$key;
|
||||||
$output .= "</td>";
|
$output .= "</td>";
|
||||||
}
|
}
|
||||||
$output .= "</tr>";
|
$output .= "</tr>";
|
||||||
@ -375,6 +377,23 @@ class ModelAdmin_CollectionController extends Controller {
|
|||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action to render results for an autocomplete filter.
|
||||||
|
*
|
||||||
|
* @param unknown_type $request
|
||||||
|
* @return unknown
|
||||||
|
*/
|
||||||
|
function filter($request) {
|
||||||
|
$model = singleton($this->modelClass);
|
||||||
|
$context = $model->getDefaultSearchContext();
|
||||||
|
$value = $request->getVar('q');
|
||||||
|
$results = $context->getResults(array("Name"=>$value));
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
foreach($results as $result) {
|
||||||
|
echo $result->Name . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -461,7 +480,10 @@ class ModelAdmin_RecordController extends Controller {
|
|||||||
|
|
||||||
$validator = ($this->currentRecord->hasMethod('getCMSValidator')) ? $this->currentRecord->getCMSValidator() : null;
|
$validator = ($this->currentRecord->hasMethod('getCMSValidator')) ? $this->currentRecord->getCMSValidator() : null;
|
||||||
|
|
||||||
$actions = new FieldSet(new FormAction("doSave", "Save"));
|
$actions = new FieldSet(
|
||||||
|
new FormAction("goBack", "Back"),
|
||||||
|
new FormAction("doSave", "Save")
|
||||||
|
);
|
||||||
|
|
||||||
$form = new Form($this, "EditForm", $fields, $actions, $validator);
|
$form = new Form($this, "EditForm", $fields, $actions, $validator);
|
||||||
$form->loadDataFrom($this->currentRecord);
|
$form->loadDataFrom($this->currentRecord);
|
||||||
|
@ -30,26 +30,25 @@ body.ModelAdmin #ResultTable_holder {
|
|||||||
overflow:auto;
|
overflow:auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.ModelAdmin #ResultTable_holder table {
|
body.ModelAdmin #right table.results {
|
||||||
margin:6px;
|
margin:6px;
|
||||||
padding:0;
|
padding:0;
|
||||||
border-spacing:0 2px;
|
border-spacing:0 2px;
|
||||||
width:230px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body.ModelAdmin #ResultTable_holder table td {
|
body.ModelAdmin #right table.results td {
|
||||||
font-size:11px;
|
font-size:12px;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
background-color:#fff;
|
background-color:#fff;
|
||||||
padding:2px;
|
padding:2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.ModelAdmin #ResultTable_holder table td.over {
|
body.ModelAdmin #right table.results td.over {
|
||||||
background-color:#bbb;
|
background-color:#bbb;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.ModelAdmin #ResultTable_holder table td.active {
|
body.ModelAdmin #right table.results td.active {
|
||||||
background-color:#555;
|
background-color:#555;
|
||||||
color:#fff;
|
color:#fff;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ window.ontabschanged = function() {
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if( _TAB_DIVS_ON_PAGE ) {
|
if(typeof _TAB_DIVS_ON_PAGE != 'undefined') {
|
||||||
for(i = 0; i < _TAB_DIVS_ON_PAGE.length; i++ ) {
|
for(i = 0; i < _TAB_DIVS_ON_PAGE.length; i++ ) {
|
||||||
fitToParent(_TAB_DIVS_ON_PAGE[i], 30);
|
fitToParent(_TAB_DIVS_ON_PAGE[i], 30);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
* @todo alias the $ function instead of literal jQuery
|
* @todo alias the $ function instead of literal jQuery
|
||||||
*/
|
*/
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
|
/**
|
||||||
|
* Stores a jQuery reference to the last submitted search form.
|
||||||
|
*/
|
||||||
|
__lastSearch = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET a fragment of HTML to display in the right panel
|
* GET a fragment of HTML to display in the right panel
|
||||||
@ -22,6 +26,11 @@ jQuery(document).ready(function() {
|
|||||||
// Is livequery a solution?
|
// Is livequery a solution?
|
||||||
Behaviour.apply(); // refreshes ComplexTableField
|
Behaviour.apply(); // refreshes ComplexTableField
|
||||||
jQuery('#right ul.tabstrip').tabs();
|
jQuery('#right ul.tabstrip').tabs();
|
||||||
|
|
||||||
|
jQuery('#Form_EditForm_action_goBack').click(function() {
|
||||||
|
if(__lastSearch) __lastSearch.trigger('submit');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,9 +82,9 @@ jQuery(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach tabs plugin to the set of search filter forms
|
* Attach tabs plugin to the set of search filter and edit forms
|
||||||
*/
|
*/
|
||||||
jQuery('#SearchForm_holder').tabs();
|
jQuery('ul.tabstrip').tabs();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submits a search filter query and attaches event handlers
|
* Submits a search filter query and attaches event handlers
|
||||||
@ -84,11 +93,13 @@ jQuery(document).ready(function() {
|
|||||||
* @todo use livequery to manage ResultTable click handlers
|
* @todo use livequery to manage ResultTable click handlers
|
||||||
*/
|
*/
|
||||||
jQuery('#SearchForm_holder .tab form').submit(function(){
|
jQuery('#SearchForm_holder .tab form').submit(function(){
|
||||||
|
__lastSearch = jQuery(this);
|
||||||
|
|
||||||
form = jQuery(this);
|
form = jQuery(this);
|
||||||
data = formData(form);
|
data = formData(form);
|
||||||
jQuery.get(form.attr('action'), data, function(result){
|
jQuery.get(form.attr('action'), data, function(result){
|
||||||
jQuery('#ResultTable_holder').html(result);
|
jQuery('#right').html(result);
|
||||||
jQuery('#ResultTable_holder td').click(function(){
|
jQuery('#right td').click(function(){
|
||||||
td = jQuery(this);
|
td = jQuery(this);
|
||||||
showRecord(td.parent().attr('title'));
|
showRecord(td.parent().attr('title'));
|
||||||
td.parent().parent().find('td').removeClass('active');
|
td.parent().parent().find('td').removeClass('active');
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end_control %>
|
<% end_control %>
|
||||||
</div>
|
</div>
|
||||||
<h2><% _t('SEARCHRESULTS','Search Results') %></h2>
|
<!--
|
||||||
<div id="ResultTable_holder" class="leftbottom">
|
<div id="ResultTable_holder" class="leftbottom">
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue
Block a user