mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
e_menu.php introduced to replace legacy menu configuration file (config.php). See banner plugin for an example.
This commit is contained in:
@@ -53,6 +53,12 @@ e107::coreLan('footer', true);
|
|||||||
// Get Icon constants, theme override (theme/templates/admin_icons_template.php) is allowed
|
// Get Icon constants, theme override (theme/templates/admin_icons_template.php) is allowed
|
||||||
include_once(e107::coreTemplatePath('admin_icons'));
|
include_once(e107::coreTemplatePath('admin_icons'));
|
||||||
|
|
||||||
|
if(!empty($_GET['iframe']))
|
||||||
|
{
|
||||||
|
define('e_IFRAME', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!defset('e_ADMIN_UI') && !defset('e_PAGETITLE'))
|
if(!defset('e_ADMIN_UI') && !defset('e_PAGETITLE'))
|
||||||
{
|
{
|
||||||
|
@@ -59,14 +59,47 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
|
|||||||
e107::js('core','bootstrap/js/bootstrap-tooltip.js');
|
e107::js('core','bootstrap/js/bootstrap-tooltip.js');
|
||||||
// e107::css('core','bootstrap/css/bootstrap.min.css');
|
// e107::css('core','bootstrap/css/bootstrap.min.css');
|
||||||
|
|
||||||
|
$JSMODAL = <<<TEMPL
|
||||||
|
$(function() {
|
||||||
|
$('.e-modal-menumanager').on('click', function(e)
|
||||||
|
{
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if($(this).attr('data-cache') == 'false')
|
||||||
|
{
|
||||||
|
window.parent.$('#uiModal').on('shown.bs.modal', function () {
|
||||||
|
$(this).removeData('bs.modal');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = $(this).attr('href');
|
||||||
|
var caption = $(this).attr('data-modal-caption');
|
||||||
|
var height = 600;
|
||||||
|
|
||||||
|
if(caption === undefined)
|
||||||
|
{
|
||||||
|
caption = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
window.parent.$('.modal-body').html('<div class="well"><iframe id="e-modal-iframe" width="100%" height="'+height+'px" frameborder="0" scrolling="auto" style="display:block;background-color:transparent" allowtransparency="true" src="' + url + '"></iframe></div>');
|
||||||
|
window.parent.$('.modal-caption').html(caption + ' <i id="e-modal-loading" class="fa fa-spin fa-spinner"></i>');
|
||||||
|
window.parent.$('.modal').modal('show');
|
||||||
|
|
||||||
|
window.parent.$("#e-modal-iframe").on("load", function () {
|
||||||
|
window.parent.$('#e-modal-loading').hide();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
TEMPL;
|
||||||
|
|
||||||
|
|
||||||
|
e107::js('inline', $JSMODAL );
|
||||||
|
|
||||||
e107::js('inline', "
|
e107::js('inline', "
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
// Visibility Options
|
// Visibility/Instance Options etc.
|
||||||
|
|
||||||
$('.e-menumanager-option').on('click', function(){
|
$('.e-menumanager-option').on('click', function(){
|
||||||
|
|
||||||
@@ -79,14 +112,14 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
|
|||||||
|
|
||||||
var target = window.parent.$('#e-save-form').attr('action');
|
var target = window.parent.$('#e-save-form').attr('action');
|
||||||
var data = window.parent.$('#e-save-form').serialize();
|
var data = window.parent.$('#e-save-form').serialize();
|
||||||
|
|
||||||
// alert(data);
|
// alert(data);
|
||||||
|
// alert(target);
|
||||||
$.post(target, data ,function(ret)
|
$.post(target, data ,function(ret)
|
||||||
{
|
{
|
||||||
// alert('Posted: '+ret);
|
// alert('Posted: '+ret);
|
||||||
var a = $.parseJSON(ret);
|
var a = $.parseJSON(ret);
|
||||||
|
|
||||||
if(a.error)
|
if(a.error)
|
||||||
{
|
{
|
||||||
alert(a.msg);
|
alert(a.msg);
|
||||||
@@ -138,7 +171,12 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
|
|||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
");
|
");
|
||||||
|
|
||||||
|
|
||||||
@@ -905,12 +943,10 @@ class e_layout
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
function menuSaveAjax($mode = null)
|
function menuSaveAjax($mode = null)
|
||||||
{
|
{
|
||||||
//print_r($_POST);
|
|
||||||
// return;
|
|
||||||
|
|
||||||
if($mode == 'visibility')
|
if($mode == 'visibility')
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -922,8 +958,10 @@ class e_layout
|
|||||||
|
|
||||||
if($mode == 'parms')
|
if($mode == 'parms')
|
||||||
{
|
{
|
||||||
$ret = $this->menuSaveParameters();
|
// echo "hi there";
|
||||||
// echo json_encode($ret);
|
$ret = array('msg'=>'hi there','error'=>true);
|
||||||
|
// $ret = $this->menuSaveParameters();
|
||||||
|
echo json_encode($ret);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -934,7 +972,7 @@ class e_layout
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* Scan Plugin folders for new _menu files.
|
* Scan Plugin folders for new _menu files.
|
||||||
*/
|
*/
|
||||||
@@ -1071,7 +1109,9 @@ class e_layout
|
|||||||
/**
|
/**
|
||||||
* This one will be greatly extended, allowing menus to offer UI and us
|
* 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)
|
* settings per instance later ($parm variable available for menus - same as shortcode's $parm)
|
||||||
|
* @see menuInstanceParameters() in menumanager_class.php
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
private function renderInstanceParameters()
|
private function renderInstanceParameters()
|
||||||
{
|
{
|
||||||
if(!vartrue($_GET['parmsId'])) return;
|
if(!vartrue($_GET['parmsId'])) return;
|
||||||
@@ -1093,20 +1133,20 @@ class e_layout
|
|||||||
<table class='table adminform'>
|
<table class='table adminform'>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
".MENLAN_45."
|
".MENLAN_45."</td><td>
|
||||||
".$frm->text('menu_parms', $row['menu_parms'], 900, 'class=e-save span7')."
|
".$frm->text('menu_parms', $row['menu_parms'], 900, 'class=e-save ')."
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>";
|
</table>";
|
||||||
/*
|
|
||||||
|
|
||||||
$text .= "
|
// $text .= "
|
||||||
<div class='buttons-bar center'>";
|
// <div class='buttons-bar center'>";
|
||||||
$text .= $frm->admin_button('parms_submit', LAN_SAVE, 'update');
|
// $text .= $frm->admin_button('parms_submit', LAN_SAVE, 'update');
|
||||||
$text .= "<input type='hidden' name='menu_id' value='".$id."' />
|
// $text .= "<input type='hidden' name='menu_id' value='".$id."' />
|
||||||
</div>";
|
// </div>";
|
||||||
|
|
||||||
*/
|
|
||||||
$text .= $frm->hidden('mode','parms');
|
$text .= $frm->hidden('mode','parms');
|
||||||
$text .= $frm->hidden('menu_id',$id);
|
$text .= $frm->hidden('menu_id',$id);
|
||||||
$text .= "
|
$text .= "
|
||||||
@@ -1117,6 +1157,7 @@ class e_layout
|
|||||||
return $text;
|
return $text;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the main area with TABS and iframes.
|
* Render the main area with TABS and iframes.
|
||||||
|
@@ -127,9 +127,9 @@ class pluginmanager_form extends e_form
|
|||||||
{
|
{
|
||||||
$text .= ($this->plug['plugin_installflag'] ? "<a class='btn btn-default' href=\"".e_SELF."?uninstall.{$this->plug['plugin_id']}\" title='".EPL_ADLAN_1."' >".ADMIN_UNINSTALLPLUGIN_ICON."</a>" : "<a class='btn' href=\"".e_SELF."?install.{$this->plug['plugin_id']}\" title='".EPL_ADLAN_0."' >".ADMIN_INSTALLPLUGIN_ICON."</a>");
|
$text .= ($this->plug['plugin_installflag'] ? "<a class='btn btn-default' href=\"".e_SELF."?uninstall.{$this->plug['plugin_id']}\" title='".EPL_ADLAN_1."' >".ADMIN_UNINSTALLPLUGIN_ICON."</a>" : "<a class='btn' href=\"".e_SELF."?install.{$this->plug['plugin_id']}\" title='".EPL_ADLAN_0."' >".ADMIN_INSTALLPLUGIN_ICON."</a>");
|
||||||
// $text .= ($this->plug['plugin_installflag'] ? "<button type='button' class='delete' value='no-value' onclick=\"location.href='".e_SELF."?uninstall.{$this->plug['plugin_id']}'\"><span>".EPL_ADLAN_1."</span></button>" : "<button type='button' class='update' value='no-value' onclick=\"location.href='".e_SELF."?install.{$this->plug['plugin_id']}'\"><span>".EPL_ADLAN_0."</span></button>");
|
// $text .= ($this->plug['plugin_installflag'] ? "<button type='button' class='delete' value='no-value' onclick=\"location.href='".e_SELF."?uninstall.{$this->plug['plugin_id']}'\"><span>".EPL_ADLAN_1."</span></button>" : "<button type='button' class='update' value='no-value' onclick=\"location.href='".e_SELF."?install.{$this->plug['plugin_id']}'\"><span>".EPL_ADLAN_0."</span></button>");
|
||||||
if (PLUGIN_SHOW_REFRESH && !vartrue($this->plug_vars['plugin_php']))
|
if (e_DEBUG && !vartrue($this->plug_vars['plugin_php']))
|
||||||
{
|
{
|
||||||
$text .= "<br /><br /><input type='button' class='btn btn-default button' onclick=\"location.href='".e_SELF."?refresh.{$this->plug['plugin_id']}'\" title='".'Refresh plugin settings'."' value='".'Refresh plugin settings'."' /> ";
|
// $text .= "<br /><br /><input type='button' class='btn btn-default button' onclick=\"location.href='".e_SELF."?refresh.{$this->plug['plugin_id']}'\" title='".'Refresh plugin settings'."' value='".'Refresh plugin settings'."' /> ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -162,6 +162,13 @@ class pluginmanager_form extends e_form
|
|||||||
$text .= "<a class='btn btn-default' href='".e_SELF."?upgrade.{$this->plug['plugin_id']}' title=\"".EPL_UPGRADE." to v".$this->plug_vars['@attributes']['version']."\" >".ADMIN_UPGRADEPLUGIN_ICON."</a>";
|
$text .= "<a class='btn btn-default' href='".e_SELF."?upgrade.{$this->plug['plugin_id']}' title=\"".EPL_UPGRADE." to v".$this->plug_vars['@attributes']['version']."\" >".ADMIN_UPGRADEPLUGIN_ICON."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->plug['plugin_installflag'] && e_DEBUG == true)
|
||||||
|
{
|
||||||
|
$text .= "<a class='btn btn-default' href='".e_SELF."?refresh.".$this->plug['plugin_id']."' title='".'Repair plugin settings'."'> ".ADMIN_REPAIRPLUGIN_ICON."</a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text .="</div> ";
|
$text .="</div> ";
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
@@ -1068,12 +1075,13 @@ class pluginManager{
|
|||||||
{
|
{
|
||||||
global $plug;
|
global $plug;
|
||||||
|
|
||||||
$plug = $plugin->getinfo($this->id);
|
$plug = e107::getSingleton('e107plugin')->getinfo($this->id);
|
||||||
|
|
||||||
$_path = e_PLUGIN.$plug['plugin_path'].'/';
|
$_path = e_PLUGIN.$plug['plugin_path'].'/';
|
||||||
if(file_exists($_path.'plugin.xml'))
|
if(file_exists($_path.'plugin.xml'))
|
||||||
{
|
{
|
||||||
$text .= $plugin->install_plugin_xml($this->id, 'refresh');
|
// $text .= $plugin->install_plugin_xml($this->id, 'refresh');
|
||||||
|
e107::getSingleton('e107plugin')->refresh($plug['plugin_path']);
|
||||||
e107::getLog()->add('PLUGMAN_04', $this->id.':'.$plug['plugin_path'], E_LOG_INFORMATIVE, '');
|
e107::getLog()->add('PLUGMAN_04', $this->id.':'.$plug['plugin_path'], E_LOG_INFORMATIVE, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -450,12 +450,13 @@ define("E_32_TRUE", "<i class='S32 e-true-32'></i>");
|
|||||||
|
|
||||||
define("ADMIN_ADD_ICON", "<i class='S32 e-add-32'></i>");
|
define("ADMIN_ADD_ICON", "<i class='S32 e-add-32'></i>");
|
||||||
define("ADMIN_INFO_ICON", "<i class='S16 e-info-16'></i>");
|
define("ADMIN_INFO_ICON", "<i class='S16 e-info-16'></i>");
|
||||||
define("ADMIN_CONFIGURE_ICON", "<i class='S32 e-configure-32'></i>");
|
define("ADMIN_CONFIGURE_ICON", "<i class='S32 e-settings-32'></i>");
|
||||||
define("ADMIN_VIEW_ICON", "<i class='S32 e-search-32'></i>");
|
define("ADMIN_VIEW_ICON", "<i class='S32 e-search-32'></i>");
|
||||||
define("ADMIN_URL_ICON", "<i class='S16 e-forums-16'></i>");
|
define("ADMIN_URL_ICON", "<i class='S16 e-forums-16'></i>");
|
||||||
define("ADMIN_INSTALLPLUGIN_ICON", "<i class='S32 e-plugin_install-32'></i>");
|
define("ADMIN_INSTALLPLUGIN_ICON", "<i class='S32 e-plugin_install-32'></i>");
|
||||||
define("ADMIN_UNINSTALLPLUGIN_ICON", "<i class='S32 e-plugin_uninstall-32'></i>");
|
define("ADMIN_UNINSTALLPLUGIN_ICON", "<i class='S32 e-plugin_uninstall-32'></i>");
|
||||||
define("ADMIN_UPGRADEPLUGIN_ICON", "<i class='S32 e-up-32'></i>");
|
define("ADMIN_UPGRADEPLUGIN_ICON", "<i class='S32 e-up-32'></i>");
|
||||||
|
define("ADMIN_REPAIRPLUGIN_ICON", "<i class='S32 e-configure-32'></i>");
|
||||||
define("ADMIN_UP_ICON", "<i class='S32 e-up-32'></i>");
|
define("ADMIN_UP_ICON", "<i class='S32 e-up-32'></i>");
|
||||||
define("ADMIN_DOWN_ICON", "<i class='S32 e-down-32'></i>");
|
define("ADMIN_DOWN_ICON", "<i class='S32 e-down-32'></i>");
|
||||||
define("ADMIN_SORT_ICON", "<i class='S32 e-sort-32'></i>");
|
define("ADMIN_SORT_ICON", "<i class='S32 e-sort-32'></i>");
|
||||||
|
@@ -1846,8 +1846,16 @@ class e107
|
|||||||
// fixme, temporary adding 's' to className, should be core fixed, better naming
|
// fixme, temporary adding 's' to className, should be core fixed, better naming
|
||||||
if(true === $className) $className = $pluginName.'_'.substr($addonName, 2); // remove 'e_'
|
if(true === $className) $className = $pluginName.'_'.substr($addonName, 2); // remove 'e_'
|
||||||
|
|
||||||
$elist = self::getPref($filename.'_list');
|
$elist = self::getPref($filename.'_list');
|
||||||
if(!isset($elist[$pluginName])) return null;
|
|
||||||
|
if($filename == 'e_menu')
|
||||||
|
{
|
||||||
|
if(!in_array($pluginName, $elist)) return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!isset($elist[$pluginName])) return null;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO override check comes here
|
// TODO override check comes here
|
||||||
$path = e_PLUGIN.$pluginName.'/'.$filename.'.php';
|
$path = e_PLUGIN.$pluginName.'/'.$filename.'.php';
|
||||||
|
@@ -450,7 +450,7 @@ class e_form
|
|||||||
|
|
||||||
if(vartrue($options['size']) && !is_numeric($options['size']))
|
if(vartrue($options['size']) && !is_numeric($options['size']))
|
||||||
{
|
{
|
||||||
$options['class'] .= " input-".$options['size'];
|
$options['class'] .= " input-".$options['size'];
|
||||||
unset($options['size']); // don't include in html 'size='.
|
unset($options['size']); // don't include in html 'size='.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ class e_form
|
|||||||
|
|
||||||
if(!empty($options['size']))
|
if(!empty($options['size']))
|
||||||
{
|
{
|
||||||
$options['class'] .= 'input-'.$options['size'];
|
$options['class'] .= ' input-'.$options['size'];
|
||||||
unset($options['size']);
|
unset($options['size']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1379,6 +1379,10 @@ class e_form
|
|||||||
{
|
{
|
||||||
parse_str($options, $options);
|
parse_str($options, $options);
|
||||||
}
|
}
|
||||||
|
elseif(is_array($options))
|
||||||
|
{
|
||||||
|
// do nothing.
|
||||||
|
}
|
||||||
else // Assume it's a label.
|
else // Assume it's a label.
|
||||||
{
|
{
|
||||||
$options = array('label'=>$options);
|
$options = array('label'=>$options);
|
||||||
@@ -4023,7 +4027,7 @@ class e_form
|
|||||||
$maxlength = vartrue($parms['maxlength'], 255);
|
$maxlength = vartrue($parms['maxlength'], 255);
|
||||||
unset($parms['maxlength']);
|
unset($parms['maxlength']);
|
||||||
if(!vartrue($parms['size'])) $parms['size'] = 'mini';
|
if(!vartrue($parms['size'])) $parms['size'] = 'mini';
|
||||||
if(!vartrue($parms['class'])) $parms['class'] = 'tbox number e-spinner';
|
if(!vartrue($parms['class'])) $parms['class'] = 'tbox number e-spinner ';
|
||||||
if(!$value) $value = '0';
|
if(!$value) $value = '0';
|
||||||
$ret = vartrue($parms['pre']).$this->number($key, $value, $maxlength, $parms).vartrue($parms['post']);
|
$ret = vartrue($parms['pre']).$this->number($key, $value, $maxlength, $parms).vartrue($parms['post']);
|
||||||
break;
|
break;
|
||||||
|
@@ -216,7 +216,7 @@ class e_menuManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$file = urldecode($_GET['path']).".php";
|
$file = urldecode($_GET['path']).".php";
|
||||||
$newurl = e_PLUGIN_ABS.$file."?id=".$_GET['id'];
|
$newurl = e_PLUGIN_ABS.$file."?id=".$_GET['id'].'&iframe=1';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -365,10 +365,12 @@ class e_menuManager {
|
|||||||
|
|
||||||
$efile = new e_file;
|
$efile = new e_file;
|
||||||
$efile->dirFilter = array('/', 'CVS', '.svn', 'languages');
|
$efile->dirFilter = array('/', 'CVS', '.svn', 'languages');
|
||||||
|
$efile->fileFilter[] = '^e_menu\.php$';
|
||||||
|
|
||||||
$fileList = $efile->get_files(e_PLUGIN,"_menu\.php$",'standard',2);
|
$fileList = $efile->get_files(e_PLUGIN,"_menu\.php$",'standard',2);
|
||||||
|
|
||||||
$this->menuAddMessage('Scanning for new menus', E_MESSAGE_DEBUG);
|
$this->menuAddMessage('Scanning for new menus', E_MESSAGE_DEBUG);
|
||||||
|
|
||||||
$menuList = array(); // existing menus in table.
|
$menuList = array(); // existing menus in table.
|
||||||
if($result = $sql->retrieve('menus', 'menu_name', null, true))
|
if($result = $sql->retrieve('menus', 'menu_name', null, true))
|
||||||
{
|
{
|
||||||
@@ -538,20 +540,55 @@ class e_menuManager {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
$row = $sql->fetch();
|
$row = $sql->fetch();
|
||||||
|
|
||||||
// TODO lan
|
|
||||||
$text = "<div style='text-align:center;'>
|
$text = "<div style='text-align:center;'>
|
||||||
<form id='e-save-form' method='post' action='".e_SELF."?lay=".$this->curLayout."'>
|
<form id='e-save-form' method='post' action='".e_SELF."?lay=".$this->curLayout."'>
|
||||||
<fieldset id='core-menus-parametersform'>
|
<fieldset id='core-menus-parametersform'>
|
||||||
<legend>Menu parameters ".$row['menu_name']."</legend>
|
<legend>".MENLAN_44." ".$row['menu_name']."</legend>
|
||||||
<table class='table adminform'>
|
<table class='table '>
|
||||||
<tr>
|
<colgroup>
|
||||||
<td>
|
<col class='col-label' />
|
||||||
Parameters (query string format):
|
<col class='col-control' />
|
||||||
".$frm->text('menu_parms', $row['menu_parms'], 900, 'class=e-save span7')."
|
</colgroup>
|
||||||
</td>
|
|
||||||
</tr>
|
";
|
||||||
</table>";
|
|
||||||
|
if(file_exists(e_PLUGIN.$row['menu_path']."e_menu.php")) // v2.x new e_menu.php
|
||||||
|
{
|
||||||
|
$plug = rtrim($row['menu_path'],'/');
|
||||||
|
|
||||||
|
$obj = e107::getAddon($plug,'e_menu');
|
||||||
|
|
||||||
|
$fields = e107::callMethod($obj,'config');
|
||||||
|
|
||||||
|
if(!$form = e107::getAddon($plug,'e_menu',$plug."_menu_form"))
|
||||||
|
{
|
||||||
|
$form = $frm;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = e107::unserialize($row['menu_parms']);
|
||||||
|
|
||||||
|
foreach($fields as $k=>$v)
|
||||||
|
{
|
||||||
|
$text .= "<tr><td class='text-left'>".$v['title']."</td>";
|
||||||
|
$v['writeParms']['class'] = 'e-save';
|
||||||
|
$text .= "<td class='text-left'>".$form->renderElement($k, $value[$k], $v)."</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$text .= "<tr>
|
||||||
|
<td>
|
||||||
|
".MENLAN_45."</td>
|
||||||
|
<td>
|
||||||
|
".$frm->text('menu_parms', $row['menu_parms'], 900, 'class=e-save&size=xxlarge')."
|
||||||
|
</td>
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "</table>";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
@@ -784,11 +821,27 @@ class e_menuManager {
|
|||||||
function menuSaveParameters()
|
function menuSaveParameters()
|
||||||
{
|
{
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$parms = $sql->escape(strip_tags($_POST['menu_parms']));
|
|
||||||
|
$id = intval($_POST['menu_id']);
|
||||||
$check = $sql->db_Update("menus", "menu_parms='".$parms."' WHERE menu_id=".intval($_POST['menu_id'])."");
|
|
||||||
|
if(isset($_POST['menu_parms']))
|
||||||
|
{
|
||||||
|
$parms = $sql->escape(strip_tags($_POST['menu_parms']));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unset($_POST['menu_id'], $_POST['mode'], $_POST['menuActivate'], $_POST['menuSetCustomPages']);
|
||||||
|
|
||||||
|
$parms = $sql->escape(e107::serialize($_POST));
|
||||||
|
|
||||||
|
if(e_DEBUG == true)
|
||||||
|
{
|
||||||
|
// return array('msg'=>print_r($_POST,true),'error'=>true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$check = $sql->update("menus", "menu_parms='".$parms."' WHERE menu_id=".$id."");
|
||||||
|
|
||||||
if($check)
|
if($check)
|
||||||
{
|
{
|
||||||
return array('msg'=>'All Okay','error'=>false);
|
return array('msg'=>'All Okay','error'=>false);
|
||||||
@@ -812,7 +865,7 @@ class e_menuManager {
|
|||||||
|
|
||||||
function menuSaveVisibility() // Used by Ajax
|
function menuSaveVisibility() // Used by Ajax
|
||||||
{
|
{
|
||||||
global $admin_log;
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
|
|
||||||
$pagelist = explode("\r\n", $_POST['pagelist']);
|
$pagelist = explode("\r\n", $_POST['pagelist']);
|
||||||
@@ -825,7 +878,7 @@ class e_menuManager {
|
|||||||
$pageparms = preg_replace("#\|$#", "", $pageparms);
|
$pageparms = preg_replace("#\|$#", "", $pageparms);
|
||||||
$pageparms = (trim($_POST['pagelist']) == '') ? '' : $pageparms;
|
$pageparms = (trim($_POST['pagelist']) == '') ? '' : $pageparms;
|
||||||
|
|
||||||
if($sql->db_Update("menus", "menu_class='".intval($_POST['menu_class'])."', menu_pages='{$pageparms}' WHERE menu_id=".intval($_POST['menu_id'])))
|
if($sql->update("menus", "menu_class='".intval($_POST['menu_class'])."', menu_pages='{$pageparms}' WHERE menu_id=".intval($_POST['menu_id'])))
|
||||||
{
|
{
|
||||||
e107::getLog()->add('MENU_02',$_POST['menu_class'].'[!br!]'.$pageparms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,'');
|
e107::getLog()->add('MENU_02',$_POST['menu_class'].'[!br!]'.$pageparms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,'');
|
||||||
|
|
||||||
@@ -1502,7 +1555,7 @@ class e_menuManager {
|
|||||||
|
|
||||||
if($conf)
|
if($conf)
|
||||||
{
|
{
|
||||||
$text .= '<a class="menu-btn" target="_top" href="'.e_SELF.'?lay='.$this->curLayout.'&mode=conf&path='.urlencode($conf).'&id='.$menu_id.'"
|
$text .= '<a data-modal-caption="Configure Menu" class="e-modal-menumanager menu-btn" target="_top" href="'.e_SELF.'?lay='.$this->curLayout.'&mode=conf&path='.urlencode($conf).'&id='.$menu_id.'&iframe=1"
|
||||||
title="Configure menu"><i class="S16 e-configure-16"></i></a>';
|
title="Configure menu"><i class="S16 e-configure-16"></i></a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1573,8 +1626,11 @@ class e_menuManager {
|
|||||||
|
|
||||||
if($mode == 'parms')
|
if($mode == 'parms')
|
||||||
{
|
{
|
||||||
$ret = $this->menuSaveParameters();
|
$ret = $this->menuSaveParameters();
|
||||||
// echo json_encode($ret);
|
if(!empty($ret['error']))
|
||||||
|
{
|
||||||
|
echo json_encode($ret);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ class e107plugin
|
|||||||
'e_frontpage',
|
'e_frontpage',
|
||||||
'e_latest', // @Deprecated - see e_dashboard
|
'e_latest', // @Deprecated - see e_dashboard
|
||||||
'e_status', //@Deprecated - see e_dashboard
|
'e_status', //@Deprecated - see e_dashboard
|
||||||
|
'e_menu', // experimental.
|
||||||
'e_search',
|
'e_search',
|
||||||
'e_shortcode',
|
'e_shortcode',
|
||||||
'e_module',
|
'e_module',
|
||||||
|
@@ -53,7 +53,7 @@ class banner_admin extends e_admin_dispatcher
|
|||||||
|
|
||||||
'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'),
|
'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'),
|
||||||
'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'),
|
'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'),
|
||||||
'main/menu' => array('caption'=> BNRLAN_36, 'perm' => 'P'),
|
'main/menu' => array('caption'=> BNRLAN_36, 'perm' => 'P'),
|
||||||
// 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'),
|
// 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'),
|
||||||
|
|
||||||
// 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P')
|
// 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P')
|
||||||
@@ -237,6 +237,10 @@ class banner_ui extends e_admin_ui
|
|||||||
|
|
||||||
public function menuPage()
|
public function menuPage()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
return e107::getMessage()->addInfo("The menu is now configured within the menu-manager.")->render();
|
||||||
|
|
||||||
|
|
||||||
$ns = e107::getRender();
|
$ns = e107::getRender();
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$menu_pref = e107::getConfig('menu')->getPref('');
|
$menu_pref = e107::getConfig('menu')->getPref('');
|
||||||
|
@@ -22,18 +22,18 @@ if (!defined('e107_INIT')) { exit; }
|
|||||||
|
|
||||||
if(file_exists(THEME.'templates/banner/banner_template.php')) // v2.x location.
|
if(file_exists(THEME.'templates/banner/banner_template.php')) // v2.x location.
|
||||||
{
|
{
|
||||||
require_once (THEME.'templates/banner/banner_template.php');
|
require(THEME.'templates/banner/banner_template.php'); // don't use require_once as we might use this menu in more than 1 location.
|
||||||
}
|
}
|
||||||
elseif(file_exists(THEME.'banner_template.php')) // v1.x location.
|
elseif(file_exists(THEME.'banner_template.php')) // v1.x location.
|
||||||
{
|
{
|
||||||
require_once (THEME.'banner_template.php');
|
require(THEME.'banner_template.php');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
require_once (e_PLUGIN.'banner/banner_template.php');
|
require(e_PLUGIN.'banner/banner_template.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$menu_pref = e107::getConfig('menu')->getPref('');
|
$menu_pref = e107::getConfig('menu')->getPref(''); // legacy preference lookup.
|
||||||
|
|
||||||
if(defset('BOOTSTRAP'))
|
if(defset('BOOTSTRAP'))
|
||||||
{
|
{
|
||||||
@@ -50,70 +50,24 @@ else
|
|||||||
|
|
||||||
if(!empty($parm))
|
if(!empty($parm))
|
||||||
{
|
{
|
||||||
parse_str($parm, $parms);
|
if(!$tmp = e107::unserialize($parm)) // unserailize the v2.x e_menu.php preferences.
|
||||||
|
{
|
||||||
|
parse_str($parm, $parms); // if it fails, use legacy method. (query string format)
|
||||||
|
}
|
||||||
|
else // prefs unserialized so overwrite the legacy preference values.
|
||||||
|
{
|
||||||
|
$menu_pref = $tmp;
|
||||||
|
$menu_pref['banner_campaign'] = implode("|",$menu_pref['banner_campaign']);
|
||||||
|
unset($parm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($parms['w']) && isset($parms['h']))
|
if(isset($parms['w']) && isset($parms['h'])) // TODO.
|
||||||
{
|
{
|
||||||
e107::getParser()->setThumbSize(intval($parms['w']), intval($parms['h']));
|
e107::getParser()->setThumbSize(intval($parms['w']), intval($parms['h']));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print_a($menu_pref);
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
if(isset($menu_pref['banner_campaign']) && $menu_pref['banner_campaign'])
|
|
||||||
{
|
|
||||||
$parms = array();
|
|
||||||
if(strstr($menu_pref['banner_campaign'], "|"))
|
|
||||||
{
|
|
||||||
$campaignlist = explode('|', $menu_pref['banner_campaign']);
|
|
||||||
$amount = ($menu_pref['banner_amount'] < 1 ? '1' : $menu_pref['banner_amount']);
|
|
||||||
$amount = ($amount > count($campaignlist) ? count($campaignlist) : $amount);
|
|
||||||
$keys = array_rand($campaignlist, $amount); // If one entry, returns a single value
|
|
||||||
if (!is_array($keys))
|
|
||||||
{
|
|
||||||
$keys = array($keys);
|
|
||||||
}
|
|
||||||
foreach ($keys as $k=>$v)
|
|
||||||
{
|
|
||||||
$parms[] = $campaignlist[$v];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$parms[] = $menu_pref['banner_campaign'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$txt = e107::getParser()->parseTemplate($BANNER_MENU_START,true);
|
|
||||||
|
|
||||||
$sc = e107::getScBatch('banner');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($parms as $parm)
|
|
||||||
{
|
|
||||||
$p = array('banner_campaign'=>$parm);
|
|
||||||
$sc->setVars($p);
|
|
||||||
|
|
||||||
$txt .= e107::getParser()->parseTemplate($BANNER_MENU_ITEM, true, $sc);
|
|
||||||
// $txt .= e107::getParser()->parseTemplate("{BANNER=".$parm."}",true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$txt .= e107::getParser()->parseTemplate($BANNER_MENU_END,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
if(!empty($menu_pref['banner_campaign']) && !empty($menu_pref['banner_amount']))
|
if(!empty($menu_pref['banner_campaign']) && !empty($menu_pref['banner_amount']))
|
||||||
@@ -149,10 +103,13 @@ if(!empty($menu_pref['banner_campaign']) && !empty($menu_pref['banner_amount']))
|
|||||||
$ret[$cat][] = $tp->simpleParse($BANNER_MENU_ITEM, $var);
|
$ret[$cat][] = $tp->simpleParse($BANNER_MENU_ITEM, $var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif(e_DEBUG == true)
|
||||||
|
{
|
||||||
|
echo "no banner data";
|
||||||
|
}
|
||||||
|
|
||||||
$foot = e107::getParser()->parseTemplate($BANNER_MENU_END,true);
|
$foot = e107::getParser()->parseTemplate($BANNER_MENU_END,true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch ($menu_pref['banner_rendertype'])
|
switch ($menu_pref['banner_rendertype'])
|
||||||
{
|
{
|
||||||
|
@@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* e107 website system
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
|
||||||
* Released under the terms and conditions of the
|
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
*
|
|
||||||
* Banner Menu Configuration (OLD - redirects to e107_admin/banner.php)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* e107 Banner management plugin
|
|
||||||
*
|
|
||||||
* Handles the display and sequencing of banners on web pages, including counting impressions
|
|
||||||
*
|
|
||||||
* @package e107_plugins
|
|
||||||
* @subpackage banner
|
|
||||||
*
|
|
||||||
* @todo - try and access file for menu config without a redirect
|
|
||||||
*/
|
|
||||||
|
|
||||||
$eplug_admin = TRUE;
|
|
||||||
require_once("../../class2.php");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The same, cleaned up code is already part of banner.php
|
|
||||||
* FIXME - we should be able to combine all core menus in a nice way... somehow
|
|
||||||
*/
|
|
||||||
header('Location:'.e_PLUGIN_ABS.'banner/admin_banner.php?menu');
|
|
||||||
exit;
|
|
||||||
|
|
||||||
?>
|
|
71
e107_plugins/banner/e_menu.php
Normal file
71
e107_plugins/banner/e_menu.php
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* e107 website system
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2015 e107 Inc (e107.org)
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
//v2.x Standard for extending menu configuration within Menu Manager. (replacement for v1.x config.php)
|
||||||
|
|
||||||
|
|
||||||
|
class banner_menu
|
||||||
|
{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
e107::lan('banner','admin', 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration Fields.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function config()
|
||||||
|
{
|
||||||
|
$renderTypes = array(BNRLAN_48,'1 - '.BNRLAN_45,'2 - '.BNRLAN_46, "3 - ".BNRLAN_47);
|
||||||
|
|
||||||
|
$fields = array();
|
||||||
|
$fields['banner_caption'] = array('title'=> BNRLAN_37, 'type'=>'text', 'writeParms'=>array('size'=>'xxlarge'));
|
||||||
|
$fields['banner_campaign'] = array('title'=> BNRLAN_39, 'type'=>'method');
|
||||||
|
$fields['banner_amount'] = array('title'=> BNRLAN_41, 'type'=>'text', 'writeParms'=>array('pattern'=>'[0-9]*'));
|
||||||
|
$fields['banner_rendertype'] = array('title'=> BNRLAN_43, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>$renderTypes));
|
||||||
|
|
||||||
|
return $fields;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// optional
|
||||||
|
class banner_menu_form extends e_form
|
||||||
|
{
|
||||||
|
|
||||||
|
public function banner_campaign($curVal)
|
||||||
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
|
$sql->select("banner", "DISTINCT(banner_campaign) as banner_campaign", "ORDER BY banner_campaign", "mode=no_where");
|
||||||
|
|
||||||
|
$text = '';
|
||||||
|
|
||||||
|
while ($row = $sql -> fetch())
|
||||||
|
{
|
||||||
|
$checked = in_array($row['banner_campaign'],$curVal);
|
||||||
|
$text .= $this->checkbox('banner_campaign[]',$row['banner_campaign'],$checked, array('label'=> $row['banner_campaign'],'class'=>'e-save')); // e-save class is required.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
Reference in New Issue
Block a user