1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

admin UI: more improvements

This commit is contained in:
secretr 2009-11-16 12:23:07 +00:00
parent 6276128b98
commit ab85df618d
2 changed files with 83 additions and 49 deletions

View File

@ -9,8 +9,8 @@
* Administration UI handlers, admin helper functions * Administration UI handlers, admin helper functions
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/admin_handler.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/admin_handler.php,v $
* $Revision: 1.27 $ * $Revision: 1.28 $
* $Date: 2009-11-15 20:24:55 $ * $Date: 2009-11-16 12:23:07 $
* $Author: secretr $ * $Author: secretr $
*/ */
@ -1709,7 +1709,7 @@ class e_admin_controller
{ {
$this->$actionObserverName(); $this->$actionObserverName();
} }
// check for triggers, not available in Ajax mode // check for triggers, not available in Ajax mode
if(!e_AJAX_REQUEST && $this->triggersEnabled()) if(!e_AJAX_REQUEST && $this->triggersEnabled())
{ {
@ -1718,7 +1718,7 @@ class e_admin_controller
{ {
if(strpos($key, 'etrigger_') === 0) if(strpos($key, 'etrigger_') === 0)
{ {
$actionTriggerName = $this->toMethodName($action.$request->camelize(substr($key, 9)), 'trigger', false); $actionTriggerName = $this->toMethodName($action.$request->camelize(substr($key, 9)), 'trigger', false);
if(method_exists($this, $actionTriggerName)) if(method_exists($this, $actionTriggerName))
{ {
$this->$actionTriggerName($value); $this->$actionTriggerName($value);
@ -2022,6 +2022,17 @@ class e_admin_controller_ui extends e_admin_controller
*/ */
protected $tableAlias; protected $tableAlias;
/**
* @var string plugin name
*/
protected $pluginName;
/**
* Could be LAN constant (mulit-language support)
* @var string plugin name
*/
protected $pluginTitle;
/** /**
* Default (db) limit value * Default (db) limit value
* @var integer * @var integer
@ -2048,6 +2059,22 @@ class e_admin_controller_ui extends e_admin_controller
*/ */
protected $_pref = null; protected $_pref = null;
/**
* @return string
*/
public function getPluginName()
{
return $this->pluginName;
}
/**
* @return string
*/
public function getPluginTitle()
{
return deftrue($this->pluginTitle, $this->pluginTitle);
}
/** /**
* Get all field data * Get all field data
* @return array * @return array
@ -2322,6 +2349,30 @@ class e_admin_controller_ui extends e_admin_controller
return $this; return $this;
} }
/**
* Manage column visibility
* @param string $batch_trigger
* @return
*/
public function manageColumns()
{
$cols = array();
$posted = $this->getPosted('e-columns', array());
foreach ($this->getFields() as $field => $attr)
{
if((vartrue($attr['forced']) || in_array($field, $posted)) && !vartrue($attr['nolist']))
{
$cols[] = $field;
continue;
}
}
if($cols)
{
$this->setUserPref($cols);
}
}
/** /**
* Handle posted batch options routine * Handle posted batch options routine
* @param string $batch_trigger * @param string $batch_trigger
@ -2632,7 +2683,7 @@ class e_admin_controller_ui extends e_admin_controller
} }
// TODO - abstract, array return type, move to parent? // TODO - abstract, array return type, move to parent?
protected function _modifyListQry($raw = false, $isfilter = false, $forceFrom = false, $forceTo = false, $listQry) protected function _modifyListQry($raw = false, $isfilter = false, $forceFrom = false, $forceTo = false, $listQry = '')
{ {
$searchQry = array(); $searchQry = array();
$filterFrom = array(); $filterFrom = array();
@ -2819,14 +2870,11 @@ class e_admin_ui extends e_admin_controller_ui
protected $dataFields = array(); protected $dataFields = array();
protected $validationRules = array(); protected $validationRules = array();
protected $pluginName;
protected $listQry;
protected $editQry;
protected $table; protected $table;
protected $pid; protected $pid;
protected $listQry;
protected $editQry;
protected $pluginTitle;
protected $batchDelete = true; protected $batchDelete = true;
/** /**
@ -2856,6 +2904,17 @@ class e_admin_ui extends e_admin_controller_ui
$this->addTitle($this->pluginTitle, true)->parseAliases(); $this->addTitle($this->pluginTitle, true)->parseAliases();
} }
/**
* Catch fieldpref submit
* @param string $batch_trigger
* @return
*/
public function ListEcolumnsTrigger()
{
$this->triggersEnabled(false); //disable further triggering
parent::manageColumns();
}
/** /**
* Catch batch submit * Catch batch submit
* @param string $batch_trigger * @param string $batch_trigger
@ -2952,31 +3011,6 @@ class e_admin_ui extends e_admin_controller_ui
$this->getTreeModel()->setMessages(); $this->getTreeModel()->setMessages();
} }
/**
* Catch fieldpref submit
* @param string $batch_trigger
* @return
*/
public function ListEcolumnsTrigger()
{
$this->triggersEnabled(false); //disable further triggering
$cols = array();
$posted = $this->getPosted('e-columns', array());
foreach ($this->getFields() as $field => $attr)
{
if((vartrue($attr['forced']) || in_array($field, $posted)) && !vartrue($attr['nolist']))
{
$cols[] = $field;
continue;
}
}
if($cols)
{
$this->setUserPref($cols);
}
}
/** /**
* Catch delete submit * Catch delete submit
* @param string $batch_trigger * @param string $batch_trigger
@ -3183,7 +3217,7 @@ class e_admin_ui extends e_admin_controller_ui
*/ */
function CreateHeader() function CreateHeader()
{ {
// TODO - make it part of e_from::textarea/bbarea(), invoke it on className (not all textarea elements) // TODO - invoke it on className (not all textarea elements)
e107::getJs()->requireCoreLib('core/admin.js'); e107::getJs()->requireCoreLib('core/admin.js');
} }
@ -3198,7 +3232,6 @@ class e_admin_ui extends e_admin_controller_ui
public function PrefsSaveTrigger() public function PrefsSaveTrigger()
{ {
$this->getConfig() $this->getConfig()
->setPostedData($this->getPosted(), null, false, false) ->setPostedData($this->getPosted(), null, false, false)
//->setPosted('not_existing_pref_test', 1) //->setPosted('not_existing_pref_test', 1)
@ -3243,16 +3276,6 @@ class e_admin_ui extends e_admin_controller_ui
return $this->pid; return $this->pid;
} }
public function getPluginName()
{
return $this->pluginName;
}
public function getPluginTitle()
{
return $this->pluginTitle;
}
public function getTableName($alias = false, $prefix = false) public function getTableName($alias = false, $prefix = false)
{ {
if($alias) return ($this->tableAlias ? $this->tableAlias : ''); if($alias) return ($this->tableAlias ? $this->tableAlias : '');

View File

@ -9,8 +9,8 @@
* e107 Base Model * e107 Base Model
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
* $Revision: 1.36 $ * $Revision: 1.37 $
* $Date: 2009-11-10 19:13:06 $ * $Date: 2009-11-16 12:23:07 $
* $Author: secretr $ * $Author: secretr $
*/ */
@ -902,6 +902,17 @@ class e_model
return $this; return $this;
} }
/**
* Update parameter array
* @param array $params
* @return e_model
*/
public function updateParams(array $params)
{
$this->_params = array_merge($this->_params, $params);
return $this;
}
/** /**
* Get parameter array * Get parameter array
* *