mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
Admin tools - more work
This commit is contained in:
@@ -542,7 +542,7 @@ class e_admin_response
|
|||||||
*/
|
*/
|
||||||
function getBody($namespace = 'default', $reset = false, $glue = '')
|
function getBody($namespace = 'default', $reset = false, $glue = '')
|
||||||
{
|
{
|
||||||
$content = varset($this->_body[$namespace]);
|
$content = vartrue($this->_body[$namespace], array());
|
||||||
if($reset)
|
if($reset)
|
||||||
{
|
{
|
||||||
$this->_body[$namespace] = array();
|
$this->_body[$namespace] = array();
|
||||||
@@ -886,7 +886,7 @@ class e_admin_dispatcher
|
|||||||
/**
|
/**
|
||||||
* @var e_admin_controller
|
* @var e_admin_controller
|
||||||
*/
|
*/
|
||||||
protected $_current_controller;
|
protected $_current_controller = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Required (set by child class).
|
* Required (set by child class).
|
||||||
@@ -1109,6 +1109,7 @@ class e_admin_dispatcher
|
|||||||
protected function _initController()
|
protected function _initController()
|
||||||
{
|
{
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
$response = $this->getResponse();
|
||||||
if(isset($this->controllerList[$request->getModeName()]) && isset($this->controllerList[$request->getModeName()]['controller']))
|
if(isset($this->controllerList[$request->getModeName()]) && isset($this->controllerList[$request->getModeName()]['controller']))
|
||||||
{
|
{
|
||||||
$class_name = $this->controllerList[$request->getModeName()]['controller'];
|
$class_name = $this->controllerList[$request->getModeName()]['controller'];
|
||||||
@@ -1120,7 +1121,7 @@ class e_admin_dispatcher
|
|||||||
}
|
}
|
||||||
if($class_name && class_exists($class_name))//NOTE: autoload in the play
|
if($class_name && class_exists($class_name))//NOTE: autoload in the play
|
||||||
{
|
{
|
||||||
$this->_current_controller = new $class_name();
|
$this->_current_controller = new $class_name($request, $response);
|
||||||
//give access to current request object, user defined init
|
//give access to current request object, user defined init
|
||||||
$this->_current_controller->setRequest($this->getRequest())->init();
|
$this->_current_controller->setRequest($this->getRequest())->init();
|
||||||
}
|
}
|
||||||
@@ -1149,7 +1150,7 @@ class e_admin_dispatcher
|
|||||||
public function getDefaultController()
|
public function getDefaultController()
|
||||||
{
|
{
|
||||||
$class_name = $this->getDefaultControllerName();
|
$class_name = $this->getDefaultControllerName();
|
||||||
return new $class_name();
|
return new $class_name($this->getRequest(), $this->getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1202,8 +1203,8 @@ class e_admin_dispatcher
|
|||||||
$var[$key]['link'] = (vartrue($val['url']) ? $tp->replaceConstants($val['url'], 'abs') : e_SELF).'?mode='.$tmp[0].'&action='.$tmp[1];
|
$var[$key]['link'] = (vartrue($val['url']) ? $tp->replaceConstants($val['url'], 'abs') : e_SELF).'?mode='.$tmp[0].'&action='.$tmp[1];
|
||||||
$var[$key]['perm'] = $val['perm']; */
|
$var[$key]['perm'] = $val['perm']; */
|
||||||
}
|
}
|
||||||
|
$request = $this->getRequest();
|
||||||
e_admin_menu($this->menuTitle, $this->getMode().'/'.$this->getAction(), $var);
|
e_admin_menu($this->menuTitle, $request->getMode().'/'.$request->getAction(), $var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1436,6 +1437,21 @@ class e_admin_controller
|
|||||||
return $this->getResponse()->getHeaderContent();
|
return $this->getResponse()->getHeaderContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMode()
|
||||||
|
{
|
||||||
|
return $this->getRequest()->getMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAction()
|
||||||
|
{
|
||||||
|
return $this->getRequest()->getAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->getRequest()->getId();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get response owned JS Helper instance, response proxy method
|
* Get response owned JS Helper instance, response proxy method
|
||||||
*
|
*
|
||||||
@@ -1609,3 +1625,868 @@ class e_admin_controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME - move everything from e_admin_controller_main except model auto-create related code
|
||||||
|
class e_admin_controller_base extends e_admin_controller
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class e_admin_controller_main extends e_admin_controller_base
|
||||||
|
{
|
||||||
|
protected $fields = array();
|
||||||
|
protected $fieldpref = array();
|
||||||
|
protected $fieldTypes = array();
|
||||||
|
protected $dataFields = array();
|
||||||
|
protected $validationRules = array();
|
||||||
|
protected $prefs = array();
|
||||||
|
protected $pluginName;
|
||||||
|
protected $listQry;
|
||||||
|
protected $editQry;
|
||||||
|
protected $table;
|
||||||
|
protected $pid;
|
||||||
|
protected $pluginTitle;
|
||||||
|
protected $perPage = 20;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var e_admin_model
|
||||||
|
*/
|
||||||
|
protected $_model = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var e_admin_tree_model
|
||||||
|
*/
|
||||||
|
protected $_tree_model = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var e_admin_tree_model
|
||||||
|
*/
|
||||||
|
protected $_ui = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var e_plugin_pref|e_core_pref
|
||||||
|
*/
|
||||||
|
protected $_pref = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param e_admin_request $request
|
||||||
|
* @param e_admin_response $response
|
||||||
|
* @param array $params [optional]
|
||||||
|
*/
|
||||||
|
public function __construct($request, $response, $params = array())
|
||||||
|
{
|
||||||
|
parent::__construct($request, $response, $params);
|
||||||
|
if(!$this->pluginName)
|
||||||
|
{
|
||||||
|
$this->pluginName = 'core';
|
||||||
|
}
|
||||||
|
$this->_pref = $this->pluginName == 'core' ? e107::getConfig() : e107::getPlugConfig($this->pluginName);
|
||||||
|
|
||||||
|
$ufieldpref = $this->getUserPref();
|
||||||
|
if($ufieldpref)
|
||||||
|
{
|
||||||
|
$this->fieldpref = $ufieldpref;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addTitle($this->pluginTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default is List action page
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function DefaultPage()
|
||||||
|
{
|
||||||
|
return $this->getUI()->getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List action observer
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function ListObserver()
|
||||||
|
{
|
||||||
|
$this->getTreeModel()->load();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List action header
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function ListHead()
|
||||||
|
{
|
||||||
|
e107::getJs()->headerCore('core/tabs.js')
|
||||||
|
->headerCore('core/admin.js');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List action page
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function ListPage()
|
||||||
|
{
|
||||||
|
return $this->getUI()->getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPerPage()
|
||||||
|
{
|
||||||
|
return $this->perPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPrimaryName()
|
||||||
|
{
|
||||||
|
return $this->pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPluginName()
|
||||||
|
{
|
||||||
|
return $this->pluginName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPluginTitle()
|
||||||
|
{
|
||||||
|
return $this->pluginTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTableName()
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFields()
|
||||||
|
{
|
||||||
|
return $this->fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldPref()
|
||||||
|
{
|
||||||
|
return $this->fieldpref;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Config object
|
||||||
|
* @return e_plugin_pref|e_core_pref
|
||||||
|
*/
|
||||||
|
public function getConfig()
|
||||||
|
{
|
||||||
|
return $this->_pref;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get column preference array
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getUserPref()
|
||||||
|
{
|
||||||
|
global $user_pref;
|
||||||
|
return vartrue($user_pref['admin_cols_'.$this->getTableName()], array());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModel()
|
||||||
|
{
|
||||||
|
if(null === $this->_model)
|
||||||
|
{
|
||||||
|
// default model
|
||||||
|
$this->_model = new e_admin_model();
|
||||||
|
$this->_model->setModelTable($this->table)
|
||||||
|
->setFieldIdName($this->pid)
|
||||||
|
->setValidationRules($this->validationRules)
|
||||||
|
->setFieldTypes($this->fieldTypes)
|
||||||
|
->setDataFields($this->dataFields)
|
||||||
|
->load($this->getId());
|
||||||
|
}
|
||||||
|
return $this->_model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setModel($model)
|
||||||
|
{
|
||||||
|
$this->_model = $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTreeModel()
|
||||||
|
{
|
||||||
|
if(null === $this->_tree_model)
|
||||||
|
{
|
||||||
|
// default tree model
|
||||||
|
$this->_tree_model = new e_admin_tree_model();
|
||||||
|
$this->_tree_model->setModelTable($this->table)
|
||||||
|
->setParams(array('model_class' => 'e_admin_model', 'db_query' => $this->listQry));
|
||||||
|
}
|
||||||
|
return $this->_tree_model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTreeModel($tree_model)
|
||||||
|
{
|
||||||
|
$this->_tree_model = $tree_model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getUI()
|
||||||
|
{
|
||||||
|
if(null === $this->_ui)
|
||||||
|
{
|
||||||
|
// default ui
|
||||||
|
$this->_ui = new e_admin_ui($this);
|
||||||
|
}
|
||||||
|
return $this->_ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUI($ui)
|
||||||
|
{
|
||||||
|
$this->_ui = $ui;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class e_admin_ui extends e_form
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var e_admin_controller_main
|
||||||
|
*/
|
||||||
|
protected $_controller = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param e_admin_controller_main $controller
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
function __construct($controller, $tabindex = false)
|
||||||
|
{
|
||||||
|
$this->_controller = $controller;
|
||||||
|
parent::__construct($tabindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User defined init
|
||||||
|
*/
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create list view
|
||||||
|
* Search for the following GET variables:
|
||||||
|
* - from: integer, current page
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getList()
|
||||||
|
{
|
||||||
|
$controller = $this->getController();
|
||||||
|
$request = $controller->getRequest();
|
||||||
|
$tree = $controller->getTreeModel()->getTree();
|
||||||
|
$total = $controller->getTreeModel()->getTotal();
|
||||||
|
|
||||||
|
$amount = $controller->getPerPage();
|
||||||
|
$from = $controller->getQuery('from', 0);
|
||||||
|
$field = $controller->getQuery('field', $controller->getPrimaryName());
|
||||||
|
$asc = strtoupper($controller->getQuery('asc', 'desc'));
|
||||||
|
$elid = ($controller->getPluginName() == 'core' ? 'core-' : '').str_replace('_', '-', $controller->getTableName());
|
||||||
|
|
||||||
|
$text = $tree ? $this->renderFilter() : '';
|
||||||
|
$text .= "
|
||||||
|
<form method='post' action='".e_SELF."?' id='{$elid}-list-form'>
|
||||||
|
<fieldset id='{$elid}-list'>
|
||||||
|
<legend class='e-hideme'>".$controller->getPluginTitle()."</legend>
|
||||||
|
<table cellpadding='0' cellspacing='0' class='adminlist' id='{$elid}-list-table'>
|
||||||
|
".$this->colGroup($controller->getFields(), $controller->getFieldPref())."
|
||||||
|
".$this->thead($controller->getFields(), $controller->getFieldPref(), 'mode='.$request->buildQueryString('field=[FIELD]&asc=[ASC]&from=[FROM]'))."
|
||||||
|
<tbody>
|
||||||
|
";
|
||||||
|
|
||||||
|
|
||||||
|
if(!$tree)
|
||||||
|
{
|
||||||
|
$text .= "
|
||||||
|
<tr>
|
||||||
|
<td colspan='".count($controller->getFieldPref())."' class='center middle'>".LAN_NO_RECORDS."</td>
|
||||||
|
</tr>
|
||||||
|
";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach($tree as $model)
|
||||||
|
{
|
||||||
|
$text .= $this->trow($controller->getFields(), $controller->getFieldPref(), $field->getData(), $controller->getPrimaryName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
";
|
||||||
|
|
||||||
|
$text .= $tree ? $this->renderBatch() : '';
|
||||||
|
|
||||||
|
$text .= "
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
";
|
||||||
|
|
||||||
|
if($tree)
|
||||||
|
{
|
||||||
|
$parms = $total.",".$amount.",".$from.",".e_SELF.'?'.$request->buildQueryString('from=[FROM]');
|
||||||
|
$text .= e107::getParser()->parseTemplate("{NEXTPREV={$parms}}");
|
||||||
|
}
|
||||||
|
|
||||||
|
//e107::getRender()->tablerender($this->pluginTitle." :: ".$this->adminMenu['list']['caption'], $mes->render().$text);
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderFilter($current_query, $input_options = array())
|
||||||
|
{
|
||||||
|
if(!$input_options) $input_options = array('size' => 20);
|
||||||
|
$text = "
|
||||||
|
<form method='get' action='".e_SELF."?".e_QUERY."'>
|
||||||
|
<div class='left' style='padding-bottom:10px'>
|
||||||
|
".$this->text('searchquery', $current_query, 50, $input_options)."
|
||||||
|
".$this->select_open('filter_options', array('class' => 'tbox select e-filter-options', 'id' => false))."
|
||||||
|
".$this->option('Display All', '')."
|
||||||
|
".$this->renderBatchFilter('filter')."
|
||||||
|
".$this->select_close()."
|
||||||
|
".$this->admin_button('etrigger_filter', LAN_FILTER)."
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
"; //TODO assign CSS
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderBatch()
|
||||||
|
{
|
||||||
|
$fields = $this->getController()->getFields();
|
||||||
|
if(!varset($fields['checkboxes']))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$text = "<div class='buttons-bar left'>
|
||||||
|
<img src='".e_IMAGE_ABS."generic/branchbottom.gif' alt='' class='icon action' />";
|
||||||
|
$text .= $frm->select_open('etrigger_batch', array('class' => 'tbox select e-execute-batch', 'id' => false)).
|
||||||
|
$this->option('With selected...', '').
|
||||||
|
$this->option(LAN_DELETE, 'batch__delete');
|
||||||
|
$text .= $this->renderBatchFilter('batch');
|
||||||
|
$text .= "</div>";
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO - do more
|
||||||
|
function renderBatchFilter($type='batch') // Common function used for both batches and filters.
|
||||||
|
{
|
||||||
|
$optdiz = array('batch' => 'Modify ', 'filter'=> 'Filter by ');
|
||||||
|
$table = $this->getController()->getTableName();
|
||||||
|
|
||||||
|
foreach($this->getController()->getFields() as $key=>$val)
|
||||||
|
{
|
||||||
|
if(!varset($val[$type]))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$option = array();
|
||||||
|
|
||||||
|
switch($val['type'])
|
||||||
|
{
|
||||||
|
case 'boolean': //TODO modify description based on $val['parm]
|
||||||
|
$option[$type.'__'.$key."__1"] = LAN_YES;
|
||||||
|
$option[$type.'__'.$key."__0"] = LAN_NO;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'dropdown': // use the array $parm;
|
||||||
|
foreach($val['parm'] as $k=>$name)
|
||||||
|
{
|
||||||
|
$option[$type.'__'.$key."__".$k] = $name;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'date': // use $parm to determine unix-style or YYYY-MM-DD
|
||||||
|
//TODO last hour, today, yesterday, this-month, last-month etc.
|
||||||
|
/* foreach($val['parm'] as $k=>$name)
|
||||||
|
{
|
||||||
|
$text .= $frm->option($name, $type.'__'.$key."__".$k);
|
||||||
|
}*/
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'userclass':
|
||||||
|
$classes = e107::getUserClass()->uc_required_class_list($val['parm']);
|
||||||
|
foreach($classes as $k=>$name)
|
||||||
|
{
|
||||||
|
$option[$type. '__'.$key."__".$k] = $name;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'method':
|
||||||
|
$method = $key;
|
||||||
|
$list = $this->$method('', $type);
|
||||||
|
foreach($list as $k=>$name)
|
||||||
|
{
|
||||||
|
$option[$type.'__'.$key."__".$k] = $name;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($option)>0)
|
||||||
|
{
|
||||||
|
$text .= "\t".$this->optgroup_open($optdiz[$type].$val['title'], $disabled)."\n";
|
||||||
|
foreach($option as $okey=>$oval)
|
||||||
|
{
|
||||||
|
$sel = ($_SESSION[$table."_".$type] == $okey) ? TRUE : FALSE; //FIXME - GET
|
||||||
|
$text .= $this->option($oval, $okey, $sel)."\n";
|
||||||
|
}
|
||||||
|
$text .= "\t".$this->optgroup_close()."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return e_admin_controller_main
|
||||||
|
*/
|
||||||
|
public function getController()
|
||||||
|
{
|
||||||
|
return $this->_controller;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// One handler to rule them all
|
||||||
|
// see e107_plugins/release/admin_config.php.
|
||||||
|
class e_admin_ui_dummy extends e_form
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var e_admin_controller_main
|
||||||
|
*/
|
||||||
|
protected $_controller = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param e_admin_controller_main $controller
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
function __construct($controller)
|
||||||
|
{
|
||||||
|
$this->_controller = $controller;
|
||||||
|
parent::__construct(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
|
||||||
|
global $user_pref; // e107::getConfig('user') ??
|
||||||
|
|
||||||
|
$this->mode = varset($_GET['mode']) ? $_GET['mode'] : 'list';
|
||||||
|
|
||||||
|
$column_pref_name = "admin_".$this->table."_columns";
|
||||||
|
|
||||||
|
if(isset($_POST['submit-e-columns']))
|
||||||
|
{
|
||||||
|
$user_pref[$column_pref_name] = $_POST['e-columns'];
|
||||||
|
save_prefs('user');
|
||||||
|
$this->mode = 'list';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->fieldpref = (varset($user_pref[$column_pref_name])) ? $user_pref[$column_pref_name] : array_keys($this->fields);
|
||||||
|
|
||||||
|
foreach($this->fields as $k=>$v) // Find Primary table ID field (before checkboxes is run. ).
|
||||||
|
{
|
||||||
|
if(vartrue($v['primary']))
|
||||||
|
{
|
||||||
|
$this->pid = $k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(varset($_POST['execute_batch']))
|
||||||
|
{
|
||||||
|
if(vartrue($_POST['multiselect']))
|
||||||
|
{
|
||||||
|
// $_SESSION[$this->table."_batch"] = $_POST['execute_batch']; // DO we want this to 'stick'?
|
||||||
|
list($tmp,$field,$value) = explode('__',$_POST['execute_batch']);
|
||||||
|
$this->processBatch($field,$_POST['multiselect'],$value);
|
||||||
|
}
|
||||||
|
$this->mode = 'list';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(varset($_POST['execute_filter'])) // Filter the db records.
|
||||||
|
{
|
||||||
|
$_SESSION[$this->table."_filter"] = $_POST['filter_options'];
|
||||||
|
list($tmp,$filterField,$filterValue) = explode('__',$_POST['filter_options']);
|
||||||
|
$this->modifyListQry($_POST['searchquery'],$filterField,$filterValue);
|
||||||
|
$this->mode = 'list';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(varset($_POST['update']) || varset($_POST['create']))
|
||||||
|
{
|
||||||
|
|
||||||
|
$id = intval($_POST['record_id']);
|
||||||
|
$this->saveRecord($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(varset($_POST['delete']))
|
||||||
|
{
|
||||||
|
$id = key($_POST['delete']);
|
||||||
|
$this->deleteRecord($id);
|
||||||
|
$this->mode = "list";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(varset($_POST['saveOptions']))
|
||||||
|
{
|
||||||
|
$this->saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(varset($_POST['edit']))
|
||||||
|
{
|
||||||
|
$this->mode = 'create';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($this->mode) // Render Page.
|
||||||
|
{
|
||||||
|
$method = $this->mode."Page";
|
||||||
|
$this->$method();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function modifyListQry($search,$filterField,$filterValue)
|
||||||
|
{
|
||||||
|
$searchQry = array();
|
||||||
|
|
||||||
|
if(vartrue($filterField) && vartrue($filterValue))
|
||||||
|
{
|
||||||
|
$searchQry[] = $filterField." = '".$filterValue."'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter = array();
|
||||||
|
|
||||||
|
foreach($this->fields as $key=>$var)
|
||||||
|
{
|
||||||
|
if(($var['type'] == 'text' || $var['type'] == 'method') && vartrue($search))
|
||||||
|
{
|
||||||
|
$filter[] = "(".$key." REGEXP ('".$search."'))";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(count($filter)>0)
|
||||||
|
{
|
||||||
|
$searchQry[] = " (".implode(" OR ",$filter)." )";
|
||||||
|
}
|
||||||
|
if(count($searchQry)>0)
|
||||||
|
{
|
||||||
|
$this->listQry .= " WHERE ".implode(" AND ",$searchQry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function processBatch($field,$ids,$value)
|
||||||
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
|
if($field == 'delete')
|
||||||
|
{
|
||||||
|
return $sql->db_Delete($this->table,$this->pid." IN (".implode(",",$ids).")");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!is_numeric($value))
|
||||||
|
{
|
||||||
|
$value = "'".$value."'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $field." = ".$value." WHERE ".$this->pid." IN (".implode(",",$ids).") ";
|
||||||
|
$count = $sql->db_Update($this->table,$query);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic DB Record Creation Form.
|
||||||
|
* @param object $id [optional]
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
function createPage()
|
||||||
|
{
|
||||||
|
global $e_userclass, $e_event;
|
||||||
|
|
||||||
|
$id = varset($_POST['edit']) ? key($_POST['edit']) : "";
|
||||||
|
|
||||||
|
$tp = e107::getParser();
|
||||||
|
$ns = e107::getRender();
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$frm = e107::getForm();
|
||||||
|
|
||||||
|
|
||||||
|
if($id)
|
||||||
|
{
|
||||||
|
$query = str_replace("{ID}",$id,$this->editQry);
|
||||||
|
$sql->db_Select_gen($query);
|
||||||
|
$row = $sql->db_Fetch(MYSQL_ASSOC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$row = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$text = "
|
||||||
|
<form method='post' action='".e_SELF."?mode=list' id='dataform' enctype='multipart/form-data'>
|
||||||
|
<fieldset id='core-cpage-create-general'>
|
||||||
|
<legend class='e-hideme'>".$this->pluginTitle."</legend>
|
||||||
|
<table cellpadding='0' cellspacing='0' class='adminedit'>
|
||||||
|
<colgroup span='2'>
|
||||||
|
<col class='col-label' />
|
||||||
|
<col class='col-control' />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>";
|
||||||
|
|
||||||
|
foreach($this->fields as $key=>$att)
|
||||||
|
{
|
||||||
|
if($att['forced']!==TRUE)
|
||||||
|
{
|
||||||
|
$text .= "
|
||||||
|
<tr>
|
||||||
|
<td class='label'>".$att['title']."</td>
|
||||||
|
<td class='control'>".$this->renderElement($key,$row)."</td>
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class='buttons-bar center'>";
|
||||||
|
|
||||||
|
if($id)
|
||||||
|
{
|
||||||
|
$text .= $frm->admin_button('update', LAN_UPDATE, 'update');
|
||||||
|
$text .= "<input type='hidden' name='record_id' value='".$id."' />";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$text .= $frm->admin_button('create', LAN_CREATE, 'create');
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>";
|
||||||
|
|
||||||
|
$ns->tablerender($this->pluginTitle." :: ".$this->adminMenu['create']['caption'], $text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic Save DB Record Function.
|
||||||
|
* @param object $id [optional]
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
function saveRecord($id=FALSE)
|
||||||
|
{
|
||||||
|
global $e107cache, $admin_log, $e_event;
|
||||||
|
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
|
$insert_array = array();
|
||||||
|
|
||||||
|
//TODO validation and sanitizing using above classes.
|
||||||
|
|
||||||
|
foreach($this->fields as $key=>$att)
|
||||||
|
{
|
||||||
|
if($att['forced']!=TRUE)
|
||||||
|
{
|
||||||
|
$insert_array[$key] = $_POST[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($id)
|
||||||
|
{
|
||||||
|
$insert_array['WHERE'] = $this->primary." = ".$id;
|
||||||
|
$status = $sql->db_Update($this->table,$insert_array) ? E_MESSAGE_SUCCESS : E_MESSAGE_FAILED;
|
||||||
|
$message = LAN_UPDATED; // deliberately ambiguous - to be used on success or error.
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$status = $sql->db_Insert($this->table,$insert_array) ? E_MESSAGE_SUCCESS : E_MESSAGE_FAILED;
|
||||||
|
$message = LAN_CREATED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$mes->add($message, $status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic Delete DB Record Function.
|
||||||
|
* @param object $id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
function deleteRecord($id)
|
||||||
|
{
|
||||||
|
if(!$id || !$this->primary || !$this->table)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
|
$query = $this->primary." = ".$id;
|
||||||
|
$status = $sql->db_Delete($this->table,$query) ? E_MESSAGE_SUCCESS : E_MESSAGE_FAILED;
|
||||||
|
$message = LAN_DELETED;
|
||||||
|
$mes->add($message, $status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render Form Element (edit page)
|
||||||
|
* @param object $key
|
||||||
|
* @param object $row
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
function renderElement($key,$row)
|
||||||
|
{
|
||||||
|
$frm = e107::getForm();
|
||||||
|
|
||||||
|
$att = ($this->mode == 'options') ? $this->prefs[$key] : $this->fields[$key];
|
||||||
|
$value = $row[$key];
|
||||||
|
|
||||||
|
if($att['type']=='method')
|
||||||
|
{
|
||||||
|
$meth = $key;
|
||||||
|
return $this->$meth($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($att['type']=='boolean')
|
||||||
|
{
|
||||||
|
return $frm->radio_switch($key, $row[$key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $frm->text($key, $row[$key], 50);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render Field value (listing page)
|
||||||
|
* @param object $key
|
||||||
|
* @param object $row
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
function renderValue($key,$row) // NO LONGER REQUIRED. use $frm->trow();
|
||||||
|
{
|
||||||
|
$att = $this->fields[$key];
|
||||||
|
//TODO add checkbox.
|
||||||
|
|
||||||
|
if($att['type']=='method')
|
||||||
|
{
|
||||||
|
$meth = $key;
|
||||||
|
return $this->$meth($row[$key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($key == "options")
|
||||||
|
{
|
||||||
|
$id = $this->primary;
|
||||||
|
// $text = "<input type='image' class='action edit' name='edit[{$row[$id]}]' src='".ADMIN_EDIT_ICON_PATH."' title='".LAN_EDIT."' />";
|
||||||
|
// $text .= "<input type='image' class='action delete' name='delete[{$row[$id]}]' src='".ADMIN_DELETE_ICON_PATH."' title='".LAN_DELETE." [ ID: {$row[$id]} ]' />";
|
||||||
|
// return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch($att['type'])
|
||||||
|
{
|
||||||
|
case 'url':
|
||||||
|
return "<a href='".$row[$key]."'>".$row[$key]."</a>";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return $row[$key];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $row[$key] .$att['type'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic Options/Preferences Form.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
function optionsPage()
|
||||||
|
{
|
||||||
|
$pref = e107::getConfig()->getPref();
|
||||||
|
$frm = e107::getForm();
|
||||||
|
$ns = e107::getRender();
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
|
//XXX Lan - Options
|
||||||
|
$text = "
|
||||||
|
<form method='post' action='".e_SELF."?".e_QUERY."'>
|
||||||
|
<fieldset id='core-cpage-options'>
|
||||||
|
<legend class='e-hideme'>".LAN_OPTIONS."</legend>
|
||||||
|
<table cellpadding='0' cellspacing='0' class='adminform'>
|
||||||
|
<colgroup span='2'>
|
||||||
|
<col class='col-label' />
|
||||||
|
<col class='col-control' />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>\n";
|
||||||
|
|
||||||
|
|
||||||
|
foreach($this->prefs as $key => $var)
|
||||||
|
{
|
||||||
|
$text .= "
|
||||||
|
<tr>
|
||||||
|
<td class='label'>".$var['title']."</td>
|
||||||
|
<td class='control'>
|
||||||
|
".$this->renderElement($key,$pref)."
|
||||||
|
</td>
|
||||||
|
</tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "</tbody>
|
||||||
|
</table>
|
||||||
|
<div class='buttons-bar center'>
|
||||||
|
".$frm->admin_button('saveOptions', LAN_SAVE, 'submit')."
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
";
|
||||||
|
|
||||||
|
$ns->tablerender($this->pluginTitle." :: ".LAN_OPTIONS, $mes->render().$text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function saveSettings() //TODO needs to use native e_model functions, validation etc.
|
||||||
|
{
|
||||||
|
global $pref, $admin_log;
|
||||||
|
|
||||||
|
unset($_POST['saveOptions'],$_POST['e-columns']);
|
||||||
|
|
||||||
|
foreach($_POST as $key=>$val)
|
||||||
|
{
|
||||||
|
e107::getConfig('core')->set($key,$val);
|
||||||
|
}
|
||||||
|
|
||||||
|
e107::getConfig('core')->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return e_admin_controller_main
|
||||||
|
*/
|
||||||
|
public function getController()
|
||||||
|
{
|
||||||
|
return $this->_controller;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -9,16 +9,13 @@
|
|||||||
* Form Handler
|
* Form Handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
||||||
* $Revision: 1.59 $
|
* $Revision: 1.60 $
|
||||||
* $Date: 2009-10-28 16:57:51 $
|
* $Date: 2009-10-28 17:05:34 $
|
||||||
* $Author: marj_nl_fr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!defined('e107_INIT'))
|
if (!defined('e107_INIT')) { exit; }
|
||||||
{
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
//FIXME hardcoded text
|
//FIXME hardcoded text
|
||||||
/**
|
/**
|
||||||
* Automate Form fields creation. Produced markup is following e107 CSS/XHTML standards
|
* Automate Form fields creation. Produced markup is following e107 CSS/XHTML standards
|
||||||
@@ -237,8 +234,7 @@ class e_form
|
|||||||
|
|
||||||
function uc_checkbox($name, $current_value, $uc_options, $field_options = array())
|
function uc_checkbox($name, $current_value, $uc_options, $field_options = array())
|
||||||
{
|
{
|
||||||
if(!is_array($field_options))
|
if(!is_array($field_options)) parse_str($field_options, $field_options);
|
||||||
parse_str($field_options, $field_options);
|
|
||||||
return '
|
return '
|
||||||
<div class="check-block">
|
<div class="check-block">
|
||||||
'.$this->_uc->vetted_tree($name, array($this, '_uc_checkbox_cb'), $current_value, $uc_options, $field_options).'
|
'.$this->_uc->vetted_tree($name, array($this, '_uc_checkbox_cb'), $current_value, $uc_options, $field_options).'
|
||||||
@@ -264,8 +260,7 @@ class e_form
|
|||||||
}
|
}
|
||||||
$descr = varset($field_options['description']) ? ' <span class="smalltext">('.$this->_uc->uc_get_classdescription($classnum).')</span>' : '';
|
$descr = varset($field_options['description']) ? ' <span class="smalltext">('.$this->_uc->uc_get_classdescription($classnum).')</span>' : '';
|
||||||
|
|
||||||
return "<div class='field-spacer{$class}'{$style}>".$this->checkbox($treename.'[]', $classnum, in_array($classnum, $tmp), $field_options).$this->label($this->_uc->uc_get_classname($classnum).$descr,
|
return "<div class='field-spacer{$class}'{$style}>".$this->checkbox($treename.'[]', $classnum, in_array($classnum, $tmp), $field_options).$this->label($this->_uc->uc_get_classname($classnum).$descr, $treename.'[]', $classnum)."</div>\n";
|
||||||
$treename.'[]', $classnum)."</div>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -289,11 +284,10 @@ class e_form
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function radio_multi($name, $elements, $checked, $multi_line = FALSE)
|
function radio_multi($name, $elements, $checked, $multi_line = false)
|
||||||
{
|
{
|
||||||
$text = array();
|
$text = array();
|
||||||
if(is_string($elements))
|
if(is_string($elements)) parse_str($elements, $elements);
|
||||||
parse_str($elements, $elements);
|
|
||||||
|
|
||||||
foreach ($elements as $value => $label)
|
foreach ($elements as $value => $label)
|
||||||
{
|
{
|
||||||
@@ -322,16 +316,14 @@ class e_form
|
|||||||
{
|
{
|
||||||
if($option_array == 'yesno')
|
if($option_array == 'yesno')
|
||||||
{
|
{
|
||||||
$option_array = array(1=>LAN_YES,
|
$option_array = array(1=>LAN_YES,0=>LAN_NO);
|
||||||
0=>LAN_NO);
|
|
||||||
}
|
}
|
||||||
return $this->select_open($name, $options)."\n".$this->option_multi($option_array, $selected)."\n".$this->select_close();
|
return $this->select_open($name, $options)."\n".$this->option_multi($option_array, $selected)."\n".$this->select_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function uc_select($name, $current_value, $uc_options, $select_options = array(), $opt_options = array())
|
function uc_select($name, $current_value, $uc_options, $select_options = array(), $opt_options = array())
|
||||||
{
|
{
|
||||||
return $this->select_open($name, $select_options)."\n".$this->_uc->vetted_tree($name, array($this, '_uc_select_cb'), $current_value, $uc_options,
|
return $this->select_open($name, $select_options)."\n".$this->_uc->vetted_tree($name, array($this, '_uc_select_cb'), $current_value, $uc_options, $opt_options)."\n".$this->select_close();
|
||||||
$opt_options)."\n".$this->select_close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback for vetted_tree - Creates the option list for a selection box
|
// Callback for vetted_tree - Creates the option list for a selection box
|
||||||
@@ -366,8 +358,7 @@ class e_form
|
|||||||
|
|
||||||
function option($option_title, $value, $selected = false, $options = array())
|
function option($option_title, $value, $selected = false, $options = array())
|
||||||
{
|
{
|
||||||
if(false === $value)
|
if(false === $value) $value = '';
|
||||||
$value = '';
|
|
||||||
$options = $this->format_options('option', '', $options);
|
$options = $this->format_options('option', '', $options);
|
||||||
$options['selected'] = $selected; //comes as separate argument just for convenience
|
$options['selected'] = $selected; //comes as separate argument just for convenience
|
||||||
return "<option value='{$value}'".$this->get_attributes($options).">{$option_title}</option>";
|
return "<option value='{$value}'".$this->get_attributes($options).">{$option_title}</option>";
|
||||||
@@ -375,8 +366,7 @@ class e_form
|
|||||||
|
|
||||||
function option_multi($option_array, $selected = false, $options = array())
|
function option_multi($option_array, $selected = false, $options = array())
|
||||||
{
|
{
|
||||||
if(is_string($option_array))
|
if(is_string($option_array)) parse_str($option_array, $option_array);
|
||||||
parse_str($option_array, $option_array);
|
|
||||||
|
|
||||||
$text = '';
|
$text = '';
|
||||||
foreach ($option_array as $value => $label)
|
foreach ($option_array as $value => $label)
|
||||||
@@ -412,8 +402,7 @@ class e_form
|
|||||||
function submit_image($name, $value, $image, $title='', $options = array())
|
function submit_image($name, $value, $image, $title='', $options = array())
|
||||||
{
|
{
|
||||||
$options = $this->format_options('submit_image', $name, $options);
|
$options = $this->format_options('submit_image', $name, $options);
|
||||||
switch($image)
|
switch ($image) {
|
||||||
{
|
|
||||||
case 'edit':
|
case 'edit':
|
||||||
$image = ADMIN_EDIT_ICON_PATH;
|
$image = ADMIN_EDIT_ICON_PATH;
|
||||||
$options['class'] = 'action edit';
|
$options['class'] = 'action edit';
|
||||||
@@ -436,17 +425,15 @@ class e_form
|
|||||||
* @param object $action [optional] default is submit
|
* @param object $action [optional] default is submit
|
||||||
* @param object $label [optional]
|
* @param object $label [optional]
|
||||||
* @param object $options [optional]
|
* @param object $options [optional]
|
||||||
* @return string
|
* @return
|
||||||
*/
|
*/
|
||||||
function admin_button($name, $value, $action = 'submit', $label = '', $options = array())
|
function admin_button($name, $value, $action = 'submit', $label = '', $options = array())
|
||||||
{
|
{
|
||||||
$btype = 'submit';
|
$btype = 'submit';
|
||||||
if(strpos($action, 'action') === 0)
|
if(strpos($action, 'action') === 0) $btype = 'button';
|
||||||
$btype = 'button';
|
|
||||||
$options = $this->format_options('admin_button', $name, $options);
|
$options = $this->format_options('admin_button', $name, $options);
|
||||||
$options['class'] = $action;//shorthand
|
$options['class'] = $action;//shorthand
|
||||||
if( empty($label))
|
if(empty($label)) $label = $value;
|
||||||
$label = $value;
|
|
||||||
|
|
||||||
return "
|
return "
|
||||||
<button type='{$btype}' name='{$name}' value='{$value}'".$this->get_attributes($options, $name)."><span>{$label}</span></button>
|
<button type='{$btype}' name='{$name}' value='{$value}'".$this->get_attributes($options, $name)."><span>{$label}</span></button>
|
||||||
@@ -455,16 +442,14 @@ class e_form
|
|||||||
|
|
||||||
function getNext()
|
function getNext()
|
||||||
{
|
{
|
||||||
if(!$this->_tabindex_enabled)
|
if(!$this->_tabindex_enabled) return 0;
|
||||||
return 0;
|
|
||||||
$this->_tabindex_counter += 1;
|
$this->_tabindex_counter += 1;
|
||||||
return $this->_tabindex_counter;
|
return $this->_tabindex_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCurrent()
|
function getCurrent()
|
||||||
{
|
{
|
||||||
if(!$this->_tabindex_enabled)
|
if(!$this->_tabindex_enabled) return 0;
|
||||||
return 0;
|
|
||||||
return $this->_tabindex_counter;
|
return $this->_tabindex_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,38 +464,31 @@ class e_form
|
|||||||
//
|
//
|
||||||
foreach ($options as $option => $optval)
|
foreach ($options as $option => $optval)
|
||||||
{
|
{
|
||||||
switch($option)
|
switch ($option) {
|
||||||
{
|
|
||||||
|
|
||||||
case 'id':
|
case 'id':
|
||||||
$ret .= $this->_format_id($optval, $name, $value);
|
$ret .= $this->_format_id($optval, $name, $value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'class':
|
case 'class':
|
||||||
if(! empty($optval))
|
if(!empty($optval)) $ret .= " class='{$optval}'";
|
||||||
$ret .= " class='{$optval}'";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'size':
|
case 'size':
|
||||||
if($optval)
|
if($optval) $ret .= " size='{$optval}'";
|
||||||
$ret .= " size='{$optval}'";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'title':
|
case 'title':
|
||||||
if($optval)
|
if($optval) $ret .= " title='{$optval}'";
|
||||||
$ret .= " title='{$optval}'";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'label':
|
case 'label':
|
||||||
if($optval)
|
if($optval) $ret .= " label='{$optval}'";
|
||||||
$ret .= " label='{$optval}'";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'tabindex':
|
case 'tabindex':
|
||||||
if($optval)
|
if($optval) $ret .= " tabindex='{$optval}'";
|
||||||
$ret .= " tabindex='{$optval}'";
|
elseif(false === $optval || !$this->_tabindex_enabled) break;
|
||||||
elseif(false === $optval || !$this->_tabindex_enabled)
|
|
||||||
break;
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->_tabindex_counter += 1;
|
$this->_tabindex_counter += 1;
|
||||||
@@ -519,28 +497,23 @@ class e_form
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'readonly':
|
case 'readonly':
|
||||||
if($optval)
|
if($optval) $ret .= " readonly='readonly'";
|
||||||
$ret .= " readonly='readonly'";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'selected':
|
case 'selected':
|
||||||
if($optval)
|
if($optval) $ret .= " selected='selected'";
|
||||||
$ret .= " selected='selected'";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'checked':
|
case 'checked':
|
||||||
if($optval)
|
if($optval) $ret .= " checked='checked'";
|
||||||
$ret .= " checked='checked'";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'disabled':
|
case 'disabled':
|
||||||
if($optval)
|
if($optval) $ret .= " disabled='disabled'";
|
||||||
$ret .= " disabled='disabled'";
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'other':
|
case 'other':
|
||||||
if($optval)
|
if($optval) $ret .= " $optval";
|
||||||
$ret .= " $optval";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,22 +531,17 @@ class e_form
|
|||||||
*/
|
*/
|
||||||
function _format_id($id_value, $name, $value = '', $return_attribute = 'id')
|
function _format_id($id_value, $name, $value = '', $return_attribute = 'id')
|
||||||
{
|
{
|
||||||
if($id_value === false)
|
if($id_value === false) return '';
|
||||||
return '';
|
|
||||||
|
|
||||||
//format data first
|
//format data first
|
||||||
$name = $this->name2id($name);
|
$name = $this->name2id($name);
|
||||||
$value = trim(preg_replace('#[^a-z0-9\-]/i#','-', $value), '-');
|
$value = trim(preg_replace('#[^a-z0-9\-]/i#','-', $value), '-');
|
||||||
$value = str_replace("/","-",$value);
|
$value = str_replace("/","-",$value);
|
||||||
if(!$id_value && is_numeric($value))
|
if(!$id_value && is_numeric($value)) $id_value = $value;
|
||||||
$id_value = $value;
|
|
||||||
|
|
||||||
if( empty($id_value))
|
if(empty($id_value) ) return " {$return_attribute}='{$name}".($value ? "-{$value}" : '')."'";// also useful when name is e.g. name='my_name[some_id]'
|
||||||
return " {$return_attribute}='{$name}".($value ? "-{$value}" : '')."'";// also useful when name is e.g. name='my_name[some_id]'
|
elseif(is_numeric($id_value) && $name) return " {$return_attribute}='{$name}-{$id_value}'";// also useful when name is e.g. name='my_name[]'
|
||||||
elseif(is_numeric($id_value) && $name)
|
else return " {$return_attribute}='{$id_value}'";
|
||||||
return " {$return_attribute}='{$name}-{$id_value}'";// also useful when name is e.g. name='my_name[]'
|
|
||||||
else
|
|
||||||
return " {$return_attribute}='{$id_value}'";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function name2id($name)
|
function name2id($name)
|
||||||
@@ -593,15 +561,13 @@ class e_form
|
|||||||
*/
|
*/
|
||||||
function format_options($type, $name, $user_options)
|
function format_options($type, $name, $user_options)
|
||||||
{
|
{
|
||||||
if(is_string($user_options))
|
if(is_string($user_options)) parse_str($user_options, $user_options);
|
||||||
parse_str($user_options, $user_options);
|
|
||||||
|
|
||||||
$def_options = $this->_default_options($type);
|
$def_options = $this->_default_options($type);
|
||||||
|
|
||||||
foreach (array_keys($user_options) as $key)
|
foreach (array_keys($user_options) as $key)
|
||||||
{
|
{
|
||||||
if(!isset($def_options[$key]))
|
if(!isset($def_options[$key])) unset($user_options[$key]);//remove it?
|
||||||
unset($user_options[$key]);//remove it?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_options['name'] = $name; //required for some of the automated tasks
|
$user_options['name'] = $name; //required for some of the automated tasks
|
||||||
@@ -616,10 +582,10 @@ class e_form
|
|||||||
*/
|
*/
|
||||||
function _default_options($type)
|
function _default_options($type)
|
||||||
{
|
{
|
||||||
if(isset($this->_cached_attributes[$type]))
|
if(isset($this->_cached_attributes[$type])) return $this->_cached_attributes[$type];
|
||||||
return $this->_cached_attributes[$type];
|
|
||||||
|
|
||||||
$def_options = array('id'=>'',
|
$def_options = array(
|
||||||
|
'id' => '',
|
||||||
'class' => '',
|
'class' => '',
|
||||||
'title' => '',
|
'title' => '',
|
||||||
'size' => '',
|
'size' => '',
|
||||||
@@ -629,14 +595,12 @@ class e_form
|
|||||||
'disabled' => false,
|
'disabled' => false,
|
||||||
'tabindex' => 0,
|
'tabindex' => 0,
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'other'=>'');
|
'other' => ''
|
||||||
|
);
|
||||||
|
|
||||||
switch($type)
|
switch ($type) {
|
||||||
{
|
|
||||||
case 'hidden':
|
case 'hidden':
|
||||||
$def_options = array('id'=>false,
|
$def_options = array('id' => false, 'disabled' => false, 'other' => '');
|
||||||
'disabled'=>false,
|
|
||||||
'other'=>'');
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'text':
|
case 'text':
|
||||||
@@ -660,11 +624,7 @@ class e_form
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'option':
|
case 'option':
|
||||||
$def_options = array('class'=>'',
|
$def_options = array('class' => '', 'selected' => false, 'other' => '', 'disabled' => false, 'label' => '');
|
||||||
'selected'=>false,
|
|
||||||
'other'=>'',
|
|
||||||
'disabled'=>false,
|
|
||||||
'label'=>'');
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'radio':
|
case 'radio':
|
||||||
@@ -698,12 +658,17 @@ class e_form
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function columnSelector($columnsArray, $columnsDefault = '', $id = 'column_options')
|
function columnSelector($columnsArray, $columnsDefault = '', $id = 'column_options')
|
||||||
{
|
{
|
||||||
$columnsArray = array_filter($columnsArray);
|
$columnsArray = array_filter($columnsArray);
|
||||||
$text = "
|
$text = "
|
||||||
<div class='col-selection-cont'>
|
<div class='col-selection-cont'>
|
||||||
<a href='#".$id."' class='e-show-if-js e-expandit' title='Click to select columns to display'>"."<img class='icon' src='".e_IMAGE_ABS."admin_images/select_columns_16.png' alt='select columns' />"."</a>
|
<a href='#".$id."' class='e-show-if-js e-expandit' title='Click to select columns to display'>"
|
||||||
|
."<img class='icon' src='".e_IMAGE_ABS."admin_images/select_columns_16.png' alt='select columns' />"
|
||||||
|
."</a>
|
||||||
<div id='".$id."' class='e-show-if-js e-hideme col-selection'><div class='col-selection-body'>
|
<div id='".$id."' class='e-show-if-js e-hideme col-selection'><div class='col-selection-body'>
|
||||||
";
|
";
|
||||||
unset($columnsArray['options'], $columnsArray['checkboxes']);
|
unset($columnsArray['options'], $columnsArray['checkboxes']);
|
||||||
@@ -796,10 +761,7 @@ class e_form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!varset($fromval))
|
if(!varset($fromval)){ $fromval = 0; }
|
||||||
{
|
|
||||||
$fromval = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ascdesc = (varset($ascdesc) == 'desc') ? 'asc' : 'desc';
|
$ascdesc = (varset($ascdesc) == 'desc') ? 'asc' : 'desc';
|
||||||
foreach($fieldarray as $key=>$val)
|
foreach($fieldarray as $key=>$val)
|
||||||
@@ -814,12 +776,8 @@ class e_form
|
|||||||
if($querypattern!="" && !varsettrue($val['nosort']) && $key != "options" && $key != "checkboxes")
|
if($querypattern!="" && !varsettrue($val['nosort']) && $key != "options" && $key != "checkboxes")
|
||||||
{
|
{
|
||||||
$from = ($key == $field) ? $fromval : 0;
|
$from = ($key == $field) ? $fromval : 0;
|
||||||
$srch = array("[FIELD]",
|
$srch = array("[FIELD]","[ASC]","[FROM]");
|
||||||
"[ASC]",
|
$repl = array($key,$ascdesc,$from);
|
||||||
"[FROM]");
|
|
||||||
$repl = array($key,
|
|
||||||
$ascdesc,
|
|
||||||
$from);
|
|
||||||
$val['url'] = e_SELF."?".str_replace($srch,$repl,$querypattern);
|
$val['url'] = e_SELF."?".str_replace($srch,$repl,$querypattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -844,14 +802,15 @@ class e_form
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function trow($obj, $fieldvalues)
|
// FIXME - newspost.php
|
||||||
|
function trow($fieldarray, $currentlist, $fieldvalues, $pid)
|
||||||
{
|
{
|
||||||
$cnt = 0;
|
$cnt = 0;
|
||||||
$ret = '';
|
$ret = '';
|
||||||
|
|
||||||
$fieldarray = $obj->fields;
|
/*$fieldarray = $obj->fields;
|
||||||
$currentlist = $obj->fieldpref;
|
$currentlist = $obj->fieldpref;
|
||||||
$pid = $obj->pid;
|
$pid = $obj->pid;*/
|
||||||
|
|
||||||
|
|
||||||
foreach ($fieldarray as $field => $data)
|
foreach ($fieldarray as $field => $data)
|
||||||
@@ -884,8 +843,7 @@ class e_form
|
|||||||
$parms = array();
|
$parms = array();
|
||||||
if(isset($data['colparms'])) //TODO rename to 'parms'.
|
if(isset($data['colparms'])) //TODO rename to 'parms'.
|
||||||
{
|
{
|
||||||
if(!is_array($data['colparms']))
|
if(!is_array($data['colparms'])) parse_str($data['colparms'], $data['colparms']);
|
||||||
parse_str($data['colparms'], $data['colparms']);
|
|
||||||
$parms = $data['colparms'];
|
$parms = $data['colparms'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -936,8 +894,7 @@ class e_form
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
$value = $value ? ADMIN_TRUE_ICON:
|
$value = $value ? ADMIN_TRUE_ICON : '';// TODO - ADMIN_FALSE_ICON
|
||||||
'';// TODO - ADMIN_FALSE_ICON
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'url':
|
case 'url':
|
||||||
@@ -1078,14 +1035,12 @@ class e_form
|
|||||||
}
|
}
|
||||||
if(!is_array($val))
|
if(!is_array($val))
|
||||||
{
|
{
|
||||||
if($disabled)
|
if($disabled) $val = $val.' ('.LAN_NOPERMISSION.')';
|
||||||
$val = $val.' ('.LAN_NOPERMISSION.')';
|
|
||||||
$text .= "\t".$this->option(' '.$val, $key, false, array('disabled' => $disabled))."\n";
|
$text .= "\t".$this->option(' '.$val, $key, false, array('disabled' => $disabled))."\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($disabled)
|
if($disabled) $val[0] = $val[0].' ('.LAN_NOPERMISSION.')';
|
||||||
$val[0] = $val[0].' ('.LAN_NOPERMISSION.')';
|
|
||||||
|
|
||||||
$text .= "\t".$this->optgroup_open($val[0], $disabled)."\n";
|
$text .= "\t".$this->optgroup_open($val[0], $disabled)."\n";
|
||||||
foreach ($val[1] as $k => $v)
|
foreach ($val[1] as $k => $v)
|
||||||
@@ -1128,20 +1083,16 @@ class e_form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class form
|
class form {
|
||||||
{
|
|
||||||
|
|
||||||
function form_open($form_method, $form_action, $form_name = "", $form_target = "", $form_enctype = "", $form_js = "")
|
function form_open($form_method, $form_action, $form_name = "", $form_target = "", $form_enctype = "", $form_js = "") {
|
||||||
{
|
|
||||||
$method = ($form_method ? "method='".$form_method."'" : "");
|
$method = ($form_method ? "method='".$form_method."'" : "");
|
||||||
$target = ($form_target ? " target='".$form_target."'" : "");
|
$target = ($form_target ? " target='".$form_target."'" : "");
|
||||||
$name = ($form_name ? " id='".$form_name."' " : " id='myform'");
|
$name = ($form_name ? " id='".$form_name."' " : " id='myform'");
|
||||||
return "\n<form action='".$form_action."' ".$method.$target.$name.$form_enctype.$form_js.">";
|
return "\n<form action='".$form_action."' ".$method.$target.$name.$form_enctype.$form_js.">";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_text($form_name, $form_size, $form_value, $form_maxlength = FALSE, $form_class = "tbox", $form_readonly = "", $form_tooltip = "",
|
function form_text($form_name, $form_size, $form_value, $form_maxlength = FALSE, $form_class = "tbox", $form_readonly = "", $form_tooltip = "", $form_js = "") {
|
||||||
$form_js = "")
|
|
||||||
{
|
|
||||||
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
|
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
|
||||||
$value = (isset($form_value) ? " value='".$form_value."'" : "");
|
$value = (isset($form_value) ? " value='".$form_value."'" : "");
|
||||||
$size = ($form_size ? " size='".$form_size."'" : "");
|
$size = ($form_size ? " size='".$form_size."'" : "");
|
||||||
@@ -1151,9 +1102,7 @@ class e_form
|
|||||||
return "\n<input class='".$form_class."' type='text' ".$name.$value.$size.$maxlength.$readonly.$tooltip.$form_js." />";
|
return "\n<input class='".$form_class."' type='text' ".$name.$value.$size.$maxlength.$readonly.$tooltip.$form_js." />";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_password($form_name, $form_size, $form_value, $form_maxlength = FALSE, $form_class = "tbox", $form_readonly = "", $form_tooltip = "",
|
function form_password($form_name, $form_size, $form_value, $form_maxlength = FALSE, $form_class = "tbox", $form_readonly = "", $form_tooltip = "", $form_js = "") {
|
||||||
$form_js = "")
|
|
||||||
{
|
|
||||||
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
|
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
|
||||||
$value = (isset($form_value) ? " value='".$form_value."'" : "");
|
$value = (isset($form_value) ? " value='".$form_value."'" : "");
|
||||||
$size = ($form_size ? " size='".$form_size."'" : "");
|
$size = ($form_size ? " size='".$form_size."'" : "");
|
||||||
@@ -1163,17 +1112,14 @@ class e_form
|
|||||||
return "\n<input class='".$form_class."' type='password' ".$name.$value.$size.$maxlength.$readonly.$tooltip.$form_js." />";
|
return "\n<input class='".$form_class."' type='password' ".$name.$value.$size.$maxlength.$readonly.$tooltip.$form_js." />";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_button($form_type, $form_name, $form_value, $form_js = "", $form_image = "", $form_tooltip = "")
|
function form_button($form_type, $form_name, $form_value, $form_js = "", $form_image = "", $form_tooltip = "") {
|
||||||
{
|
|
||||||
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
|
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
|
||||||
$image = ($form_image ? " src='".$form_image."' " : "");
|
$image = ($form_image ? " src='".$form_image."' " : "");
|
||||||
$tooltip = ($form_tooltip ? " title='".$form_tooltip."' " : "");
|
$tooltip = ($form_tooltip ? " title='".$form_tooltip."' " : "");
|
||||||
return "\n<input class='button' type='".$form_type."' ".$form_js." value='".$form_value."'".$name.$image.$tooltip." />";
|
return "\n<input class='button' type='".$form_type."' ".$form_js." value='".$form_value."'".$name.$image.$tooltip." />";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_textarea($form_name, $form_columns, $form_rows, $form_value, $form_js = "", $form_style = "", $form_wrap = "", $form_readonly = "",
|
function form_textarea($form_name, $form_columns, $form_rows, $form_value, $form_js = "", $form_style = "", $form_wrap = "", $form_readonly = "", $form_tooltip = "") {
|
||||||
$form_tooltip = "")
|
|
||||||
{
|
|
||||||
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
|
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
|
||||||
$readonly = ($form_readonly ? " readonly='readonly'" : "");
|
$readonly = ($form_readonly ? " readonly='readonly'" : "");
|
||||||
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
|
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
|
||||||
@@ -1182,8 +1128,7 @@ class e_form
|
|||||||
return "\n<textarea class='tbox' cols='".$form_columns."' rows='".$form_rows."' ".$name.$form_js.$style.$wrap.$readonly.$tooltip.">".$form_value."</textarea>";
|
return "\n<textarea class='tbox' cols='".$form_columns."' rows='".$form_rows."' ".$name.$form_js.$style.$wrap.$readonly.$tooltip.">".$form_value."</textarea>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_checkbox($form_name, $form_value, $form_checked = 0, $form_tooltip = "", $form_js = "")
|
function form_checkbox($form_name, $form_value, $form_checked = 0, $form_tooltip = "", $form_js = "") {
|
||||||
{
|
|
||||||
$name = ($form_name ? " id='".$form_name.$form_value."' name='".$form_name."'" : "");
|
$name = ($form_name ? " id='".$form_name.$form_value."' name='".$form_name."'" : "");
|
||||||
$checked = ($form_checked ? " checked='checked'" : "");
|
$checked = ($form_checked ? " checked='checked'" : "");
|
||||||
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
|
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
|
||||||
@@ -1191,8 +1136,7 @@ class e_form
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_radio($form_name, $form_value, $form_checked = 0, $form_tooltip = "", $form_js = "")
|
function form_radio($form_name, $form_value, $form_checked = 0, $form_tooltip = "", $form_js = "") {
|
||||||
{
|
|
||||||
$name = ($form_name ? " id='".$form_name.$form_value."' name='".$form_name."'" : "");
|
$name = ($form_name ? " id='".$form_name.$form_value."' name='".$form_name."'" : "");
|
||||||
$checked = ($form_checked ? " checked='checked'" : "");
|
$checked = ($form_checked ? " checked='checked'" : "");
|
||||||
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
|
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
|
||||||
@@ -1200,37 +1144,31 @@ class e_form
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_file($form_name, $form_size, $form_tooltip = "", $form_js = "")
|
function form_file($form_name, $form_size, $form_tooltip = "", $form_js = "") {
|
||||||
{
|
|
||||||
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
|
$name = ($form_name ? " id='".$form_name."' name='".$form_name."'" : "");
|
||||||
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
|
$tooltip = ($form_tooltip ? " title='".$form_tooltip."'" : "");
|
||||||
return "<input type='file' class='tbox' size='".$form_size."'".$name.$tooltip.$form_js." />";
|
return "<input type='file' class='tbox' size='".$form_size."'".$name.$tooltip.$form_js." />";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_select_open($form_name, $form_js = "")
|
function form_select_open($form_name, $form_js = "") {
|
||||||
{
|
|
||||||
return "\n<select id='".$form_name."' name='".$form_name."' class='tbox' ".$form_js." >";
|
return "\n<select id='".$form_name."' name='".$form_name."' class='tbox' ".$form_js." >";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_select_close()
|
function form_select_close() {
|
||||||
{
|
|
||||||
return "\n</select>";
|
return "\n</select>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_option($form_option, $form_selected = "", $form_value = "", $form_js = "")
|
function form_option($form_option, $form_selected = "", $form_value = "", $form_js = "") {
|
||||||
{
|
|
||||||
$value = ($form_value !== FALSE ? " value='".$form_value."'" : "");
|
$value = ($form_value !== FALSE ? " value='".$form_value."'" : "");
|
||||||
$selected = ($form_selected ? " selected='selected'" : "");
|
$selected = ($form_selected ? " selected='selected'" : "");
|
||||||
return "\n<option".$value.$selected." ".$form_js.">".$form_option."</option>";
|
return "\n<option".$value.$selected." ".$form_js.">".$form_option."</option>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_hidden($form_name, $form_value)
|
function form_hidden($form_name, $form_value) {
|
||||||
{
|
|
||||||
return "\n<input type='hidden' id='".$form_name."' name='".$form_name."' value='".$form_value."' />";
|
return "\n<input type='hidden' id='".$form_name."' name='".$form_name."' value='".$form_value."' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_close()
|
function form_close() {
|
||||||
{
|
|
||||||
return "\n</form>";
|
return "\n</form>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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.25 $
|
* $Revision: 1.26 $
|
||||||
* $Date: 2009-10-27 17:49:12 $
|
* $Date: 2009-10-28 17:05:34 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ class e_model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Predefined data fields in format key => type
|
* Get data fields array
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getDataFields()
|
public function getDataFields()
|
||||||
@@ -95,6 +95,16 @@ class e_model
|
|||||||
return $this->_data_fields;
|
return $this->_data_fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Predefined data fields in format key => type
|
||||||
|
* @return e_model
|
||||||
|
*/
|
||||||
|
public function setDataFields($data_fields)
|
||||||
|
{
|
||||||
|
$this->_data_fields = $data_fields;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set name of object's field id
|
* Set name of object's field id
|
||||||
*
|
*
|
||||||
@@ -978,6 +988,18 @@ class e_admin_model extends e_model
|
|||||||
return $this->_FIELD_TYPES;
|
return $this->_FIELD_TYPES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Predefined data fields types, passed to DB handler
|
||||||
|
*
|
||||||
|
* @param array $field_types
|
||||||
|
* @return e_admin_model
|
||||||
|
*/
|
||||||
|
public function setFieldTypes($field_types)
|
||||||
|
{
|
||||||
|
$this->_FIELD_TYPES = $field_types;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves data from the object ($_posted_data) without
|
* Retrieves data from the object ($_posted_data) without
|
||||||
* key parsing (performance wise, prefered when possible)
|
* key parsing (performance wise, prefered when possible)
|
||||||
@@ -1525,6 +1547,36 @@ class e_admin_model extends e_model
|
|||||||
$this->addMessageDebug('SQL Error #'.$this->_db_errno.': '.e107::getDb()->getLastErrorText());
|
$this->addMessageDebug('SQL Error #'.$this->_db_errno.': '.e107::getDb()->getLastErrorText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete DB data
|
||||||
|
*
|
||||||
|
* @param boolean $force force query even if $data_has_changed is false
|
||||||
|
* @param boolean $session_messages to use or not session to store system messages
|
||||||
|
*/
|
||||||
|
public function dbDelete($session_messages = false)
|
||||||
|
{
|
||||||
|
$this->_db_errno = 0;
|
||||||
|
if(!$this->getId())
|
||||||
|
{
|
||||||
|
$this->addMessageError('Record not found', $session_messages); //TODO - Lan
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
$res = e107::getDb()->db_Delete($this->getModelTable(), $this->getFieldIdName().'='.intval($this->getId()));
|
||||||
|
if(!$res)
|
||||||
|
{
|
||||||
|
$this->_db_errno = e107::getDb()->getLastErrorNumber();
|
||||||
|
if($this->_db_errno)
|
||||||
|
{
|
||||||
|
$this->addMessageError('SQL Delete Error', $session_messages); //TODO - Lan
|
||||||
|
$this->addMessageDebug('SQL Error #'.$this->_db_errno.': '.e107::getDb()->getLastErrorText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1640,6 +1692,274 @@ class e_admin_model extends e_model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model collection handler
|
||||||
|
*/
|
||||||
|
class e_tree_model extends e_model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_params = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current model DB table, used in all db calls
|
||||||
|
* This can/should be overwritten by extending the class
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_db_table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All records (no limit) cache
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_total = 0;
|
||||||
|
|
||||||
|
public function getTotal()
|
||||||
|
{
|
||||||
|
return $this->_total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTotal($num)
|
||||||
|
{
|
||||||
|
$this->_total = $num;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set table name
|
||||||
|
* @param object $table
|
||||||
|
* @return e_admin_tree_model
|
||||||
|
*/
|
||||||
|
public function setModelTable($table)
|
||||||
|
{
|
||||||
|
$this->_db_table = $table;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get table name
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getModelTable()
|
||||||
|
{
|
||||||
|
return $this->_db_table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function __construct($tree_data = array())
|
||||||
|
{
|
||||||
|
if($tree_data)
|
||||||
|
{
|
||||||
|
$this->setTree($tree_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set array of models
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function getTree($force = false)
|
||||||
|
{
|
||||||
|
return $this->get('__tree');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set array of models
|
||||||
|
* @return e_tree_model
|
||||||
|
*/
|
||||||
|
function setTree($tree_data, $force = false)
|
||||||
|
{
|
||||||
|
if($force || !$this->is('__tree'))
|
||||||
|
{
|
||||||
|
$this->set('__tree', $tree_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default load method
|
||||||
|
*
|
||||||
|
* @return e_tree_model
|
||||||
|
*/
|
||||||
|
public function load()
|
||||||
|
{
|
||||||
|
if($this->getParam('db_query') && $this->getParam('model_class') && class_exists($this->getParam('model_class')))
|
||||||
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$class_name = $this->getParam('model_class');
|
||||||
|
if($sql->db_Select_gen($this->getParam('db_query')))
|
||||||
|
{
|
||||||
|
$this->_total = $sql->total_results; //requires SQL_CALC_FOUND_ROWS in query - see db handler
|
||||||
|
while($tmp = $sql->db_Fetch())
|
||||||
|
{
|
||||||
|
$tmp = new $class_name($tmp);
|
||||||
|
$this->setNode($tmp->getId(), $tmp);
|
||||||
|
}
|
||||||
|
unset($tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get single model instance from the collection
|
||||||
|
* @param integer $node_id
|
||||||
|
* @return e_model
|
||||||
|
*/
|
||||||
|
function getNode($node_id)
|
||||||
|
{
|
||||||
|
return $this->getData('__tree/'.$node_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or remove (when $node is null) model to the collection
|
||||||
|
*
|
||||||
|
* @param integer $node_id
|
||||||
|
* @param e_model $node
|
||||||
|
* @return e_tree_model
|
||||||
|
*/
|
||||||
|
function setNode($node_id, $node)
|
||||||
|
{
|
||||||
|
if(null === $node)
|
||||||
|
{
|
||||||
|
$this->removeData('__tree/'.$node_id);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setData('__tree/'.$node_id, $node);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if model with passed id exists in the collection
|
||||||
|
*
|
||||||
|
* @param integer $node_id
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isNode($node_id)
|
||||||
|
{
|
||||||
|
return $this->isData('__tree/'.$node_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if model with passed id exists in the collection and is not empty
|
||||||
|
*
|
||||||
|
* @param integer $node_id
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function hasNode($node_id)
|
||||||
|
{
|
||||||
|
return $this->hasData('__tree/'.$node_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if collection is empty
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function isEmpty()
|
||||||
|
{
|
||||||
|
return $this->has('__tree');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set parameter array
|
||||||
|
* Core parameters:
|
||||||
|
* - db_query: string db query to be passed to $sql->db_Select_gen();
|
||||||
|
* - model_class: string class name for creating nodes inside default load() method
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
* @return e_tree_model
|
||||||
|
*/
|
||||||
|
public function setParams(array $params)
|
||||||
|
{
|
||||||
|
$this->_params = $params;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get parameter array
|
||||||
|
*
|
||||||
|
* @return array parameters
|
||||||
|
*/
|
||||||
|
public function getParams()
|
||||||
|
{
|
||||||
|
return $this->_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set parameter
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param mixed $value
|
||||||
|
* @return e_tree_model
|
||||||
|
*/
|
||||||
|
public function setParam($key, $value)
|
||||||
|
{
|
||||||
|
$this->_params[$key] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get parameter
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param mixed $default
|
||||||
|
*/
|
||||||
|
public function getParam($key, $default = null)
|
||||||
|
{
|
||||||
|
return (isset($this->_params[$key]) ? $this->_params[$key] : $default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class e_admin_tree_model extends e_tree_model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Delete records
|
||||||
|
* @param mixed $ids
|
||||||
|
* @param boolean $destroy [optional] destroy object instance after db delete
|
||||||
|
* @param boolean $session_messages [optional]
|
||||||
|
* @return mixed integer deleted records or false on DB error
|
||||||
|
*/
|
||||||
|
public function delete($ids, $destroy = true, $session_messages = false)
|
||||||
|
{
|
||||||
|
if(is_string($ids))
|
||||||
|
{
|
||||||
|
$ids = explode(',', $ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ids = e107::getParser()->toDB($ids);
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$res = $sql->db_Delete($this->getModelTable(), $this->getFieldIdName().' IN ('.$ids.')');
|
||||||
|
if(!$res)
|
||||||
|
{
|
||||||
|
if($sql->getLastErrorNumber())
|
||||||
|
{
|
||||||
|
$this->addMessageError('SQL Delete Error', $session_messages); //TODO - Lan
|
||||||
|
$this->addMessageDebug('SQL Error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif($destroy)
|
||||||
|
{
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
call_user_func(array($this->getNode($id), 'destroy')); // first call model destroy method if any
|
||||||
|
$this->setNode($id, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Experimental admin interface class. //TODO integrate with the above.
|
// Experimental admin interface class. //TODO integrate with the above.
|
||||||
// see e107_plugins/release/admin_config.php.
|
// see e107_plugins/release/admin_config.php.
|
||||||
|
@@ -9,16 +9,130 @@
|
|||||||
* e107 Release Plugin
|
* e107 Release Plugin
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/release/admin_config.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/release/admin_config.php,v $
|
||||||
* $Revision: 1.9 $
|
* $Revision: 1.10 $
|
||||||
* $Date: 2009-10-26 08:16:09 $
|
* $Date: 2009-10-28 17:05:35 $
|
||||||
* $Author: e107coders $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once("../../class2.php");
|
require_once("../../class2.php");
|
||||||
if (!getperms("P")) { header("location:".e_BASE."index.php"); exit; }
|
if (!getperms("P")) { header("location:".e_BASE."index.php"); exit; }
|
||||||
|
|
||||||
|
require_once(e_HANDLER.'admin_handler.php');
|
||||||
|
|
||||||
|
class plugin_release_admin_dispatcher extends e_admin_dispatcher
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Format: 'MODE' => array('controller' =>'CONTROLLER_CLASS'[, 'path' => 'CONTROLLER SCRIPT PATH', 'ui' => 'UI CLASS NAME child of e_admin_ui', 'uipath' => 'UI SCRIPT PATH']);
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $controllerList = array(
|
||||||
|
'main' => array('controller' => 'plugin_release_admin_controller_main', 'path' => null, 'ui' => 'plugin_release_admin_ui_main', 'uipath' => null)
|
||||||
|
);
|
||||||
|
/**
|
||||||
|
* Format: 'MODE/ACTION' => array('caption' => 'Menu link title'[, 'url' => '{e_PLUGIN}release/admin_config.php', 'perm' => '0']);
|
||||||
|
* Additionally, any valid e_admin_menu() key-value pair could be added to the above array
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $adminMenu = array(
|
||||||
|
'main/list' => array('caption'=> 'Release List', 'perm'=>'0'),
|
||||||
|
'main/create' => array('caption'=> LAN_CREATE, 'perm'=>'0'),
|
||||||
|
'main/options' => array('caption'=> LAN_OPTIONS, 'perm'=>'0'),
|
||||||
|
'main/custom' => array('caption'=> 'Custom Page', 'perm'=>0)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigation menu title
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $menuTitle = 'Release Menu';
|
||||||
|
}
|
||||||
|
|
||||||
|
class plugin_release_admin_controller_main extends e_admin_controller_main
|
||||||
|
{
|
||||||
|
// required
|
||||||
|
protected $pluginTitle = "e107 Release";
|
||||||
|
|
||||||
|
// required
|
||||||
|
protected $pluginName = 'release';
|
||||||
|
|
||||||
|
// required - if no custom model is set in init()
|
||||||
|
protected $table = "release";
|
||||||
|
|
||||||
|
// required - if no custom model is set in init() (primary id)
|
||||||
|
protected $pid = "release_id";
|
||||||
|
|
||||||
|
// optional
|
||||||
|
protected $perPage = 20;
|
||||||
|
|
||||||
|
//TODO change the release_url type back to URL before release.
|
||||||
|
// required
|
||||||
|
protected $fields = array(
|
||||||
|
'checkboxes' => array('title'=> '', 'type' => '', 'width'=>'5%', 'thclass' =>'center', 'forced'=> TRUE, 'class'=>'center'),
|
||||||
|
'release_id' => array('title'=> ID, 'type' => '', 'width'=>'5%', 'thclass' => '', 'forced'=> TRUE, 'primary'=>TRUE),
|
||||||
|
'release_type' => array('title'=> 'Type', 'type' => 'method', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
|
||||||
|
'release_folder' => array('title'=> 'Folder', 'type' => 'text', 'width' => 'auto', 'thclass' => ''),
|
||||||
|
'release_name' => array('title'=> 'Name', 'type' => 'text', 'width' => 'auto', 'thclass' => ''),
|
||||||
|
'release_version' => array('title'=> 'Version', 'type' => 'text', 'width' => 'auto', 'thclass' => ''),
|
||||||
|
'release_author' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
|
'release_authorURL' => array('title'=> LAN_AUTHOR_URL, 'type' => 'url', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
|
'release_date' => array('title'=> LAN_DATE, 'type' => 'text', 'width' => 'auto', 'thclass' => ''),
|
||||||
|
'release_compatibility' => array('title'=> 'compatib', 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ),
|
||||||
|
'release_url' => array('title'=> 'Userclass', 'type' => 'userclass', 'width' => '10%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE),
|
||||||
|
'options' => array('title'=> LAN_OPTIONS, 'type' => '', 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced'=>TRUE)
|
||||||
|
);
|
||||||
|
|
||||||
|
//required - default column user prefs
|
||||||
|
protected $fieldpref = array('checkboxes', 'release_id', 'release_type', 'release_compatibility', 'options');
|
||||||
|
|
||||||
|
// required if no custom model is set in init()
|
||||||
|
protected $dataFields = array(
|
||||||
|
'release_id' => 'int',
|
||||||
|
'release_type' => 'str',
|
||||||
|
'release_folder' => 'str',
|
||||||
|
'release_name' => 'str',
|
||||||
|
'release_version' => 'str',
|
||||||
|
'release_author' => 'str',
|
||||||
|
'release_authorURL' => 'str',
|
||||||
|
'release_date' => 'int',
|
||||||
|
'release_compatibility' => 'str',
|
||||||
|
'release_url' => 'str',
|
||||||
|
);
|
||||||
|
|
||||||
|
// optional
|
||||||
|
protected $validationRules = array();
|
||||||
|
|
||||||
|
// optional
|
||||||
|
protected $prefs = array( //TODO add option for core or plugin pref.
|
||||||
|
|
||||||
|
'pref_type' => array('title'=> 'type', 'type'=>'text'),
|
||||||
|
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean'),
|
||||||
|
'pref_name' => array('title'=> 'name', 'type' => 'text')
|
||||||
|
);
|
||||||
|
|
||||||
|
// required if no custom model is set in init()
|
||||||
|
protected $listQry = "SELECT * FROM #release"; // without any Order or Limit.
|
||||||
|
|
||||||
|
// required if no custom model is set in init()
|
||||||
|
protected $editQry = "SELECT * FROM #release WHERE release_id = {ID}";
|
||||||
|
|
||||||
|
// optional
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$dispatcher = new plugin_release_admin_dispatcher();
|
||||||
|
$dispatcher->runObservers(true);
|
||||||
|
e107::setRegistry('admin/release_dispatcher', $dispatcher);
|
||||||
|
|
||||||
require_once(e_ADMIN."auth.php");
|
require_once(e_ADMIN."auth.php");
|
||||||
|
|
||||||
|
e107::getRegistry('admin/release_dispatcher')->runPage();
|
||||||
|
|
||||||
|
require_once(e_ADMIN."footer.php");
|
||||||
|
|
||||||
|
/*
|
||||||
class releasePlugin extends e_model_interface
|
class releasePlugin extends e_model_interface
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -103,37 +217,35 @@ class releasePlugin extends e_model_interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
//$rp = new releasePlugin;
|
||||||
|
//$rp->init();
|
||||||
|
|
||||||
$rp = new releasePlugin;
|
|
||||||
$rp->init();
|
|
||||||
|
|
||||||
require_once(e_ADMIN."footer.php");
|
|
||||||
|
|
||||||
function admin_config_adminmenu() //TODO move this into e_model_interface
|
function admin_config_adminmenu() //TODO move this into e_model_interface
|
||||||
{
|
{
|
||||||
global $rp;
|
//global $rp;
|
||||||
$rp->show_options();
|
//$rp->show_options();
|
||||||
|
e107::getRegistry('admin/release_dispatcher')->renderMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function headerjs() // needed for the checkboxes - how can we remove the need to duplicate this code?
|
function headerjs() // needed for the checkboxes - how can we remove the need to duplicate this code?
|
||||||
{
|
{
|
||||||
require_once (e_HANDLER.'js_helper.php');
|
/*require_once (e_HANDLER.'js_helper.php');
|
||||||
$ret = "
|
$ret = "
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
if(typeof e107Admin == 'undefined') var e107Admin = {}
|
if(typeof e107Admin == 'undefined') var e107Admin = {}
|
||||||
|
|
||||||
/**
|
|
||||||
* OnLoad Init Control
|
|
||||||
*/
|
|
||||||
e107Admin.initRules = {
|
e107Admin.initRules = {
|
||||||
'Helper': true,
|
'Helper': true,
|
||||||
'AdminMenu': false
|
'AdminMenu': false
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
||||||
";
|
";*/
|
||||||
|
return e107::getRegistry('admin/release_dispatcher')->getController()->getHeader();
|
||||||
|
|
||||||
return $ret;
|
//return $ret;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user