mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
Changed navbar() to return and array and each template set will now use its own navbar.inc.php file. Theres still much to do, but its at least working
This commit is contained in:
parent
c8290ae8c5
commit
13cf6da7aa
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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 = "<A href=\"" . $phpgw->link($urlbasename."/index.php");
|
||||
} elseif ($appname == "logout") {
|
||||
$output_text = "<A href=\"" . $phpgw->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 = "<A href=\"" . $phpgw->link($urlbasename."/about.php",$about_app);
|
||||
} elseif ($appname == "print") {
|
||||
$output_text = "<A href=\"javascript:window.print();\"";
|
||||
// Changed by Skeeter 03 Dec 00 2000 GMT
|
||||
// This is to allow for the calendar app to have a default page view.
|
||||
} elseif ($appname == "calendar") {
|
||||
if (isset($phpgw_info["user"]["preferences"]["calendar"]["defaultcalendar"])) {
|
||||
$view = $phpgw_info["user"]["preferences"]["calendar"]["defaultcalendar"];
|
||||
} else {
|
||||
$view = "index.php";
|
||||
}
|
||||
$output_text = "<A href=\"" . $phpgw->link($urlbasename."/$appname/".$view);
|
||||
// end change
|
||||
} else {
|
||||
$output_text = "<A href=\"" . $phpgw->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 .= '<img src="' . $this->get_image_path($appname) . '/navbar.gif" border=0 alt="' . lang($description) . '" title="' . lang($description) . '">';
|
||||
} else {
|
||||
$output_text .= '<img src="' . $phpgw_info["server"]["images_dir"] .'/' . $appname . '.gif" border="0" alt="' . lang($description) . '" title="' . lang($description) . '">';
|
||||
}
|
||||
}
|
||||
if (ereg("text",$phpgw_info["user"]["preferences"]["common"]["navbar_format"])) {
|
||||
$output_text .= "<br><font size=\"-2\">" . lang($description) . "</font>";
|
||||
}
|
||||
$output_text .= "</A>";
|
||||
$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 '<center><b>Warning: You can no longer call navbar() directly, use echo parse_navbar() from now on.</b></center>';
|
||||
}
|
||||
|
||||
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",'<a href="' . $phpgw->link($urlbasename."/admin/currentusers.php")
|
||||
. '"> ' . lang("Current users") . ': ' . $phpgw->db->f(0) . '</a>');
|
||||
$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",'<a href="' . $phpgw->link($urlbasename."/admin/currentusers.php")
|
||||
. '"> ' . lang("Current users") . ': ' . $phpgw->db->f(0) . '</a>');
|
||||
$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 "<br><center>" . lang("You are required to change your password "
|
||||
. "during your first login");
|
||||
echo "<br> Click this image on the navbar: <img src=\"".$phpgw_info["server"]["webserver_url"]."/preferences/templates/".$phpgw_info["server"]["template_set"]."/images/navbar.gif\">";
|
||||
echo "</center>";
|
||||
} else if ($phpgw_info["user"]["lastpasswd_change"] < time() - (86400*30)) {
|
||||
echo "<br><CENTER>" . lang("it has been more then x days since you "
|
||||
. "changed your password",30) . "</CENTER>";
|
||||
}
|
||||
if (isset($cd) && $cd) {
|
||||
echo "<center>" . check_code($cd) . "</center>";
|
||||
}
|
||||
|
||||
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 ("<BODY BGCOLOR=\"".$phpgw_info["theme"]["bg_color"]."\">\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();
|
||||
}
|
||||
}
|
||||
|
||||
|
317
phpgwapi/templates/default/navbar.inc.php
Normal file
317
phpgwapi/templates/default/navbar.inc.php
Normal file
@ -0,0 +1,317 @@
|
||||
<?php
|
||||
/*
|
||||
function show_icon(&$tpl, $td_width, $appname, $description = "")
|
||||
{
|
||||
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 = "<A href=\"" . $phpgw->link($urlbasename."/index.php");
|
||||
} elseif ($appname == "logout") {
|
||||
$output_text = "<A href=\"" . $phpgw->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 = "<A href=\"" . $phpgw->link($urlbasename."/about.php",$about_app);
|
||||
} elseif ($appname == "print") {
|
||||
$output_text = "<A href=\"javascript:window.print();\"";
|
||||
// Changed by Skeeter 03 Dec 00 2000 GMT
|
||||
// This is to allow for the calendar app to have a default page view.
|
||||
} elseif ($appname == "calendar") {
|
||||
if (isset($phpgw_info["user"]["preferences"]["calendar"]["defaultcalendar"])) {
|
||||
$view = $phpgw_info["user"]["preferences"]["calendar"]["defaultcalendar"];
|
||||
} else {
|
||||
$view = "index.php";
|
||||
}
|
||||
$output_text = "<A href=\"" . $phpgw->link($urlbasename."/$appname/".$view);
|
||||
// end change
|
||||
} else {
|
||||
$output_text = "<A href=\"" . $phpgw->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 .= '<img src="' . $this->get_image_path($appname) . '/navbar.gif" border=0 alt="' . lang($description) . '" title="' . lang($description) . '">';
|
||||
} else {
|
||||
$output_text .= '<img src="' . $phpgw_info["server"]["images_dir"] .'/' . $appname . '.gif" border="0" alt="' . lang($description) . '" title="' . lang($description) . '">';
|
||||
}
|
||||
}
|
||||
if (ereg("text",$phpgw_info["user"]["preferences"]["common"]["navbar_format"])) {
|
||||
$output_text .= "<br><font size=\"-2\">" . lang($description) . "</font>";
|
||||
}
|
||||
$output_text .= "</A>";
|
||||
$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",'<a href="' . $phpgw->link($urlbasename."/admin/currentusers.php")
|
||||
. '"> ' . lang("Current users") . ': ' . $phpgw->db->f(0) . '</a>');
|
||||
$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",'<a href="' . $phpgw->link($urlbasename."/admin/currentusers.php")
|
||||
. '"> ' . lang("Current users") . ': ' . $phpgw->db->f(0) . '</a>');
|
||||
$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 "<br><center>" . lang("You are required to change your password "
|
||||
. "during your first login");
|
||||
echo "<br> Click this image on the navbar: <img src=\"".$phpgw_info["server"]["webserver_url"]."/preferences/templates/".$phpgw_info["server"]["template_set"]."/images/navbar.gif\">";
|
||||
echo "</center>";
|
||||
} else if ($phpgw_info["user"]["lastpasswd_change"] < time() - (86400*30)) {
|
||||
echo "<br><CENTER>" . lang("it has been more then x days since you "
|
||||
. "changed your password",30) . "</CENTER>";
|
||||
}
|
||||
if (isset($cd) && $cd) {
|
||||
echo "<center>" . check_code($cd) . "</center>";
|
||||
}
|
||||
|
||||
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 = '<img src="' . $app[1]["icon"] . '" alt="' . $app[1]["title"] . '" title="'
|
||||
. $app[1]["title"] . '" border="0">';
|
||||
if ($phpgw_info["user"]["preferences"]["common"]["navbar_format"] == "icons_and_text") {
|
||||
$title .= "<br>" . $app[1]["title"];
|
||||
$tpl->set_var("width","7%");
|
||||
} else {
|
||||
$tpl->set_var("width","3%");
|
||||
}
|
||||
|
||||
$tpl->set_var("value",'<a href="' . $app[1]["url"] . '"' . $target . '>' . $title . '</a>');
|
||||
$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",'<a href="' . $phpgw->link("/admin/currentusers.php") . '"> '
|
||||
. lang("Current users") . ': ' . $db->f(0) . '</a>');
|
||||
}
|
||||
$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")
|
||||
. '<br> Click this image on the navbar: <img src="'
|
||||
. $phpgw_info["server"]["webserver_url"] . '/preferences/templates/'
|
||||
. $phpgw_info["server"]["template_set"] . '/images/navbar.gif">';
|
||||
} 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 . "<br>" . 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"));
|
||||
}
|
@ -1,6 +1,26 @@
|
||||
|
||||
<!-- BEGIN navbar -->
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
{navbar_rows}
|
||||
<tr bgcolor="{navbar_color}">
|
||||
<td align="left"> </td>
|
||||
{applications}
|
||||
</tr>
|
||||
<tr>
|
||||
</table>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align="left">
|
||||
{powered_by}
|
||||
</td>
|
||||
<td align="right">
|
||||
{current_users}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" colspan="2">
|
||||
{user_info}
|
||||
</td>
|
||||
</tr>
|
||||
</table><p>
|
||||
<center>{messages}</center>
|
||||
<!-- END navbar -->
|
||||
|
Loading…
Reference in New Issue
Block a user