From 0f4698726a1b81db37420fcbc4bb77daed5d72aa Mon Sep 17 00:00:00 2001 From: Normann Lou Date: Mon, 20 Oct 2008 00:20:00 +0000 Subject: [PATCH] APICHANGE: delete GenericDataAdmin, RelatedDataEditor, DropdownField_WithAdd and their related code (js, css, etc) from cms, sapphire, "GenericDataAdmin" name space has also been deleted from lang files. They are all added in the new module "genericdataadmin" git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@64528 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/GenericDataAdmin.php | 699 ------------------- css/GenericDataAdmin.css | 253 ------- javascript/GenericDataAdmin_left.js | 190 ----- javascript/GenericDataAdmin_right.js | 115 --- lang/bg_BG.php | 15 - lang/cs_CZ.php | 3 - lang/da_DK.php | 15 - lang/de_DE.php | 14 - lang/en_US.php | 15 - lang/eo_XX.php | 5 - lang/es_ES.php | 15 - lang/fi_FI.php | 14 - lang/fr_FR.php | 15 - lang/hr_HR.php | 3 - lang/hu_HU.php | 3 - lang/it_IT.php | 12 - lang/lc_XX.php | 3 - lang/nb_NO.php | 3 - lang/ne_NP.php | 3 - lang/nl_NL.php | 15 - lang/pl_PL.php | 15 - lang/pt_BR.php | 3 - lang/pt_PT.php | 13 - lang/ru_RU.php | 15 - lang/si_LK.php | 3 - lang/sk_SK.php | 5 +- lang/sv_SE.php | 1 - lang/tr_TR.php | 15 - lang/zh_CN.php | 3 - lang/zh_TW.php | 3 - templates/Includes/GenericDataAdmin_left.ss | 28 - templates/Includes/GenericDataAdmin_right.ss | 14 - 32 files changed, 1 insertion(+), 1527 deletions(-) delete mode 100755 code/GenericDataAdmin.php delete mode 100755 css/GenericDataAdmin.css delete mode 100755 javascript/GenericDataAdmin_left.js delete mode 100755 javascript/GenericDataAdmin_right.js delete mode 100755 templates/Includes/GenericDataAdmin_left.ss delete mode 100755 templates/Includes/GenericDataAdmin_right.ss diff --git a/code/GenericDataAdmin.php b/code/GenericDataAdmin.php deleted file mode 100755 index b518935e..00000000 --- a/code/GenericDataAdmin.php +++ /dev/null @@ -1,699 +0,0 @@ - 'AccountName' - * ) - * - * Format "list": - * see {@DataObject->buildNestedUL} - */ - static $result_columns; - - /** - * @var string - * Either "table" or "list". List-format also supports second level results. - */ - static $result_format = "table"; - - static $csv_columns; - - private $results; - - function __construct() { - $this->result_actions = new FieldSet( - new FormAction('export', _t('GenericDataAdmin.EXPORTCSV', 'Export as CSV')) - ); - - parent::__construct(); - } - - /** - * Sets Requirements and checks for Permissions. - * Subclass this function to add custom Requirements. - */ - function init() { - parent::init(); - - Requirements::javascript(MCE_ROOT . "tiny_mce_src.js"); - Requirements::javascript(THIRDPARTY_DIR . "/tiny_mce_improvements.js"); - - Requirements::javascript(THIRDPARTY_DIR . "/hover.js"); - Requirements::javascript(THIRDPARTY_DIR . "/scriptaculous/controls.js"); - - Requirements::javascript(CMS_DIR . "/javascript/SecurityAdmin.js"); - Requirements::javascript(CMS_DIR . "/javascript/CMSMain_left.js"); - Requirements::javascript(CMS_DIR . '/javascript/CMSMain_right.js'); - - Requirements::javascript(CMS_DIR . "/javascript/GenericDataAdmin_left.js"); - Requirements::javascript(CMS_DIR . "/javascript/GenericDataAdmin_right.js"); - Requirements::javascript(CMS_DIR . "/javascript/SideTabs.js"); - - // We don't want this showing up in every ajax-response, it should always be present in a CMS-environment - if(!Director::is_ajax()) { - Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array( - "ContentCSS" => project() . "/css/editor.css", - "BaseURL" => Director::absoluteBaseURL(), - "Lang" => i18n::get_tinymce_lang() - )); - } - - Requirements::css(CMS_DIR . "/css/GenericDataAdmin.css"); - - //For wrightgroup workshop - Requirements::css("writework/css/WorkshopCMSLayout.css"); - } - - function Link() { - $args = func_get_args(); - return call_user_func_array( array( &$this, 'getLink' ), $args ); - } - - /** - * @return String - */ - function DataTypeSingular() { - return singleton($this->stat('data_type'))->singular_name(); - } - - /** - * @return String - */ - function DataTypePlural() { - return singleton($this->stat('data_type'))->plural_name(); - } - - /** - * @return Form - */ - function CreationForm() { - // is this plural name used ?? - $plural_name = singleton($this->stat('data_type'))->i18n_plural_name(); - $singular_name = singleton($this->stat('data_type'))->i18n_singular_name(); - return new Form($this, 'CreationForm', new FieldSet(), new FieldSet(new FormAction("createRecord", _t('GenericDataAdmin.CREATE', 'Create').' '.$singular_name))); - } - - /** - * @return Form - */ - function EditForm() { - $id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : Session::get('currentPage'); - if($id && DataObject::get_by_id($this->stat('data_type'), $id)) { - return $this->getEditForm($id); - } - } - - // legacy - function ExportForm() { - return $form = new Form( - $this, - "ExportForm", - new FieldSet( - new HiddenField("csvIDs","csvIDs",$_REQUEST[csvIDs]) - ), - $this->result_actions - ); - } - - /** - * @return Form - */ - function SearchForm() { - - $fields = $this->getSearchFields(); - $actions = new FieldSet($action = new FormAction("getResults", _t('GenericDataAdmin.GO', 'Go'))); - - $searchForm = new Form($this, "SearchForm", $fields, $actions); - $searchForm->loadDataFrom($_REQUEST); - return $searchForm; - } - - /** - * Determines fields and actions for the given {$data_type}, and populates - * these fields with values from {$data_type} and any connected {$data_type_extra}. - * Adds default actions ("save" and "delete") if no custom actions are found. - * Returns an empty form if no fields or actions are found (on first load). - * - * @param $id Number - * @return Form - */ - function getEditForm($id) { - if(isset($_GET['debug_profile'])) Profiler::mark('getEditForm'); - - $genericData = DataObject::get_by_id($this->stat('data_type'), $id); - - $fields = (method_exists($genericData, 'getCMSFields')) ? $genericData->getCMSFields() : new FieldSet(); - - if(!$fields->dataFieldByName('ID')) { - - $fields->push($idField = new HiddenField("ID","ID",$id)); - $idField->setValue($id); - } - - if(method_exists($genericData, 'getGenericStatus')){ - $genericDataStatus = $genericData->getGenericStatus(); - if($genericDataStatus){ - $fields->push($dataStatusField = new ReadonlyField("GenericDataStatus", "", $genericDataStatus)); - $dataStatusField -> dontEscape = true; - } - } - - - $actions = (method_exists($genericData, 'getCMSActions')) ? $genericData->getCMSActions() : new FieldSet(); - if(!$actions->fieldByName('action_save')) { - $actions->push(new FormAction('save', _t('GenericDataAdmin.SAVE', 'Save'),'ajaxAction-save')); - } - if(!$actions->fieldByName('action_delete')) { - $actions->push(new FormAction('delete', _t('GenericDataAdmin.DELETE', 'Delete'),'ajaxAction-delete')); - } - - $required = (method_exists($genericData, 'getCMSRequiredField')) ? $genericData->getCMSRequiredField() : new RequiredFields(); - $form = new Form($this, "EditForm", $fields, $actions, $required); - if($this->stat('data_type_extra')) { - foreach ($this->stat('data_type_extra') as $oneRelated) { - $oneExtra = $genericData-> $oneRelated(); - if($oneExtra) { - $allFields = $oneExtra->getAllFields(); - foreach ($allFields as $k => $v) { - $fieldname = $oneRelated . "[" . $k . "]"; - $allFields[$fieldname] = $v; - unset ($allFields[$k]); - } - - $form->loadDataFrom($allFields); - } - } - } - - $form->loadDataFrom($genericData); - $form->disableDefaultAction(); - - if(isset($_GET['debug_profile'])) Profiler::unmark('getEditForm'); - return $form; - } - - /** - * Display the results of the search. - * @return String - */ - function Results() { - $ret = ""; - - $singular_name = singleton($this->stat('data_type'))->i18n_singular_name(); - $plural_name = singleton($this->stat('data_type'))->i18n_plural_name(); - if (!$this->filter) { - $this->filter = array( - "ClassName" => $this->stat('data_type') - ); - } else { - $this->filter = $this->filter + array("ClassName" => $this->stat('data_type')); - } - - $results = $this->performSearch(); - if($results) { - $name = ($results->Count() > 1) ? $plural_name : $singular_name; - $ret .= "

{$results->Count()} {$name} "._t('GenericDataAdmin.FOUND', 'found:')."

"; - - switch($this->stat('result_format')) { - case 'table': - $ret .= $this->getResultTable($results); - break; - case 'list': - $ret .= $this->getResultList($results); - break; - } - $ret .= $this->getResultActionsForm($results); - } else { - if($this->hasMethod('isEmptySearch') && $this->isEmptySearch()) { - $ret .='

'._t('GenericDataAdmin.CHOOSECRIT', 'Please choose some search criteria and press \'Go\'.').'

'; - } else { - $ret .='

'.sprintf(_t('GenericDataAdmin.NORESULTS', 'Sorry, no %s found by this search.'), $plural_name).'

'; - } - } - return $ret; - } - - function getResults($data, $form) { - return $this->Results($data, $form); - } - - function getResultList($results, $link = true) { - $listBody = $results->buildNestedUL($this->stat('result_columns')); - - return << - $listBody - -HTML; - } - - /** - * @param $results - * @param $link Link the rows to their according result (evaluated by javascript) - * @return String Result-Table as HTML - */ - function getResultTable($results, $link = true) { - $tableHeader = $this->columnheader(); - - $tableBody = $this->columnbody($results); - - return << - - $tableHeader - - - $tableBody - - -HTML; - } - - protected function columnheader(){ - $content = ""; - foreach( array_keys($this->stat('result_columns')) as $field ) { - $content .= $this->htmlTableCell($field); - } - return $this->htmlTableRow($content); - } - - protected function columnbody($results=null) { - // shouldn't be called here, but left in for legacy - if(!$results) { - $results = $this->performSearch(); - } - - $body = ""; - if($results){ - $i=0; - foreach($results as $result){ - $i++; - $html = ""; - foreach($this->stat('result_columns') as $field) { - $value = $this->buildResultFieldValue($result, $field); - $html .= $this->htmlTableCell($value, $this->Link("show", $result->ID), "show", true); - - } - $evenOrOdd = ($i%2)?"even":"odd"; - $row = $this->htmlTableRow($html, null, $evenOrOdd); - $body .= $row; - } - } - return $body; - } - - protected function listbody($results=null) { - - } - - /** - * @param $results Array - * @return String Form-Content - */ - function getResultActionsForm($results) { - $ret = ""; - - $csvValues = array(); - foreach($results as $record) { - $csvValues[] = $record->ID; - } - - $form = new Form( - $this, - "ExportForm", - new FieldSet( - new HiddenField("csvIDs","csvIDs",implode(",",$csvValues)) - ), - $this->result_actions - ); - - $ret = << -{$form->renderWith("Form")} - -HTML; - - return $ret; - } - - /** - * @param $result - * @param $field Mixed can be array: eg: array("FirstName", "Surname"), in which case two fields - * in database table should concatenate to one cell for report table. - * The field could be "Total->Nice" or "Order.Created->Date", intending to show its specific format. - * Caster then is "Nice" "Date" etc. - */ - protected function buildResultFieldValue($result, $field) { - if(is_array($field)) { - // array-syntax - $i = 0; - foreach($field as $each) { - $value .= $i == 0 ? "" : "_"; - $value .= $this->buildResultFieldValue($result, $each); - $i++; - } - } else { - // This supports simple FieldName syntax - if(strpos($field,'.') === false) { - $value = ($result->val($field)) ? $result->val($field) : $result->$field; - // This support the syntax fieldName = Relation.RelatedField - } else { - $fieldNameParts = explode('.', $field) ; - $tmpItem = $result; - for($j=0;$j$relationMethod; - } else { - $tmpItem = $tmpItem->$relationMethod(); - } - } - $result = $tmpItem; - } - - if(strpos($field, '->') !== false) { - list ($field, $caster) = explode("->", $field); - } - - if(!empty($caster)) { - $fieldNameParts = explode('.', $field); - $fieldName = $fieldNameParts[sizeof($fieldNameParts)-1]; - // When the intending value is Created.Date, the obj need to be casted as Datetime explicitely. - if ($field == "Created" || $field == "LastEdited") { - $created = Object::create('Datetime', $result->Created, "Created"); - $value = $created->val($caster); - } else { - // Dealing with other field like "Total->Nice", etc. - $value = $result->obj($fieldName)->val($caster); - } - } - } - - return $value; - } - - protected function htmlTableCell($value, $link = false, $class = "", $id = null) { - if($link) { - return "" . htmlentities($value) . ""; - } else { - return "" . htmlentities($value) . ""; - } - } - - protected function htmlTableRow($value, $link = null, $evenOrOdd = null) { - if ($link) { - return "" . $value . ""; - } else { - return "" . $value . ""; - } - } - - /** - * Exports a given set of comma-separated IDs (from a previous search-query, stored in a HiddenField). - * Uses {$csv_columns} if present, and falls back to {$result_columns}. - */ - function export() { - - $now = Date("s-i-H"); - $fileName = "export-$now.csv"; - - $csv_columns = ($this->stat('csv_columns')) ? array_values($this->stat('csv_columns')) : array_values($this->stat('result_columns')); - - $fileData = ""; - $fileData .= "\"" . implode("\",\"",$csv_columns) . "\""; - $fileData .= "\n"; - - $records = $this->performSearch(); - if($records) { - foreach($records as $record) { - $columnData = array(); - foreach($csv_columns as $column) { - $tmpColumnData = "\"" . str_replace("\"", "\"\"", $record->$column) . "\""; - $tmpColumnData = str_replace(array("\r", "\n"), "", $tmpColumnData); - $columnData[] = $tmpColumnData; - } - $fileData .= implode(",",$columnData); - $fileData .= "\n"; - } - - return HTTPRequest::send_file($fileData, $fileName); - } else { - user_error("No records found", E_USER_ERROR); - } - - } - - - /** - * Save generic data handler - * - * @return String Statusmessage - */ - function save($urlParams, $form) { - - $className = $this->stat('data_type'); - - $id = $_REQUEST['ID']; - - if(substr($id, 0, 3) != 'new') { - $generic = DataObject::get_one($className, "`$className`.ID = $id"); - $generic->__Status = "Saved (Update)"; - } else { - $generic = new $className(); - $generic->__Status = "Saved (New)"; - } - - $form->saveInto($generic, true); - $id = $generic->write(); - - if($this->stat('data_type_extra')) { - foreach($this->stat('data_type_extra') as $oneRelated) { - $oneExtra = $generic->$oneRelated(); - if($_REQUEST[$oneExtra->class]) { - foreach($_REQUEST[$oneExtra->class] as $field => $value) { - $oneExtra->setField($field, $value); - } - } - $oneExtra->write(); - $oneExtra->destroy(); - } - } - $this->getActionUpdateJS($generic); - FormResponse::status_message(_t('GenericDataAdmin.SAVED', 'Saved'), 'good'); - FormResponse::update_status($generic->__Status); - - if (method_exists($this, "saveAfterCall")) { - $this->saveAfterCall($generic, $urlParams, $form); - } - - $generic->destroy(); - - return FormResponse::respond(); - } - - /** - * Show a single record - * - * @return Array Editing Form - */ - function show() { - - Session::set('currentPage', $this->urlParams['ID']); - - $editForm = $this->getEditForm($this->urlParams['ID']); - - if(Director::is_ajax()) { - return $editForm->formHtmlContent(); - } else { - return array ( - 'EditForm' => $editForm - ); - } - } - - /** - * Add a new DataObject - * - * @return String - */ - function createRecord($data, $form) { - $baseClass = $this->stat('data_type'); - $obj = new $baseClass(); - $form->saveInto($obj); - $obj->write(); - - // This appears to be a typo. There is no 'urlParms'. - // $this->urlParms['ID'] = $obj->ID; - - $editForm = $this->getEditForm($obj->ID); - - return (Director::is_ajax()) ? $editForm->formHtmlContent() : array ('EditForm' => $editForm); - } - - /** - * Delete a given Dataobjebt by ID - * - * @param $urlParams Array - * @param $form Form - * @return String - */ - function delete($urlParams, $form) { - $id = Convert::raw2sql($_REQUEST['ID']); - $obj = DataObject::get_by_id($this->stat('data_type'), $id); - if ($obj) { - $obj->delete(); - } - - // clear session data - Session::clear('currentPage'); - - FormResponse::status_message(_t('GenericDataAdmin.DELETEDSUCCESS', 'Successfully deleted'), 'good'); - FormResponse::add("$('Form_EditForm').deleteEffect();"); - - return FormResponse::respond(); - } - - protected function getRelatedData() { - - $relatedName = $_REQUEST['RelatedClass']; - $id = $_REQUEST[$relatedName]['ID']; - $baseClass = $this->stat('data_type'); - $relatedClasses = singleton($baseClass)->stat('has_one'); - if($id){ - $relatedObject = DataObject::get_by_id($relatedClasses[$relatedName], $id); - $response .= <<ParentID = $parentID; - } - $id = $relatedObject->write(); - $response .= <<ParentID = $parentID; - } - $response .= << $v) { - $JS_newKey = Convert::raw2js($relatedName . '[' . $k . ']'); - $JS_newValue = Convert::raw2js($relatedObject-> $k); - $response .=<<stat('data_type'))->$funcName(); - $relatedKeyDropdown->extraClass = "relatedDataKey"; - echo $relatedKeyDropdown->FieldHolder(); - } else { - Director::redirectBack(); - } - } - - /** - * Execute a query based on {$filter} and build a DataObjectSet - * out of the results. - * - * @return DataObjectSet - */ - abstract function performSearch(); - - /** - * Form fields which trigger {getResults} and {peformSearch}. - * Provide HTML in the following format to get auto-collapsing "advanced search"-fields. - *
- * - *
- * - * @return FieldSet - */ - abstract function getSearchFields(); - - /** - * Provide custom link. - * - * @return String - */ - abstract function getLink(); - - //abstract function create(); - - /** - * Legacy - */ - function AddForm() { - return $this->CreationForm(); - } -} -?> diff --git a/css/GenericDataAdmin.css b/css/GenericDataAdmin.css deleted file mode 100755 index 9a99f111..00000000 --- a/css/GenericDataAdmin.css +++ /dev/null @@ -1,253 +0,0 @@ -.right form div.tab { - padding-top: 1em; -} - -form#Form_EditForm #Form_ExportForm fieldset { - height: auto; -} - - -.leftcolumn { - margin: 0; - width: 46%; - float: left; -} - -.rightcolumn { - width: 46%; - margin: 0; - float: right; - clear: right; -} - -.tab div.groupfield, .tab div.groupfield div.groupfield { - margin: 1.2em 0; - border: 1px solid #ffffff; -} - -.tab div.field { - margin: .3em 0; -} - -#left { - width:335px -} - #LeftPane { - background-color: #FFF; - border-left: 1px #ccc solid; - padding: 0; - } - - /* Generic form styling */ - - #LeftPane h3 { - font-size:1.2em; - letter-spacing:1px; - color:#4874C6; - } - - #LeftPane form label.left { - font-size:1.1em; - font-weight:bold; - float:left; - width:100px; - padding-right:3px; - } - - #LeftPane form div { - clear:left; - } - - #LeftPane form div.field { - margin-bottom:5px; - } - - #LeftPane form input { - padding:2px; - } - - #LeftPane form input.text, - #LeftPane form select { - padding:2px; - } - - #LeftPane form input.text { - width:145px; - } - - #LeftPane form div.field select { - width:152px; - } - - #LeftPane #AddForm { - padding: 5px 10px; - } - - #Search_holder { - overflow: auto; - } - - #Search_holder .ToggleAdvancedSearchFields { - margin: 3px 0; - } - - #Search_holder .Actions { - margin: 5px 0; - vertical-align: middle; - } - - #Search_holder h3 { - margin-bottom: 8px; - } - - #LeftPane #Form_CreationForm { - margin: 0; - padding: 0; - } - - #LeftPane #Form_CreationForm .Actions { - margin-left: 1em; - } - - #SearchForm_holder { - overflow: auto; /* TODO */ - padding: 5px 10px; - } - - #SearchForm_holder .indicator { - margin: .8em 0 0 .5em; - display: block; - } - - #Form_SearchForm_action_getResults { - float: left; - } - - #SearchForm_holder #DateRange .calendardate, - #SearchForm_holder #DateRange label{ - float:left; - clear:none; - padding:1px; - } - - #SearchForm_holder #DateRange input { - width:65px; - } - - /* Result list layout */ - div.ResultList { - padding: 1em; - } - - div.ResultList ul { - margin: 0; - padding: 0; - list-style: none; - background:#eee; - } - - div.ResultList li { - padding: .1em; - } - - div.ResultList ul ul { - margin-left: 2em; - } - - div.ResultList li.odd { - background:#f5f5f5; - } - - div.ResultList li.even { - background:#eee; - } - - /* Result table layout */ - table.ResultTable table tbody tr.odd { - background:#f5f5f5; - } - table.ResultTable table tbody tr td { - padding:2px; - } - - table.ResultTable { - padding: 1em; - width: 100%; - } - table.ResultTable * { - border:0; - font-size:1em; - } - table.ResultTable td { - padding: 3px; - } - - table.ResultTable thead tr { - background:#eee; - } - table.ResultTable thead tr td { - font-weight:bold; - letter-spacing:1px; - font-size:1.1em; - } - table.ResultTable tbody tr { - background:#eee; - } - table.ResultTable tbody tr.even { - background:#f0f8ff; - } - table.ResultTable tbody tr.odd { - background:#fff; - } - table.ResultTable tbody tr td { - font-size:1em; - } - - #Search_holder table.ResultTable tbody tr { - cursor: pointer; - } - - #Form_export_action_export { - margin-top: 10px; - } - -#Form_EditForm_GenericDataStatus { - position: absolute; - z-index: 500; - top: -70px; - right: -10px; - text-align: right; - width: 150px; - height: 38px; - - padding: 10px; - - font-size: 14px; - font-weight: bold; - - border: 1px solid #cc9; - color: #660; - background-color: #F9F9E3; -} - -.clear:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} - -.clear {display: inline-block;} - -#LeftPane { - overflow-y: scroll; -} - -/* Hides from IE-mac \*/ -* html .clear {height: 1%;} -.clear { - display: block; - clear: both; -} -/* End hide from IE-mac */ \ No newline at end of file diff --git a/javascript/GenericDataAdmin_left.js b/javascript/GenericDataAdmin_left.js deleted file mode 100755 index 268c5858..00000000 --- a/javascript/GenericDataAdmin_left.js +++ /dev/null @@ -1,190 +0,0 @@ -/** - * Manages searching and displaying of datarecords speccified in GenericDataAdmin. - */ -LeftPane = Class.create(); -LeftPane.applyTo('#LeftPane'); -LeftPane.prototype = { - - effectDuration: .7, - - initialize: function() { - Behaviour.register('LeftPane',{ - '#Form_CreationForm_action_createRecord': { - onclick: this.addNewRecord.bind(this) - }, - - '#Form_SearchForm_action_getResults': { - onclick: this.filterOnChange.bind(this) - }, - /** - * Small hack to keep forms for search and resultActions separate - * in order to avoid DOM-id-duplicates. - */ - '#Form_ExportForm_action_export': { - onclick: function(e) { - var el = Event.element(e); - var origAction = $('Form_SearchForm').action; - $('Form_SearchForm').action = origAction + "&" + el.name + "=1"; - $('Form_SearchForm').submit(); - $('Form_SearchForm').action = origAction; - Event.stop(e); - return false; - }.bind(this) - } - }); - - this.initAdvancedSearch(); - }, - - /** - * If a toggle-link is present, provide functionality to show/hide additional search-options. - */ - initAdvancedSearch: function() { - var advancedSearch = $('AdvancedSearchFields'); - if(!advancedSearch) { - return false; - } - - advancedSearch.style.display = "none"; - var toggleLinks = document.getElementsBySelector('div#LeftPane .ToggleAdvancedSearchFields'); - if(toggleLinks && toggleLinks[0]) toggleLinks[0].style.display = "block"; - - Behaviour.register('LeftPane_initAdvancedSearch',{ - "div#LeftPane .ToggleAdvancedSearchFields a":{ - onclick: function(e){ - var el = Event.element(e); - var advancedSearchDiv = $('AdvancedSearchFields'); - if(advancedSearchDiv.style.display == 'none') { - Effect.SlideDown(advancedSearchDiv,{duration:this.effectDuration}); - el.firstChild.nodeValue = el.firstChild.nodeValue.replace(/Show/,"Hide"); - - } else { - Effect.SlideUp(advancedSearchDiv,{duration:this.effectDuration}); - el.firstChild.nodeValue = el.firstChild.nodeValue.replace(/Hide/,"Show"); - - } - Event.stop(e); - return false; - }.bind(this) - } - }); - }, - - /** - * @param form DOM-Element Needed if you invoke this action externally - */ - addNewRecord: function(e, form) { - var el = Event.element(e); - var form = (form) ? form : Event.findElement(e,"form"); - var link = form.action + "&" + Form.serialize(form); - - // disable button - Form.Element.disable(el); - var openTab = $('Form_EditForm').getCurrentTab(); - var callback = function() { - Form.Element.enable(this); - statusMessage("Record created","good"); - }.bind(Event.element(e)); - $('Form_EditForm').updateCMSContent(el, openTab, link, callback); - - Event.stop(e); - return false; - }, - - displayNewRecord: function(response) { - - $('Form_EditForm').innerHTML = response.responseText; - onload_init_tabstrip(); - // Makes sure content-behaviour is correctly initialized in the main window. - Behaviour.apply( $('Form_EditForm') ); - }, - - filterOnChange: function (e, custom_onComplete) { - try { - // hide existing results - $("ResultTable_holder").innerHTML = ""; - // show loading indicator - showIndicator('SearchLoading', $$('#Form_SearchForm .Actions')[0]); - } catch(e) {} - - - Ajax.SubmitForm( - "Form_SearchForm", - "action_getResults", - { - postBody : 'ajax=1', - onSuccess : this.updateResult.bind(this), - onFailure : function(response) { - errorMessage('Error encountered during search', response); - }, - onComplete : custom_onComplete - } - ); - - Event.stop(e); - - return false; - }, - - updateResult: function(response){ - // hide loading indicator - hideIndicator('SearchLoading'); - - var holder; - if(holder = $('ResultTable_holder')){ - holder.innerHTML = response.responseText; - Behaviour.apply( $('ResultTable_holder') ); - } - }, - - clearFilter: function() { - var searchForm = $('Form_SearchForm'); - var fields = searchForm.getElementsByTagName('input'); - for(var i=0; iSilverStripe CMS

Welcome to SilverStripe CMS! Please choose click on one of the items on the left pane.

", - - initialize : function() { - }, - - updateCMSContent: function(el, currentTab, link, customCallBack) { - if(!customCallBack) customCallBack = function(){}; - - if(el || link){ - var reqLink = (el && el.href) ? el.href : link; - - if(typeof(currentTab) != 'undefined') - $('Form_EditForm').openTab = currentTab; - - statusMessage("loading...", null, true); - - new Ajax.Request(reqLink, { - asynchronous : true, - postBody : 'ajax=1', - onSuccess: customCallBack.bind(this), - onComplete : this.successfullyReceivedPage.bind(this), - onFailure : function(response) { - errorMessage('Error loading page',response); - } - }); - }else{ - $('Form_EditForm').innerHTML = this.welcomeMessage; - } - }, - - successfullyReceivedPage : function(response) { - $('Form_EditForm').loadNewPage(response.responseText); - $('Form_EditForm').initialize(); - onload_init_tabstrip(); - // TODO - // try to reopen saved tab (before ajax request) - if($('Form_EditForm').openTab) { - openTab($('Form_EditForm').openTab); - } else { - $('Form_EditForm').openTab = this.getCurrentTab(); - openTab($('Form_EditForm').openTab); - } - - clearStatusMessage(); - }, - - remove: function(e) { - if(window.confirm('Are you sure you want to delete?')){ - var el = Event.element(e); - Ajax.SubmitForm($('Form_EditForm'), el.name, { - postBody : 'ajax=1', - onSuccess: Ajax.Evaluator, - onFailure: ajaxErrorHandler - }); - } - Event.stop(e); - return false; - }, - - deleteEffect: function() { - new Effect.Fade(this, {duration:2}); - window.setTimeout(function() { - $('Form_EditForm').updateCMSContent(); - new Effect.Appear($('Form_EditForm'), {duration:3}); - }, 3000); - }, - - tabExists: function(tabName) { - if($('Root')){ - var tags = $('Root').getElementsByTagName('li'); - for(var i=0; i -#left_separator { - border-bottom: 3px solid #d4d0c8; -} - -#SearchFrom_holder{ - border-bottom: 1px solid #808080; -} - - - -
-

<% _t('ADDLISTING','Add Listing') %>

-
- $AddForm -
-

<% _t('SEARCHLISTINGS','Search Listings') %>

-
- $SearchForm -
-
-   -
-

<% _t('SEARCHRESULTS','Search Results') %>

-
- $Results -
-
\ No newline at end of file diff --git a/templates/Includes/GenericDataAdmin_right.ss b/templates/Includes/GenericDataAdmin_right.ss deleted file mode 100755 index 850d259b..00000000 --- a/templates/Includes/GenericDataAdmin_right.ss +++ /dev/null @@ -1,14 +0,0 @@ -<% include Editor_toolbar %> - -<% if EditForm %> - $EditForm -<% else %> -
-

$ApplicationName

- -

<% _t('WELCOME1', 'Welcome to') %> $ApplicationName! <% _t('WELCOME2', 'Please choose click on one of the entries on the left pane.') %>

- -
-<% end_if %> - -