mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 22:57:14 +02:00
- menu parameters temporary UI solution
- various minor fixes and improvements (menu manager) - message handler wont accept emtpy messages now
This commit is contained in:
@@ -2,16 +2,14 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) 2008-2012 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/menus.php,v $
|
* $URL$
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(isset($_GET['configure']))
|
if(isset($_GET['configure']))
|
||||||
@@ -29,7 +27,9 @@ if (!getperms("2"))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
//include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
|
||||||
|
e107::coreLan('menus', true);
|
||||||
|
e107::coreLan('admin', true);
|
||||||
|
|
||||||
$e_sub_cat = 'menus';
|
$e_sub_cat = 'menus';
|
||||||
|
|
||||||
@@ -78,6 +78,7 @@ if($_POST)
|
|||||||
$text .= $men->menuRenderMessage();
|
$text .= $men->menuRenderMessage();
|
||||||
$text .= $men->menuSelectLayout();
|
$text .= $men->menuSelectLayout();
|
||||||
$text .= $men->menuVisibilityOptions();
|
$text .= $men->menuVisibilityOptions();
|
||||||
|
$text .= $men->menuInstanceParameters();
|
||||||
$text .= $men->menuRenderIframe();
|
$text .= $men->menuRenderIframe();
|
||||||
$ns -> tablerender(ADLAN_6." :: ".LAN_MENULAYOUT, $text, 'menus_config');
|
$ns -> tablerender(ADLAN_6." :: ".LAN_MENULAYOUT, $text, 'menus_config');
|
||||||
}
|
}
|
||||||
|
@@ -2,16 +2,14 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) 2008-2012 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/menumanager_class.php,v $
|
* $URL$
|
||||||
* $Revision$
|
* $Id$
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@@ -71,14 +69,16 @@ class e_menuManager {
|
|||||||
|
|
||||||
if(isset($_POST['menu_id']) || $_GET['id'])
|
if(isset($_POST['menu_id']) || $_GET['id'])
|
||||||
{
|
{
|
||||||
$this->menuId = (isset($_POST['menu_id'])) ? intval($_POST['menu_id']) : $_GET['id'];
|
$this->menuId = (isset($_POST['menu_id'])) ? intval($_POST['menu_id']) : intval($_GET['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($menu_act == "sv" || isset($_POST['class_submit']))
|
if (/*$menu_act == "sv" || */isset($_POST['class_submit']))
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->menuSaveVisibility();
|
$this->menuSaveVisibility();
|
||||||
|
}
|
||||||
|
elseif(isset($_POST['parms_submit']))
|
||||||
|
{
|
||||||
|
$this->menuSaveParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET['mode'] == "deac")
|
if ($_GET['mode'] == "deac")
|
||||||
@@ -155,19 +155,18 @@ class e_menuManager {
|
|||||||
function menuRenderMessage()
|
function menuRenderMessage()
|
||||||
{
|
{
|
||||||
// return $this->menuMessage;
|
// return $this->menuMessage;
|
||||||
$emessage = &eMessage::getInstance();
|
$emessage = eMessage::getInstance();
|
||||||
|
$text = $emessage->render('menuUi');
|
||||||
$text = $emessage->render($message);
|
|
||||||
// $text .= "ID = ".$this->menuId;
|
// $text .= "ID = ".$this->menuId;
|
||||||
return $text;
|
return $text;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function menuAddMessage($message, $type = E_MESSAGE_INFO, $session = false)
|
function menuAddMessage($message, $type = E_MESSAGE_INFO, $session = false)
|
||||||
{
|
{
|
||||||
$emessage = &eMessage::getInstance();
|
$emessage = eMessage::getInstance();
|
||||||
$emessage->add($message, $type, $session);
|
$emessage->add(array($message, 'menuUi'), $type, $session);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@@ -245,7 +244,7 @@ class e_menuManager {
|
|||||||
{
|
{
|
||||||
if (trim($v))
|
if (trim($v))
|
||||||
{
|
{
|
||||||
$this->menuId = $k;
|
$this->menuId = intval($k);
|
||||||
list($menu_act, $location, $position, $this->menuNewLoc) = explode(".", $_POST['menuAct'][$k]);
|
list($menu_act, $location, $position, $this->menuNewLoc) = explode(".", $_POST['menuAct'][$k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -448,9 +447,48 @@ class e_menuManager {
|
|||||||
return $link_class;
|
return $link_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This one will be greatly extended, allowing menus to offer UI and us
|
||||||
|
* settings per instance later ($parm variable available for menus - same as shortcode's $parm)
|
||||||
|
*/
|
||||||
|
function menuInstanceParameters()
|
||||||
|
{
|
||||||
|
if(!$_GET['parmsId']) return;
|
||||||
|
$id = intval($_GET['parmsId']);
|
||||||
|
$frm = e107::getForm();
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
|
if(!$sql->db_Select("menus", "*", "menu_id=".$id))
|
||||||
|
{
|
||||||
|
$this->menuAddMessage("Couldn't Load Menu",E_MESSAGE_ERROR);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
$row = $sql->db_Fetch();
|
||||||
|
|
||||||
|
// TODO lan
|
||||||
|
$text = "<div style='text-align:center;'>
|
||||||
|
<form method='post' action='".e_SELF."?lay=".$this->curLayout."'>
|
||||||
|
<fieldset id='core-menus-parametersform'>
|
||||||
|
<legend>Menu parameters ".$row['menu_name']."</legend>
|
||||||
|
<table cellpadding='0' cellspacing='0' class='adminform'>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
Parameters (query string format):
|
||||||
|
".$frm->text('menu_parms', $row['menu_parms'], 900)."
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class='buttons-bar center'>";
|
||||||
|
$text .= $frm->admin_button('parms_submit', LAN_SAVE, 'update');
|
||||||
|
$text .= "<input type='hidden' name='menu_id' value='".$id."' />
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>";
|
||||||
|
return $text;
|
||||||
|
//$caption = MENLAN_7." ".$row['menu_name'];
|
||||||
|
//$ns->tablerender($caption, $text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function menuVisibilityOptions()
|
function menuVisibilityOptions()
|
||||||
@@ -474,11 +512,6 @@ class e_menuManager {
|
|||||||
<fieldset id='core-menus-visibilityform'>
|
<fieldset id='core-menus-visibilityform'>
|
||||||
<legend>". MENLAN_7." ".$row['menu_name']."</legend>
|
<legend>". MENLAN_7." ".$row['menu_name']."</legend>
|
||||||
<table cellpadding='0' cellspacing='0' class='adminform'>
|
<table cellpadding='0' cellspacing='0' class='adminform'>
|
||||||
|
|
||||||
<colgroup span='2'>
|
|
||||||
<col class='col-label' />
|
|
||||||
<col class='col-control' />
|
|
||||||
</colgroup>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type='hidden' name='menuAct[{$row['menu_id']}]' value='sv.{$row['menu_id']}' />
|
<input type='hidden' name='menuAct[{$row['menu_id']}]' value='sv.{$row['menu_id']}' />
|
||||||
@@ -633,7 +666,27 @@ class e_menuManager {
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function menuSaveParameters()
|
||||||
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$parms = $sql->escape(strip_tags($_POST['menu_parms']));
|
||||||
|
$check = $sql->db_Update("menus", "menu_parms='".$parms."' WHERE menu_id=".$this->menuId);
|
||||||
|
|
||||||
|
if($check)
|
||||||
|
{
|
||||||
|
// FIXME - menu log
|
||||||
|
//$admin_log->log_event('MENU_02',$_POST['menu_parms'].'[!br!]'.$parms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,'');
|
||||||
|
$this->menuAddMessage(LAN_SAVED,E_MESSAGE_SUCCESS);
|
||||||
|
}
|
||||||
|
elseif(false === $check)
|
||||||
|
{
|
||||||
|
$this->menuAddMessage(LAN_UPDATED_FAILED,E_MESSAGE_ERROR);
|
||||||
|
}
|
||||||
|
else $this->menuAddMessage(LAN_NOCHANGE_NOTSAVED,E_MESSAGE_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@@ -1047,13 +1100,20 @@ class e_menuManager {
|
|||||||
//FIXME extract
|
//FIXME extract
|
||||||
extract($row);
|
extract($row);
|
||||||
if(!$menu_id){ return; }
|
if(!$menu_id){ return; }
|
||||||
|
include_once(e_HANDLER.'admin_handler.php');
|
||||||
$menu_name = preg_replace("#_menu#i", "", $menu_name);
|
$menu_name = preg_replace("#_menu#i", "", $menu_name);
|
||||||
//TODO we need a CSS class for this
|
//TODO we need a CSS class for this
|
||||||
$vis = ($menu_class || strlen($menu_pages) > 1) ? " <span class='required'>*</span> " : "";
|
$vis = ($menu_class || strlen($menu_pages) > 1) ? " <span class='required'>*</span> " : "";
|
||||||
//DEBUG div not allowed in final tags $caption = "<div style='text-align:center'>{$menu_name}{$vis}</div>";
|
//DEBUG div not allowed in final tags $caption = "<div style='text-align:center'>{$menu_name}{$vis}</div>";
|
||||||
// use theme render style instead
|
// use theme render style instead
|
||||||
$caption = $menu_name.$vis;
|
$menuParms = array();
|
||||||
|
if(!empty($row['menu_parms'])) parse_str($row['menu_parms'], $menuParms);
|
||||||
|
if(isset($menuParms['admin_title']) && $menuParms['admin_title'])
|
||||||
|
{
|
||||||
|
$caption = deftrue($menuParms['admin_title'], $menuParms['admin_title']).$vis;
|
||||||
|
}
|
||||||
|
else $caption = $menu_name.$vis;
|
||||||
|
|
||||||
$menu_info = "{$menu_location}.{$menu_order}";
|
$menu_info = "{$menu_location}.{$menu_order}";
|
||||||
|
|
||||||
$text = "";
|
$text = "";
|
||||||
@@ -1095,21 +1155,26 @@ class e_menuManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $text .= $rs->form_option(MENLAN_20, "", "adv.{$menu_info}");
|
// Visibility is an action icon now
|
||||||
|
//$text .= $rs->form_option(MENLAN_20, "", "adv.{$menu_info}");
|
||||||
$text .= $rs->form_select_close();
|
$text .= $rs->form_select_close();
|
||||||
//DEBUG remove inline style, switch to simple quoted string for title text value
|
//DEBUG remove inline style, switch to simple quoted string for title text value
|
||||||
//TODO hardcoded text
|
//TODO hardcoded text
|
||||||
$text .= '<div class="right">
|
$text .= '<div class="right">
|
||||||
<a target="_top" href="'.e_SELF.'?lay='.$this->curLayout.'&vis='.$menu_id.'">
|
<a target="_top" href="'.e_SELF.'?lay='.$this->curLayout.'&vis='.$menu_id.'" title="'.MENLAN_20.'">
|
||||||
'.ADMIN_VIEW_ICON.'
|
'.ADMIN_VIEW_ICON.'
|
||||||
</a>';
|
</a>';
|
||||||
|
|
||||||
if($conf)
|
if($conf)
|
||||||
{
|
{
|
||||||
$text .= '<a target="_top" href="'.e_SELF.'?lay='.$this->curLayout.'&mode=conf&path='.urlencode($conf).'&id='.$menu_id.'">
|
$text .= '<a target="_top" href="'.e_SELF.'?lay='.$this->curLayout.'&mode=conf&path='.urlencode($conf).'&id='.$menu_id.'" title="Configure menu">
|
||||||
'.ADMIN_CONFIGURE_ICON.'
|
'.ADMIN_CONFIGURE_ICON.'
|
||||||
</a>';
|
</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$text .= '<a target="_top" href="'.e_SELF.'?lay='.$this->curLayout.'&parmsId='.$menu_id.'" title="Configure parameters">
|
||||||
|
'._ITAG('edit', 16, 'icon action S16').'
|
||||||
|
</a>';
|
||||||
|
|
||||||
$text .= '<a class="delete" href="'.e_SELF.'?configure='.$this->curLayout.'&mode=deac&id='.$menu_id.'">'.ADMIN_DELETE_ICON.'
|
$text .= '<a class="delete" href="'.e_SELF.'?configure='.$this->curLayout.'&mode=deac&id='.$menu_id.'">'.ADMIN_DELETE_ICON.'
|
||||||
</a>
|
</a>
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2010 e107 Inc (e107.org)
|
* Copyright (C) 2008-2012 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
@@ -161,7 +161,8 @@ class eMessage
|
|||||||
$mstack = $message[1];
|
$mstack = $message[1];
|
||||||
$msg = $message[0];
|
$msg = $message[0];
|
||||||
}
|
}
|
||||||
|
if(empty($msg)) return $this;
|
||||||
|
|
||||||
if(!$session)
|
if(!$session)
|
||||||
{
|
{
|
||||||
if($this->isType($type)) $this->_sysmsg[$type][$mstack][] = $msg;
|
if($this->isType($type)) $this->_sysmsg[$type][$mstack][] = $msg;
|
||||||
|
Reference in New Issue
Block a user