mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 04:38:27 +01:00
Separated admin/menu.php into a separate class. Added instant menuPreset activation in theme-manager plus other small gui enhances. Added iconpool - work in progress.
Iconpool: installed plugins containing png files in their image folder with a *_16, *_32, *_48 etc name ending will automatically be added to the iconpool. This central pool will be available in all areas of admin where we choose icons. eg. download category, links, event-calendar, links-page etc etc.
This commit is contained in:
parent
84a6fc3a61
commit
5f1933c3fa
35
class2.php
35
class2.php
@ -9,8 +9,8 @@
|
||||
* General purpose file
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/class2.php,v $
|
||||
* $Revision: 1.107 $
|
||||
* $Date: 2009-07-12 14:44:56 $
|
||||
* $Revision: 1.108 $
|
||||
* $Date: 2009-07-16 02:55:18 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
@ -423,6 +423,20 @@ $e107->set_base_path();
|
||||
// extract menu prefs
|
||||
$menu_pref = unserialize(stripslashes($sysprefs->get('menu_pref')));
|
||||
|
||||
// extract iconpool
|
||||
if($tmp = ecache::retrieve_sys('IconPool', 24 * 60, true))
|
||||
{
|
||||
$iconpool = $tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($iconData= $sysprefs->get('IconPool'))
|
||||
{
|
||||
ecache::set_sys('IconPool', $iconData);
|
||||
$iconpool = $eArrayStorage->ReadArray($iconData);
|
||||
}
|
||||
}
|
||||
|
||||
$sql->db_Mark_Time('(Extracting Core Prefs Done)');
|
||||
|
||||
//
|
||||
@ -1349,7 +1363,7 @@ function get_user_data($uid, $extra = '')
|
||||
|
||||
function save_prefs($table = 'core', $uid = USERID, $row_val = '')
|
||||
{
|
||||
global $pref, $user_pref, $tp, $PrefCache, $sql, $eArrayStorage, $theme_pref;
|
||||
global $pref, $user_pref, $tp, $PrefCache, $sql, $eArrayStorage, $theme_pref, $iconpool;
|
||||
if ($table == 'core')
|
||||
{
|
||||
if ($row_val == '')
|
||||
@ -1371,6 +1385,21 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '')
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($table == "iconpool")
|
||||
{
|
||||
// $sql->db_Select_gen("REPLACE INTO `#core` (e107_name,e107_value) values ('IconPool_Backup', '".addslashes($PrefCache)."') ");
|
||||
$_iconpool = $tp->toDB($iconpool, true, true);
|
||||
|
||||
if($sql->db_Select_gen("REPLACE INTO `#core` (e107_name,e107_value) values ('IconPool', '".$eArrayStorage->WriteArray($_iconpool)."') "))
|
||||
{
|
||||
ecache::clear_sys('IconPool');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif($table == "theme")
|
||||
{
|
||||
$pref['sitetheme_pref'] = $theme_pref;
|
||||
|
1121
e107_admin/menus.php
1121
e107_admin/menus.php
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: iconpicker.php,v 1.1 2009-01-16 17:57:56 secretr Exp $
|
||||
* $Id: iconpicker.php,v 1.2 2009-07-16 02:55:19 e107coders Exp $
|
||||
*
|
||||
* Image picker shortcode
|
||||
*
|
||||
@ -41,7 +41,44 @@ function iconpicker_shortcode($parm)
|
||||
$tmp = array(16, 32, 48, 64, 128);
|
||||
$tmp1 = array();
|
||||
$name = varset($parms['id']);
|
||||
foreach($iconlist as $icon)
|
||||
|
||||
global $iconpool,$tp;
|
||||
|
||||
$iconlist = $iconpool;
|
||||
|
||||
foreach($iconlist as $folder)
|
||||
{
|
||||
|
||||
// $filepath = varsettrue($parms['path_omit']) ? str_replace(explode('|', $parms['path_omit']), "", $icon['path'].$icon['fname']) : $e107->tp->createConstants($icon['path'], 1).$icon['fname'];
|
||||
// $filepath_abs = str_replace(array(e_IMAGE, e_FILE, e_PLUGIN), array(e_IMAGE_ABS, e_FILE_ABS, e_PLUGIN_ABS), $icon['path'].$icon['fname']);
|
||||
|
||||
foreach($folder as $icon)
|
||||
{
|
||||
$filepath = $icon;
|
||||
$filepath_abs = $tp->replaceConstants($icon);
|
||||
$icon_file = basename($filepath_abs);
|
||||
|
||||
$str = "<a href='#{$filepath}' title='{$filepath}' onclick=\"e107Helper.insertText('{$filepath}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='{$filepath_abs}' alt='{$filepath}' /></a>";
|
||||
|
||||
foreach ($tmp as $isize)
|
||||
{
|
||||
if(strpos($icon_file, '_'.$isize.'.') !== false)
|
||||
{
|
||||
|
||||
$tmp1[$isize] = varset($tmp1[$isize]).str_replace('%%size%%', ' S'.$isize, $str);
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
$tmp1['other'] = varset($tmp1['other']).$str;//other
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*foreach($iconlist as $icon)
|
||||
{
|
||||
|
||||
$filepath = varsettrue($parms['path_omit']) ? str_replace(explode('|', $parms['path_omit']), "", $icon['path'].$icon['fname']) : $e107->tp->createConstants($icon['path'], 1).$icon['fname'];
|
||||
@ -59,7 +96,7 @@ function iconpicker_shortcode($parm)
|
||||
}
|
||||
}
|
||||
$tmp1['other'] = varset($tmp1['other']).$str;//other
|
||||
}
|
||||
}*/
|
||||
|
||||
return $tmp1 ? '<div id="'.$name.'-iconpicker-ajax"><div class="field-spacer iconpicker">'.str_replace('%%size%%', '', implode('</div><div class="field-spacer iconpicker">', $tmp1)).'</div></div>' : '';
|
||||
|
||||
|
1153
e107_handlers/menu_class.php
Normal file
1153
e107_handlers/menu_class.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
|
||||
| $Revision: 1.67 $
|
||||
| $Date: 2009-07-14 03:18:16 $
|
||||
| $Revision: 1.68 $
|
||||
| $Date: 2009-07-16 02:55:19 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -81,7 +81,7 @@ class e107plugin
|
||||
'plugin_path', // Name of the directory off e_PLUGIN - unique
|
||||
'plugin_installflag', // '0' = not installed, '1' = installed
|
||||
'plugin_addons', // List of any extras associated with plugin - bbcodes, e_XXX files...
|
||||
'plugin_category' // Plugin Category: settings, users, content, management, tools, misc
|
||||
'plugin_category' // Plugin Category: settings, users, content, management, tools, misc, about
|
||||
);
|
||||
|
||||
var $plug_vars;
|
||||
@ -266,7 +266,63 @@ class e107plugin
|
||||
if ($sp) { save_prefs(); }
|
||||
}
|
||||
|
||||
function manage_icons($plugin='')
|
||||
{
|
||||
global $sql,$tp, $iconpool;
|
||||
|
||||
$query = "SELECT * FROM #plugin WHERE plugin_installflag =0 ORDER BY plugin_path ASC";
|
||||
$sql->db_Select_gen($query);
|
||||
$list = $sql->db_getList();
|
||||
|
||||
|
||||
$reject_core = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*');
|
||||
$reject_plugin = $reject_core;
|
||||
foreach($list as $val) // reject uninstalled plugin folders.
|
||||
{
|
||||
$reject_plugin[] = $val['plugin_path']."/images";
|
||||
}
|
||||
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$fl = new e_file;
|
||||
|
||||
$filesrch = implode("|",array("_16.png","_16.PNG","_32.png","_32.PNG","_48.png","_48.PNG","_64.png","_64.PNG","_128.png","_128.png"));
|
||||
|
||||
if($plugin_icons = $fl->get_files(e_PLUGIN,$filesrch,$reject_plugin,2))
|
||||
{
|
||||
sort($plugin_icons);
|
||||
}
|
||||
|
||||
if($core_icons = $fl->get_files(e_IMAGE."icons/",$filesrch,$reject_core,2))
|
||||
{
|
||||
sort($core_icons);
|
||||
}
|
||||
|
||||
$srch = array(e_IMAGE,"/");
|
||||
$repl = array("","-");
|
||||
|
||||
$iconpool = array();
|
||||
|
||||
foreach($core_icons as $file)
|
||||
{
|
||||
$path = str_replace($srch,$repl,$file['path']);
|
||||
$key = substr("core-".$path,0,-1);
|
||||
$iconpool[$key][] = $tp->createConstants($file['path'],1).$file['fname'];
|
||||
}
|
||||
|
||||
$srch = array(e_PLUGIN,"/images/");
|
||||
$repl = array("","");
|
||||
|
||||
foreach($plugin_icons as $file)
|
||||
{
|
||||
$path = str_replace($srch,$repl,$file['path']);
|
||||
$key = "plugin-".$path;
|
||||
$iconpool[$key][] = $tp->createConstants($file['path'],1).$file['fname'];
|
||||
}
|
||||
|
||||
|
||||
return (save_prefs("iconpool")) ? TRUE : FALSE;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns details of a plugin from the plugin table from it's ID
|
||||
@ -1456,6 +1512,15 @@ class e107plugin
|
||||
}
|
||||
|
||||
save_prefs();
|
||||
|
||||
if($this->manage_icons())
|
||||
{
|
||||
// echo 'IT WORKED';
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "didn't work!";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3,16 +3,15 @@
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| ©Steve Dunstan 2001-2002
|
||||
| Copyright (c) e107 Inc. 2001-2009
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $
|
||||
| $Revision: 1.37 $
|
||||
| $Date: 2009-07-15 09:38:00 $
|
||||
| $Revision: 1.38 $
|
||||
| $Date: 2009-07-16 02:55:19 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -31,7 +30,7 @@ class themeHandler{
|
||||
|
||||
function themeHandler() {
|
||||
|
||||
global $emessage;
|
||||
global $emessage, $e107cache, $pref;
|
||||
|
||||
require_once(e_HANDLER."form_handler.php");
|
||||
$this->frm = new e_form(); //enable inner tabindex counter
|
||||
@ -99,6 +98,31 @@ class themeHandler{
|
||||
$emessage->add($message, E_MESSAGE_SUCCESS);
|
||||
}
|
||||
|
||||
if(isset($_POST['setMenuPreset']))
|
||||
{
|
||||
$key = key($_POST['setMenuPreset']);
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php");
|
||||
require_once(e_HANDLER."menu_class.php");
|
||||
$men = new menuManager();
|
||||
$men->curLayout = $key;
|
||||
$men->dbLayout = ($men->curLayout !=$pref['sitetheme_deflayout']) ? $men->curLayout : ""; //menu_layout is left blank when it's default.
|
||||
|
||||
if($areas = $men->menuSetPreset())
|
||||
{
|
||||
foreach($areas as $val)
|
||||
{
|
||||
$ar[$val['menu_location']][] = $val['menu_name'];
|
||||
}
|
||||
foreach($ar as $k=>$v)
|
||||
{
|
||||
$message .= MENLAN_14." ".$k." : ".implode(", ",$v)."<br />";
|
||||
}
|
||||
|
||||
$emessage->add(MENLAN_43." : ".$key."<br />".$message, E_MESSAGE_SUCCESS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -526,7 +550,7 @@ class themeHandler{
|
||||
mode = 2 :: selected admin theme
|
||||
*/
|
||||
|
||||
global $ns, $pref;
|
||||
global $ns, $pref, $frm;
|
||||
|
||||
|
||||
|
||||
@ -563,16 +587,6 @@ class themeHandler{
|
||||
|
||||
$this->loadThemeConfig(); // load customn theme configuration fieldss.
|
||||
|
||||
$menuPresetCount = 0;
|
||||
foreach($theme['layouts'] as $key=>$val)
|
||||
{
|
||||
if($val['menuPresets'])
|
||||
{
|
||||
$menuPresetCount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$text = "
|
||||
<h2 class='caption'>".$theme['name']."</h2>
|
||||
<div class='admintabs' id='tab-container'>";
|
||||
@ -633,12 +647,6 @@ class themeHandler{
|
||||
$text .= " </td>
|
||||
</tr>";
|
||||
|
||||
$text .= "
|
||||
<tr>
|
||||
<td style='vertical-align:top; width:24%;'><b>".TPVLAN_54."</b></td>
|
||||
<td colspan='2' style='vertical-align:top width:auto;'>".$menuPresetCount."</td>
|
||||
</tr>";
|
||||
|
||||
$text .= "
|
||||
<tr>
|
||||
<td style='vertical-align:top; width:24%;'><b>".TPVLAN_30."</b></td>
|
||||
@ -657,12 +665,19 @@ class themeHandler{
|
||||
$itext = "<tr>
|
||||
<td style='vertical-align:top; width:24%'><b>".TPVLAN_50."</b>:</td>
|
||||
<td colspan='2' style='vertical-align:top'>
|
||||
<table class='adminlist' style='auto;width:100%' >
|
||||
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||
<colgroup span='2'>
|
||||
<col class='col-tm-layout-default' style='width:10%' />
|
||||
<col class='col-tm-layout-name' style='width:20%' />
|
||||
<col class='col-tm-layout-visibility' style='width:35%' />
|
||||
<col class='col-tm-layout-preset' style='width:35%' />
|
||||
</colgroup>
|
||||
<tr>";
|
||||
$itext .= ($mode == 1) ? "<td style='width:15%;vertical-align:top;'>".TPVLAN_55."</td>" : "";
|
||||
$itext .= ($mode == 1) ? "<td class='center top'>".TPVLAN_55."</td>" : "";
|
||||
$itext .= "
|
||||
<td style='width:20%'>".TPVLAN_52."</td>
|
||||
<td style='width:65%'>".TPVLAN_56."</td>
|
||||
<td>".TPVLAN_52."</td>
|
||||
<td>".TPVLAN_56."</td>
|
||||
<td>".TPVLAN_54."</td>
|
||||
|
||||
</tr>\n";
|
||||
|
||||
@ -689,11 +704,18 @@ class themeHandler{
|
||||
$itext .= $val['@attributes']['title'];
|
||||
$itext .= ($val['@attributes']['previewFull']) ? "</a>" : "";
|
||||
|
||||
$custompage_count = (isset($pref['sitetheme_custompages'][$key])) ? " [".count($pref['sitetheme_custompages'][$key])."]" : "";
|
||||
$itext .= "</td>
|
||||
<td style='vertical-align:top'>";
|
||||
$itext .= ($pref['sitetheme_deflayout'] != $key) ? "<input type='text' style='width:97%' name='custompages[".$key."]' value=\"".(isset($pref['sitetheme_custompages'][$key]) ? implode(" ",$pref['sitetheme_custompages'][$key]) : "")."\" />\n" : TPVLAN_55; // Default
|
||||
$itext .= ($pref['sitetheme_deflayout'] != $key) ? "<a href='#element-to-be-shown' class='e-expandit'>".ADMIN_EDIT_ICON."</a>".$custompage_count."<div class='e-hideme' id='element-to-be-shown'><textarea style='width:97%' rows='6' cols='20' name='custompages[".$key."]' >".(isset($pref['sitetheme_custompages'][$key]) ? implode("\n",$pref['sitetheme_custompages'][$key]) : "")."</textarea></div>\n" : TPVLAN_55; // Default
|
||||
|
||||
$itext .= "</td>";
|
||||
|
||||
$itext .= "<td>";
|
||||
|
||||
$itext .= (varset($val['menuPresets'])) ? $this->frm->admin_button("setMenuPreset[".$key."]", "Use Preset") : "";
|
||||
$itext .= "</td>
|
||||
|
||||
</tr>";
|
||||
}
|
||||
|
||||
@ -712,7 +734,7 @@ class themeHandler{
|
||||
<tr><td style='vertical-align:top;'><b>".TPVLAN_22.":</b></td><td colspan='2' style='vertical-align:top'>
|
||||
<table class='adminlist' style='width:100%' >
|
||||
<tr>
|
||||
<td class='center' style='width:15%'>".TPVLAN_55."</td>
|
||||
<td class='center' style='width:10%'>".TPVLAN_55."</td>
|
||||
<td style='width:20%'>".TPVLAN_52."</td>
|
||||
<td class='left'>".TPVLAN_7."</td>
|
||||
</tr>\n";
|
||||
@ -1007,7 +1029,7 @@ class themeHandler{
|
||||
global $pref;
|
||||
$key = key($array);
|
||||
|
||||
$pref['sitetheme_custompages'][$key] = array_filter(explode(" ",$array[$key]));
|
||||
$pref['sitetheme_custompages'][$key] = array_filter(explode("\n",trim($array[$key])));
|
||||
|
||||
if($pref['sitetheme_deflayout'] == 'legacyCustom')
|
||||
{
|
||||
|
@ -4,8 +4,8 @@
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_menus.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2009-07-15 09:38:00 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2009-07-16 02:55:19 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -58,6 +58,8 @@ define("MENLAN_39", "Preset Area");
|
||||
define("MENLAN_40", "Use Menu Presets");
|
||||
define("MENLAN_41", "The position of all your menus for this layout will be lost. Do you still wish to continue?");
|
||||
define("MENLAN_42", "Custom");
|
||||
define("MENLAN_43", "Menu Preset Activated");
|
||||
|
||||
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user