[Linpha-cvs] SF.net SVN: linpha: [4895] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2008-02-25 23:07:14
|
Revision: 4895 http://linpha.svn.sourceforge.net/linpha/?rev=4895&view=rev Author: fangehrn Date: 2008-02-25 15:07:07 -0800 (Mon, 25 Feb 2008) Log Message: ----------- 2008-02-25 flo * fixed login menu * fixed some menu related bugs reload menu after login does not yet work * added utf-8 database charset for postgres and oracle Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/permissions_readwrite.php trunk/linpha2/admin/settings_plugins.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/modules/module.ajax.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/menu.html.php trunk/linpha2/templates/default/themes/default/menu/theme.js Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/ChangeLog 2008-02-25 23:07:07 UTC (rev 4895) @@ -1,4 +1,10 @@ +2008-02-25 flo + * fixed login menu + * fixed some menu related bugs + reload menu after login does not yet work + * added utf-8 database charset for postgres and oracle + 2008-02-22 flo * implemented jscookmenu * changed templates with new rounded corners Modified: trunk/linpha2/admin/permissions_readwrite.php =================================================================== --- trunk/linpha2/admin/permissions_readwrite.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/admin/permissions_readwrite.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -232,7 +232,7 @@ <?php -} // end if plugin_filemanager_enable +} // end if plugins_filemanager_enable /** * print the permission entries Modified: trunk/linpha2/admin/settings_plugins.php =================================================================== --- trunk/linpha2/admin/settings_plugins.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/admin/settings_plugins.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -13,7 +13,7 @@ */ if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') { - $GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT'] = true; + $GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT'] = true; // disable syslog foreach($arrPlugins as $value) { @@ -86,9 +86,17 @@ } } - } + /** + * add menu entry + */ + if (strpos($GLOBALS['linpha']->sql->config->value['sys_style_menu_list'], 'plugins_'.$value)===false) { + $GLOBALS['linpha']->sql->config->updateConfig('sys_style_menu_list', + $GLOBALS['linpha']->sql->config->value['sys_style_menu_list'].',plugins_'.$value + ); + } + } // end if valid plugin } - } + } // end foreach unset($GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT']); // set plugins_*_enable to '1' Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -138,6 +138,7 @@ $GLOBALS['linpha']->db->Execute("SET character_set_server='utf8'"); break; case "postgres": + $GLOBALS['linpha']->db->charSet = 'UTF-8'; // character set to use - only for interbase, postgres and oci8 (http://phplens.com/adodb/code.initialization.html) if(isset($db_password)) { $GLOBALS['linpha']->db->Connect("host=$db_hostname port=$db_port user=$db_username password=$db_password dbname=$db_name"); @@ -148,6 +149,7 @@ } break; case "oci8po": + $GLOBALS['linpha']->db->charSet = 'UTF-8'; // character set to use - only for interbase, postgres and oci8 (http://phplens.com/adodb/code.initialization.html) $GLOBALS['linpha']->db->PConnect($db_hostname, $db_username, $db_password, $db_name); break; } Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -33,7 +33,7 @@ public $URL_base, $URL_full, $idCurrent; public $hideMenu = false, $hideTitle = false; - public $menu, $menuFinal, $nofMenuEntries = 0; + public $menu = array(), $menuFinal, $nofMenuEntries = 0; public $arrayDefaultMenuEntries; public $bgcolor, $bodybgcolor, $fontcolor, $albumsbgcolor, $linkscolor, $linkshovercolor; @@ -273,7 +273,7 @@ foreach($arrayMenuEntries as $menuEntry) { - if ($menuEntry == 'more' || $menuEntry == 'admin' || $menuEntry == 'settings') + if ($menuEntry == 'more') { if (!isset($this->menu[$menuEntry])) { continue; @@ -281,12 +281,19 @@ } if (isset($this->arrayDefaultMenuEntries[$menuEntry])) { + if ($menuEntry == 'more') { + $link = ''; + } elseif($menuEntry == 'admin') { + $link = LINPHA_CLIENT.'/admin/'; + } else { + $link = LINPHA_LINK.'&linCat='.$menuEntry; + } $this->menuFinal[ $menuEntry ] = array( 'name' => $this->arrayDefaultMenuEntries[$menuEntry], - 'link' => LINPHA_LINK.'&linCat='.$menuEntry + 'link' => $link ); - } elseif ( strpos($menuEntry, 'plugin_') !== false ) { - $menuEntry = substr($menuEntry, 7); + } elseif ( strpos($menuEntry, 'plugins_') !== false ) { + $menuEntry = substr($menuEntry, 8); $this->menuFinal[ $menuEntry ] = array( 'name' => i18n(ucfirst($menuEntry)), // this will not be detected by the language translater, but thats no problem because this plugin name is for sure somewhere else 'link' => LINPHA_LINK.'&linCat='.$menuEntry @@ -344,7 +351,13 @@ foreach ($this->menu as $key=>$arrayMenuEntry) { if (strpos($key,'icon_')===false) { - $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', null, null, null, "."\n"; + if (empty($this->menuFinal[$key]['link'])) { + $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', null, null, null, "."\n"; + } else { + $link = linConvertAmp($this->menuFinal[$key]['link']); + $link = str_replace("'",'\\\'', $link); + $this->menuJSCook[$key][] = "[null, '".$this->arrayDefaultMenuEntries[$key]."', '".$link."', null, null, "."\n"; + } $this->createJSCookMenuEntry($key, $arrayMenuEntry); $this->menuJSCook[$key][] = "]"; } Modified: trunk/linpha2/lib/modules/module.ajax.php =================================================================== --- trunk/linpha2/lib/modules/module.ajax.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/lib/modules/module.ajax.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -64,9 +64,11 @@ */ elseif(isset($_GET['reloadmenu'])) { - if( isset($_SESSION['ref_url_base']) ) + if( isset($_SESSION['ref_url_base']) ) { - include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); + // call imgview to get menu details + + include_once(LINPHA_DIR . '/lib/classes/linpha.imgview.class.php'); $linpha->imgview = new linImgview(); $linpha->imgview->setCurrentView($_SESSION['ref_modulename']); @@ -79,8 +81,10 @@ else // return a default menu { } - - $linpha->template->printMenus('home,search,login,more,icons,settings,admin',$comingfrom_ajax=true); + + $linTpl->includeFile('menu'); + $linTpl->setMenu(); + linSetMenuJS(); } exit(); // important if linpha is included from another webpage Modified: trunk/linpha2/templates/default/global.html.php =================================================================== --- trunk/linpha2/templates/default/global.html.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/templates/default/global.html.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -49,7 +49,7 @@ <!-- menu --> <?php if (!$linTpl->hideMenu) { ?> <div id="linDivMenu"> - <?php $linTpl->includeFile('menu'); ?> + <?php $linTpl->includeFile('menu'); linDrawMenu(); ?> </div> <!-- end menu --> <?php } ?> Modified: trunk/linpha2/templates/default/menu.html.php =================================================================== --- trunk/linpha2/templates/default/menu.html.php 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/templates/default/menu.html.php 2008-02-25 23:07:07 UTC (rev 4895) @@ -1,127 +1,122 @@ <?php -/* +function linDrawMenu() +{ + global $linTpl; + $linTpl->setMenu(); ?> - <ul> - <li><span><?php echo i18n("Search"); ?> </span> - <ul> - <li><a href="<?php echo LINPHA_LINK; ?>&linCat=search"><?php echo i18n("Extended Search"); ?></a></li> - <li> - <div> - <form method="GET" action="<?php echo LINPHA_LINK; ?>&linCat=search"> - <input type="text" class="linForms" name="search_text" value="" /> - <input type="hidden" name="button[meta][all]" value="1" /> - <input type="hidden" name="cmd" value="search" /> - <input type="hidden" name="linCat" value="search" /> - <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Search"); ?>" /> - </form> - </div> - </li> - </ul> - </li> - </ul> - <ul> - <li> - <span><?php echo i18n("Login"); ?> </span> - <ul id="linMenuLogin"> - <li> - <div> - <?php if( linUseAjax() ) { ?> - <form action="" method="POST" onsubmit="new Ajax.Updater('linDivMenu', LINPHA_CLIENT + '/?linCat=ajax&reloadmenu&linId='+IdCurrent, {method: 'post', asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;"> - <?php } else { ?> - <form action="<?php echo $this->URL_full; ?>" method="POST"> - <?php } - if($GLOBALS['linpha']->sql->isLoggedIn()) { ?> - <?php echo i18n("Welcome").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')<br />'; ?> - <input type="hidden" name="cmd" value="logout" /> - <input type="submit" name="submit" value="<?php echo i18n("Logout"); ?>" /> - <?php } else { ?> - <!-- login infos --> - <br /> - <label for="linFormUsername" style="display: block; float: left; width: 80px;"><?php echo i18n("Username"); ?>: </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" /><br /> - <label for="linFormPassword" style="display: block; float: left; width: 80px;"><?php echo i18n("Password"); ?>: </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" /><br /> - <?php if($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { ?><input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" /><label for="linFormCheckboxRemember"><?php echo i18n("Remember Me"); ?></label><?php } ?> - <input type="hidden" name="cmd" value="login" /> - <input type="submit" name="submit" class="linButton linInputMenu" value="<?php echo i18n("Login"); ?>" /><br /><br /> - <div style="font-size: smaller; border: 0px;"><?php echo i18n("You must have cookies enabled to log in."); ?></div> - <?php } ?> - - </form> - </div> - </li> - </ul> - </li> - </ul> - <!-- icons --> - <div> - <?php if( isset( $this->output['menu_Icons'] ) ) { - echo $this->output['menu_Icons']; - } ?> - </div> -<?php -*/ - -$menu['search'] = "['<img src=\"".LINPHA_CLIENT."/lib/graphics/xmag.jpg\" width=\"15\" height=\"15\" />', '".i18n("Search")."', null, null, null," . "\n" . - "[_cmNoClick, '<td class=\"ThemePanelMenuItemLeft\"></td><td colspan=\"2\"><form action=\"\">" . - "<input type=\"text\" size=\"10\" name=\"searchwhat\" value=\"\"/><input type=\"submit\" value=\"search\" /></form></td>']," . "\n" . - "_cmSplit, [null, 'Extended Search', '".LINPHA_LINK."&linCat=search', null, null]" . "\n" . - "]"; -$menu['login'] = "[null, '".i18n("Login")."', null, null, null," . "\n" . - "[_cmNoClick, '<td class=\"ThemePanelMenuItemLeft\"></td><td colspan=\"2\"><form action=\"\">" . - "<input type=\"text\" size=\"10\" name=\"searchwhat\" value=\"\"/><input type=\"submit\" value=\"search\" /></form></td>']," . "\n" . - "_cmSplit, [null, 'Extended Search', '".LINPHA_LINK."&linCat=search', null, null]" . "\n" . - "]"; -$menu['icon_slideshow_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Play Slideshow").'" class="linImgMenu" />'; -$menu['icon_download_img'] = '<img src="'.$linTpl->themeFile("images/download.png").'" alt="" title="'.i18n("Download Images").'" class="linImgMenu" />'; -$menu['icon_mail_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Mail Images").'" class="linImgMenu" />'; -$menu['icon_print_img'] = '<img src="'.$linTpl->themeFile("images/print.png").'" alt="" title="'.i18n("Print Images").'" class="linImgMenu" />'; - -$linTpl->setMenu(); -$linTpl->createJSCookMenu(); -?> <script type="text/javascript"> <!-- -var myMenu = -[ +var myMenu = <?php linSetMenuJS(); ?>; +cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); + +function linRedrawMenu() +{ + cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); +} +function linReloadMenu(form_params) +{ + myLinGlobal.AjaxPost(form_params, linRedrawMenu, LINPHA_CLIENT + '/?linCat=ajax&reloadmenu&linId=' + IdCurrent); +} +--> +</script> <?php -reset($linTpl->menuFinal); -list($key, $menuEntry) = each($linTpl->menuFinal); -$prevIsIcon = false; -if (isset( $menu[$key] )) { - echo $menu[$key]; -} elseif (isset($linTpl->menuJSCook[$key])) { - echo $linTpl->menuJSCook[$key]; -} elseif (isset( $menu[$key.'_img'] )) { - echo "['".$menu[$key.'_img']."', ' ', '".$menuEntry['link']."', null, null]"; - $prevIsIcon = true; -} else { - echo "[null, '".$menuEntry['name']."', '".$menuEntry['link']."', null, null]"; +linSetMenuNoJS(); } -for($i=1; list($key, $menuEntry) = each($linTpl->menuFinal); $i++) +function linSetMenuJS() { - if (isset( $menu[$key.'_img'] ) && $prevIsIcon) { - echo ','."\n"; + global $linTpl; + $linTpl->createJSCookMenu(); + + $html_search = '<td class="ThemePanelMenuItemLeft"></td><td colspan="2"><form action="">' . + '<input type="text" size="10" name="searchwhat" value="" /><input type="submit" value="'.i18n("search").'" /></form></td>'; + + $html_login = '<td class="ThemePanelMenuItemLeft"></td><td colspan="2">'; + if (linUseAjax()) { + $html_login .= '<form action="" method="POST" onsubmit="new Ajax.Updater(\'linDivMenu\', '. + 'LINPHA_CLIENT + \'/?linCat=ajax&reloadmenu&linId=\'+IdCurrent, {method: \'post\', '. + 'asynchronous:true, parameters:Form.serialize(this), evalScripts:true}); return false;">'; } else { - echo ',_cmSplit,'."\n"; + $html_login .= '<form action="'.$this->URL_full.'" method="POST">'; } + if ($GLOBALS['linpha']->sql->isLoggedIn()) { + $html_login .= i18n("Welcome").' '.$_SESSION['user_name'].' ('.$_SESSION['user_displayname'].')<br />' . + '<input type="hidden" name="cmd" value="logout" />' . + '<input type="submit" name="submit" class="linButton" value="'.i18n("Logout").'" />'; + } else { + $html_login .= '<br /><label for="linFormUsername" style="display: block; float: left; width: 80px;">' . + i18n("Username").': </label><input style="width: 105px;" class="linForms" type="text" name="username" value="" id="linFormUsername" />' . + '<br /><label for="linFormPassword" style="display: block; float: left; width: 80px;">' . + i18n("Password").': </label><input style="width: 105px;" class="linForms" type="password" name="password" value="" id="linFormPassword" />' . + '<br /><br />'; + + if ($GLOBALS['linpha']->sql->config->value['sys_session_autologin']) { + $html_login .= '<label for="linFormCheckboxRemember">' . + '<input type="checkbox" name="rememberme" value="true" id="linFormCheckboxRemember" />' . + i18n("Remember Me").'</label>'; + } + + $html_login .= '<input type="hidden" name="cmd" value="login" />' . + '<input type="submit" name="submit" class="linButton" value="'.i18n("Login").'" /><br /><br />' . + '<div style="font-size: smaller; border: 0px;">'.i18n("You must have cookies enabled to log in.").'</div>'; + } + $html_login .= '</form></td>'; + + $menu['search'] = "['<img src=\"".LINPHA_CLIENT."/lib/graphics/xmag.jpg\" width=\"15\" height=\"15\" />', '".i18n("Search")."', null, null, null," . "\n" . + "[_cmNoClick, '".str_replace("'",'\\\'', $html_search)."']," . "\n" . + "_cmSplit, [null, 'Extended Search', '".LINPHA_LINK."&linCat=search', null, null]" . "\n" . + "]"; + $menu['login'] = "[null, '".i18n("Login")."', null, null, null," . "\n" . + "[_cmNoClick, '".str_replace("'",'\\\'', $html_login)."']" . "\n" . + "]"; + $menu['icon_slideshow_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Play Slideshow").'" class="linImgMenu" />'; + $menu['icon_download_img'] = '<img src="'.$linTpl->themeFile("images/download.png").'" alt="" title="'.i18n("Download Images").'" class="linImgMenu" />'; + $menu['icon_mail_img'] = '<img src="'.$linTpl->themeFile("images/slideshow.png").'" alt="" title="'.i18n("Mail Images").'" class="linImgMenu" />'; + $menu['icon_print_img'] = '<img src="'.$linTpl->themeFile("images/print.png").'" alt="" title="'.i18n("Print Images").'" class="linImgMenu" />'; + + echo '['; + reset($linTpl->menuFinal); + list($key, $menuEntry) = each($linTpl->menuFinal); $prevIsIcon = false; if (isset( $menu[$key] )) { echo $menu[$key]; } elseif (isset($linTpl->menuJSCook[$key])) { - echo implode('',$linTpl->menuJSCook[$key]); + echo $linTpl->menuJSCook[$key]; } elseif (isset( $menu[$key.'_img'] )) { echo "['".$menu[$key.'_img']."', ' ', '".$menuEntry['link']."', null, null]"; $prevIsIcon = true; } else { - echo "[null, '".$menuEntry['name']."', '".$menuEntry['link']."', null, null]"; + echo "[null, '".$menuEntry['name']."', '".linConvertAmp($menuEntry['link'])."', null, null]"; } + + for($i=1; list($key, $menuEntry) = each($linTpl->menuFinal); $i++) + { + if (isset( $menu[$key.'_img'] ) && $prevIsIcon) { + echo ','."\n"; + } else { + echo ',_cmSplit,'."\n"; + } + + $prevIsIcon = false; + if (isset( $menu[$key] )) { + echo $menu[$key]; + } elseif (isset($linTpl->menuJSCook[$key])) { + echo implode('',$linTpl->menuJSCook[$key]); + } elseif (isset( $menu[$key.'_img'] )) { + echo "['".$menu[$key.'_img']."', ' ', '".$menuEntry['link']."', null, null]"; + $prevIsIcon = true; + } else { + echo "[null, '".$menuEntry['name']."', '".linConvertAmp($menuEntry['link'])."', null, null]"; + } + } + echo ']'; } + +function linSetMenuNoJS() +{ + global $linTpl; ?> -]; -cmDraw ('linDivMenu', myMenu, 'hbr', cmThemePanel); ---> -</script> <noscript> <?php reset($linTpl->menuFinal); @@ -139,3 +134,6 @@ } ?> </noscript> +<?php +} +?> \ No newline at end of file Modified: trunk/linpha2/templates/default/themes/default/menu/theme.js =================================================================== --- trunk/linpha2/templates/default/themes/default/menu/theme.js 2008-02-25 14:55:38 UTC (rev 4894) +++ trunk/linpha2/templates/default/themes/default/menu/theme.js 2008-02-25 23:07:07 UTC (rev 4895) @@ -58,6 +58,8 @@ // also for the other lvls offsetSubAdjust: [0, -2], + delay: 500, + effect: new CMFadingEffect (8, 4) // rest use default settings This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |