1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

Infopanel can now be customized with any available menu item. Also, some additional serialize cleanup in plugin_class.php

This commit is contained in:
CaMer0n
2009-09-03 01:27:27 +00:00
parent 722e007d51
commit 262c075a49
3 changed files with 188 additions and 187 deletions

View File

@@ -1,86 +1,52 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ + ----------------------------------------------------------------------------+
| e107 website system | e107 website system
| |
| <20>Steve Dunstan 2001-2002 | <20>Steve Dunstan 2001-2002
| http://e107.org | http://e107.org
| jalist@e107.org | jalist@e107.org
| |
| Released under the terms and conditions of the | Released under the terms and conditions of the
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/infopanel.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/includes/infopanel.php,v $
| $Revision: 1.7 $ | $Revision: 1.8 $
| $Date: 2009-08-31 13:12:03 $ | $Date: 2009-09-03 01:27:26 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) if (!defined('e107_INIT'))
{ {
exit; exit;
} }
require_once (e_HANDLER."message_handler.php"); require_once (e_HANDLER."message_handler.php");
$emessage = & eMessage :: getInstance(); $emessage = &eMessage::getInstance();
require_once (e_HANDLER."form_handler.php"); require_once (e_HANDLER."form_handler.php");
$frm = new e_form(true); $frm = new e_form(true);
//enable inner tabindex counter //enable inner tabindex counter
if (isset ($_POST['submit-mye107']))
if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
{ {
$user_pref['core-infopanel-mye107'] = $_POST['e-mye107']; $user_pref['core-infopanel-mye107'] = $_POST['e-mye107'];
$user_pref['core-infopanel-menus'] = $_POST['e-mymenus'];
save_prefs('user'); save_prefs('user');
} }
// $text = "<div style='text-align:center'>";
/*$text .="
<div class='admintabs' id='tab-container'>
<ul class='e-tabs e-hideme' id='core-emote-tabs'>
<li id='tab-infopanel_mye107'><a href='#core-infopanel_mye107'>My Admin Panel</a></li>
<li id='tab-infopanel_news'><a href='#core-infopanel_news'>e107 News</a></li>
<li id='tab-infopanel_latest'><a href='#core-infopanel_latest'>Info</a></li>
<li id='tab-infopanel_online'><a href='#core-infopanel_online'>Who's Online</a></li>
<li id='tab-infopanel_customize'><a href='#core-infopanel_customize'>Customize</a></li>
<li id='tab-infopanel_add'><a href='#core-infopanel_add'>+</a></li>
</ul>";
*/
$text = "<div style='text-align:center'>";
// My E107
// Info about attributes
/* //TODO LANs throughout.
attribute 1 = link
attribute 2 = title
attribute 3 = description
attribute 4 = perms
attribute 5 = category
1 - settings
2 - users
3 - content
4 - tools
5 - plugins
6 - about
attribute 6 = 16 x 16 image
attribute 7 = 32 x 32 image
*/
/* $buts = ""; // ---------------------- Start Panel --------------------------------
while (list($key, $funcinfo) = each($array_functions_assoc)) $text = "<div style='text-align:center'>";
{ if (!vartrue($user_pref['core-infopanel-mye107'])) // Set default icons.
$iconlist[$key] = array("title"=>$funcinfo[1],"icon"=>$funcinfo[5]); // , $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], "classis"); {
$buts .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], "classis"); $user_pref['core-infopanel-mye107'] = $pref['core-infopanel-default'];
}*/ }
$iconlist = array_merge($array_functions_assoc, getPluginLinks(E_16_PLUGMANAGER, "array"));
if(!vartrue($user_pref['core-infopanel-mye107'])) // Set default icons.
{
$user_pref['core-infopanel-mye107'] = $pref['core-infopanel-default'];
}
$iconlist = array_merge($array_functions_assoc,getPluginLinks(E_16_PLUGMANAGER,"array"));
$text .= "
$text .= "
<form method='post' action='".e_SELF."?".e_QUERY."'>
<div id='core-infopanel_mye107' class='f-left' style='width:49%'> <div id='core-infopanel_mye107' class='f-left' style='width:49%'>
<div style='border:1px solid silver;margin:10px'> <div style='border:1px solid silver;margin:10px'>
<div class='main_caption bevel left'><b>Welcome to your e107 Content Management System</b></div> <div class='main_caption bevel left'><b>Welcome to your e107 Content Management System</b></div>
@@ -93,118 +59,67 @@ $text .= "
</div> </div>
<div class='left' style='padding:25px'>"; <div class='left' style='padding:25px'>";
// Rendering the saved configuration.
foreach ($iconlist as $key=>$val)
// Rendering the saved configuration.
foreach ($iconlist as $key => $val)
{
if (!isset($user_pref['core-infopanel-mye107']) || in_array($key,$user_pref['core-infopanel-mye107']) )
{
$text .= render_links($val['link'],$val['title'],$val['caption'],$val['perms'],$val['icon_32'],"div");
}
}
$text .= "<div class='clear'>&nbsp;</div>
</div>
<div class='left block-text' >
To customize the icons that appear in this panel, please
<a href='#customize_icons' class='e-expandit'>click here</a>.
<form method='post' action='".e_SELF."?".e_QUERY."'>
<div id='customize_icons' class='e-hideme block-text'>
<div style='border:1px solid silver;margin:10px'>
<div class='main_caption bevel left'><b>Customize Icons</b></div>
<div class='left block-text' >";
foreach ($iconlist as $key => $icon)
{
if(getperms($icon['perms']))
{
$checked = (varset($user_pref['core-infopanel-mye107']) && in_array($key,$user_pref['core-infopanel-mye107'])) ? true : false;
$text .= "<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'>
".$icon['icon'].$frm->checkbox('e-mye107[]',$key,$checked).$icon['title']."</div>";
}
}
if (is_array($pluglist))
{
foreach ($pluglist as $key => $icon)
{
if(getperms($icon['perms']))
{ {
$checked = (in_array('p-'.$key,$user_pref['core-infopanel-mye107'])) ? true : false; if (!isset($user_pref['core-infopanel-mye107']) || in_array($key, $user_pref['core-infopanel-mye107']))
$text .= "<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'> {
".$icon['icon'].$frm->checkbox('e-mye107[]',$key,$checked).$icon['title']."</div>"; $text .= render_links($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div");
}
} }
}
} $text .= "<div class='clear'>&nbsp;</div>
$text .= "<div class='clear'>&nbsp;</div>"; </div>
$text .= "<div id='button' class='buttons-bar center'>";
// has issues with the checkboxes.
$text .= $frm->admin_button('submit-mye107','Save','Save');
$text .= "</div></div></div></div></form>
</div> </div>
</div>";
</div>
</div> // ------------------------------- e107 News --------------------------------
"; $text .= "
// e107 News ------------------------------------------------------------------
$text .= "
<div id='core-infopanel_news' class='f-left' style='width:49%'> <div id='core-infopanel_news' class='f-left' style='width:49%'>
<div style='border:1px solid silver;margin:10px'> <div style='border:1px solid silver;margin:10px'>
<div class='main_caption bevel left'><b>e107 News</b></div> <div class='main_caption bevel left'><b>e107 News</b></div>
<div class='left block-text'>"; <div class='left block-text'>";
// TODO Load with Ajax
/*
require_once(e_HANDLER.'xml_class.php'); /*
$xml = new xmlClass; require_once(e_HANDLER.'xml_class.php');
$vars = $xml->loadXMLfile('http://www.e107.org/e107_plugins/rss_menu/rss.php?1.2', true, true); $xml = new xmlClass;
$text .= print_r($vars,TRUE);*/ $vars = $xml->loadXMLfile('http://www.e107.org/e107_plugins/rss_menu/rss.php?1.2', true, true);
$text .= print_r($vars,TRUE);
$text .= " */
$text .= "
RSS News feed from e107.org goes here. RSS News feed from e107.org goes here.
</div> </div>
</div> </div>
</div> </div>
"; ";
// ---------------------Latest Stuff ---------------------------
// e107 latest
$text .= " $text .= "
<div id='core-infopanel_latest' class='f-left' style='width:49%' > <div id='core-infopanel_latest' class='f-left' style='width:49%' >
<div style='border:1px solid silver;margin:10px'> <div style='border:1px solid silver;margin:10px'>
<table cellspacing='0' cellpadding='0'> <table cellspacing='0' cellpadding='0'>
<tr> <tr>
<td style='padding:0px'> <td style='padding:0px'>";
"; require_once (e_FILE."shortcode/batch/admin_shortcodes.php");
require_once (e_FILE."shortcode/batch/admin_shortcodes.php"); $text .= $tp->parseTemplate("{ADMIN_LATEST}");
$text .= $tp->parseTemplate("{ADMIN_LATEST}"); $text .= "</td><td style='padding:0px'>";
$text .= "</td><td style='padding:0px'>"; $text .= $tp->parseTemplate("{ADMIN_STATUS}");
$text .= $tp->parseTemplate("{ADMIN_STATUS}"); $text .= "</td></tr></table>
$text .= "</td></tr></table>
</div> </div>
</div> </div>
"; ";
// ---------------------- Who's Online ------------------------
// Who's Online --------------------------------- // TODO Could use a new _menu item instead.
$text .= " $text .= "
<div id='core-infopanel_online' class='f-left' style='width:49%'> <div id='core-infopanel_online' class='f-left' style='width:49%'>
<div style='border:1px solid silver;margin:10px'> <div style='border:1px solid silver;margin:10px'>
<div class='main_caption bevel left'><b>Who's Online</b></div> <div class='main_caption bevel left'><b>Who's Online</b></div>
<div class='left block-text'> <div class='left block-text'>
<form action='".e_SELF."' id='onlineform' method='post'>
<table cellpadding='0' cellspacing='0' class='adminlist'> <table cellpadding='0' cellspacing='0' class='adminlist'>
<colgroup span='3'> <colgroup span='3'>
@@ -220,47 +135,131 @@ $text .= "
</tr> </tr>
</thead> </thead>
<tbody>"; <tbody>";
if (e107::getDB()->db_Select('online', '*'))
if ($e107->sql->db_Select('online','*'))
{
$newsarray = $e107->sql->db_getList();
foreach ($newsarray as $key => $val)
{ {
$text .= "<tr> $newsarray = $e107->sql->db_getList();
<td>".$val['online_timestamp']."</td> foreach ($newsarray as $key=>$val)
<td>".$val['online_user_id']."</td> {
<td>".$val['online_location']."</td> $text .= "<tr>
</tr> <td>".$val['online_timestamp']."</td>
"; <td>".$val['online_user_id']."</td>
<td>".$val['online_location']."</td>
</tr>
";
}
} }
}
$text .= "</tbody></table></form></div> $text .= "</tbody></table></div>
</div> </div>
</div> </div>
"; ";
// --------------------- User Selected Menus -------------------
if (varset($user_pref['core-infopanel-menus']))
{
foreach ($user_pref['core-infopanel-menus'] as $val)
{
$text .= "
<div id='core-infopanel_{$val}' class='f-left' style='width:49%' >
<div style='border:1px solid silver;margin:10px'>
";
$text .= $tp->parseTemplate("{PLUGIN=$val|TRUE}");
$text .= "
</div>
</div>
";
}
}
// Customizer ------------------------------------------
/*
$text .= "
<div id='core-infopanel_add' class='f-left' style='width:49%'>
<div style='border:1px solid silver;margin:10px'>
<div class='main_caption bevel left'><b>Add</b></div>
<div class='left block-text'>
Here we configure additional tabs. A list is shown of plugins that have their own 'infopanel' tab. e_infopanel.php ? ;-)
</div>
</div>
</div>
";
*/
$text .= "<div class='clear'>&nbsp;</div>"; $text .= "<div class='clear'>&nbsp;</div>";
$text .= render_infopanel_options();
$text .= "</form>";
$text .= "</div>"; $text .= "</div>";
//$text .= "</div>"; $ns->tablerender(ADLAN_47." ".ADMINNAME, $emessage->render().$text);
$ns->tablerender(ADLAN_47." ".ADMINNAME,$emessage->render().$text);
function render_info_panel($caption, $text)
{
return "<div class='main_caption bevel left'><b>".$caption."</b></div>
<div class='left block-text' >".$text."</div>";
}
// ------------------
function render_infopanel_options()
{
$frm = e107::getSingleton('e_form');
$start = "<div>To customize this page, please <a href='#customize_icons' class='e-expandit'>click here</a>.</div>
<div class='e-hideme' id='customize_icons' style='border:1px solid silver;margin:10px'>";
$text2 = "<h2>Icons</h2>";
$text2 .= render_infopanel_icons();
$text2 .= "<div class='clear'>&nbsp;</div>";
$text2 .= "<h2>Menus</h2>";
$text2 .= render_infopanel_menu_options();
$text2 .= "<div class='clear'>&nbsp;</div>";
$text2 .= "<div id='button' class='buttons-bar center'>";
$text2 .= $frm->admin_button('submit-mye107', 'Save', 'Save');
$text2 .= "</div>";
$end = "</div>";
return $start.render_info_panel("Customize", $text2).$end;
}
function render_infopanel_icons()
{
$frm = e107::getSingleton('e_form');
global $iconlist,$pluglist;
foreach ($iconlist as $key=>$icon)
{
if (getperms($icon['perms']))
{
$checked = (varset($user_pref['core-infopanel-mye107']) && in_array($key, $user_pref['core-infopanel-mye107'])) ? true : false;
$text .= "<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'>
".$icon['icon'].$frm->checkbox('e-mye107[]', $key, $checked).$icon['title']."</div>";
}
}
if (is_array($pluglist))
{
foreach ($pluglist as $key=>$icon)
{
if (getperms($icon['perms']))
{
$checked = (in_array('p-'.$key, $user_pref['core-infopanel-mye107'])) ? true : false;
$text .= "<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'>
".$icon['icon'].$frm->checkbox('e-mye107[]', $key, $checked).$icon['title']."</div>";
}
}
}
return $text;
}
function render_infopanel_menu_options()
{
global $user_pref;
$frm = e107::getSingleton('e_form');
$text = "";
$menu_qry = 'SELECT * FROM #menus WHERE menu_id!= 0 GROUP BY menu_name ORDER BY menu_name';
if (e107::getDb()->db_Select_gen($menu_qry))
{
while ($row = e107::getDb()->db_Fetch())
{
$checked = (in_array($row['menu_name'], $user_pref['core-infopanel-menus'])) ? true : false;
$text .= "<div class='left f-left list field-spacer' style='display:block;height:24px;width:200px;'>";
$text .= $frm->checkbox("e-mymenus[]", $row['menu_name'], $checked);
$text .= $row['menu_name'];
$text .= "</div>";
}
}
return $text;
}
?> ?>

View File

@@ -1,11 +1,11 @@
<?php <?php
/* $Id: plugin.php,v 1.1 2009-08-16 23:58:31 e107coders Exp $ */ /* $Id: plugin.php,v 1.2 2009-09-03 01:27:27 e107coders Exp $ */
function plugin_shortcode($parm) function plugin_shortcode($parm)
{ {
global $sql, $tp, $ns; global $sql, $tp, $ns;
$menu = $parm; list($menu,$return) = explode("|",$parm);
$path = $tp -> toDB(dirname($menu)); $path = $tp -> toDB(dirname($menu));
$name = $tp -> toDB(basename($menu)); $name = $tp -> toDB(basename($menu));
@@ -14,5 +14,5 @@ function plugin_shortcode($parm)
{ {
$path = $menu; $path = $menu;
} }
return e107::getMenu()->renderMenu($path,$name); return e107::getMenu()->renderMenu($path,$name,$mode,$return);
} }

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
| $Revision: 1.76 $ | $Revision: 1.77 $
| $Date: 2009-09-02 02:05:51 $ | $Date: 2009-09-03 01:27:27 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -743,7 +743,9 @@ class e107plugin
{ {
unset($search_prefs['comments_handlers'][$eplug_folder]); unset($search_prefs['comments_handlers'][$eplug_folder]);
} }
$tmp = addslashes(serialize($search_prefs)); // $tmp = addslashes(serialize($search_prefs));
$tmp = e107::getArrayStorage()->WriteArray($search_prefs);
//TODO Use preference class instead of this.
$sql->db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = 'search_prefs' "); $sql->db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = 'search_prefs' ");
} }
@@ -791,7 +793,7 @@ class e107plugin
} }
} }
$s_prefs = $tp -> toDB($notify_prefs); $s_prefs = $tp -> toDB($notify_prefs);
$s_prefs = $eArrayStorage->WriteArray($s_prefs); $s_prefs = $eArrayStorage->WriteArray($s_prefs); //TODO use preference class function instead.
$sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'"); $sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'");
} }