diff --git a/code/AssetAdmin.php b/code/AssetAdmin.php
index 886d37cc..3cc10925 100755
--- a/code/AssetAdmin.php
+++ b/code/AssetAdmin.php
@@ -35,6 +35,7 @@ class AssetAdmin extends LeftAndMain {
'save',
'savefile',
'uploadiframe',
+ 'UploadForm',
'deleteUnusedThumbnails' => 'ADMIN'
);
diff --git a/code/GenericDataAdmin.php b/code/GenericDataAdmin.php
index 99b983dd..62650f72 100755
--- a/code/GenericDataAdmin.php
+++ b/code/GenericDataAdmin.php
@@ -14,6 +14,9 @@ abstract class GenericDataAdmin extends LeftAndMain {
'getResults',
'save',
'show',
+ 'CreationForm',
+ 'ExportForm',
+ 'SearchForm',
);
public $filter;
diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php
index 4e05889b..236ab6ac 100644
--- a/code/LeftAndMain.php
+++ b/code/LeftAndMain.php
@@ -35,7 +35,8 @@ class LeftAndMain extends Controller {
'printable',
'save',
'show',
- 'Member_ProfileForm'
+ 'Member_ProfileForm',
+ 'EditorToolbar',
);
/**
@@ -120,7 +121,9 @@ class LeftAndMain extends Controller {
Requirements::javascript('jsparty/tree/tree.js');
Requirements::css('jsparty/tree/tree.css');
+ /*
Requirements::javascript('jsparty/tabstrip/tabstrip.js');
+ */
Requirements::css('jsparty/tabstrip/tabstrip.css');
Requirements::css('cms/css/TinyMCEImageEnhancement.css');
diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php
index 2be815d3..ace1115e 100644
--- a/code/ModelAdmin.php
+++ b/code/ModelAdmin.php
@@ -354,16 +354,18 @@ class ModelAdmin_CollectionController extends Controller {
$model = singleton($this->modelClass);
$searchKeys = array_intersect_key($request->getVars(), $model->searchable_fields());
$context = $model->getDefaultSearchContext();
- $results = $context->getResults($searchKeys, 0, $this->parentController->stat('page_length'));
- $output = "";
+ $results = $context->getResults($searchKeys, null, array('start'=>0, 'limit'=>$this->parentController->stat('page_length')));
+ $output = "
" . _t('ModelAdmin.SEARCHRESULTS','Search Results') . "
\n";
+
+
if ($results) {
- $output .= "";
+ $output .= "";
foreach($results as $row) {
$uri = Director::absoluteBaseUrl();
$output .= "modelClass}/{$row->ID}/edit\">";
foreach($model->searchable_fields() as $key=>$val) {
$output .= "";
- $output .= $row->getField($key);
+ $output .= $row->$key;
$output .= " | ";
}
$output .= "
";
@@ -374,6 +376,23 @@ class ModelAdmin_CollectionController extends Controller {
}
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;
- $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->loadDataFrom($this->currentRecord);
diff --git a/css/ModelAdmin.css b/css/ModelAdmin.css
index cd23b3e3..84df26e2 100644
--- a/css/ModelAdmin.css
+++ b/css/ModelAdmin.css
@@ -30,26 +30,25 @@ body.ModelAdmin #ResultTable_holder {
overflow:auto;
}
-body.ModelAdmin #ResultTable_holder table {
+body.ModelAdmin #right table.results {
margin:6px;
padding:0;
border-spacing:0 2px;
- width:230px;
}
-body.ModelAdmin #ResultTable_holder table td {
- font-size:11px;
+body.ModelAdmin #right table.results td {
+ font-size:12px;
font-weight:bold;
background-color:#fff;
padding:2px;
}
-body.ModelAdmin #ResultTable_holder table td.over {
+body.ModelAdmin #right table.results td.over {
background-color:#bbb;
cursor:pointer;
}
-body.ModelAdmin #ResultTable_holder table td.active {
+body.ModelAdmin #right table.results td.active {
background-color:#555;
color:#fff;
}
diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js
index c1e85f9d..1eeeaffd 100644
--- a/javascript/LeftAndMain.js
+++ b/javascript/LeftAndMain.js
@@ -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++ ) {
fitToParent(_TAB_DIVS_ON_PAGE[i], 30);
}
diff --git a/javascript/ModelAdmin.js b/javascript/ModelAdmin.js
index bc343fd8..7197d48d 100644
--- a/javascript/ModelAdmin.js
+++ b/javascript/ModelAdmin.js
@@ -9,6 +9,10 @@
* @todo alias the $ function instead of literal jQuery
*/
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
@@ -22,6 +26,11 @@ jQuery(document).ready(function() {
// Is livequery a solution?
Behaviour.apply(); // refreshes ComplexTableField
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
@@ -84,11 +93,13 @@ jQuery(document).ready(function() {
* @todo use livequery to manage ResultTable click handlers
*/
jQuery('#SearchForm_holder .tab form').submit(function(){
+ __lastSearch = jQuery(this);
+
form = jQuery(this);
data = formData(form);
jQuery.get(form.attr('action'), data, function(result){
- jQuery('#ResultTable_holder').html(result);
- jQuery('#ResultTable_holder td').click(function(){
+ jQuery('#right').html(result);
+ jQuery('#right td').click(function(){
td = jQuery(this);
showRecord(td.parent().attr('title'));
td.parent().parent().find('td').removeClass('active');
diff --git a/templates/Includes/ModelAdmin_left.ss b/templates/Includes/ModelAdmin_left.ss
index 3ff1a3e0..f49c480e 100755
--- a/templates/Includes/ModelAdmin_left.ss
+++ b/templates/Includes/ModelAdmin_left.ss
@@ -25,7 +25,8 @@
<% end_control %>
- <% _t('SEARCHRESULTS','Search Results') %>
+
\ No newline at end of file