mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +02:00
More admin tools work
This commit is contained in:
@@ -911,6 +911,12 @@ class e_admin_dispatcher
|
|||||||
*/
|
*/
|
||||||
protected $modes;
|
protected $modes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional - map 'mode/action' pair to 'modeAlias/actionAlias'
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $adminMenuAliases = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional (set by child class).
|
* Optional (set by child class).
|
||||||
* Required for admin menu render
|
* Required for admin menu render
|
||||||
@@ -1213,7 +1219,7 @@ class e_admin_dispatcher
|
|||||||
* Generic Admin Menu Generator
|
* Generic Admin Menu Generator
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function renderMenu($return = true)
|
function renderMenu()
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$var = array();
|
$var = array();
|
||||||
@@ -1241,17 +1247,21 @@ class e_admin_dispatcher
|
|||||||
}
|
}
|
||||||
$var[$key][$k2] = $v;
|
$var[$key][$k2] = $v;
|
||||||
}
|
}
|
||||||
|
// TODO slide down menu options?
|
||||||
if(!vartrue($var[$key]['link']))
|
if(!vartrue($var[$key]['link']))
|
||||||
{
|
{
|
||||||
$var[$key]['link'] = e_SELF.'?mode='.$tmp[0].'&action='.$tmp[1];
|
$var[$key]['link'] = e_SELF.'?mode='.$tmp[0].'&action='.$tmp[1]; // FIXME - URL based on $modes, remove url key
|
||||||
}
|
}
|
||||||
|
|
||||||
/*$var[$key]['text'] = $val['caption'];
|
/*$var[$key]['text'] = $val['caption'];
|
||||||
$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();
|
$request = $this->getRequest();
|
||||||
return e_admin_menu($this->menuTitle, $request->getMode().'/'.$request->getAction(), $var);
|
$selected = $request->getMode().'/'.$request->getAction();
|
||||||
|
$selected = vartrue($this->adminMenuAliases[$selected], $selected);
|
||||||
|
return e_admin_menu($this->menuTitle, $selected, $var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1757,7 +1767,7 @@ class e_admin_controller
|
|||||||
|
|
||||||
$url = $path.'?'.$request->buildQueryString($merge_query, false);
|
$url = $path.'?'.$request->buildQueryString($merge_query, false);
|
||||||
// Transfer all messages to session
|
// Transfer all messages to session
|
||||||
e107::getMessage()->mergeWithSession();
|
e107::getMessage()->moveToSession();
|
||||||
// write session data
|
// write session data
|
||||||
session_write_close();
|
session_write_close();
|
||||||
// do redirect
|
// do redirect
|
||||||
@@ -2054,6 +2064,13 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
|
|
||||||
// Copy model messages to the default message stack
|
// Copy model messages to the default message stack
|
||||||
$this->getModel()->setMessages();
|
$this->getModel()->setMessages();
|
||||||
|
|
||||||
|
// Take action based on use choice after success
|
||||||
|
if(!$this->getModel()->hasError())
|
||||||
|
{
|
||||||
|
$this->doAfterSubmit($this->getModel()->getId(), 'edit');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2065,6 +2082,39 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
return $this->getUI()->getCreate();
|
return $this->getUI()->getCreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take approproate action after successfull submit
|
||||||
|
*
|
||||||
|
* @param integer $id optional, needed only if redirect action is 'edit'
|
||||||
|
* @param string $noredirect_for don't redirect if action equals to its value
|
||||||
|
*/
|
||||||
|
public function doAfterSubmit($id = 0, $noredirect_for = '')
|
||||||
|
{
|
||||||
|
if($noredirect_for && $noredirect_for == $this->getPosted('__after_submit_action'))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$choice = $this->getPosted('__after_submit_action', 0);
|
||||||
|
switch ($choice) {
|
||||||
|
case 'create': // create
|
||||||
|
$this->redirectAction('create', 'id');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'edit': // edit
|
||||||
|
$this->redirectAction('edit', '', 'id='.$id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'list': // list
|
||||||
|
$this->redirectAction('list');
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$this->redirectAction(preg_replace('/[^\w\-]/', '', $choice), 'id');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert posted values when needed (based on field type)
|
* Convert posted values when needed (based on field type)
|
||||||
* @param array $data
|
* @param array $data
|
||||||
@@ -2168,6 +2218,11 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
return vartrue($user_pref['admin_cols_'.$this->getTableName()], array());
|
return vartrue($user_pref['admin_cols_'.$this->getTableName()], array());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current model
|
||||||
|
*
|
||||||
|
* @return e_admin_model
|
||||||
|
*/
|
||||||
public function getModel()
|
public function getModel()
|
||||||
{
|
{
|
||||||
if(null === $this->_model)
|
if(null === $this->_model)
|
||||||
@@ -2242,7 +2297,11 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
$this->_tree_model = $tree_model;
|
$this->_tree_model = $tree_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get extended (UI) Form instance
|
||||||
|
*
|
||||||
|
* @return e_admin_form_ui
|
||||||
|
*/
|
||||||
public function getUI()
|
public function getUI()
|
||||||
{
|
{
|
||||||
if(null === $this->_ui)
|
if(null === $this->_ui)
|
||||||
@@ -2254,7 +2313,7 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
}
|
}
|
||||||
else// default ui
|
else// default ui
|
||||||
{
|
{
|
||||||
$this->_ui = new e_admin_ui($this);
|
$this->_ui = new e_admin_form_ui($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->_ui;
|
return $this->_ui;
|
||||||
@@ -2292,6 +2351,115 @@ class e_admin_form_ui extends e_form
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* WORK IN PROGRESS
|
||||||
|
* Generic DB Record Creation Form.
|
||||||
|
* Expected array format:
|
||||||
|
* <code>
|
||||||
|
* $form = array(
|
||||||
|
* 'id' => 'myplugin',
|
||||||
|
* 'url' => '{e_PLUGIN}myplug/admin_config.php',
|
||||||
|
* 'fieldsets' => array(
|
||||||
|
* 'create' => array(
|
||||||
|
* 'primary' => 'primary_id',
|
||||||
|
* 'legend' => 'Fieldset Legend',
|
||||||
|
* 'fields' => array(...), //see e_admin_ui::$fields
|
||||||
|
*
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* );
|
||||||
|
* </code>
|
||||||
|
* @param array $form
|
||||||
|
* @param array $models instances of e_admin_model
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function createForm($forms, $models)
|
||||||
|
{
|
||||||
|
$text = '';
|
||||||
|
foreach ($forms as $fid => $form)
|
||||||
|
{
|
||||||
|
$model = $models[$fid];
|
||||||
|
$text .= "
|
||||||
|
<form method='post' action='".e107::getParser()->replaceConstants($form['url'], 'abs')."' id='{$form['id']}-form' enctype='multipart/form-data'>
|
||||||
|
";
|
||||||
|
|
||||||
|
foreach ($form['fieldsets'] as $elid => $data)
|
||||||
|
{
|
||||||
|
$elid = $form['id'].'-'.$elid;
|
||||||
|
$text .= "
|
||||||
|
<fieldset id='{$elid}'>
|
||||||
|
<legend>{$data['legend']}</legend>
|
||||||
|
<table cellpadding='0' cellspacing='0' class='adminedit'>
|
||||||
|
<colgroup span='2'>
|
||||||
|
<col class='col-label' />
|
||||||
|
<col class='col-control' />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
";
|
||||||
|
|
||||||
|
foreach($data['fields'] as $key => $att)
|
||||||
|
{
|
||||||
|
|
||||||
|
$parms = vartrue($att['formparms'], array());
|
||||||
|
if(!is_array($parms)) parse_str($parms, $parms);
|
||||||
|
$label = vartrue($att['note']) ? '<div class="label-note">'.deftrue($att['note'], $att['note']).'</div>' : '';
|
||||||
|
$help = vartrue($att['help']) ? '<div class="field-help">'.deftrue($att['help'], $att['help']).'</div>' : '';
|
||||||
|
|
||||||
|
// type null - system (special) fields
|
||||||
|
if($att['type'] !== null && !vartrue($att['noedit']) && $key != $form['primary'])
|
||||||
|
{
|
||||||
|
$text .= "
|
||||||
|
<tr>
|
||||||
|
<td class='label'>
|
||||||
|
".defset($att['title'], $att['title']).$label."
|
||||||
|
</td>
|
||||||
|
<td class='control'>
|
||||||
|
".$this->renderElement($key, $model->getIfPosted($key), $att)."
|
||||||
|
{$help}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class='buttons-bar center'>
|
||||||
|
";
|
||||||
|
// TODO - make this optional, introduce ui_parameters variable (array)
|
||||||
|
$text .= '
|
||||||
|
<div class="options">
|
||||||
|
After submit: '.$this->radio_multi('__after_submit_action', array('list' => 'go to list', 'create' => 'create another', 'edit' => 'edit current'), $request->getPosted('__after_submit_action', 'list'), false).'
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
if($controller->getId())
|
||||||
|
{
|
||||||
|
$text .= $this->admin_button('etrigger_submit', LAN_UPDATE, 'update');
|
||||||
|
$text .= "<input type='hidden' name='record_id' value='".$controller->getId()."' />";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$text .= $this->admin_button('etrigger_submit', LAN_CREATE, 'create');
|
||||||
|
$text .= "<input type='hidden' name='record_id' value='0' />";
|
||||||
|
}
|
||||||
|
$text .= $this->admin_button('etrigger_cancel', LAN_CANCEL, 'cancel');
|
||||||
|
|
||||||
|
$text .= "
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This will use the above (after it's done)
|
||||||
* Generic DB Record Creation Form.
|
* Generic DB Record Creation Form.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -2344,7 +2512,12 @@ class e_admin_form_ui extends e_form
|
|||||||
</table>
|
</table>
|
||||||
<div class='buttons-bar center'>
|
<div class='buttons-bar center'>
|
||||||
";
|
";
|
||||||
|
// TODO - make this optional, introduce ui_parameters variable (array)
|
||||||
|
$text .= '
|
||||||
|
<div class="options">
|
||||||
|
After submit: '.$this->radio_multi('__after_submit_action', array('list' => 'go to list', 'create' => 'create another', 'edit' => 'edit current'), $request->getPosted('__after_submit_action', 'list'), false).'
|
||||||
|
</div>
|
||||||
|
';
|
||||||
if($controller->getId())
|
if($controller->getId())
|
||||||
{
|
{
|
||||||
$text .= $this->admin_button('etrigger_submit', LAN_UPDATE, 'update');
|
$text .= $this->admin_button('etrigger_submit', LAN_UPDATE, 'update');
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* 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.61 $
|
* $Revision: 1.62 $
|
||||||
* $Date: 2009-10-30 17:59:30 $
|
* $Date: 2009-11-01 19:05:25 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -62,16 +62,16 @@ if (!defined('e107_INIT')) { exit; }
|
|||||||
*/
|
*/
|
||||||
class e_form
|
class e_form
|
||||||
{
|
{
|
||||||
var $_tabindex_counter = 0;
|
protected $_tabindex_counter = 0;
|
||||||
var $_tabindex_enabled = true;
|
protected $_tabindex_enabled = true;
|
||||||
var $_cached_attributes = array();
|
protected $_cached_attributes = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var user_class
|
* @var user_class
|
||||||
*/
|
*/
|
||||||
var $_uc;
|
protected $_uc;
|
||||||
|
|
||||||
function e_form($enable_tabindex = false)
|
function __construct($enable_tabindex = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->_tabindex_enabled = $enable_tabindex;
|
$this->_tabindex_enabled = $enable_tabindex;
|
||||||
@@ -85,7 +85,7 @@ class e_form
|
|||||||
return "<input type='text' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->get_attributes($options, $name)." />";
|
return "<input type='text' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->get_attributes($options, $name)." />";
|
||||||
}
|
}
|
||||||
|
|
||||||
function iconpreview($id,$default,$width='',$height='') // FIXME
|
function iconpreview($id, $default, $width='', $height='') // FIXME
|
||||||
{
|
{
|
||||||
$parms = $name."|".$width."|".$height."|".$id;
|
$parms = $name."|".$width."|".$height."|".$id;
|
||||||
$sc_parameters .= 'mode=preview&default='.$default.'&id='.$id;
|
$sc_parameters .= 'mode=preview&default='.$default.'&id='.$id;
|
||||||
@@ -134,10 +134,10 @@ class e_form
|
|||||||
//$parms .= "&click_target=data";
|
//$parms .= "&click_target=data";
|
||||||
//$parms .= "&click_prefix=[img][[e_IMAGE]]newspost_images/";
|
//$parms .= "&click_prefix=[img][[e_IMAGE]]newspost_images/";
|
||||||
//$parms .= "&click_postfix=[/img]";
|
//$parms .= "&click_postfix=[/img]";
|
||||||
|
$tp = e107::getParser();
|
||||||
$ret = "<div class='field-section'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=select}")."</div>";
|
$ret = "<div class='field-section'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=select}")."</div>";
|
||||||
$ret = "<div class='field-spacer'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=preview}")."</div>";
|
$ret .= "<div class='field-spacer'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=preview}")."</div>";
|
||||||
return $text;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -563,10 +563,13 @@ class e_form
|
|||||||
if($id_value === false) return '';
|
if($id_value === false) return '';
|
||||||
|
|
||||||
//format data first
|
//format data first
|
||||||
$name = $this->name2id($name);
|
$name = trim($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 = trim(str_replace("/","-",$value), '-');
|
||||||
if(!$id_value && is_numeric($value)) $id_value = $value;
|
if(!$id_value && is_numeric($value)) $id_value = $value;
|
||||||
|
|
||||||
|
// clean - do it better, this could lead to dups
|
||||||
|
$id_value = trim($id_value, '-');
|
||||||
|
|
||||||
if(empty($id_value) ) return " {$return_attribute}='{$name}".($value ? "-{$value}" : '')."'";// also useful when name is e.g. name='my_name[some_id]'
|
if(empty($id_value) ) 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) return " {$return_attribute}='{$name}-{$id_value}'";// also useful when name is e.g. name='my_name[]'
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* Message Handler
|
* Message Handler
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/message_handler.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/message_handler.php,v $
|
||||||
* $Revision: 1.23 $
|
* $Revision: 1.24 $
|
||||||
* $Date: 2009-10-30 17:59:32 $
|
* $Date: 2009-11-01 19:05:25 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -466,7 +466,6 @@ class eMessage
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Merge _SESSION message array with the current messages
|
* Merge _SESSION message array with the current messages
|
||||||
* TODO - merge stacks, merge custom stack to default
|
|
||||||
*
|
*
|
||||||
* @param boolean $reset
|
* @param boolean $reset
|
||||||
* @return eMessage
|
* @return eMessage
|
||||||
@@ -499,6 +498,38 @@ class eMessage
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert current messages to Session messages
|
||||||
|
*
|
||||||
|
* @param string $mstack false - move all message stacks
|
||||||
|
* @param string $message_type false - move all types
|
||||||
|
* @return unknown
|
||||||
|
*/
|
||||||
|
public function moveToSession($mstack = false, $message_type = false)
|
||||||
|
{
|
||||||
|
foreach (array_keys($this->_sysmsg) as $type)
|
||||||
|
{
|
||||||
|
if(!$this->isType($type) || ($message_type && $message_type !== $type))
|
||||||
|
{
|
||||||
|
unset($this->_sysmsg[$type]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(false === $mstack)
|
||||||
|
{
|
||||||
|
$_SESSION[$this->_session_id][$type] = array_merge_recursive( $_SESSION[$this->_session_id][$type], $this->_sysmsg[$type]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($this->_sysmsg[$type][$mstack]))
|
||||||
|
{
|
||||||
|
$_SESSION[$this->_session_id][$type][$mstack] = $this->_sysmsg[$type][$mstack];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->reset($message_type, $mstack, false);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merge messages from source stack with destination stack
|
* Merge messages from source stack with destination stack
|
||||||
* and reset source stack
|
* and reset source stack
|
||||||
|
@@ -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.27 $
|
* $Revision: 1.28 $
|
||||||
* $Date: 2009-10-30 17:59:31 $
|
* $Date: 2009-11-01 19:05:25 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -712,7 +712,7 @@ class e_model
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param boolean $session [optional]
|
* @param boolean $session [optional]
|
||||||
* @return e_validator
|
* @return e_model
|
||||||
*/
|
*/
|
||||||
public function addMessageInfo($message, $session = false)
|
public function addMessageInfo($message, $session = false)
|
||||||
{
|
{
|
||||||
@@ -720,12 +720,25 @@ class e_model
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add system message of type Success
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param boolean $session [optional]
|
||||||
|
* @return e_model
|
||||||
|
*/
|
||||||
|
public function addMessageSuccess($message, $session = false)
|
||||||
|
{
|
||||||
|
e107::getMessage()->addStack($message, $this->_message_stack, E_MESSAGE_SUCCESS, $session);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add system message of type Warning
|
* Add system message of type Warning
|
||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param boolean $session [optional]
|
* @param boolean $session [optional]
|
||||||
* @return e_validator
|
* @return e_model
|
||||||
*/
|
*/
|
||||||
public function addMessageWarning($message, $session = false)
|
public function addMessageWarning($message, $session = false)
|
||||||
{
|
{
|
||||||
@@ -738,7 +751,7 @@ class e_model
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param boolean $session [optional]
|
* @param boolean $session [optional]
|
||||||
* @return e_validator
|
* @return e_model
|
||||||
*/
|
*/
|
||||||
public function addMessageError($message, $session = false)
|
public function addMessageError($message, $session = false)
|
||||||
{
|
{
|
||||||
@@ -751,7 +764,7 @@ class e_model
|
|||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param boolean $session [optional]
|
* @param boolean $session [optional]
|
||||||
* @return e_validator
|
* @return e_model
|
||||||
*/
|
*/
|
||||||
public function addMessageDebug($message, $session = false)
|
public function addMessageDebug($message, $session = false)
|
||||||
{
|
{
|
||||||
@@ -775,7 +788,7 @@ class e_model
|
|||||||
* Move model System messages (if any) to the default eMessage stack
|
* Move model System messages (if any) to the default eMessage stack
|
||||||
*
|
*
|
||||||
* @param boolean $session store messages to session
|
* @param boolean $session store messages to session
|
||||||
* @return setMessages
|
* @return e_model
|
||||||
*/
|
*/
|
||||||
public function setMessages($session = false)
|
public function setMessages($session = false)
|
||||||
{
|
{
|
||||||
@@ -1639,8 +1652,13 @@ class e_admin_model extends e_model
|
|||||||
$this->_db_errno = e107::getDb()->getLastErrorNumber();
|
$this->_db_errno = e107::getDb()->getLastErrorNumber();
|
||||||
$this->addMessageError('SQL Insert Error', $session_messages); //TODO - Lan
|
$this->addMessageError('SQL Insert Error', $session_messages); //TODO - Lan
|
||||||
$this->addMessageDebug('SQL Error #'.$this->_db_errno.': '.e107::getDb()->getLastErrorText());
|
$this->addMessageDebug('SQL Error #'.$this->_db_errno.': '.e107::getDb()->getLastErrorText());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the reutrned ID
|
||||||
|
$this->setId($res);
|
||||||
|
$this->addMessageSuccess(LAN_CREATED);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1693,9 +1711,12 @@ class e_admin_model extends e_model
|
|||||||
{
|
{
|
||||||
$this->addMessageError('SQL Update Error', $session_messages); //TODO - Lan
|
$this->addMessageError('SQL Update Error', $session_messages); //TODO - Lan
|
||||||
$this->addMessageDebug('SQL Error #'.$this->_db_errno.': '.e107::getDb()->getLastErrorText());
|
$this->addMessageDebug('SQL Error #'.$this->_db_errno.': '.e107::getDb()->getLastErrorText());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
$this->addMessageInfo(LAN_NO_CHANGE);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
$this->addMessageSuccess(LAN_UPDATED);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* 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.12 $
|
* $Revision: 1.13 $
|
||||||
* $Date: 2009-10-31 17:57:15 $
|
* $Date: 2009-11-01 19:05:26 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -42,7 +42,7 @@ e107::getAdminUI()->runPage();
|
|||||||
require_once(e_ADMIN."footer.php");
|
require_once(e_ADMIN."footer.php");
|
||||||
|
|
||||||
/* OBSOLETE - see admin_shortcodes::sc_admin_menu()
|
/* OBSOLETE - see admin_shortcodes::sc_admin_menu()
|
||||||
function admin_config_adminmenu() //TODO move this into e_model_interface
|
function admin_config_adminmenu()
|
||||||
{
|
{
|
||||||
//global $rp;
|
//global $rp;
|
||||||
//$rp->show_options();
|
//$rp->show_options();
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* Release Plugin Administration UI
|
* Release Plugin Administration UI
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/release/includes/admin.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/release/includes/admin.php,v $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2009-10-31 17:57:15 $
|
* $Date: 2009-11-01 19:05:26 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -24,16 +24,26 @@ class plugin_release_admin extends e_admin_dispatcher
|
|||||||
protected $modes = array(
|
protected $modes = array(
|
||||||
'main' => array('controller' => 'plugin_release_admin_ui', 'path' => null, 'ui' => 'plugin_release_admin_form_ui', 'uipath' => null)
|
'main' => array('controller' => 'plugin_release_admin_ui', 'path' => null, 'ui' => 'plugin_release_admin_form_ui', 'uipath' => null)
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format: 'MODE/ACTION' => array('caption' => 'Menu link title'[, 'url' => '{e_PLUGIN}release/admin_config.php', 'perm' => '0']);
|
* 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
|
* Additionally, any valid e_admin_menu() key-value pair could be added to the above array
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $adminMenu = array(
|
protected $adminMenu = array(
|
||||||
'main/list' => array('caption'=> 'Release List', 'perm'=>'0'),
|
'main/list' => array('caption'=> 'Manage', 'perm' => '0'),
|
||||||
'main/create' => array('caption'=> LAN_CREATE, 'perm'=>'0'),
|
'main/create' => array('caption'=> LAN_CREATE, 'perm' => '0'),
|
||||||
'main/options' => array('caption'=> LAN_OPTIONS, 'perm'=>'0'),
|
'main/options' => array('caption'=> 'Settings', 'perm' => '0'),
|
||||||
'main/custom' => array('caption'=> 'Custom Page', 'perm'=>0)
|
'main/custom' => array('caption'=> 'Custom Page', 'perm' => '0')
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional, map mode/action t
|
||||||
|
* Format: 'MODE/ACTION' => 'MODE ALIAS/ACTION ALIAS';
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $adminMenuAliases = array(
|
||||||
|
'main/edit' => 'main/list'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -345,6 +345,7 @@ button.cancel:active span {}
|
|||||||
.buttons-bar { padding: 10px 0px; }
|
.buttons-bar { padding: 10px 0px; }
|
||||||
.buttons-bar button { margin-right: 10px; }
|
.buttons-bar button { margin-right: 10px; }
|
||||||
.buttons-bar button.f-right { margin-right: 0px; }
|
.buttons-bar button.f-right { margin-right: 0px; }
|
||||||
|
.buttons-bar .options { margin-bottom: 10px; }
|
||||||
|
|
||||||
/* Actions (adminlist) - input type image */
|
/* Actions (adminlist) - input type image */
|
||||||
input.action { vertical-align: middle; } /* default */
|
input.action { vertical-align: middle; } /* default */
|
||||||
|
@@ -650,6 +650,7 @@ button.cancel:active span {}
|
|||||||
.buttons-bar { padding: 10px 0px; }
|
.buttons-bar { padding: 10px 0px; }
|
||||||
.buttons-bar button { margin-right: 10px; }
|
.buttons-bar button { margin-right: 10px; }
|
||||||
.buttons-bar button.f-right { margin-right: 0px; }
|
.buttons-bar button.f-right { margin-right: 0px; }
|
||||||
|
.buttons-bar .options { margin-bottom: 10px; }
|
||||||
|
|
||||||
/* Actions (adminlist) - input type image */
|
/* Actions (adminlist) - input type image */
|
||||||
input.action { vertical-align: middle; } /* default */
|
input.action { vertical-align: middle; } /* default */
|
||||||
|
Reference in New Issue
Block a user