From 0d469b61b73c9fff2c428eb042d346587f62aac9 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Fri, 23 May 2008 14:15:14 +0000 Subject: [PATCH] Moved menu-system from header.inc/footer.inc to renderer.php for relevant theme. Fixed frontaccounting.php to get the correct renderer.php. --- CHANGELOG.txt | 15 +++-- frontaccounting.php | 50 +++++++++-------- includes/page/footer.inc | 43 +++------------ includes/page/header.inc | 87 ++++++++--------------------- themes/aqua/renderer.php | 107 ++++++++++++++++++++++++++++++++---- themes/cool/renderer.php | 106 +++++++++++++++++++++++++++++++---- themes/default/renderer.php | 105 +++++++++++++++++++++++++++++++---- 7 files changed, 349 insertions(+), 164 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d1d86dbd..91582330 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,12 +19,15 @@ Legend: ! -> Note $ -> Affected files -22-May-2008 Janusz Dobrowolski -! Error handler switching moved to session.inc for early error catching -$ /includes/main.inc - /includes/session.inc -! Cosmetic cleanup - /js/utils.js +23-May-2008 Joe Hunt +! Moved menu-system from header.inc/footer.inc to renderer.php for relevant theme. Fixed frontaccounting.php to get the + correct renderer.php. +$ frontaccounting.php + /includes/page/header.inc + /includes/page/footer.inc + /themes/default/renderer.php + /themes/cool/renderer.php + /themes/aqua/renderer.php 18-May-2008 Janusz Dobrowolski # Added explicit ob_end_flush() on shutdown needed for php5 diff --git a/frontaccounting.php b/frontaccounting.php index 409186c1..6f3ad333 100644 --- a/frontaccounting.php +++ b/frontaccounting.php @@ -7,11 +7,10 @@ include_once('applications/dimensions.php'); include_once('applications/generalledger.php'); include_once('applications/setup.php'); - include_once('themes/default/renderer.php'); $path_to_root="."; include_once($path_to_root . "/includes/session.inc"); - class front_accounting + class front_accounting { var $user; var $settings; @@ -19,39 +18,42 @@ var $selected_application; // GUI var $menu; - var $renderer; - function front_accounting() - { - $this->renderer = new renderer(); - } - function add_application($app) + //var $renderer; + function front_accounting() + { + //$this->renderer =& new renderer(); + } + function add_application($app) { $this->applications[$app->id] = &$app; } - function get_application($id) + function get_application($id) { if (isset($this->applications[$id])) return $this->applications[$id]; return null; } - function get_selected_application() - { - if (isset($this->selected_application)) + function get_selected_application() + { + if (isset($this->selected_application)) return $this->applications[$this->selected_application]; foreach ($this->applications as $application) return $application; return null; - } - function display() - { - $this->init(); - $this->renderer->wa_header(); - $this->renderer->menu_header($this->menu); - $this->renderer->display_applications($this); - $this->renderer->menu_footer($this->menu); - $this->renderer->wa_footer(); - } - function init() + } + function display() + { + global $path_to_root; + include($path_to_root . "/themes/".user_theme()."/renderer.php"); + $this->init(); + $rend = new renderer(); + $rend->wa_header(); + //$rend->menu_header($this->menu); + $rend->display_applications($this); + //$rend->menu_footer($this->menu); + $rend->wa_footer(); + } + function init() { $this->menu = new menu(_("Main Menu")); $this->menu->add_item(_("Main Menu"), "index.php"); @@ -64,6 +66,6 @@ $this->add_application(new dimensions_app()); $this->add_application(new general_ledger_app()); $this->add_application(new setup_app()); - } + } } ?> \ No newline at end of file diff --git a/includes/page/footer.inc b/includes/page/footer.inc index f0a9b65e..d597ab3b 100644 --- a/includes/page/footer.inc +++ b/includes/page/footer.inc @@ -1,46 +1,17 @@ \n"; - else - echo "\n"; - echo ""; - if (isset($_SESSION['wa_current_user'])) - echo "\n"; - echo "
" . Today() . " | " . Now() . "
\n"; - } - echo "\n"; - echo "\n"; - if ($no_menu == false) - { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - if ($allow_demo_mode==true) - { - echo "\n"; - //echo "\n"; - echo "\n"; - } - echo "

\n"; - } + include_once($path_to_root."/themes/".user_theme()."/renderer.php"); + $rend = new renderer(); + $rend->menu_footer($no_menu, $is_index); echo "\n"; } diff --git a/includes/page/header.inc b/includes/page/header.inc index 50c56252..7d52f410 100644 --- a/includes/page/header.inc +++ b/includes/page/header.inc @@ -27,41 +27,44 @@ function help_url($title, $app) return $help_base_url.urlencode(str_replace(' ', '', ucwords($help_page_url))); } -function send_scripts() +function send_scripts() { global $js_lib, $js_static, $js_path, $js_userlib, $comp_path, $path_to_root, $go_debug; - - add_user_js_data(); + + add_user_js_data(); $js =''; - foreach($js_static as $jsfile) { + foreach($js_static as $jsfile) + { $fpath = $comp_path.'/'.user_company().'/js_cache/'.$jsfile; // compress also static files - if (!file_exists($fpath) || $go_debug) - cache_js_file($fpath, file_get_contents($js_path.$jsfile)); - - $js .= ''; + if (!file_exists($fpath) || $go_debug) + cache_js_file($fpath, file_get_contents($js_path.$jsfile)); + + $js .= ''; } - foreach($js_userlib as $jsfile) { - $js .= ''; + foreach($js_userlib as $jsfile) + { + $js .= ''; } - foreach($js_lib as $text) { - $js .= $text; + foreach($js_lib as $text) + { + $js .= $text; } - echo $js; + echo $js; } function page_header($title, $no_menu=false, $is_index=false, $onload="", $js="") { // titles and screen header - global $db_connections, $path_to_root, $def_app, $applications, - $help_base_url, $help_page_url, $use_popup_windows; + global $path_to_root, $def_app, $use_popup_windows, $help_base_url; - if (in_ajax()) return; // just for speed up + if (in_ajax()) + return; // just for speed up $theme = user_theme(); $local_path_to_root = $path_to_root; @@ -110,51 +113,9 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js="" echo ""; else echo ""; - - echo "\n"; - echo "\n"; - echo ""; @@ -36,17 +120,16 @@ echo ""; echo ""; - //echo "\nOA_current_user name = " . $_SESSION["wa_current_user"]->username; - if (sizeof($module->rappfunctions) > 0) + if (sizeof($module->rappfunctions) > 0) { echo "\n"; + echo "\n"; + echo "
\n"; - - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "
\n"; - echo "\n"; - echo "\n"; - echo "
\n"; - if (!$no_menu) - { - echo "
"; - echo "
"; - foreach($applications as $app => $name) - { - echo "" .$name . ""; - } - echo "
"; - - echo "
"; - - echo ""; - echo ""; - if ($help_base_url != null) - { - - echo ""; - } - echo "
" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . " | " . $_SERVER['SERVER_NAME'] . " | " . $_SESSION["wa_current_user"]->name . "" . _("Help") . "" . _("Logout") . ""; - echo "
"; - } - - echo "
"; - - if ($title && !$no_menu && !$is_index) - { - echo "
$title
"; - } - - if (!$is_index) - echo "
"; + include_once($local_path_to_root."/themes/".user_theme()."/renderer.php"); + $rend = new renderer(); + $rend->menu_header($title, $no_menu, $is_index); } ?> \ No newline at end of file diff --git a/themes/aqua/renderer.php b/themes/aqua/renderer.php index ae084787..924c82e2 100644 --- a/themes/aqua/renderer.php +++ b/themes/aqua/renderer.php @@ -1,30 +1,114 @@ \n"; + echo "
\n"; + + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + if (!$no_menu) + { + $local_path_to_root = $path_to_root; + $sel_app = $_SESSION['sel_app']; + echo "
"; + echo "
"; + foreach($applications as $app => $name) + { + echo "" .$name . ""; + } + echo "
"; + + echo "
"; + + echo ""; + echo ""; + if ($help_base_url != null) + { + echo ""; + } + echo "
" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . " | " . $_SERVER['SERVER_NAME'] . " | " . $_SESSION["wa_current_user"]->name . "" . _("Help") . "" . _("Logout") . ""; + echo "
"; + } + echo "
"; + + if ($title && !$no_menu && !$is_index) + { + echo "
$title
"; + } + + if (!$is_index) + echo "
"; + } - function menu_footer(&$menu) + function menu_footer($no_menu, $is_index) { + global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root; + include_once($path_to_root . "/includes/date_functions.inc"); + + if ($no_menu == false) + { + if ($is_index) + echo "\n"; + else + echo "
\n"; + echo ""; + if (isset($_SESSION['wa_current_user'])) + echo "\n"; + echo "
" . Today() . " | " . Now() . "
\n"; + } + echo "
\n"; + if ($no_menu == false) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + if ($allow_demo_mode==true) + { + echo "\n"; + //echo "\n"; + echo "\n"; + } + echo "

\n"; + } } - function display_applications(&$waapp) + function display_applications(&$waapp) { - $selected_app = &$waapp->get_selected_application(); + $selected_app = $waapp->get_selected_application(); - foreach ($selected_app->modules as $module) + foreach ($selected_app->modules as $module) { // image echo "
\n"; + + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + if (!$no_menu) + { + $local_path_to_root = $path_to_root; + $sel_app = $_SESSION['sel_app']; + echo "
"; + echo "
"; + foreach($applications as $app => $name) + { + echo "" .$name . ""; + } + echo "
"; + + echo "
"; + + echo ""; + echo ""; + if ($help_base_url != null) + { + echo ""; + } + echo "
" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . " | " . $_SERVER['SERVER_NAME'] . " | " . $_SESSION["wa_current_user"]->name . "" . _("Help") . "" . _("Logout") . ""; + echo "
"; + } + echo "
"; + + if ($title && !$no_menu && !$is_index) + { + echo "
$title
"; + } + + if (!$is_index) + echo "
"; + } - function menu_footer(&$menu) + function menu_footer($no_menu, $is_index) { + global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root; + include_once($path_to_root . "/includes/date_functions.inc"); + + if ($no_menu == false) + { + if ($is_index) + echo "\n"; + else + echo "
\n"; + echo ""; + if (isset($_SESSION['wa_current_user'])) + echo "\n"; + echo "
" . Today() . " | " . Now() . "
\n"; + } + echo "
\n"; + if ($no_menu == false) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + if ($allow_demo_mode==true) + { + echo "\n"; + //echo "\n"; + echo "\n"; + } + echo "

\n"; + } } - function display_applications(&$waapp) + function display_applications(&$waapp) { - $selected_app = &$waapp->get_selected_application(); + $selected_app = $waapp->get_selected_application(); - foreach ($selected_app->modules as $module) + foreach ($selected_app->modules as $module) { // image echo ""; @@ -37,17 +120,16 @@ echo ""; echo ""; - foreach ($module->lappfunctions as $appfunction) + foreach ($module->lappfunctions as $appfunction) { if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) echo " " . $appfunction->label . "
"; } echo ""; - //echo "\nOA_current_user name = " . $_SESSION["wa_current_user"]->username; - if (sizeof($module->rappfunctions) > 0) + if (sizeof($module->rappfunctions) > 0) { echo ""; - foreach ($module->rappfunctions as $appfunction) + foreach ($module->rappfunctions as $appfunction) { if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) echo " " . $appfunction->label . "
"; diff --git a/themes/default/renderer.php b/themes/default/renderer.php index ad3ccc57..924c82e2 100644 --- a/themes/default/renderer.php +++ b/themes/default/renderer.php @@ -1,30 +1,114 @@ \n"; + echo "\n"; + echo "\n"; + + echo "\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; + if (!$no_menu) + { + $local_path_to_root = $path_to_root; + $sel_app = $_SESSION['sel_app']; + echo "
"; + echo "
"; + foreach($applications as $app => $name) + { + echo "" .$name . ""; + } + echo "
"; + + echo "
"; + + echo ""; + echo ""; + if ($help_base_url != null) + { + echo ""; + } + echo "
" . $db_connections[$_SESSION["wa_current_user"]->company]["name"] . " | " . $_SERVER['SERVER_NAME'] . " | " . $_SESSION["wa_current_user"]->name . "" . _("Help") . "" . _("Logout") . ""; + echo "
"; + } + echo "
"; + + if ($title && !$no_menu && !$is_index) + { + echo "
$title
"; + } + + if (!$is_index) + echo "
"; + } - function menu_footer(&$menu) + function menu_footer($no_menu, $is_index) { + global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root; + include_once($path_to_root . "/includes/date_functions.inc"); + + if ($no_menu == false) + { + if ($is_index) + echo "\n"; + else + echo "
\n"; + echo ""; + if (isset($_SESSION['wa_current_user'])) + echo "\n"; + echo "
" . Today() . " | " . Now() . "
\n"; + } + echo "
\n"; + echo "\n"; + if ($no_menu == false) + { + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + if ($allow_demo_mode==true) + { + echo "\n"; + //echo "\n"; + echo "\n"; + } + echo "

\n"; + } } - function display_applications(&$waapp) + function display_applications(&$waapp) { $selected_app = $waapp->get_selected_application(); - foreach ($selected_app->modules as $module) + + foreach ($selected_app->modules as $module) { // image echo ""; @@ -36,17 +120,16 @@ echo ""; echo ""; - foreach ($module->lappfunctions as $appfunction) + foreach ($module->lappfunctions as $appfunction) { if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) echo " " . $appfunction->label . "
"; } echo ""; - //echo "\nOA_current_user name = " . $_SESSION["wa_current_user"]->username; - if (sizeof($module->rappfunctions) > 0) + if (sizeof($module->rappfunctions) > 0) { echo ""; - foreach ($module->rappfunctions as $appfunction) + foreach ($module->rappfunctions as $appfunction) { if ($_SESSION["wa_current_user"]->can_access_page($appfunction->access)) echo " " . $appfunction->label . "
"; -- 2.30.2