mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Issue #129 Custom-Menus not displaying in Menu Manager.
This commit is contained in:
parent
ae1f60f42f
commit
3556ebf743
@ -45,7 +45,14 @@ class page_admin extends e_admin_dispatcher
|
||||
'path' => null,
|
||||
'ui' => 'menu_admin_form_ui',
|
||||
'uipath' => null
|
||||
)
|
||||
),
|
||||
'dialog' => array(
|
||||
'controller' => 'menu_admin_ui',
|
||||
'path' => null,
|
||||
'ui' => 'menu_admin_form_ui',
|
||||
'uipath' => null
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
protected $adminMenu = array(
|
||||
@ -185,7 +192,7 @@ class menu_admin_ui extends e_admin_ui
|
||||
|
||||
protected $fields = array(
|
||||
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||
'page_id' => array('title'=> 'ID', 'type'=>'text', 'tab' => 0, 'width'=>'5%', 'readParms'=>'link=sef&dialog=1','forced'=> TRUE),
|
||||
'page_id' => array('title'=> 'ID', 'type'=>'text', 'tab' => 0, 'width'=>'5%', 'readParms'=>'','forced'=> TRUE),
|
||||
'page_theme' => array('title'=> "Menu Name", 'tab' => 0, 'type' => 'text', 'width' => 'auto','nolist'=>true),
|
||||
|
||||
'page_title' => array('title'=> LAN_TITLE, 'tab' => 0, 'type' => 'text', 'width'=>'25%', 'inline'=>true,/*'readParms'=>'link={e_BASE}page.php?[id]&dialog=1'*/),
|
||||
@ -199,6 +206,98 @@ class menu_admin_ui extends e_admin_ui
|
||||
|
||||
protected $fieldpref = array("page_id","page_theme", "page_title", "page_text");
|
||||
|
||||
|
||||
function init()
|
||||
{
|
||||
$this->fields['page_id']['readParms'] = array('link'=> e_SELF."?mode=dialog&action=preview&id=[id]", 'target'=> 'modal', 'iframe' => true);
|
||||
|
||||
|
||||
if(E107_DEBUG_LEVEL > 0 && e_AJAX_REQUEST)
|
||||
{
|
||||
echo "REQUEST = ".e_REQUEST_SELF; //XXX Why no Query String ?? FIXME
|
||||
// $this->getAction()
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($this->getMode() == 'dialog')
|
||||
{
|
||||
|
||||
$this->getRequest()->setAction('preview');
|
||||
|
||||
// $this->setDefaultAction('previewPage');
|
||||
|
||||
// echo "ACTIOn = ".$this->getAction();
|
||||
|
||||
define('e_IFRAME', TRUE);
|
||||
|
||||
// return;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
function CreateHeader()
|
||||
{
|
||||
e107::css('inline',' body { background-color: green } ');
|
||||
}
|
||||
|
||||
// Create Menu in Menu Table
|
||||
function afterCreate($newdata,$olddata, $id)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
$mes = e107::getMessage();
|
||||
|
||||
$menu_name = $tp->toDB($newdata['page_theme']); // not to be confused with menu-caption.
|
||||
$menu_path = intval($id);
|
||||
|
||||
if (!$sql->select('menus', 'menu_name', "`menu_path` = ".$menu_path." LIMIT 1"))
|
||||
{
|
||||
$insert = array('menu_name' => $menu_name, 'menu_path' => $menu_path);
|
||||
|
||||
if($sql->insert('menus', $insert) !== false)
|
||||
{
|
||||
|
||||
$mes->addDebug("Menu Created");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Update Menu in Menu Table
|
||||
function afterUpdate($newdata,$olddata,$id)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$sql = e107::getDb();
|
||||
$mes = e107::getMessage();
|
||||
|
||||
$menu_name = $tp->toDB($newdata['page_theme']); // not to be confused with menu-caption.
|
||||
|
||||
if ($sql->select('menus', 'menu_name', "`menu_path` = ".$id." LIMIT 1"))
|
||||
{
|
||||
if($sql->update('menus', "menu_name='{$menu_name}' WHERE menu_path=".$id." LIMIT 1") !== false)
|
||||
{
|
||||
$mes->addDebug("Menu Updated");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function previewPage() //XXX FIXME Doesn't work when in Ajax mode.. why???
|
||||
{
|
||||
print_a($_GET);
|
||||
|
||||
// $id = $this->getListModel()->get('page_id');
|
||||
$tp = e107::getParser();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//TODO XXX FIXME // Hooks!
|
||||
@ -286,7 +385,8 @@ class page_admin_ui extends e_admin_ui
|
||||
protected $templates = array();
|
||||
|
||||
function init()
|
||||
{
|
||||
{
|
||||
|
||||
$this->templates = e107::getLayouts('', 'page', 'front', '', false, false);
|
||||
$this->fields['page_template']['writeParms'] = $this->templates;
|
||||
|
||||
@ -315,6 +415,8 @@ class page_admin_ui extends e_admin_ui
|
||||
}
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
new page_admin();
|
||||
require_once('auth.php');
|
||||
|
@ -4530,6 +4530,8 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
|
||||
/**
|
||||
* User defined pre-create logic, return false to prevent DB query execution
|
||||
* @param $new_data
|
||||
* @param $old_data
|
||||
*/
|
||||
public function beforeCreate($new_data, $old_data)
|
||||
{
|
||||
@ -4537,6 +4539,9 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
|
||||
/**
|
||||
* User defined after-create logic
|
||||
* @param $new_data
|
||||
* @param $old_data
|
||||
* @param $id
|
||||
*/
|
||||
public function afterCreate($new_data, $old_data, $id)
|
||||
{
|
||||
@ -4544,6 +4549,8 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
|
||||
/**
|
||||
* User defined error handling, return true to suppress model messages
|
||||
* @param $new_data
|
||||
* @param $old_data
|
||||
*/
|
||||
public function onCreateError($new_data, $old_data)
|
||||
{
|
||||
@ -4551,6 +4558,8 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
|
||||
/**
|
||||
* User defined pre-update logic, return false to prevent DB query execution
|
||||
* @param $new_data
|
||||
* @param $old_data
|
||||
*/
|
||||
public function beforeUpdate($new_data, $old_data, $id)
|
||||
{
|
||||
@ -4558,6 +4567,8 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
|
||||
/**
|
||||
* User defined after-update logic
|
||||
* @param $new_data
|
||||
* @param $old_data
|
||||
*/
|
||||
public function afterUpdate($new_data, $old_data, $id)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user