From 808283fc1167c856c198b9e27fd7f0112b9ad6c4 Mon Sep 17 00:00:00 2001 From: secretr Date: Mon, 8 Nov 2010 09:20:12 +0000 Subject: [PATCH] Admin UI improvements and fixes; introducing 'lanlist' field type; 'multiple' dropdown option possible now but incomplete (batch, filter related work required) --- e107_handlers/admin_ui.php | 48 +++++++++++++-- e107_handlers/form_handler.php | 102 ++++++++++++++++++++++++++++--- e107_handlers/language_class.php | 14 ++++- 3 files changed, 150 insertions(+), 14 deletions(-) diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index ebbcaba6d..64b1fb605 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -2349,6 +2349,12 @@ class e_admin_controller_ui extends e_admin_controller { return e107::getRegistry('core/adminUI/currentListModel'); } + + public function setListModel($model) + { + e107::setRegistry('core/adminUI/currentListModel', $model); + return $this; + } /** * User defined tree model setter @@ -2607,6 +2613,17 @@ class e_admin_controller_ui extends e_admin_controller $value = trim($value) ? e107::getInstance()->ipEncode($value) : ''; } break; + + case 'dropdown': // TODO - ask Steve if this check is required + case 'lanlist': + if(is_array($value)) + { + // no sanitize here - data is added to model posted stack + // and validated & sanitized before sent to db + //$value = array_map(array(e107::getParser(), 'toDB'), $value); + $value = implode(',', $value); + } + break; } if(vartrue($attributes['dataPath'])) { @@ -2729,6 +2746,7 @@ class e_admin_controller_ui extends e_admin_controller */ protected function parseAliases() { + if($this->_alias_parsed) return $this; // already parsed!!! if($this->getJoinData()) { foreach ($this->getJoinData() as $table => $att) @@ -2741,7 +2759,7 @@ class e_admin_controller_ui extends e_admin_controller $att['table'] = $tmp[1]; $att['__tablePath'] = $att['alias'].'.'; $att['__tableFrom'] = '`#'.$att['table'].'` AS '.$att['alias']; - $this->setJoinData($att['alias'], $att); + $this->setJoinData($att['alias'], $att); unset($tmp); continue; } @@ -2752,7 +2770,7 @@ class e_admin_controller_ui extends e_admin_controller $this->setJoinData($table, $att); } } - + // check for table & field aliases $fields = array(); // preserve order foreach ($this->fields as $field => $att) @@ -2803,7 +2821,7 @@ class e_admin_controller_ui extends e_admin_controller }*/ } $this->fields = $fields; - + $this->_alias_parsed = true; return $this; } @@ -2923,7 +2941,7 @@ class e_admin_controller_ui extends e_admin_controller if($raw) { - $rawData = array('joinWhere' => $jwhere, 'filter' => $filter, 'filterFrom' => $filterFrom, 'search' => $searchQry, 'tableFrom' => $tableFrom); + $rawData = array('joinWhere' => $jwhere, 'filter' => $filter, 'filterFrom' => $filterFrom, 'search' => $searchQry, 'tableFromName' => $tableFrom); $rawData['tableFrom'] = $tableSFieldsArr; $rawData['joinsFrom'] = $tableSJoinArr; $rawData['joins'] = $joins; @@ -4084,12 +4102,34 @@ class e_admin_form_ui extends e_form break; case 'dropdown': // use the array $parm; + if(!is_array(varset($parms['__options']))) parse_str($parms['__options'], $parms['__options']); + $opts = $parms['__options']; + if(vartrue($opts['multiple'])) + { + // no batch support for multiple, should have some for filters soon + continue; + } unset($parms['__options']); //remove element options if any foreach($parms as $k => $name) { $option[$key.'__'.$k] = $name; } break; + + case 'lanlist': // use the array $parm; + if(!is_array(varset($parms['__options']))) parse_str($parms['__options'], $parms['__options']); + $opts = $parms['__options']; + if(vartrue($opts['multiple'])) + { + // no batch support for multiple, should have some for filters soon + continue; + } + $options = e107::getLanguage()->getLanSelectArray(); + foreach($options as $code => $name) + { + $option[$key.'__'.$code] = $name; + } + break; case 'datestamp': // use $parm to determine unix-style or YYYY-MM-DD //TODO last hour, today, yesterday, this-month, last-month etc. diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index ef59a7478..f765d76c7 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -536,7 +536,7 @@ class e_form function select_open($name, $options = array()) { - $options = $this->format_options('select', $name, $options); + $options = $this->format_options('select', $name, $options); return "