diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 2129570f0..331390c0d 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -1035,7 +1035,7 @@ class e_admin_dispatcher if($this->adminMenu) { reset($this->adminMenu); - list($mode, $action) = explode('/', key($this->adminMenu), 2); + list($mode, $action) = explode('/', key($this->adminMenu), 3); } else { @@ -1303,11 +1303,14 @@ class e_admin_dispatcher { $tp = e107::getParser(); $var = array(); - + $selected = false; foreach($this->adminMenu as $key => $val) { - $tmp = explode('/', trim($key, '/'), 2); - + $tmp = explode('/', trim($key, '/'), 3); + + // custom 'selected' check + if(isset($val['selected']) && $val['selected']) $selected = $val['selected'] === true ? $key : $val['selected']; + foreach ($val as $k=>$v) { switch($k) @@ -1321,6 +1324,11 @@ class e_admin_dispatcher $k2 = 'link'; $v = $tp->replaceConstants($v, 'abs').'?mode='.$tmp[0].'&action='.$tmp[1]; break; + + case 'uri': + $k2 = 'link'; + $v = $tp->replaceConstants($v, 'abs'); + break; default: $k2 = $k; @@ -1352,7 +1360,7 @@ class e_admin_dispatcher } $request = $this->getRequest(); - $selected = $request->getMode().'/'.$request->getAction(); + if(!$selected) $selected = $request->getMode().'/'.$request->getAction(); $selected = vartrue($this->adminMenuAliases[$selected], $selected); return e_admin_menu($this->menuTitle, $selected, $var); } @@ -2009,6 +2017,12 @@ class e_admin_controller_ui extends e_admin_controller * @var string SQL order, false to disable order, null is default order */ protected $listOrder = null; + + /** + * Structure same as TreeModel parameters used for building the load() SQL + * @var additional SQL to be applied when auto-building the list query + */ + protected $listQrySql = array(); /** * @var boolean @@ -2949,7 +2963,14 @@ class e_admin_controller_ui extends e_admin_controller if($raw) { - $rawData = array('joinWhere' => $jwhere, 'filter' => $filter, 'filterFrom' => $filterFrom, 'search' => $searchQry, 'tableFromName' => $tableFrom); + $rawData = array( + 'joinWhere' => $jwhere, + 'filter' => $filter, + 'listQrySql' => $this->listQrySql, + 'filterFrom' => $filterFrom, + 'search' => $searchQry, + 'tableFromName' => $tableFrom, + ); $rawData['tableFrom'] = $tableSFieldsArr; $rawData['joinsFrom'] = $tableSJoinArr; $rawData['joins'] = $joins; @@ -2971,6 +2992,19 @@ class e_admin_controller_ui extends e_admin_controller { $searchQry[] = " ( ".implode(" OR ",$filter)." ) "; } + + // more user added sql + if(isset($this->listQrySql['db_where']) && $this->listQrySql['db_where']) + { + if(is_array($this->listQrySql['db_where'])) + { + $searchQry[] = implode(" AND ", $this->listQrySql['db_where']); + } + else + { + $searchQry[] = $this->listQrySql['db_where']; + } + } // where query if(count($searchQry) > 0) @@ -3701,7 +3735,10 @@ class e_admin_ui extends e_admin_controller_ui }*/ } } - + + // don't touch it if already exists + if($this->_model) return $this; + // default model $this->_model = new e_admin_model(); $this->_model->setModelTable($this->table) @@ -4093,7 +4130,7 @@ class e_admin_form_ui extends e_form $option = array(); $parms = vartrue($val['writeParms'], array()); if(is_string($parms)) parse_str($parms, $parms); - + switch($val['type']) { case 'bool': @@ -4167,7 +4204,7 @@ class e_admin_form_ui extends e_form case 'method': $method = $key; $list = call_user_func_array(array($this, $method), array('', $type, $parms)); - + if(is_array($list)) { //check for single option diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 4d6537f57..20eaf39ae 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -2246,9 +2246,6 @@ class e107 define('e_REQUEST_URI', str_replace(array("'", '"'), array('%27', '%22'), $requestUri)); unset($requestUrl, $requestUri); // END request uri/url detection, XSS protection - - define('e_SIGNUP', e_BASE.(file_exists(e_BASE.'customsignup.php') ? 'customsignup.php' : 'signup.php')); - define('e_LOGIN', e_BASE.(file_exists(e_BASE.'customlogin.php') ? 'customlogin.php' : 'login.php')); // e_SELF has the full HTML path $inAdminDir = FALSE; @@ -2285,6 +2282,10 @@ class e107 define('SITEURLBASE', $this->HTTP_SCHEME.'://'.$_SERVER['HTTP_HOST']); define('SITEURL', SITEURLBASE.e_HTTP); + + // login/signup + define('e_SIGNUP', SITEURL.(file_exists(e_BASE.'customsignup.php') ? 'customsignup.php' : 'signup.php')); + define('e_LOGIN', SITEURL.(file_exists(e_BASE.'customlogin.php') ? 'customlogin.php' : 'login.php')); return $this; } diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 30e111ec9..8d2fdcb14 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -312,11 +312,14 @@ class e_form function userpicker($name_fld, $id_fld, $default_name, $default_id, $options = array()) { if(!is_array($options)) parse_str($options, $options); + + $label_fld = str_replace('_', '-', $name_fld).'-upicker-lable'; //'.$this->text($id_fld, $default_id, 10, array('id' => false, 'readonly'=>true, 'class'=>'tbox number')).' $ret = '