diff --git a/index.php b/index.php
index 0528cad949..eb30115ee4 100755
--- a/index.php
+++ b/index.php
@@ -19,7 +19,7 @@
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "home",
"enable_network_class" => True, "enable_todo_class" => True,
- "enable_addressbook_class" => True
+ "enable_addressbook_class" => True
);
include("header.inc.php");
// Note: I need to add checks to make sure these apps are installed.
@@ -56,7 +56,7 @@
}
if ($navbarframe) {
$phpgw->common->phpgw_header();
- $phpgw->common->navbar(True);
+ echo parse_navbar();
}
}
} elseif ($cd=="yes" && $phpgw_info["user"]["preferences"]["common"]["default_app"]
@@ -67,7 +67,7 @@
$phpgw->common->phpgw_exit();
} else {
$phpgw->common->phpgw_header();
- $phpgw->common->navbar();
+ echo parse_navbar();
}
diff --git a/phpgwapi/inc/phpgw.inc.php b/phpgwapi/inc/phpgw.inc.php
index 61ff08f31b..1a6b7e197a 100644
--- a/phpgwapi/inc/phpgw.inc.php
+++ b/phpgwapi/inc/phpgw.inc.php
@@ -218,7 +218,7 @@
$kp3 = $phpgw_info["user"]["kp3"];
if (! $url) { // PHP won't allow you to set a var to a var
- $url = $PHP_SELF; // or function for default values
+ $url = $PHP_SELF; // or function for default values
}
if (isset($phpgw_info["server"]["usecookies"]) && $phpgw_info["server"]["usecookies"]) {
@@ -229,6 +229,7 @@
$url .= "?sessionid=" . $phpgw_info["user"]["sessionid"];
$url .= "&kp3=" . $kp3;
$url .= "&domain=" . $phpgw_info["user"]["domain"];
+ // This doesn't belong in the API. Its up to the app to pass this value. (jengo)
if ($phpgw_info["flags"]["newsmode"]) {
$url .= "&newsmode=on";
}
@@ -238,9 +239,11 @@
}
}
+ // Note: The following code is slighty redundant, you should ALWAYS pass the full path (jengo)
+
// next line adds index.php when one is assumed since
// iis will not interpret urls like http://.../addressbook/?xyz=5
- $url = str_replace("/?", "/index.php?", $url);
+/* $url = str_replace("/?", "/index.php?", $url);
$html_check = strtolower(substr($url ,0,4));
$slash_check = strtolower(substr($url ,0,1));
if($url_check != "http") {
@@ -249,15 +252,12 @@
} else{
$url = $phpgw_info["server"]["hostname"].$url;
}
- }
+ } */
return $url;
}
function strip_html($s)
{
- global $phpgw_info;
- $working_langs = array("en" => True);
-
return htmlspecialchars(stripslashes($s));
}
@@ -335,10 +335,10 @@
$phpgw = new phpgw;
$phpgw->phpgw_();
if ($phpgw_info["flags"]["currentapp"] != "login" && $phpgw_info["flags"]["currentapp"] != "logout") {
-// if (! $phpgw->session->verify()) {
-// Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/login.php", "cd=10"));
-// exit;
-// }
+ if (! $phpgw->session->verify()) {
+ Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/login.php", "cd=10"));
+ exit;
+ }
load_optional();
phpgw_fillarray();
diff --git a/phpgwapi/inc/phpgw_common.inc.php b/phpgwapi/inc/phpgw_common.inc.php
index bad2ee9a4e..c7d9b182ff 100644
--- a/phpgwapi/inc/phpgw_common.inc.php
+++ b/phpgwapi/inc/phpgw_common.inc.php
@@ -154,8 +154,15 @@
return $s;
}
- function display_fullname($lid, $firstname, $lastname)
+ function display_fullname($lid = "", $firstname = "", $lastname = "")
{
+ if (! $lid && ! $firstname && ! $lastname) {
+ global $phpgw_info;
+ $lid = $phpgw_info["user"]["account_lid"];
+ $firstname = $phpgw_info["user"]["firstname"];
+ $lastname = $phpgw_info["user"]["lastname"];
+ }
+
if (! $firstname && ! $lastname) {
$s = $lid;
}
@@ -330,255 +337,54 @@
}
}
- function show_icon(&$tpl, $td_width, $appname, $description = "")
+ function navbar($called_directly = True)
{
- global $phpgw_info, $colspan, $phpgw;
-
- if ($appname && (($appname=="home" || $appname=="logout" || $appname == "print" || $appname == "preferences" || $appname == "about")
- || ($phpgw_info["user"]["apps"][$appname]))) {
-
- if (isset($phpgw_info["flags"]["navbar_target"]) && $phpgw_info["flags"]["navbar_target"]) {
- $target = ' target="' . $phpgw_info["flags"]["navbar_target"] . '"';
- if ($appname == "logout") {
- $target = ' target="_top"';
- }
- } else {
- $target = "";
- }
-
- if (isset($colspan) && $colspan) {
- $colspan++;
- } else {
- $colspan = 1;
- }
-
- if (!isset($description) || !$description) {
- $description = $phpgw_info["apps"][$appname]["title"];
- }
-
- $urlbasename = $phpgw_info["server"]["webserver_url"];
-
- if ($appname == "home") {
- $output_text = "link($urlbasename."/index.php");
- } elseif ($appname == "logout") {
- $output_text = "link($urlbasename."/logout.php");
- } elseif ($appname == "about") {
- if ($phpgw_info["flags"]["currentapp"] != "home" && $phpgw_info["flags"]["currentapp"] != "preferences" && $phpgw_info["flags"]["currentapp"] != "about") {
- $about_app = "app=" . $phpgw_info["flags"]["currentapp"];
- }
- $output_text = "link($urlbasename."/about.php",$about_app);
- } elseif ($appname == "print") {
- $output_text = "link($urlbasename."/$appname/".$view);
-// end change
- } else {
- $output_text = "link($urlbasename."/$appname/index.php");
- }
- $output_text .= "\"$target>";
- if ($phpgw_info["user"]["preferences"]["common"]["navbar_format"] != "text") {
- if ($appname != "home" && $appname != "logout" && $appname != "print" && $appname != "about") {
- $output_text .= '';
- } else {
- $output_text .= '';
- }
- }
- if (ereg("text",$phpgw_info["user"]["preferences"]["common"]["navbar_format"])) {
- $output_text .= "
" . lang($description) . "";
- }
- $output_text .= "";
- $tpl->set_var("td_align","center");
- $tpl->set_var("td_width",$td_width);
- $tpl->set_var("colspan",1);
- $tpl->set_var("value",$output_text);
- $tpl->parse("navbar_columns","navbar_column",True);
+ // This is only temp, until will change everything to use the new method
+ if ($called_directly) {
+ echo '
Warning: You can no longer call navbar() directly, use echo parse_navbar() from now on.';
}
+
+ global $phpgw_info, $phpgw;
+
+ $phpgw_info["navbar"]["home"]["title"] = lang("Home");
+ $phpgw_info["navbar"]["home"]["url"] = $phpgw->link($phpgw_info["server"]["webserver_url"] . "/index.php");
+ $phpgw_info["navbar"]["home"]["icon"] = $phpgw_info["server"]["webserver_url"] . "/phpgwapi/templates/"
+ . $phpgw_info["server"]["template_set"] . "/images/home.gif";
+ while ($permission = each($phpgw_info["user"]["apps"])) {
+ if ($phpgw_info["apps"][$permission[0]]["status"] != 2) {
+ $phpgw_info["navbar"][$permission[0]]["title"] = lang($phpgw_info["apps"][$permission[0]]["title"]);
+ $phpgw_info["navbar"][$permission[0]]["url"] = $phpgw->link($phpgw_info["server"]["webserver_url"]
+ . "/" . $permission[0] . "/index.php");
+ $phpgw_info["navbar"][$permission[0]]["icon"] = $phpgw_info["server"]["webserver_url"] . "/"
+ . $permission[0] . "/templates/"
+ . $phpgw_info["server"]["template_set"]
+ . "/images/navbar.gif";
+ }
+ }
+ $phpgw_info["navbar"]["preferences"]["title"] = lang("preferences");
+ $phpgw_info["navbar"]["preferences"]["url"] = $phpgw->link($phpgw_info["server"]["webserver_url"]
+ . "/preferences/index.php");
+ $phpgw_info["navbar"]["preferences"]["icon"] = $phpgw_info["server"]["webserver_url"] . "/preferences/templates/"
+ . $phpgw_info["server"]["template_set"] . "/images/navbar.gif";
+
+ if ($phpgw_info["flags"]["currentapp"] == "home" || $phpgw_info["flags"]["currentapp"] == "preferences" || $phpgw_info["flags"]["currentapp"] == "about") {
+ $app = "phpGroupWare";
+ } else {
+ $app = $phpgw_info["flags"]["currentapp"];
+ }
+ $phpgw_info["navbar"]["about"]["title"] = lang("About x",$about);
+ $phpgw_info["navbar"]["about"]["url"] = $phpgw->link($phpgw_info["server"]["webserver_url"]
+ . "/about.php");
+ $phpgw_info["navbar"]["about"]["icon"] = $phpgw_info["server"]["webserver_url"] . "/phpgwapi/templates/"
+ . $phpgw_info["server"]["template_set"] . "/images/about.gif";
+
+ $phpgw_info["navbar"]["logout"]["title"] = lang("Logout"); // Add app name
+ $phpgw_info["navbar"]["logout"]["url"] = $phpgw->link($phpgw_info["server"]["webserver_url"]
+ . "/logout.php");
+ $phpgw_info["navbar"]["logout"]["icon"] = $phpgw_info["server"]["webserver_url"] . "/phpgwapi/templates/"
+ . $phpgw_info["server"]["template_set"] . "/images/logout.gif";
}
- function navbar($force = False)
- {
- global $cd,$phpgw,$phpgw_info,$colspan,$PHP_SELF;
-
- if (($phpgw_info["user"]["preferences"]["common"]["useframes"] && $phpgw_info["server"]["useframes"] == "allowed")
- || ($phpgw_info["server"]["useframes"] == "always")) {
- if (! $force) {
- return False;
- }
- }
-
- $tpl = new Template($phpgw_info["server"]["template_dir"]);
- $tpl->set_file(array("navbar" => "navbar.tpl",
- "navbar_row" => "navbar_row.tpl",
- "navbar_column" => "navbar_column.tpl"
- ));
-
- $urlbasename = $phpgw_info["server"]["webserver_url"];
-
- if (ereg("text",$phpgw_info["user"]["preferences"]["common"]["navbar_format"])) {
- $td_width = "7%";
- } else {
- $td_width = "3%";
- }
-
- // This is hardcoded for right now
- if ($phpgw_info["user"]["preferences"]["common"]["navbar_format"] == "text") {
- $tpl->set_var("tr_color","FFFFFF");
- } else {
- $tpl->set_var("tr_color",$phpgw_info["theme"]["navbar_bg"]);
- }
-
- $tpl->set_var("td_align","left");
- $tpl->set_var("td_width","");
- $tpl->set_var("value"," " . $phpgw_info["user"]["fullname"] . " - "
- . lang($phpgw->common->show_date(time(),"l")) . " "
- . lang($phpgw->common->show_date(time(),"F")) . " "
- . $phpgw->common->show_date(time(),"d, Y"));
- $tpl->parse("navbar_columns","navbar_column",True);
-
- if ($phpgw_info["user"]["preferences"]["common"]["navbar_format"] == "text") {
- $tabs[1]["label"] = "home";
- $tabs[1]["link"] = $phpgw->link($phpgw_info["server"]["webserver_url"] . "/index.php");
-
- if ($PHP_SELF == $phpgw_info["server"]["webserver_url"] . "/index.php") {
- $selected = 1;
- }
-
- $i = 2;
-
- while ($permission = each($phpgw_info["user"]["apps"])) {
- if ($phpgw_info["apps"][$permission[0]]["status"] != 2) {
- $tabs[$i]["label"] = $permission[0];
- $tabs[$i]["link"] = $phpgw->link($phpgw_info["server"]["webserver_url"] . "/" . $permission[0] . "/index.php");
- if (ereg($permission[0],$PHP_SELF)) {
- $selected = $i;
- }
- $i++;
- }
- }
-
- $tabs[$i]["label"] = "preferences";
- $tabs[$i]["link"] = $phpgw->link($phpgw_info["server"]["webserver_url"] . "/preferences/index.php");
- if ($PHP_SELF == $phpgw_info["server"]["webserver_url"] . "/preferences/index.php") {
- $selected = $i;
- }
- $i++;
-
- $tabs[$i]["label"] = "logout";
- $tabs[$i]["link"] = $phpgw->link($phpgw_info["server"]["webserver_url"] . "/logout.php");
-
- $tpl->set_var("td_align","center");
- $tpl->set_var("td_width",$td_width);
- $tpl->set_var("colspan",1);
- $tpl->set_var("value",$this->create_tabs($tabs,$selected,-1));
- $tpl->parse("navbar_columns","navbar_column",True);
-
- } else {
-
- $this->show_icon(&$tpl,$td_width,"home","home");
- $this->show_icon(&$tpl,$td_width,"print","print");
-
- while ($permission = each($phpgw_info["user"]["apps"])) {
- if ($phpgw_info["apps"][$permission[0]]["status"] != 2) {
- $this->show_icon(&$tpl,$td_width,$permission[0]);
- }
- }
-
- $this->show_icon(&$tpl,$td_width,"preferences","Preferences");
- if ($phpgw_info["flags"]["currentapp"] == "home" || $phpgw_info["flags"]["currentapp"] == "preferences" || $phpgw_info["flags"]["currentapp"] == "about") {
- $app = "phpGroupWare";
- } else {
- $app = $phpgw_info["flags"]["currentapp"];
- }
- $this->show_icon(&$tpl,$td_width,"about","About $app");
- $this->show_icon(&$tpl,$td_width,"logout","Logout");
-
- } // end else
-
- $tpl->parse("navbar_rows","navbar_row",True);
-
- if (isset($phpgw_info["user"]["apps"]["admin"]) && isset($phpgw_info["user"]["preferences"]["common"]["show_currentusers"])) {
- if ($phpgw_info["server"]["showpoweredbyon"] != "top") {
- $phpgw->db->query("select count(*) from phpgw_sessions");
- $phpgw->db->next_record();
- $tpl->set_var("td_align","right");
- $tpl->set_var("td_width","");
- $tpl->set_var("tr_color",$phpgw_info["theme"]["bg_color"]);
- $tpl->set_var("value",' ' . lang("Current users") . ': ' . $phpgw->db->f(0) . '');
- $tpl->set_var("colspan",($colspan+1));
- $tpl->parse("navbar_columns","navbar_column");
- $tpl->parse("navbar_rows","navbar_row",True);
- }
- }
-
- if ($phpgw_info["server"]["showpoweredbyon"] == "top") {
- if ( ! $phpgw_info["user"]["preferences"]["common"]["show_currentusers"]) {
- $tpl->set_var("td_align","left");
- $tpl->set_var("td_width","");
- $tpl->set_var("tr_color",$phpgw_info["theme"]["bg_color"]);
- $tpl->set_var("value",lang("Powered by phpGroupWare version x",$phpgw_info["server"]["versions"]["phpgwapi"]));
- $tpl->set_var("colspan",$colspan);
- $tpl->parse("navbar_columns","navbar_column");
- $tpl->parse("navbar_rows","navbar_row",True);
- }
- }
-
- if ($phpgw_info["server"]["showpoweredbyon"] == "top"
- && isset($phpgw_info["user"]["apps"]["admin"])
- && isset($phpgw_info["user"]["preferences"]["common"]["show_currentusers"])) {
-
- $tpl->set_var("td_align","left");
- $tpl->set_var("td_width","");
- $tpl->set_var("tr_color",$phpgw_info["theme"]["bg_color"]);
- $tpl->set_var("value",lang("Powered by phpGroupWare version x",$phpgw_info["server"]["versions"]["phpgwapi"]));
- $tpl->set_var("colspan",1);
- $tpl->parse("navbar_columns","navbar_column");
-
- $phpgw->db->query("select count(*) from phpgw_sessions");
- $phpgw->db->next_record();
- $tpl->set_var("td_align","right");
- $tpl->set_var("td_width","");
- $tpl->set_var("value",' ' . lang("Current users") . ': ' . $phpgw->db->f(0) . '');
- $tpl->set_var("colspan",($colspan--));
- $tpl->parse("navbar_columns","navbar_column",True);
- $tpl->parse("navbar_rows","navbar_row",True);
- }
-
- $tpl->pparse("out","navbar");
-
- // Make the wording a little more user friendly
- if ($phpgw_info["user"]["lastpasswd_change"] == 0) {
- echo "
" . lang("You are required to change your password "
- . "during your first login");
- echo "
Click this image on the navbar: ";
- echo "";
- } else if ($phpgw_info["user"]["lastpasswd_change"] < time() - (86400*30)) {
- echo "
" . lang("it has been more then x days since you "
- . "changed your password",30) . "";
- }
- if (isset($cd) && $cd) {
- echo "" . check_code($cd) . "";
- }
-
- unset($colspan);
-
- /**************************************************************************\
- * Load the app include files if the exists *
- \**************************************************************************/
- /* Then the include file */
-
- if ($phpgw_info["flags"]["noheader"] && !$phpgw_info["flags"]["noappheader"]) {
- $this->app_header();
- }
- }
function app_header() {
if (file_exists ($phpgw_info["server"]["app_inc"]."/header.inc.php")) {
@@ -613,8 +419,11 @@
} else {
echo ("\n");
}
+ $this->navbar(False);
+ include($phpgw_info["server"]["include_root"] . "/phpgwapi/templates/"
+ . $phpgw_info["server"]["template_set"] . "/navbar.inc.php");
if ((! isset($phpgw_info["flags"]["nonavbar"]) || ! $phpgw_info["flags"]["nonavbar"]) && ! $phpgw_info["flags"]["navbar_target"]) {
- $this->navbar();
+ echo parse_navbar();
}
}
diff --git a/phpgwapi/templates/default/navbar.inc.php b/phpgwapi/templates/default/navbar.inc.php
new file mode 100644
index 0000000000..9c0ce6ca73
--- /dev/null
+++ b/phpgwapi/templates/default/navbar.inc.php
@@ -0,0 +1,317 @@
+link($urlbasename."/index.php");
+ } elseif ($appname == "logout") {
+ $output_text = "link($urlbasename."/logout.php");
+ } elseif ($appname == "about") {
+ if ($phpgw_info["flags"]["currentapp"] != "home" && $phpgw_info["flags"]["currentapp"] != "preferences" && $phpgw_info["flags"]["currentapp"] != "about") {
+ $about_app = "app=" . $phpgw_info["flags"]["currentapp"];
+ }
+ $output_text = "link($urlbasename."/about.php",$about_app);
+ } elseif ($appname == "print") {
+ $output_text = "link($urlbasename."/$appname/".$view);
+// end change
+ } else {
+ $output_text = "link($urlbasename."/$appname/index.php");
+ }
+ $output_text .= "\"$target>";
+ if ($phpgw_info["user"]["preferences"]["common"]["navbar_format"] != "text") {
+ if ($appname != "home" && $appname != "logout" && $appname != "print" && $appname != "about") {
+ $output_text .= '';
+ } else {
+ $output_text .= '';
+ }
+ }
+ if (ereg("text",$phpgw_info["user"]["preferences"]["common"]["navbar_format"])) {
+ $output_text .= "
" . lang($description) . "";
+ }
+ $output_text .= "";
+ $tpl->set_var("td_align","center");
+ $tpl->set_var("td_width",$td_width);
+ $tpl->set_var("colspan",1);
+ $tpl->set_var("value",$output_text);
+ $tpl->parse("navbar_columns","navbar_column",True);
+ }
+ }
+
+
+
+
+
+
+ function navbar($force = False)
+ {
+ global $cd,$phpgw,$phpgw_info,$colspan,$PHP_SELF;
+
+ if (($phpgw_info["user"]["preferences"]["common"]["useframes"] && $phpgw_info["server"]["useframes"] == "allowed")
+ || ($phpgw_info["server"]["useframes"] == "always")) {
+ if (! $force) {
+ return False;
+ }
+ }
+
+ $tpl = new Template($phpgw_info["server"]["template_dir"]);
+ $tpl->set_file(array("navbar" => "navbar.tpl",
+ "navbar_row" => "navbar_row.tpl",
+ "navbar_column" => "navbar_column.tpl"
+ ));
+
+ $urlbasename = $phpgw_info["server"]["webserver_url"];
+
+ if (ereg("text",$phpgw_info["user"]["preferences"]["common"]["navbar_format"])) {
+ $td_width = "7%";
+ } else {
+ $td_width = "3%";
+ }
+
+ // This is hardcoded for right now
+ if ($phpgw_info["user"]["preferences"]["common"]["navbar_format"] == "text") {
+ $tpl->set_var("tr_color","FFFFFF");
+ } else {
+ $tpl->set_var("tr_color",$phpgw_info["theme"]["navbar_bg"]);
+ }
+
+ $tpl->set_var("td_align","left");
+ $tpl->set_var("td_width","");
+ $tpl->set_var("value"," " . $phpgw_info["user"]["fullname"] . " - "
+ . lang($phpgw->common->show_date(time(),"l")) . " "
+ . lang($phpgw->common->show_date(time(),"F")) . " "
+ . $phpgw->common->show_date(time(),"d, Y"));
+ $tpl->parse("navbar_columns","navbar_column",True);
+
+ if ($phpgw_info["user"]["preferences"]["common"]["navbar_format"] == "text") {
+ $tabs[1]["label"] = "home";
+ $tabs[1]["link"] = $phpgw->link($phpgw_info["server"]["webserver_url"] . "/index.php");
+
+ if ($PHP_SELF == $phpgw_info["server"]["webserver_url"] . "/index.php") {
+ $selected = 1;
+ }
+
+ $i = 2;
+
+ while ($permission = each($phpgw_info["user"]["apps"])) {
+ if ($phpgw_info["apps"][$permission[0]]["status"] != 2) {
+ $tabs[$i]["label"] = $permission[0];
+ $tabs[$i]["link"] = $phpgw->link($phpgw_info["server"]["webserver_url"] . "/" . $permission[0] . "/index.php");
+ if (ereg($permission[0],$PHP_SELF)) {
+ $selected = $i;
+ }
+ $i++;
+ }
+ }
+
+ $tabs[$i]["label"] = "preferences";
+ $tabs[$i]["link"] = $phpgw->link($phpgw_info["server"]["webserver_url"] . "/preferences/index.php");
+ if ($PHP_SELF == $phpgw_info["server"]["webserver_url"] . "/preferences/index.php") {
+ $selected = $i;
+ }
+ $i++;
+
+ $tabs[$i]["label"] = "logout";
+ $tabs[$i]["link"] = $phpgw->link($phpgw_info["server"]["webserver_url"] . "/logout.php");
+
+ $tpl->set_var("td_align","center");
+ $tpl->set_var("td_width",$td_width);
+ $tpl->set_var("colspan",1);
+ $tpl->set_var("value",$this->create_tabs($tabs,$selected,-1));
+ $tpl->parse("navbar_columns","navbar_column",True);
+
+ } else {
+
+ $this->show_icon(&$tpl,$td_width,"home","home");
+ $this->show_icon(&$tpl,$td_width,"print","print");
+
+ while ($permission = each($phpgw_info["user"]["apps"])) {
+ if ($phpgw_info["apps"][$permission[0]]["status"] != 2) {
+ $this->show_icon(&$tpl,$td_width,$permission[0]);
+ }
+ }
+
+ $this->show_icon(&$tpl,$td_width,"preferences","Preferences");
+ if ($phpgw_info["flags"]["currentapp"] == "home" || $phpgw_info["flags"]["currentapp"] == "preferences" || $phpgw_info["flags"]["currentapp"] == "about") {
+ $app = "phpGroupWare";
+ } else {
+ $app = $phpgw_info["flags"]["currentapp"];
+ }
+ $this->show_icon(&$tpl,$td_width,"about","About $app");
+ $this->show_icon(&$tpl,$td_width,"logout","Logout");
+
+ } // end else
+
+ $tpl->parse("navbar_rows","navbar_row",True);
+
+ if (isset($phpgw_info["user"]["apps"]["admin"]) && isset($phpgw_info["user"]["preferences"]["common"]["show_currentusers"])) {
+ if ($phpgw_info["server"]["showpoweredbyon"] != "top") {
+ $phpgw->db->query("select count(*) from phpgw_sessions");
+ $phpgw->db->next_record();
+ $tpl->set_var("td_align","right");
+ $tpl->set_var("td_width","");
+ $tpl->set_var("tr_color",$phpgw_info["theme"]["bg_color"]);
+ $tpl->set_var("value",' ' . lang("Current users") . ': ' . $phpgw->db->f(0) . '');
+ $tpl->set_var("colspan",($colspan+1));
+ $tpl->parse("navbar_columns","navbar_column");
+ $tpl->parse("navbar_rows","navbar_row",True);
+ }
+ }
+
+ if ($phpgw_info["server"]["showpoweredbyon"] == "top") {
+ if ( ! $phpgw_info["user"]["preferences"]["common"]["show_currentusers"]) {
+ $tpl->set_var("td_align","left");
+ $tpl->set_var("td_width","");
+ $tpl->set_var("tr_color",$phpgw_info["theme"]["bg_color"]);
+ $tpl->set_var("value",lang("Powered by phpGroupWare version x",$phpgw_info["server"]["versions"]["phpgwapi"]));
+ $tpl->set_var("colspan",$colspan);
+ $tpl->parse("navbar_columns","navbar_column");
+ $tpl->parse("navbar_rows","navbar_row",True);
+ }
+ }
+
+ if ($phpgw_info["server"]["showpoweredbyon"] == "top"
+ && isset($phpgw_info["user"]["apps"]["admin"])
+ && isset($phpgw_info["user"]["preferences"]["common"]["show_currentusers"])) {
+
+ $tpl->set_var("td_align","left");
+ $tpl->set_var("td_width","");
+ $tpl->set_var("tr_color",$phpgw_info["theme"]["bg_color"]);
+ $tpl->set_var("value",lang("Powered by phpGroupWare version x",$phpgw_info["server"]["versions"]["phpgwapi"]));
+ $tpl->set_var("colspan",1);
+ $tpl->parse("navbar_columns","navbar_column");
+
+ $phpgw->db->query("select count(*) from phpgw_sessions");
+ $phpgw->db->next_record();
+ $tpl->set_var("td_align","right");
+ $tpl->set_var("td_width","");
+ $tpl->set_var("value",' ' . lang("Current users") . ': ' . $phpgw->db->f(0) . '');
+ $tpl->set_var("colspan",($colspan--));
+ $tpl->parse("navbar_columns","navbar_column",True);
+ $tpl->parse("navbar_rows","navbar_row",True);
+ }
+
+ $tpl->pparse("out","navbar");
+
+ // Make the wording a little more user friendly
+ if ($phpgw_info["user"]["lastpasswd_change"] == 0) {
+ echo "
" . lang("You are required to change your password "
+ . "during your first login");
+ echo "
Click this image on the navbar: ";
+ echo "";
+ } else if ($phpgw_info["user"]["lastpasswd_change"] < time() - (86400*30)) {
+ echo "
" . lang("it has been more then x days since you "
+ . "changed your password",30) . "";
+ }
+ if (isset($cd) && $cd) {
+ echo "" . check_code($cd) . "";
+ }
+
+ unset($colspan);
+
+ } */
+
+ function parse_navbar($force = False)
+ {
+ global $phpgw_info, $phpgw;
+
+ $tpl = new Template($phpgw_info["server"]["template_dir"]);
+ $tpl->set_unknowns("remove");
+
+ $tpl->set_file(array("navbar" => "navbar.tpl",
+ "navbar_app" => "navbar_app.tpl"
+ ));
+
+ $tpl->set_var("navbar_color",$phpgw_info["theme"]["navbar_bg"]);
+
+ if ($phpgw_info["flags"]["navbar_target"]) {
+ $target = ' target="' . $phpgw_info["flags"]["navbar_target"] . '"';
+ }
+
+ while ($app = each($phpgw_info["navbar"])) {
+ $title = '';
+ if ($phpgw_info["user"]["preferences"]["common"]["navbar_format"] == "icons_and_text") {
+ $title .= "
" . $app[1]["title"];
+ $tpl->set_var("width","7%");
+ } else {
+ $tpl->set_var("width","3%");
+ }
+
+ $tpl->set_var("value",'' . $title . '');
+ $tpl->parse("applications","navbar_app",True);
+ }
+
+ if ($phpgw_info["server"]["showpoweredbyon"] == "top") {
+ $tpl->set_var("powered_by",lang("Powered by phpGroupWare version x",$phpgw_info["server"]["versions"]["phpgwapi"]));
+ }
+ if (isset($phpgw_info["navbar"]["admin"]) && isset($phpgw_info["user"]["preferences"]["common"]["show_currentusers"])) {
+ $db = $phpgw->db;
+ $db->query("select count(*) from phpgw_sessions");
+ $db->next_record();
+ $tpl->set_var("current_users",' '
+ . lang("Current users") . ': ' . $db->f(0) . '');
+ }
+ $tpl->set_var("user_info",$phpgw->common->display_fullname() . " - "
+ . lang($phpgw->common->show_date(time(),"l")) . " "
+ . lang($phpgw->common->show_date(time(),"F")) . " "
+ . $phpgw->common->show_date(time(),"d, Y"));
+
+ // Maybe we should create a common function in the phpgw_accounts_shared.inc.php file
+ // to get rid of duplicate code.
+ if ($phpgw_info["user"]["lastpasswd_change"] == 0) {
+ $api_messages = lang("You are required to change your password during your first login")
+ . '
Click this image on the navbar: ';
+ } else if ($phpgw_info["user"]["lastpasswd_change"] < time() - (86400*30)) {
+ $api_messages = lang("it has been more then x days since you changed your password",30);
+ }
+
+ // This is gonna change
+ if (isset($cd)) {
+ $tpl->set_var("messages",$api_messages . "
" . checkcode($cd));
+ }
+
+ // If the application has a header include, we now include it
+ if ($phpgw_info["flags"]["noheader"] && ! $phpgw_info["flags"]["noappheader"]) {
+
+ }
+ return $tpl->finish($tpl->parse("out","navbar"));
+ }
diff --git a/phpgwapi/templates/default/navbar.tpl b/phpgwapi/templates/default/navbar.tpl
index da9060183f..a57a8f3113 100644
--- a/phpgwapi/templates/default/navbar.tpl
+++ b/phpgwapi/templates/default/navbar.tpl
@@ -1,6 +1,26 @@
- {navbar_rows}
+
+ |
+ {applications}
+
+
+
+
+
+
+ {powered_by}
+ |
+
+ {current_users}
+ |
+
+
+
+ {user_info}
+ |
+
+
{messages}