1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

More work on theme-manager and menu-manager.

This commit is contained in:
CaMer0n
2009-07-09 08:31:38 +00:00
parent 35aef983c4
commit b81a3a0536
8 changed files with 443 additions and 273 deletions

View File

@@ -9,8 +9,8 @@
* General purpose file
*
* $Source: /cvs_backup/e107_0.8/class2.php,v $
* $Revision: 1.103 $
* $Date: 2009-07-08 01:28:55 $
* $Revision: 1.104 $
* $Date: 2009-07-09 08:31:36 $
* $Author: e107coders $
*
*/
@@ -940,23 +940,32 @@ if(!defined("THEME_LAYOUT"))
{
if ($kpage && (strstr(e_SELF, $kpage) || strstr(e_SELF."?".e_QUERY,$kpage)))
{
$def = ($lyout) ? $lyout : "no_array";
// $def = ($lyout) ? $lyout : "legacyCustom";
$def = $lyout;
break;
}
}
}
}
if(strpos(e_SELF.'?'.e_QUERY, $ADMIN_DIRECTORY. 'menus.php?configure')!==FALSE)
{
$menus_equery = explode('.', e_QUERY);
$def = $menus_equery[1];
}
if($def) // custom-page layout.
{
define("THEME_LAYOUT",$def);
}
else // default layout.
{
$deflayout = (!isset($user_pref['sitetheme_deflayout'])) ? varset($pref['sitetheme_deflayout']) : $user_pref['sitetheme_deflayout'];
$deflayout = (!isset($user_pref['sitetheme_deflayout'])) ? varset($pref['sitetheme_deflayout']) : $user_pref['sitetheme_deflayout'];
define("THEME_LAYOUT",$deflayout); // default layout.
}
unset($def,$lyout,$cusPagePref);
unset($def,$lyout,$cusPagePref,$menus_equery,$deflayout);
}

View File

@@ -9,8 +9,8 @@
* Admin Navigation
*
* $Source: /cvs_backup/e107_0.8/e107_admin/ad_links.php,v $
* $Revision: 1.10 $
* $Date: 2009-07-09 02:47:09 $
* $Revision: 1.11 $
* $Date: 2009-07-09 08:31:37 $
* $Author: e107coders $
*/
@@ -554,7 +554,7 @@ $array_functions = array(
12 => array(e_ADMIN.'links.php', ADLAN_138, ADLAN_139, 'I', 1, E_16_LINKS, E_32_LINKS),
13 => array(e_ADMIN.'wmessage.php', ADLAN_28, ADLAN_29, 'M', 3, E_16_WELCOME, E_32_WELCOME),
14 => array(e_ADMIN.'ugflag.php', ADLAN_40, ADLAN_41, '9', 4, E_16_MAINTAIN, E_32_MAINTAIN),
15 => array(e_ADMIN.'menus.php', ADLAN_6, ADLAN_7, '2', 3, E_16_MENUS, E_32_MENUS),
15 => array(e_ADMIN.'menus.php', ADLAN_6, ADLAN_7, '2', 5, E_16_MENUS, E_32_MENUS),
16 => array(e_ADMIN.'meta.php', ADLAN_66, ADLAN_67, 'T', 1, E_16_META, E_32_META),
17 => array(e_ADMIN.'newspost.php', ADLAN_0, ADLAN_1, 'H', 3, E_16_NEWS, E_32_NEWS),
18 => array(e_ADMIN.'phpinfo.php', ADLAN_68, ADLAN_69, '0', 20, E_16_PHP, E_32_PHP),

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/menus.php,v $
| $Revision: 1.21 $
| $Date: 2009-07-08 06:58:00 $
| $Revision: 1.22 $
| $Date: 2009-07-09 08:31:37 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -46,18 +46,16 @@ if (isset($_POST['custom_select']))
}
else if (!isset($curLayout))
{
$curLayout = '';
$curLayout = $pref['sitetheme_deflayout'];
}
if ($curLayout == '' || $curLayout == 'default_layout')
/*if ($curLayout == '' || $curLayout == 'default_layout')
{
$menus_header = is_array($HEADER) ? $HEADER[$pref['sitetheme_deflayout']] : $HEADER;
$menus_footer = is_array($FOOTER) ? $FOOTER[$pref['sitetheme_deflayout']] : $FOOTER;
}
else if ($curLayout == 'no_array')
else if ($curLayout == 'legacyCustom')
{
$menus_header = $CUSTOMHEADER ? $CUSTOMHEADER : $HEADER;
$menus_footer = $CUSTOMFOOTER ? $CUSTOMFOOTER : $FOOTER;
@@ -78,47 +76,52 @@ else
$menus_header = $CUSTOMHEADER[$curLayout] ? $CUSTOMHEADER[$curLayout] : $HEADER;
$menus_footer = $CUSTOMFOOTER[$curLayout] ? $CUSTOMFOOTER[$curLayout] : $FOOTER;
}
*/
// Almost the same code as found in templates/header_default.php
if(($curLayout == 'legacyCustom' || $curLayout=='legacyDefault') && (isset($CUSTOMHEADER) || isset($CUSTOMFOOTER)) ) // 0.6 themes.
{
if($curLayout == 'legacyCustom')
{
$HEADER = ($CUSTOMHEADER) ? $CUSTOMHEADER : $HEADER;
$FOOTER = ($CUSTOMFOOTER) ? $CUSTOMFOOTER : $FOOTER;
}
}
elseif($curLayout && $curLayout != "legacyCustom" && (isset($CUSTOMHEADER[$curLayout]) || isset($CUSTOMHEADER[$curLayout]))) // 0.7 themes
{
// echo " MODE 0.7";
$HEADER = ($CUSTOMHEADER[$curLayout]) ? $CUSTOMHEADER[$curLayout] : $HEADER;
$FOOTER = ($CUSTOMFOOTER[$curLayout]) ? $CUSTOMFOOTER[$curLayout] : $FOOTER;
}
elseif($curLayout && isset($HEADER[$curLayout]) && isset($FOOTER[$curLayout])) // 0.8 themes - we use only $HEADER and $FOOTER arrays.
{
// echo " MODE 0.8";
$HEADER = $HEADER[$curLayout];
$FOOTER = $FOOTER[$curLayout];
}
if (e_PAGE == 'news.php' && isset($NEWSHEADER))
{
// parseheader($NEWSHEADER);
}
else
{
// parseheader($HEADER);
}
// $layouts_str = $HEADER.$FOOTER;
$layouts_str = $menus_header.$menus_footer;
$layouts_str = $HEADER.$FOOTER;
$menus_header = $HEADER;
$menus_footer = $FOOTER;
if ($NEWSHEADER)
{
$layouts_str .= $NEWSHEADER;
}
/*if ($CUSTOMPAGES)
{
if (is_array($CUSTOMPAGES))
{
foreach ($CUSTOMPAGES as $custom_extract_key => $custom_extract_value)
{
if ($CUSTOMHEADER[$custom_extract_key])
{
$layouts_str .= $CUSTOMHEADER[$custom_extract_key];
}
if ($CUSTOMFOOTER[$custom_extract_key])
{
$layouts_str .= $CUSTOMFOOTER[$custom_extract_key];
}
}
}
else
{
if ($CUSTOMHEADER)
{
$layouts_str .= $CUSTOMHEADER;
}
if ($CUSTOMFOOTER)
{
$layouts_str .= $CUSTOMFOOTER;
}
}
}*/
$menu_array = parseheader($layouts_str, 'check');
sort($menu_array, SORT_NUMERIC);
$menu_check = 'set';
foreach ($menu_array as $menu_value)
@@ -142,94 +145,7 @@ if($_POST['menuSetCustomPages'])
menuSetCustomPages($_POST['custompages']);
}
function menuActivate()
{
global $sql, $admin_log, $pref;
$location = key($_POST['menuActivate']);
$layout = ($_POST['curLayout'] != $pref['sitetheme_deflayout']) ? $_POST['curLayout'] : "";
$menu_count = $sql->db_Count("menus", "(*)", " WHERE menu_location=".$location." AND menu_layout = '$layout' ");
foreach($_POST['menuselect'] as $sel_mens)
{
//Get info from menu being activated
if($sql->db_Select("menus", 'menu_name, menu_path' , "menu_id = ".$sel_mens." "))
{
$row=$sql->db_Fetch();
//If menu is not already activated in that area, add the record.
if(!$sql->db_Select('menus', 'menu_name,menu_path', " menu_name='".$row['menu_name']."' AND menu_layout = '$layout' AND menu_location = ".$location." LIMIT 1 "))
{
$qry = "
INSERT into #menus
(`menu_name`, `menu_location`, `menu_order`, `menu_pages`, `menu_path`, `menu_layout`)
VALUES ('{$row['menu_name']}', {$location}, {$menu_count}, '', '{$row['menu_path']}', '{$layout}')
";
$sql->db_Select_gen($qry);
$admin_log->log_event('MENU_01',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$menu_count.'[!br!]'.$row['menu_path'],E_LOG_INFORMATIVE,'');
$menu_count++;
}
}
}
}
function menuSetCustomPages($array)
{
global $pref;
$key = key($array);
$pref['sitetheme_custompages'][$key] = array_filter(explode(" ",$array[$key]));
save_prefs();
}
function getMenuPreset($layout)
{
global $pref;
// print_a($pref['sitetheme_layouts'][$layout]['menuPresets']);
if(!isset($pref['sitetheme_layouts'][$layout]['menuPresets']))
{
return;
}
$temp = $pref['sitetheme_layouts'][$layout]['menuPresets']['area'];
foreach($temp as $key=>$val)
{
$iD = $val['@attributes']['id'];
foreach($val['menu'] as $k=>$v)
{
$uclass = (defined(trim($v['@attributes']['userclass']))) ? constant(trim($v['@attributes']['userclass'])) : 0;
$menuArea[] = array(
'menu_location' => $iD,
'menu_order' => $k,
'menu_name' => $v['@attributes']['name']."_menu",
'menu_class' => intval($uclass)
);
}
}
return $menuArea;
}
function checkMenuPreset($array,$name)
{
if(!is_array($array))
{
return;
}
foreach($array as $key=>$val)
{
if($val['menu_name']==$name)
{
return $val['menu_location'];
}
}
return FALSE;
}
@@ -288,113 +204,36 @@ if ($menu_act == 'config')
}
$newurl = $PLUGINS_DIRECTORY.$location."/{$position}{$newloc}.php";
$newurl = SITEURL.str_replace("//", "/", $newurl);
echo "<script> top.location.href = '{$newurl}'; </script> ";
echo "<script type='text/javascript'> top.location.href = '{$newurl}'; </script> ";
exit;
}
if ($menu_act == "adv")
{
showVisibility();
menuVisibilityOptions();
}
function showVisibility()
{
global $sql,$ns;
require_once(e_HANDLER."userclass_class.php");
$sql->db_Select("menus", "*", "menu_id=".$id);
$row = $sql->db_Fetch();
$listtype = substr($row['menu_pages'], 0, 1);
$menu_pages = substr($row['menu_pages'], 2);
$menu_pages = str_replace("|", "\n", $menu_pages);
$text = "<div style='text-align:center;'>
<form method='post' action='".e_SELF."?configure.".$curLayout."'>
<table style='width:40%'>
<tr>
<td>
<input type='hidden' name='menuAct[{$row['menu_id']}]' value='sv.{$row['menu_id']}' />
".MENLAN_4." ".
r_userclass('menu_class', $row['menu_class'], "off", "public,member,guest,admin,main,classes,nobody")."
</td>
</tr>
<tr><td><br />";
$checked = ($listtype == 1) ? " checked='checked' " : "";
$text .= "<input type='radio' {$checked} name='listtype' value='1' /> ".MENLAN_26."<br />";
$checked = ($listtype == 2) ? " checked='checked' " : "";
$text .= "<input type='radio' {$checked} name='listtype' value='2' /> ".MENLAN_27."<br /><br />".MENLAN_28."<br />";
$text .= "<textarea name='pagelist' cols='60' rows='10' class='tbox'>$menu_pages</textarea>";
$text .= "
<tr>
<td style='text-align:center'><br />
<input class='button' type='submit' name='class_submit' value='".MENLAN_6."' />
</td>
</tr>
</table>
</form>
</div>";
$caption = MENLAN_7." ".$row['menu_name'];
$ns->tablerender($caption, $text);
}
unset($message);
if ($menu_act == "sv")
{
$pagelist = explode("\r\n", $_POST['pagelist']);
for ($i = 0 ; $i < count($pagelist) ; $i++)
{
$pagelist[$i] = trim($pagelist[$i]);
}
$plist = implode("|", $pagelist);
$pageparms = $_POST['listtype'].'-'.$plist;
$pageparms = preg_replace("#\|$#", "", $pageparms);
$pageparms = (trim($_POST['pagelist']) == '') ? '' : $pageparms;
$sql->db_Update("menus", "menu_class='".$_POST['menu_class']."', menu_pages='{$pageparms}' WHERE menu_id=".intval($id));
$admin_log->log_event('MENU_02',$_POST['menu_class'].'[!br!]'.$pageparms.'[!br!]'.$id,E_LOG_INFORMATIVE,'');
$message = "<br />".MENLAN_8."<br />";
menuSaveVisibility();
}
if ($menu_act == "move")
{
// Get current menu name
if($sql->db_Select('menus', 'menu_name', 'menu_id='.$id, 'default'))
{
$row = $sql->db_Fetch();
//Check to see if menu is already active in the new area, if not then move it
if(!$sql->db_Select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = ".$newloc))
{
$menu_count = $sql->db_Count("menus", "(*)", " WHERE menu_location=".$newloc);
$sql->db_Update("menus", "menu_location='{$newloc}', menu_order=".($menu_count+1)." WHERE menu_id=".$id);
$sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_location='{$location}' AND menu_order > {$position}");
}
$admin_log->log_event('MENU_03',$row['menu_name'].'[!br!]'.$newloc.'[!br!]'.$id,E_LOG_INFORMATIVE,'');
}
menuMove();
}
if ($menu_act == "deac")
{
// Get current menu name
if($sql->db_Select('menus', 'menu_name', 'menu_id='.$id, 'default'))
{
$row = $sql->db_Fetch();
//Check to see if there is already a menu with location = 0 (to maintain BC)
if($sql->db_Select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = 0"))
{
//menu_location=0 already exists, we can just delete this record
$sql->db_Delete('menus', 'menu_id='.$id);
}
else
{
//menu_location=0 does NOT exist, let's just convert this to it
$sql->db_Update("menus", "menu_location=0, menu_order=0, menu_class=0, menu_pages='' WHERE menu_id=".$id);
}
//Move all other menus up
$sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_location={$location} AND menu_order > {$position}");
$admin_log->log_event('MENU_04',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$position.'[!br!]'.$id,E_LOG_INFORMATIVE,'');
}
menuDeactivate();
}
if ($menu_act == "bot")
@@ -509,11 +348,237 @@ if (strpos(e_QUERY, 'configure') === FALSE)
else // Within the IFrame.
{
echo layout_list();
echo menuSelectLayout();
menuRenderPage();
}
// ---------------------------------------------------------------------------
function menuVisibilityOptions()
{
global $sql,$ns,$id;
require_once(e_HANDLER."userclass_class.php");
$sql->db_Select("menus", "*", "menu_id=".$id);
$row = $sql->db_Fetch();
$listtype = substr($row['menu_pages'], 0, 1);
$menu_pages = substr($row['menu_pages'], 2);
$menu_pages = str_replace("|", "\n", $menu_pages);
$text = "<div style='text-align:center;'>
<form method='post' action='".e_SELF."?configure.".$curLayout."'>
<table style='width:40%'>
<tr>
<td>
<input type='hidden' name='menuAct[{$row['menu_id']}]' value='sv.{$row['menu_id']}' />
".MENLAN_4." ".
r_userclass('menu_class', $row['menu_class'], "off", "public,member,guest,admin,main,classes,nobody")."
</td>
</tr>
<tr><td><br />";
$checked = ($listtype == 1) ? " checked='checked' " : "";
$text .= "<input type='radio' {$checked} name='listtype' value='1' /> ".MENLAN_26."<br />";
$checked = ($listtype == 2) ? " checked='checked' " : "";
$text .= "<input type='radio' {$checked} name='listtype' value='2' /> ".MENLAN_27."<br /><br />".MENLAN_28."<br />";
$text .= "<textarea name='pagelist' cols='60' rows='10' class='tbox'>$menu_pages</textarea>";
$text .= "
<tr>
<td style='text-align:center'><br />
<input class='button' type='submit' name='class_submit' value='".MENLAN_6."' />
</td>
</tr>
</table>
</form>
</div>";
$caption = MENLAN_7." ".$row['menu_name'];
$ns->tablerender($caption, $text);
}
function menuActivate()
{
global $sql, $admin_log, $pref;
$location = key($_POST['menuActivate']);
$layout = ($_POST['curLayout'] != $pref['sitetheme_deflayout']) ? $_POST['curLayout'] : "";
$menu_count = $sql->db_Count("menus", "(*)", " WHERE menu_location=".$location." AND menu_layout = '$layout' ");
foreach($_POST['menuselect'] as $sel_mens)
{
//Get info from menu being activated
if($sql->db_Select("menus", 'menu_name, menu_path' , "menu_id = ".$sel_mens." "))
{
$row=$sql->db_Fetch();
//If menu is not already activated in that area, add the record.
if(!$sql->db_Select('menus', 'menu_name,menu_path', " menu_name='".$row['menu_name']."' AND menu_layout = '$layout' AND menu_location = ".$location." LIMIT 1 "))
{
$qry = "
INSERT into #menus
(`menu_name`, `menu_location`, `menu_order`, `menu_pages`, `menu_path`, `menu_layout`)
VALUES ('{$row['menu_name']}', {$location}, {$menu_count}, '', '{$row['menu_path']}', '{$layout}')
";
$sql->db_Select_gen($qry);
$admin_log->log_event('MENU_01',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$menu_count.'[!br!]'.$row['menu_path'],E_LOG_INFORMATIVE,'');
$menu_count++;
}
}
}
}
function menuSetCustomPages($array)
{
global $pref;
$key = key($array);
$pref['sitetheme_custompages'][$key] = array_filter(explode(" ",$array[$key]));
save_prefs();
}
function getMenuPreset($layout)
{
global $pref;
// print_a($pref['sitetheme_layouts'][$layout]['menuPresets']);
if(!isset($pref['sitetheme_layouts'][$layout]['menuPresets']))
{
return;
}
$temp = $pref['sitetheme_layouts'][$layout]['menuPresets']['area'];
foreach($temp as $key=>$val)
{
$iD = $val['@attributes']['id'];
foreach($val['menu'] as $k=>$v)
{
$uclass = (defined(trim($v['@attributes']['userclass']))) ? constant(trim($v['@attributes']['userclass'])) : 0;
$menuArea[] = array(
'menu_location' => $iD,
'menu_order' => $k,
'menu_name' => $v['@attributes']['name']."_menu",
'menu_class' => intval($uclass)
);
}
}
return $menuArea;
}
function checkMenuPreset($array,$name)
{
if(!is_array($array))
{
return;
}
foreach($array as $key=>$val)
{
if($val['menu_name']==$name)
{
return $val['menu_location'];
}
}
return FALSE;
}
// --------------------------------------------------------------------------
function menuSaveVisibility()
{
global $sql, $admin_log,$id;
$pagelist = explode("\r\n", $_POST['pagelist']);
for ($i = 0 ; $i < count($pagelist) ; $i++)
{
$pagelist[$i] = trim($pagelist[$i]);
}
$plist = implode("|", $pagelist);
$pageparms = $_POST['listtype'].'-'.$plist;
$pageparms = preg_replace("#\|$#", "", $pageparms);
$pageparms = (trim($_POST['pagelist']) == '') ? '' : $pageparms;
if($sql->db_Update("menus", "menu_class='".$_POST['menu_class']."', menu_pages='{$pageparms}' WHERE menu_id=".intval($id)))
{
$admin_log->log_event('MENU_02',$_POST['menu_class'].'[!br!]'.$pageparms.'[!br!]'.$id,E_LOG_INFORMATIVE,'');
$message = "<br />".MENLAN_8."<br />";
}
else
{
$message = "the update failed";
}
echo $message;
}
// -----------------------------------------------------------------------
function menuDeactivate()
{ // Get current menu name
global $sql,$admin_log,$id,$curLayout;
if($sql->db_Select('menus', 'menu_name', 'menu_id='.$id, 'default'))
{
$row = $sql->db_Fetch();
//Check to see if there is already a menu with location = 0 (to maintain BC)
if($sql->db_Select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = 0 AND menu_layout ='".$curLayout."' LIMIT 1"))
{
//menu_location=0 already exists, we can just delete this record
$sql->db_Delete('menus', 'menu_id='.$id);
}
else
{
//menu_location=0 does NOT exist, let's just convert this to it
if(!$sql->db_Update("menus", "menu_location=0, menu_order=0, menu_class=0, menu_pages='' WHERE menu_id=".$id))
{
$message = "FAILED";
}
}
//Move all other menus up
$sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_location={$location} AND menu_order > {$position} AND menu_layout = '".$curLayout."' ");
$admin_log->log_event('MENU_04',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$position.'[!br!]'.$id,E_LOG_INFORMATIVE,'');
}
echo $message;
}
// ----------------------------------------------------------------------
function menuMove()
{// Get current menu name
global $id,$admin_log,$sql,$newloc, $curLayout;
if($sql->db_Select('menus', 'menu_name', 'menu_id='.$id, 'default'))
{
$row = $sql->db_Fetch();
//Check to see if menu is already active in the new area, if not then move it
if(!$sql->db_Select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = ".$newloc." AND menu_layout='".$curLayout ."' LIMIT 1"))
{
$menu_count = $sql->db_Count("menus", "(*)", " WHERE menu_location=".$newloc);
$sql->db_Update("menus", "menu_location='{$newloc}', menu_order=".($menu_count+1)." WHERE menu_id=".$id);
$sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_location='{$location}' AND menu_order > {$position} AND menu_layout='".$curLayout ."' ");
}
$admin_log->log_event('MENU_03',$row['menu_name'].'[!br!]'.$newloc.'[!br!]'.$id,E_LOG_INFORMATIVE,'');
}
}
// =-----------------------------------------------------------------------------
@@ -596,17 +661,30 @@ function menuRenderPage()
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
function layout_list()
function menuSelectLayout()
{
global $frm, $curLayout, $menus_equery, $pref, $HEADER, $CUSTOMHEADER, $CUSTOMFOOTER, $CUSTOMPAGES;
$text .= "<form method='post' action='".e_SELF."?configure.".$curLayout."'>";
$text .= "<div style='color:white;background-color:black;width:99%;left:0px;position:relative;display:block;padding:15px;text-align:center'>".MENLAN_30." ";
// $text .= $frm->form_select_open('custom_select', 'onchange="this.form.submit()"');
$text .= "<select style='color:black' name='custom_select' onchange=\"this.form.submit()\">\n";
$search = array("_","legacyDefault","legacyCustom");
$replace = array(" ",MENLAN_31,MENLAN_33);
foreach($pref['sitetheme_layouts'] as $key=>$val)
{
$layoutName = str_replace($search,$replace,$key);
$layoutName .=($key==$pref['sitetheme_deflayout']) ? " (".MENLAN_31.")" : "";
$selected = ($curLayout == $key || ($key==$pref['sitetheme_deflayout'] && $curLayout=='')) ? "selected" : FALSE;
$text .= "<option value='$key' {$selected}>".$layoutName."</option>";
}
$text .= "</select></div></form>";
return $text;
if(is_array($HEADER))
{
foreach($HEADER as $key=>$val)
@@ -624,12 +702,12 @@ function layout_list()
if($CUSTOMHEADER && !is_array($CUSTOMHEADER))
{
$CUSTOMHEADER = array('no_array'=>$CUSTOMHEADER);
$CUSTOMHEADER = array('legacyCustom'=>$CUSTOMHEADER);
}
if($CUSTOMFOOTER && !is_array($CUSTOMFOOTER))
{
$CUSTOMFOOTER = array('no_array'=> $CUSTOMFOOTER);
$CUSTOMFOOTER = array('legacyCustom'=> $CUSTOMFOOTER);
}
@@ -640,7 +718,7 @@ function layout_list()
{
$selected = ($curLayout == $key || $curLayout == 'default_layout' ) ? "selected='selected'" : "";
$deftext = ($key==$pref['sitetheme_deflayout']) ? " (".MENLAN_31.")" : "";
$diz = ($key == "no_array") ? MENLAN_33 : str_replace("_"," ",$key);
$diz = ($key == "legacyCustom") ? MENLAN_33 : str_replace("_"," ",$key);
$text .= "<option value='$key' $selected style='color:black'>".ucwords($diz).$deftext."</option>\n";
// $text .= $frm->form_option(ucwords($diz).$deftext, $default, $key);
}
@@ -651,7 +729,7 @@ function layout_list()
$text .= "</select>";
// TO-DO Saving of the custompage preference for each layout.
/*
if($curLayout && ($curLayout != $pref['sitetheme_deflayout']))
{
@@ -661,7 +739,7 @@ function layout_list()
{
$custPages = $pref['sitetheme_layouts'][$curLayout]['customPages'];
}
elseif(isset($CUSTOMPAGES[$curLayout]) && $curLayout !='no_array')
elseif(isset($CUSTOMPAGES[$curLayout]) && $curLayout !='legacyCustom')
{
$custPages = $CUSTOMPAGES[$curLayout];
}
@@ -681,7 +759,7 @@ function layout_list()
$text .= "<div style='padding:10px'>Displays on these pages: <input type='text' style='width:80%;color:black;background-color:white' name='custompages[".$curLayout."]' value=\"".implode(" ",$custPages)."\" />
<input type='submit' name='menuSetCustomPages' value='".LAN_SAVE."' />
</div>";
}
}*/
$text .= "</div>
</form>";
return $text;
@@ -727,7 +805,7 @@ function parseheader($LAYOUT, $check = FALSE)
function checklayout($str,$curLayout)
{ // Displays a basic representation of the theme
global $pref, $menu_areas, $ns, $PLUGINS_DIRECTORY, $frm, $sc_style, $tp, $menus_equery;
global $pref, $menu_areas, $ns, $PLUGINS_DIRECTORY, $frm, $sc_style, $tp, $menu_order, $menus_equery;
$menuLayout = ($curLayout != $pref['sitetheme_deflayout']) ? $curLayout : "";

View File

@@ -1,7 +1,7 @@
<?php
/*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: admin_shortcodes_class.php,v 1.6 2009-07-09 02:47:12 e107coders Exp $
* $Id: admin_shortcodes_class.php,v 1.7 2009-07-09 08:31:37 e107coders Exp $
*
* Admin shortcode batch - class
*/
@@ -923,7 +923,7 @@ class admin_shortcodes
{
/*
* e107 website system (c) 2001-2008 Steve Dunstan (e107.org)
* $Id: admin_shortcodes_class.php,v 1.6 2009-07-09 02:47:12 e107coders Exp $
* $Id: admin_shortcodes_class.php,v 1.7 2009-07-09 08:31:37 e107coders Exp $
*/
if (ADMIN)
@@ -1259,6 +1259,25 @@ class admin_shortcodes
// print_a($menu_vars);
// ------------------------------------------------------------------
$menu_vars['home']['text'] = ADLAN_53;
$menu_vars['home']['link'] = e_BASE.'index.php';
$menu_vars['home']['image'] = "<img src='".E_16_NAV_LEAV."' alt='".ADLAN_151."' class='icon S16' />";
$menu_vars['home']['image_src'] = ADLAN_151;
$menu_vars['home']['perm'] = '';
$menu_vars['logout']['text'] = ADLAN_46;
$menu_vars['logout']['link'] = e_ADMIN_ABS.'admin.php?logout';
$menu_vars['logout']['image'] = "<img src='".E_16_NAV_LGOT."' alt='".ADLAN_151."' class='icon S16' />";
$menu_vars['logout']['image_src'] = ADLAN_46;
$menu_vars['logout']['perm'] = '';
// $text .= adnav_cat(ADLAN_53, e_BASE.'index.php', E_16_NAV_LEAV);
// $text .= adnav_cat(ADLAN_46, e_ADMIN.'admin.php?logout', E_16_NAV_LGOT);
return e_admin_menu('', '', $menu_vars, $$tmpl, false, false);
}

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $
| $Revision: 1.28 $
| $Date: 2009-07-09 02:47:12 $
| $Revision: 1.29 $
| $Date: 2009-07-09 08:31:38 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -73,9 +73,12 @@ class themeHandler{
{
$this -> id = $_POST['curTheme'];
$this -> setStyle();
$this -> SetCustomPages($_POST['custompages']);
}
}
function getThemes($mode=FALSE)
@@ -394,6 +397,7 @@ class themeHandler{
function renderThemeConfig() // process custom theme configuration - TODO.
{
global $frm;
$confile = e_THEME.$this->id."/".$this->id."_config.php";
if(is_readable($confile))
{
@@ -465,7 +469,16 @@ class themeHandler{
return $text;
}
$this->id = $theme['path'];
$this->id = $theme['path'];
$menuPresetCount = 0;
foreach($theme['layouts'] as $key=>$val)
{
if($val['menuPresets'])
{
$menuPresetCount++;
}
}
$text = "<div class='block' >
<h2 class='caption'>".$theme['name']."</h2>
@@ -477,39 +490,71 @@ class themeHandler{
$text .= "<tr><td style='vertical-align:top; width:25%'><b>".TPVLAN_4."</b>:</td><td style='vertical-align:top'>".$author."</td></tr>";
$text .= "<tr><td style='vertical-align:top; width:25%'><b>".TPVLAN_5."</b>:</td><td style='vertical-align:top'>".$website."</td></tr>";
$text .= "<tr><td style='vertical-align:top; width:25%'><b>".TPVLAN_6."</b>:</td><td style='vertical-align:top'>".$theme['date']."</td></tr>";
$text .= "<tr><td style='vertical-align:top; width:25%'><b>".TPVLAN_49."</b>:</td>
$text .= "<tr><td style='vertical-align:top; width:25%'><b>".TPVLAN_7."</b>:</td><td style='vertical-align:top'>".$theme['info']."</td></tr>";
$text .= "<tr><td style='vertical-align:top; width:25%'><b>".TPVLAN_49."</b>:</td>
<td style='vertical-align:top'>XHTML ";
$text .= ($theme['xhtmlcompliant']) ? ADMIN_TRUE_ICON : "X";
$text .= " &nbsp;&nbsp; CSS ";
$text .= ($theme['csscompliant']) ? ADMIN_TRUE_ICON : "X";
$text .= "</td></tr>";
$text .= "<tr><td style='vertical-align:top; width:25%'><b>".TPVLAN_7."</b>:</td><td style='vertical-align:top'>".$theme['info']."</td></tr>
";
if($mode == 1)
{
$text .= "
$text .= "
<tr>
<td style='vertical-align:top; width:24%;'><b>".TPVLAN_30."</b></td>
<td style='vertical-align:top; width:24%;'><b>".TPVLAN_53."</b></td>
<td colspan='2' style='vertical-align:top width:auto;'>";
foreach($theme['layouts'] as $key=>$val)
{
$text .= $this->renderPlugins($val['@attributes']['plugins']);
$text .= "&nbsp;";
}
$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>
<td colspan='2' style='vertical-align:top width:auto;'>
<input type='radio' name='image_preload' value='1'".($pref['image_preload'] ? " checked='checked'" : "")." /> ".TPVLAN_28."&nbsp;&nbsp;
<input type='radio' name='image_preload' value='0'".(!$pref['image_preload'] ? " checked='checked'" : "")." /> ".TPVLAN_29."
</td>
</tr>";
}
if($theme['layouts'] && $mode==1) // New in 0.8 ----
{
$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%' >
<tr>";
$itext .= ($mode == 1) ? "<td class='fcaption' style='width:15%;text-align:center;vertical-align:top;'>".TPVLAN_55."</td>" : "";
$itext .= ($mode == 1) ? "<td style='width:15%;text-align:center;vertical-align:top;'>".TPVLAN_55."</td>" : "";
$itext .= "
<td class='fcaption' style='width:20%'>".TPVLAN_52."</td>
<td class='fcaption' style='width:35%'>".TPVLAN_53."</td>
<td class='fcaption' style='text-align:center;width:100px'>".TPVLAN_54."</td>
<td style='width:20%'>".TPVLAN_52."</td>
<td style='width:65%'>".TPVLAN_56."</td>
</tr>\n";
@@ -534,12 +579,12 @@ class themeHandler{
$itext .= ($val['@attributes']['previewFull']) ? "<a href='".e_THEME_ABS.$theme['path']."/".$val['@attributes']['previewFull']."' >" : "";
$itext .= $val['@attributes']['title'];
$itext .= ($val['@attributes']['previewFull']) ? "</a>" : "";
$itext .= ($pref['sitetheme_deflayout'] == $key) ? " (default)" : "";
$itext .= "</td>
<td style='vertical-align:top'>";
$itext .= ($pref['sitetheme_deflayout'] != $key) ? "<input type='text' style='width:97%' name='custompages[".$key."]' value=\"".implode(" ",$pref['sitetheme_custompages'][$key])."\" />\n" : TPVLAN_55; // Default
$itext .= "</td>
<td style='vertical-align:top'>".$this->renderPlugins($val['@attributes']['plugins'])."&nbsp;</td>
<td style='vertical-align:top;text-align:center'>";
$itext .= ($val['menuPresets']) ? ADMIN_TRUE_ICON : "&nbsp;";
$itext .= "</td>
</tr>";
}
@@ -558,9 +603,9 @@ 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='fcaption center' style='width:15%'>".TPVLAN_55."</td>
<td class='fcaption' style='width:20%'>".TPVLAN_52."</td>
<td class='fcaption left'>".TPVLAN_7."</td>
<td class='center' style='width:15%'>".TPVLAN_55."</td>
<td style='width:20%'>".TPVLAN_52."</td>
<td class='left'>".TPVLAN_7."</td>
</tr>\n";
foreach($theme['css'] as $css)
@@ -669,13 +714,13 @@ class themeHandler{
$plug = trim($plug);
if(plugInstalled($plug))
{
$text .= ADMIN_TRUE_ICON.$plug;
$text .= $plug." ".ADMIN_TRUE_ICON;
}
else
{
$text .= ADMIN_FALSE_ICON."<a href='".e_ADMIN."plugin.php'>".$plug."</a>";
$text .= "<a href='".e_ADMIN."plugin.php'>".$plug."</a> ".ADMIN_FALSE_ICON;
}
$text .= "&nbsp;";
$text .= "&nbsp;&nbsp;";
}
return $text;
@@ -782,6 +827,19 @@ class themeHandler{
$ns->tablerender(TPVLAN_36, "<br /><div style='text-align:center;'>".TPVLAN_43.".</div><br />");
}
function SetCustomPages($array)
{
global $pref;
$key = key($array);
$pref['sitetheme_custompages'][$key] = array_filter(explode(" ",$array[$key]));
if($pref['sitetheme_deflayout'] == 'legacyCustom')
{
$pref['sitetheme_custompages']['legacyCustom'] = array();
}
save_prefs();
}
// Log event to admin log
function theme_adminlog($msg_num='00', $woffle='')
@@ -831,7 +889,7 @@ class themeHandler{
}
// echo " <hr>".$path."<hr>";
$lays['legacyDefault']['@attributes'] = array('title'=>'Default','preview'=>'','previewFull'=>'','plugins'=>'', 'default'=>'true');
foreach($themeContentsArray as $line)
{
@@ -849,10 +907,12 @@ class themeHandler{
}
elseif($CUSTOMPAGES)
{
$themeArray['custompages']['no_array'] = explode(" ",$CUSTOMPAGES);
$themeArray['custompages']['legacyCustom'] = explode(" ",$CUSTOMPAGES);
$lays['legacyCustom']['@attributes'] = array('title'=>'Custom','preview'=>'','previewFull'=>'','plugins'=>'');
}
$themeArray['path'] = $path;
$themeArray['layouts'] = $lays;
return $themeArray;
}

View File

@@ -4,8 +4,8 @@
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_theme.php,v $
| $Revision: 1.6 $
| $Date: 2009-07-06 09:28:02 $
| $Revision: 1.7 $
| $Date: 2009-07-09 08:31:38 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -71,9 +71,9 @@ define("TPVLAN_50", "Layouts");
define("TPVLAN_51", "Change Theme");
define("TPVLAN_52", "Name");
define("TPVLAN_53", "Suggested Plugins");
define("TPVLAN_54", "Menu Preset");
define("TPVLAN_54", "Menu Presets");
define("TPVLAN_55", "Default");
define("TPVLAN_56", "Visibility Filter");

View File

@@ -726,12 +726,14 @@ ul.plugin-navigation ul.plugin-navigation-sub a.link-active {font-weight: bold;}
/******** Block Elements */
.block { border: 1px solid #DDDDDD; margin-bottom: 10px;}
.block-text { padding: 10px 10px 10px; }
.block h2.caption, .block h4.caption { padding: 5px 10px 5px; border-bottom: 1px solid #DDDDDD; }
.block h2.caption, .block h4.caption { padding: 5px 10px 5px; border-bottom: 1px solid #DDDDDD; }
.page-info { border: 1px solid #DDDDDD; margin-bottom: 10px; }
.page-info p { padding: 10px; }
/***** Admin Info Panel Buttons **/
h2.caption { font-size: 200%; font-weight:bold; }
.core-mainpanel-block { text-align:center; width:100px; float:left; height:48px; display:block;margin:15px; }
.core-mainpanel-link-text { font-weight:bold; text-decoration: none; padding:3px }

View File

@@ -6,8 +6,8 @@
| Released under the terms and conditions of the GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/header_default.php,v $
| $Revision: 1.32 $
| $Date: 2009-07-07 16:04:51 $
| $Revision: 1.33 $
| $Date: 2009-07-09 08:31:38 $
| $Author: e107coders $
+-----------------------------------------------------------------------------------------------+
*/
@@ -448,17 +448,19 @@ if ($e107_popup != 1) {
// ---------- New in 0.8 -------------------------------------------------------
$def = THEME_LAYOUT;
$def = THEME_LAYOUT; // The active layout based on custompage matches.
// echo "DEF = ".$def;
// echo "DEF = ".$def."<br />";
if(($def == 'no_array') && (isset($CUSTOMHEADER) || isset($CUSTOMFOOTER)) ) // 0.6 themes.
if(($def == 'legacyCustom' || $def=='legacyDefault') && (isset($CUSTOMHEADER) || isset($CUSTOMFOOTER)) ) // 0.6 themes.
{
// echo " MODE 0.6";
$HEADER = ($CUSTOMHEADER) ? $CUSTOMHEADER : $HEADER;
$FOOTER = ($CUSTOMFOOTER) ? $CUSTOMFOOTER : $FOOTER;
if($def == 'legacyCustom')
{
$HEADER = ($CUSTOMHEADER) ? $CUSTOMHEADER : $HEADER;
$FOOTER = ($CUSTOMFOOTER) ? $CUSTOMFOOTER : $FOOTER;
}
}
elseif($def && $def != "no_array" && (isset($CUSTOMHEADER[$def]) || isset($CUSTOMHEADER[$def]))) // 0.7 themes
elseif($def && $def != "legacyCustom" && (isset($CUSTOMHEADER[$def]) || isset($CUSTOMHEADER[$def]))) // 0.7 themes
{
// echo " MODE 0.7";
$HEADER = ($CUSTOMHEADER[$def]) ? $CUSTOMHEADER[$def] : $HEADER;