1888 lines
83 KiB
PHP
1888 lines
83 KiB
PHP
<?php
|
|
/** \file include\core.php
|
|
* \brief DI webinterface framework core functions
|
|
* \author Rob Schalken, Core|Vision
|
|
* \version $Revision: 1.295 $
|
|
* \date $Date: 2013/12/03 13:38:48 $
|
|
*
|
|
* This file contains the framework core functions. All functions needed to build
|
|
* up the complete framework. This file is always included.
|
|
*/
|
|
|
|
/*
|
|
* Handle standard/extended view
|
|
*/
|
|
if (isset($_GET['extended'])) {
|
|
if ($_GET['extended'] == 0) {
|
|
unset($_SESSION[$_PAGE_INFO['id']]['extended']);
|
|
}
|
|
else {
|
|
$_SESSION[$_PAGE_INFO['id']]['extended'] = 1;
|
|
}
|
|
|
|
// Update/store cookie
|
|
WriteCookie("view_" . $_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], $_GET['extended']);
|
|
}
|
|
|
|
/*
|
|
* Debugging?
|
|
*/
|
|
if (db_ver_extra_right_user($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'],"debug")) {
|
|
// Enable debugging
|
|
$_SESSION[$_PAGE_INFO['id']]['dbg']['enabled'] = TRUE;
|
|
|
|
if (isset($_GET['dbg'])) {
|
|
// Mask 0x01 : General debugging
|
|
// Mask 0x02 : Realtime status debugging (syslog)
|
|
// Mask 0x04 : Realtime status debugging (debug window)
|
|
if (is_numeric(hexdec($_GET['dbg']))) {
|
|
$_SESSION[$_PAGE_INFO['id']]['dbg']['mask'] = hexdec($_GET['dbg']);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
// Disable debugging
|
|
unset($_SESSION[$_PAGE_INFO['id']]['dbg']['enabled']);
|
|
}
|
|
|
|
/*
|
|
* Report debugging?
|
|
*/
|
|
if (isset($_GET['table'])) {
|
|
// Mask 0x00 : Use log_zkl & log_realtime
|
|
// Mask 0x01 : Use log_zkl
|
|
// Mask 0x02 : Use log_realtime
|
|
if (is_numeric(hexdec($_GET['table']))) {
|
|
if (!hexdec($_GET['table'])) {
|
|
unset($_SESSION[$_PAGE_INFO['id']]['table']);
|
|
}
|
|
else {
|
|
$_SESSION[$_PAGE_INFO['id']]['table'] = hexdec($_GET['table']);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Skip when redirect/help file or second info line
|
|
if ((!isset($_GET['redirect'])) && ($_GET['href'] != "page/help") && (!isset($_GET['extended_info']))) {
|
|
// Remove session vars & cookies
|
|
unset($_SESSION[$_PAGE_INFO['id']]['extended_view']);
|
|
unset($_SESSION[$_PAGE_INFO['id']]['standard_view']);
|
|
if (($_GET['href'] == "page/menu_rt") &&
|
|
((!isset($_GET['page_project']) && (!isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id']))) ||
|
|
($_GET['page_project'] == $_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) &&
|
|
(isset($_SESSION[$_PAGE_INFO['id']]['logged_on']))) {
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['extended'])) {
|
|
$_SESSION[$_PAGE_INFO['id']]['extended_view'] = 1;
|
|
}
|
|
else {
|
|
$_SESSION[$_PAGE_INFO['id']]['standard_view'] = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
* "Retrieve" base path
|
|
*/
|
|
// Called as background process? => Skip these checks
|
|
if (stristr($_SERVER['SCRIPT_FILENAME'], "/") !== FALSE) {
|
|
$_SESSION[$_PAGE_INFO['id']]['base'] = $_DEFAULT['base'];
|
|
$_SESSION[$_PAGE_INFO['id']]['base_path'] = $_DEFAULT['base_path'];
|
|
|
|
if (is_ReleaseCandidate()) {
|
|
$_SESSION[$_PAGE_INFO['id']]['base'] = $_RELEASE['rc']['url'] . $_SESSION[$_PAGE_INFO['id']]['release_dir'] . "/";
|
|
$_SESSION[$_PAGE_INFO['id']]['base_path'] = $_RELEASE['rc']['dir'] . $_SESSION[$_PAGE_INFO['id']]['release_dir'] . "/";
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
* Check resolution
|
|
*/
|
|
$_PAGE_INFO['tablet'] = is_tablet();
|
|
|
|
/*
|
|
* Project selected?
|
|
*/
|
|
$_PAGE_INFO['page_project'] = "";
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['name'])) && (($_SESSION[$_PAGE_INFO['id']]['login']['project']['name'] != "skip") || ($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'] != -1)) ) {
|
|
$_PAGE_INFO['page_project'] = "&page_project=" . $_GET['page_project'];
|
|
}
|
|
|
|
|
|
/*
|
|
* Define header main menu button and history link
|
|
*/
|
|
$_PAGE_INFO['MAIN_LINK'] = "";
|
|
if (db_ver_rights_user_one_valid($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "hoofdmenu")) {
|
|
$_PAGE_INFO['MAIN_LINK'] = "action/_a_project&link=page/menu&project=skip&project_id=-1";
|
|
}
|
|
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) {
|
|
$project = db_fetch_project($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", 1);
|
|
// Project name removed!!
|
|
$_PAGE_INFO['HIST_MAIN'] = "Project info";
|
|
}
|
|
else {
|
|
$_PAGE_INFO['HIST_MAIN'] = "Main menu";
|
|
}
|
|
|
|
/*
|
|
* Define skin
|
|
*/
|
|
// Skin defaults
|
|
$_PAGE_INFO['default_skin'] = ($_PAGE_INFO['tablet']) ? "dualinventive_tablet" : "dualinventive";
|
|
$_PAGE_INFO['default_skin_name'] = "dualinventive";
|
|
|
|
// Define skin name
|
|
$customer = db_fetch_customer($_SESSION[$_PAGE_INFO['id']]['login']['customer']['id'], 1);
|
|
$_SESSION[$_PAGE_INFO['id']]['skin_name'] = _(strtolower($customer['skin']));
|
|
$_SESSION[$_PAGE_INFO['id']]['skin'] = ($_PAGE_INFO['tablet']) ? strtolower($customer['skin']) . "_tablet" : strtolower($customer['skin']);
|
|
|
|
// Skin not available/not logged in => Default skin
|
|
if ((!isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) || ((isset($_GET['href'])) && ($_GET['href'] == "page/login")) || (!strlen($_SESSION[$_PAGE_INFO['id']]['skin'])) || (!is_dir(SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin']))) {
|
|
$_SESSION[$_PAGE_INFO['id']]['skin_name'] = _($_PAGE_INFO['default_skin_name']);
|
|
$_SESSION[$_PAGE_INFO['id']]['skin'] = $_PAGE_INFO['default_skin'];
|
|
}
|
|
|
|
// Retrieve ini file skin
|
|
$ini_file = get_all_files(SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/", array("ini"));
|
|
$_PAGE_INFO['ini'] = parse_ini_file($ini_file[0], true);
|
|
|
|
// Update global variables
|
|
UpdateGlobals();
|
|
|
|
|
|
/*
|
|
* Define Header menu items
|
|
*/
|
|
if ((!isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) || ((isset($_GET['href'])) && ($_GET['href'] == "page/login"))) {
|
|
$_PAGE_INFO['header_menu_buttons'] = array("WELCOME TO MTINFO 3000");
|
|
$_PAGE_INFO['header_menu_links'] = array("");
|
|
}
|
|
else {
|
|
$_PAGE_INFO['header_menu_buttons'] = array("MAIN MENU", "LOGOUT", "BACK", $_PAGE_INFO['ini']['news'][$_SESSION[$_PAGE_INFO['id']]['i18n']], "HELP");
|
|
$_PAGE_INFO['header_menu_links'] = array($_PAGE_INFO['MAIN_LINK'], PAGE_LOGIN, "javascript:window.history.back();", $_PAGE_INFO['ini']['news'][$_SESSION[$_PAGE_INFO['id']]['i18n'] . "_link"], "javascript:windowOpener('" . $_SESSION[$_PAGE_INFO['id']]['base'] . "?id=" . $_PAGE_INFO['id'] . "&href=page/help','mtinfo_help_menu','scrollbars=1,resizable=yes,width=600px,height=200px');");
|
|
$_PAGE_INFO['header_menu_oncontext'] = array("javascript:ShowPopup(this);", "", "", "", "");
|
|
}
|
|
|
|
|
|
/**
|
|
* Print the framework header
|
|
*
|
|
* Inputs:
|
|
* - $extra_head_html: Extra HTML code to be inserted between the <head> and </head> tags.
|
|
* Useful for including extra CSS and JavaScript
|
|
* - $body_tag: The HTML <body> tag. This parametrisable to allow extra JavaScript events
|
|
* such as onload()
|
|
*/
|
|
function print_page_header($extra_head_html="", $body_tag = NULL) {
|
|
GLOBAL $_PAGE_INFO;
|
|
|
|
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n";
|
|
echo "<html lang=\"" . $_SESSION[$_PAGE_INFO['id']]['i18n'] . "\">\n\n";
|
|
echo "<head>\n";
|
|
echo "<title>";
|
|
echo $_SESSION[$_PAGE_INFO['id']]['skin_name'] . " - " . ucfirst(_($_PAGE_INFO['page_title']));
|
|
echo "</title>\n";
|
|
|
|
// Add google analytics
|
|
?><script type="text/javascript">
|
|
var _gaq = _gaq || [];
|
|
_gaq.push(['_setAccount', 'UA-29642816-1']);
|
|
_gaq.push(['_trackPageview']);
|
|
|
|
(function() {
|
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
})();
|
|
</script><?php
|
|
|
|
// Project rt shortcuts used?
|
|
$rt_shortcuts = "";
|
|
if (isset($_GET['project_rt_shortcut'])) {
|
|
$rt_shortcuts = "&project_rt_shortcut=" . $_GET['project_rt_shortcut'] . "&project_action=" . $_GET['project_action'];
|
|
}
|
|
|
|
// Javascript sources
|
|
echo "<script type=\"text/javascript\" src=\"" . JAVA_DIR . "java.js\"></script>\n";
|
|
echo "<script type=\"text/javascript\" src=\"" . JAVA_DIR . "mouse.js\"></script>\n";
|
|
echo "<script type=\"text/javascript\" src=\"" . JAVA_DIR . "styleswitcher.js\"></script>\n";
|
|
echo "<script type=\"text/javascript\" src=\"" . JAVA_DIR . "xmlhttp_data.js\"></script>\n";
|
|
if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) {
|
|
echo "<script type=\"text/javascript\" src=\"" . JAVA_DIR . "jquery-1.2.6.min.js\"></script>\n";
|
|
}
|
|
|
|
// Ibox stylesheets
|
|
echo "<link rel=\"alternate stylesheet\" href=\"" . CSS_DIR . "ibox_busy.css\" type=\"text/css\" title=\"ibox_busy\">\n";
|
|
echo "<link rel=\"alternate stylesheet\" href=\"" . CSS_DIR . "ibox.css\" type=\"text/css\" title=\"ibox_normal\">\n";
|
|
|
|
// New page/session?
|
|
if (!is_dev("RS3000")) {
|
|
echo "<script type=\"text/javascript\">\n";
|
|
if ((!isset($_GET['reload'])) && (!isset($_COOKIE['screen_width']))) {
|
|
// Write screen resolution to cookie
|
|
echo "xmlhttp_data('','', 0,'" . $_SESSION[$_PAGE_INFO['id']]['base'] . "','" . $_PAGE_INFO['id'] . "','&write_cookie=screen_width,' + screen.width,'&redirect=include/set_info.php');";
|
|
// "Refresh" page
|
|
echo "window.location = window.location.href + '?id=' + '" . $_PAGE_INFO['id'] . "' + '&reload=1';\n";
|
|
}
|
|
else if ((isset($_GET['reload'])) && (!isset($_COOKIE['screen_width']))) {
|
|
echo "alert('" . _("No access because cookies are blokked") . "');\n";
|
|
}
|
|
// Extended info/Extended menu => skip check
|
|
echo "if ((!getURLParam('extended_info').length) && (!" . strlen($_SESSION[$_PAGE_INFO['id']]['extended_menu']) . ")) {\n";
|
|
// Renew action => Store window name
|
|
echo "if (getURLParam('renew').length) { window.name = '" . $_PAGE_INFO['id'] . "'; }\n";
|
|
// No window name and no id => login page => Store window name
|
|
echo "else if ((!window.name.length) && ((!getURLParam('id').length) || (getURLParam('reload').length))) { window.name = '" . $_PAGE_INFO['id'] . "'; }\n";
|
|
// No window name and id => Copy/paste action new window => new session id
|
|
echo "else if ((!window.name.length) && (getURLParam('id').length)) { window.location = window.location.href + '&renew=1' + '" . ((isset($_PAGE_INFO['user_log_id'])) ? "&user_log_id=" . $_PAGE_INFO['user_log_id'] : "") . "'; }\n";
|
|
// Window name and no id => login page => Store window (to be sure)
|
|
echo "else if ((window.name.length) && (!getURLParam('id').length)) { window.name = '" . $_PAGE_INFO['id'] . "'; }\n";
|
|
// Window name not equal to session id => Copy/paste action in window with history => new session id
|
|
echo "else if ((window.name.length) && (window.name != '" . $_PAGE_INFO['id'] . "')) { window.location = window.location.href + '&renew=1' + '" . ((isset($_PAGE_INFO['user_log_id'])) ? "&user_log_id=" . $_PAGE_INFO['user_log_id'] : "") . "'; }\n";
|
|
echo "}";
|
|
echo "</script>\n";
|
|
}
|
|
|
|
// Calender multiple language support
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "var language = \"" . $_SESSION[$_PAGE_INFO['id']]['i18n'] ."\";\n";
|
|
echo "</script>\n";
|
|
|
|
// IE6 detection
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<script type=\"text/javascript\">";
|
|
echo "var is_IE6 = 1";
|
|
echo "</script>";
|
|
echo "<![endif]-->";
|
|
|
|
// include stylesheets
|
|
// Tablet and non-tablet
|
|
if (!$_PAGE_INFO['tablet']) {
|
|
echo "<link href=\"" . CSS_DIR . "framework.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
$_PAGE_INFO['menu_button_sizes'] = ((isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) ? 196 : 335);
|
|
$_SESSION[$_PAGE_INFO['id']]['print_table_width'] = 354;
|
|
$_SESSION[$_PAGE_INFO['id']]['print_table_large_width'] = 458;
|
|
|
|
if (browser() != "IE") {
|
|
echo "<link href=\"" . CSS_DIR . "content.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
}
|
|
else {
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<link href=\"" . CSS_DIR . "content_ie6.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<![endif]-->";
|
|
echo "<!--[if IE 7]>";
|
|
echo "<link href=\"" . CSS_DIR . "content_ie7.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<![endif]-->";
|
|
echo "<!--[if gt IE 7]>";
|
|
echo "<link href=\"" . CSS_DIR . "content.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<![endif]-->";
|
|
}
|
|
}
|
|
else {
|
|
echo "<link href=\"" . CSS_DIR . "framework.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<link href=\"" . CSS_DIR . "framework_tablet.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
$_PAGE_INFO['menu_button_sizes'] = ((isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) ? 196 : 335);
|
|
$_SESSION[$_PAGE_INFO['id']]['print_table_width'] = 354;
|
|
$_SESSION[$_PAGE_INFO['id']]['print_table_large_width'] = 458;
|
|
|
|
if (browser() != "IE") {
|
|
echo "<link href=\"" . CSS_DIR . "content.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<link href=\"" . CSS_DIR . "content_tablet.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
}
|
|
else {
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<link href=\"" . CSS_DIR . "content_ie6.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<link href=\"" . CSS_DIR . "content_ie6_tablet.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<![endif]-->";
|
|
echo "<!--[if IE 7]>";
|
|
echo "<link href=\"" . CSS_DIR . "content_ie7.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<link href=\"" . CSS_DIR . "content_ie7_tablet.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<![endif]-->";
|
|
echo "<!--[if gt IE 7]>";
|
|
echo "<link href=\"" . CSS_DIR . "content.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<link href=\"" . CSS_DIR . "content_tablet.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
echo "<![endif]-->";
|
|
}
|
|
}
|
|
|
|
if ($_GET['href'] == "page/menu_rt") {
|
|
// CSS Realtime status
|
|
echo "<link href=\"" . CSS_DIR . "rtstatus.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
|
|
// CSS extended view
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) {
|
|
echo "<link href=\"" . CSS_DIR . "extended_view.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
if ($_PAGE_INFO['tablet']) {
|
|
echo "<link href=\"" . CSS_DIR . "extended_view_tablet.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
}
|
|
}
|
|
|
|
// rtstatus javascript
|
|
echo "<script type=\"text/javascript\" src=\"" . JAVA_DIR . "rtstatus.js\"></script>\n";
|
|
}
|
|
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) {
|
|
// CSS extended menu
|
|
echo "<link href=\"" . CSS_DIR . "extended_menu.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
if ($_PAGE_INFO['tablet']) {
|
|
echo "<link href=\"" . CSS_DIR . "extended_menu_tablet.css\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
}
|
|
}
|
|
|
|
// iBox support (including alternate stylesheets)
|
|
echo "<script type=\"text/javascript\" src=\"" . JAVA_DIR . "ibox.js\"></script>\n";
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "iBox.setPath(\"html/javascript/\");\n";
|
|
echo "iBox.fade_in_speed = 30;\n";
|
|
echo "iBox.fade_out_speed = 0;\n";
|
|
echo "iBox.Base = '" . $_SESSION[$_PAGE_INFO['id']]['base'] . "';\n";
|
|
echo "iBox.SessionId = '" . $_PAGE_INFO['id'] . "';\n";
|
|
echo "iBox.close_label = '" . _("Cancel") . "';\n";
|
|
echo "</script>\n";
|
|
|
|
// Hide Select controls
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "iBox.tags_to_hide.push('select');\n";
|
|
echo "</script>\n";
|
|
echo "<![endif]-->";
|
|
|
|
// Busy function
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "function busy() {\n";
|
|
echo "hide_ibox = 1;\n";
|
|
echo "getElement('ibox_cancel_button').style.visibility = 'hidden';";
|
|
echo "setActiveStyleSheet('ibox_busy');\n";
|
|
$body = "<html><head></head><body>";
|
|
$body .= "<center>";
|
|
$body .= "<img src='" . IMAGE_DIR . "ibox_indicator.gif' alt=\\\"\\\" style=\\\"margin-top:20px\\\" width=\\\"50px\\\" height=\\\"50px\\\">";
|
|
$body .= "</center>";
|
|
$body .= "</body>";
|
|
$body .= "</html>";
|
|
echo "iBox.show(\"" . $body . "\", \"\");\n";
|
|
echo "}\n";
|
|
echo "</script>\n";
|
|
|
|
// Slideshow functionality
|
|
if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) {
|
|
echo "<script type=\"text/javascript\">\n"; ?>
|
|
function slideSwitch()
|
|
{
|
|
var active = $('#slideshow li.active');
|
|
if ( active.length === 0 )
|
|
active = $('#slideshow li:first');
|
|
var next = active.next().length ? active.next() : $('#slideshow li:first');
|
|
active.addClass('last-active');
|
|
next.css({opacity: 0.0})
|
|
.addClass('active')
|
|
.animate({opacity: 1.0}, 1500, function() {
|
|
active.removeClass('active last-active');
|
|
setTimeout(function(){
|
|
slideSwitch();
|
|
}, 6000);
|
|
});
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
setTimeout("slideSwitch()", 6000);
|
|
});
|
|
<?php echo "</script>\n";
|
|
}
|
|
|
|
// Define button functionality
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "function DefineButton(aID, index, width, arraysize, imagedir, tablet) {";
|
|
echo "getElement(aID).style.left = (index * width) + \"px\";";
|
|
echo "getElement(aID).style.backgroundImage = \"url('\" + imagedir + \"di_menu.gif')\";";
|
|
echo "}";
|
|
echo "</script>\n";
|
|
|
|
// Create status div
|
|
echo "<div id=\"hidden_status\" style=\"display:none\">";
|
|
echo "</div>";
|
|
|
|
// Status function
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "function status(w, h, cancel) {\n";
|
|
echo "hide_ibox = 0;\n";
|
|
echo "if ((typeof(cancel) != 'undefined') && (cancel == 1)) { getElement('ibox_cancel_button').style.visibility = 'visible'; } ";
|
|
echo "else { getElement('ibox_cancel_button').style.visibility = 'hidden'; } ";
|
|
echo "setActiveStyleSheet('ibox_normal');\n";
|
|
echo "getElement('hidden_status').innerHTML = '<div id=\\\"status_content\\\"><div style=\"color:white;margin:6px;font-size:12px;\">" . ucfirst(_("loading")) . "...</div></div>';\n";
|
|
echo "iBox.show(getElement('status_content'), \"Status\", {width:'' + w + '', height:'' + h + ''});\n";
|
|
echo "}\n";
|
|
echo "</script>\n";
|
|
|
|
// Onclick event listener
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "function onclick_handler() {\n";
|
|
echo "if (typeof button_onclick == 'function') {\n";
|
|
echo "button_onclick();\n";
|
|
echo "}\n";
|
|
echo "}\n";
|
|
echo "</script>\n";
|
|
|
|
// Set base
|
|
echo "<base href=\"" . $_SESSION[$_PAGE_INFO['id']]['base'] . "\">\n";
|
|
|
|
// Get icon
|
|
$icon_image = SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/" . $_PAGE_INFO['ini']['image']['icon'];
|
|
if ((file_exists($icon_image)) && (strlen($_PAGE_INFO['ini']['image']['icon']))) {
|
|
echo "<link type=\"image/x-icon\" href=\"" . $icon_image . "\" rel=\"shortcut icon\">\n";
|
|
}
|
|
|
|
// Insert skin style sheets (when available)
|
|
$css_files = get_all_files(SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/css/", array("css"));
|
|
if (is_array($css_files)) {
|
|
foreach($css_files as $file) {
|
|
echo "<link href=\"" . $file . "\" rel=\"stylesheet\" type=\"text/css\">\n";
|
|
}
|
|
}
|
|
|
|
// Add extra head items
|
|
echo $extra_head_html;
|
|
echo "</head>\n\n";
|
|
if( !$body_tag ) {
|
|
$body_tag="<body oncontextmenu='return false;'>";
|
|
}
|
|
echo $body_tag;
|
|
|
|
// Add tooltips functionality
|
|
echo "<script type=\"text/javascript\" src=\"" . JAVA_DIR . "wz_tooltip.js\"></></script>\n";
|
|
echo "<script>window.tt_HideSrcTags.done = true;</script>";
|
|
|
|
// Header content (logo & header menu)
|
|
if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) {
|
|
echo "<div id=\"header_content\">\n";
|
|
echo "<!-- Header template -->\n";
|
|
echo "<div id=\"header\">\n";
|
|
|
|
echo "<!-- header logo -->\n";
|
|
echo "<div id=\"di_header_logo\">\n";
|
|
|
|
// Show print icon
|
|
if ((!is_tablet()) && ((Browser() != "IE") || (browser_version() > 7))) {
|
|
$print_actions = array("project_info" ,
|
|
"project_new" ,
|
|
"project_duplicate" ,
|
|
"project_change" ,
|
|
"project_design" ,
|
|
"project_verify_design" ,
|
|
"project_validate_design" ,
|
|
"project_plan" ,
|
|
"project_verify_plan" ,
|
|
"project_validate_plan" ,
|
|
"project_release" ,
|
|
"project_return" ,
|
|
"lance_info" ,
|
|
"user_info" ,
|
|
"cust_info");
|
|
$print_pages = array("page/menu_report_live", "page/menu&page_project=");
|
|
|
|
// Define printable pages
|
|
$print_icon_visible = FALSE;
|
|
|
|
// Printable action (with the exception of the search pages)
|
|
if (((is_array($print_actions)) && (in_array($_SESSION[$_PAGE_INFO['id']]['action'], $print_actions))) && (stristr($_GET['href'], "_search") === FALSE)) {
|
|
$print_icon_visible = TRUE;
|
|
}
|
|
// Printable href
|
|
else if ((is_array($print_pages)) && (in_array($_GET['href'], $print_pages))) {
|
|
$print_icon_visible = TRUE;
|
|
}
|
|
// Printable uri?
|
|
else {
|
|
if (is_array($print_pages)) {
|
|
foreach($print_pages as $print_page) {
|
|
if (stristr($_SERVER['REQUEST_URI'], $print_page) !== FALSE) {
|
|
$print_icon_visible = TRUE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($print_icon_visible) {
|
|
echo "<div id=\"print_page\">";
|
|
echo "<a href=\"javascript:void(0)\" onClick=\"javascript:PrintLayout();\">";
|
|
echo "<img id=\"img_print\" src=\"" . IMAGE_DIR . "Gnome-dev-printer.png\" alt=\"\">\n";
|
|
echo "</a>";
|
|
echo "</div>";
|
|
}
|
|
}
|
|
|
|
// Show refresh button (including cache clearing)
|
|
echo "<div id=\"refresh_page\">";
|
|
echo "<a href=\"javascript:void(0)\" onClick=\"javascript:xmlhttp_data('include/set_info.php','', 0,'" . $_SESSION[$_PAGE_INFO['id']]['base'] . "','" . $_PAGE_INFO['id'] . "','&clear_reload=1');javascript:location.reload();\">";
|
|
echo "<img id=\"img_refresh\" src=\"" . IMAGE_DIR . "Refresh.png\" alt=\"\">\n";
|
|
echo "</a>";
|
|
echo "</div>";
|
|
|
|
// Show screen mode icon
|
|
if ((!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) && ((isset($_SESSION[$_PAGE_INFO['id']]['standard_view'])) || (isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])))) {
|
|
echo "<div id=\"screen_mode\">\n";
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) {
|
|
echo "<a href=\"?id=" . $_PAGE_INFO['id'] . "&href=page/menu_rt&action=" . $_SESSION[$_PAGE_INFO['id']]['action'] . $_PAGE_INFO['page_project'] . "&extended=0" . $rt_shortcuts . "\" onClick=\"javascript:onclick_handler();\"";
|
|
echo "onmouseover=\"Tip('" . _("Standard view") . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\">";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<span style=\"display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" . IMAGE_DIR . "standardscreen.png');\">";
|
|
echo "<![endif]-->";
|
|
echo "<img id=\"img_rt\" src=\"" . IMAGE_DIR . "standardscreen.png\" alt=\"\">\n";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "</span>";
|
|
echo "<![endif]-->";
|
|
echo "</a>";
|
|
}
|
|
else {
|
|
echo "<a href=\"?id=" . $_PAGE_INFO['id'] . "&href=page/menu_rt&action=" . $_SESSION[$_PAGE_INFO['id']]['action'] . $_PAGE_INFO['page_project'] . "&extended=1" . $rt_shortcuts . "\" onClick=\"javascript:onclick_handler();\"";
|
|
echo "onmouseover=\"Tip('" . _("Extended view") . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\">";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<span style=\"display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" . IMAGE_DIR . "fullscreen.png');\">";
|
|
echo "<![endif]-->";
|
|
echo "<img id=\"img_rt\" src=\"" . IMAGE_DIR . "fullscreen.png\" alt=\"\">\n";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "</span>";
|
|
echo "<![endif]-->";
|
|
echo "</a>";
|
|
}
|
|
echo "</div>";
|
|
}
|
|
|
|
// Insert Shortcuts from skin (when available)
|
|
echo "<div id=\"header_shortcuts" . ((is_ReleaseCandidate()) ? "_rc" : "") . "\">\n";
|
|
if ((is_array($_PAGE_INFO['ini']['link'])) && (!empty($_PAGE_INFO['ini']['link']))) {
|
|
$i=0;
|
|
foreach($_PAGE_INFO['ini']['link'] as $link => $key) {
|
|
// Add link
|
|
echo "<a href=\"" . $key . "\" target=\"_blank\" oncontextmenu=\"javascript:ShowPopup(this);\">" . ucfirst(strtolower($link)) . "</a>";
|
|
// Increment counter
|
|
$i++;
|
|
}
|
|
}
|
|
echo "</div>\n";
|
|
|
|
// Version info
|
|
echo "<div id=\"version_info\">" . strtoupper(((is_ReleaseCandidate()) ? $_SESSION[$_PAGE_INFO['id']]['release_dir'] : VERSION)) . "</div>\n";
|
|
|
|
// Heartbeat
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) {
|
|
echo "<!-- blinking heartbeat -->\n";
|
|
echo "<div id=\"heartbeat\">\n";
|
|
echo "<img id=\"greenled\" src=\"" . IMAGE_DIR . "GreenLed.gif" . "\" alt=\"\" style=\"visibility:visible;\">\n";
|
|
echo "<img id=\"redled\" src=\"" . IMAGE_DIR . "RedLed.png" . "\" alt=\"\" style=\"visibility:hidden;\">\n";
|
|
echo "</div>\n";
|
|
}
|
|
|
|
// Logo image
|
|
$logo_svg = SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/" . $_PAGE_INFO['ini']['image']['header_logo_svg'];
|
|
$logo_image = SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/" . $_PAGE_INFO['ini']['image']['header_logo'];
|
|
if (((strlen($_PAGE_INFO['ini']['image']['header_logo_svg'])) && (file_exists($logo_svg))) && ((Browser() != "IE") || (browser_version() > 8))) {
|
|
// Open the file
|
|
$handle = fopen($logo_svg ,"r");
|
|
// Read SVG data
|
|
echo fread($handle, filesize($logo_svg));
|
|
// close handle
|
|
fclose($handle);
|
|
}
|
|
else if ((strlen($_PAGE_INFO['ini']['image']['header_logo'])) && (file_exists($logo_image))) {
|
|
echo "<img id=\"svg_logo\" src=\"" . $logo_image . "\" alt=\"\">";
|
|
}
|
|
echo "</div>\n\n";
|
|
|
|
echo "<!-- Header menu -->\n";
|
|
echo "<div id=\"di_header_menu\">\n";
|
|
|
|
echo "<div id=\"menu_items" . ((isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) ? "" : "_login") . "\">\n";
|
|
// Create header button divisions
|
|
for ($i = 0; $i <= sizeof($_PAGE_INFO['header_menu_buttons']); $i++) {
|
|
// Only separator?
|
|
if ($i < sizeof($_PAGE_INFO['header_menu_buttons'])) {
|
|
echo "<div class=\"menu_item" . ((isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) ? "" : "_login") . "\" id=\"header_menu_item_" . $i ."\">\n";
|
|
echo "<img class=\"menu_seperator\" src=\"" . IMAGE_DIR . "di_menu_seperator.gif\" alt=\"\">\n";
|
|
// Create link or not
|
|
if (!empty($_PAGE_INFO['header_menu_links'][$i])) {
|
|
// Start with javascript:
|
|
if (stristr($_PAGE_INFO['header_menu_links'][$i], "javascript:")) {
|
|
echo "<a style=\"height:100%; width:100%\" href=\"" . $_PAGE_INFO['header_menu_links'][$i] . "\" onClick=\"javascript:onclick_handler();\" oncontextmenu=\"" . $_PAGE_INFO['header_menu_oncontext'][$i] . "\">\n";
|
|
}
|
|
else {
|
|
// Link to other host?
|
|
$url_info = parse_url($_PAGE_INFO['header_menu_links'][$i]);
|
|
|
|
if ((isset($url_info['host'])) && (stristr($url_info['host'], $_SESSION[$_PAGE_INFO['id']]['base']) === FALSE)) {
|
|
echo "<a target=\"_blank\" style=\"height:100%; width:100%\" href=\"" . $_PAGE_INFO['header_menu_links'][$i] . "\" onClick=\"javascript:onclick_handler();\" oncontextmenu=\"" . $_PAGE_INFO['header_menu_oncontext'][$i] . "\">\n";
|
|
}
|
|
else {
|
|
echo "<a style=\"height:100%; width:100%\" href=\"?id=" . $_PAGE_INFO['id'] . "&href=" . $_PAGE_INFO['header_menu_links'][$i] . "\" onClick=\"javascript:onclick_handler();\" oncontextmenu=\"" . $_PAGE_INFO['header_menu_oncontext'][$i] . "\">\n";
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
echo "<div class=\"menu_item_nolink" . ((isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) ? "" : "_login") . "\">\n";
|
|
}
|
|
echo _($_PAGE_INFO['header_menu_buttons'][$i]);
|
|
if (!empty($_PAGE_INFO['header_menu_links'][$i])) {
|
|
echo "</a>\n";
|
|
}
|
|
else {
|
|
echo "</div>\n";
|
|
}
|
|
}
|
|
else {
|
|
echo "<div class=\"menu_item" . ((isset($_SESSION[$_PAGE_INFO['id']]['logged_on'])) ? "" : "_login") . "\" id=\"header_menu_item_" . $i ."\" style=\"width:4px\">\n";
|
|
echo "<img class=\"menu_seperator\" src=\"" . IMAGE_DIR . "di_menu_seperator.gif\" alt=\"\">\n";
|
|
}
|
|
echo "</div>\n";
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "DefineButton('header_menu_item_" . $i ."', $i," . $_PAGE_INFO['menu_button_sizes'] . "," . sizeof($_PAGE_INFO['header_menu_buttons']) . ",\"" . IMAGE_DIR . "\", " . $_PAGE_INFO['tablet'] . ");\n";
|
|
echo "</script>\n";
|
|
}
|
|
echo "</div>\n";
|
|
echo "</div>\n\n";
|
|
}
|
|
|
|
// Insert project name
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) && (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) {
|
|
echo "<div id=\"project_name\">\n";
|
|
$project = db_fetch_project($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", 1);
|
|
echo htmlspecialchars($project['naam']);
|
|
echo "</div>\n";
|
|
}
|
|
|
|
// Header image & message of the day
|
|
echo "<!-- Dual inventive header image & motd -->\n";
|
|
if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) {
|
|
echo "<div id=\"di_header_image_background\">\n";
|
|
echo "<div id=\"header_image\">\n";
|
|
if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) {
|
|
echo "<ul id=\"slideshow\">\n";
|
|
|
|
// Get all header images
|
|
$header_images = get_all_files(SKIN_DIR . $_SESSION[$_PAGE_INFO['id']]['skin'] . "/header/", array("jpg","png"));
|
|
|
|
// Get all header label
|
|
$header_labels = $_PAGE_INFO['ini']["header"];
|
|
|
|
// Check for i18n header labels
|
|
if (isset($_PAGE_INFO['ini']["header_" . $_SESSION[$_PAGE_INFO['id']]['i18n']])) {
|
|
$header_labels = $_PAGE_INFO['ini']["header_" . $_SESSION[$_PAGE_INFO['id']]['i18n']];
|
|
}
|
|
|
|
if (is_array($header_images)) {
|
|
// Define start image
|
|
srand((double)microtime()*1000000);
|
|
$start = rand() % (sizeof($header_images) - 1);
|
|
|
|
for($i=0; $i<sizeof($header_images); $i++) {
|
|
echo "<li class=\"slide";
|
|
if ($i == $start) {
|
|
echo " active";
|
|
}
|
|
echo "\">\n";
|
|
echo "<img class=\"slide_image\" src=\"" . $header_images[$i] . "\" alt=\"\">\n";
|
|
|
|
if (isset($header_labels)) {
|
|
$label_index = rand() % (sizeof($header_labels) - 1);
|
|
echo "<div class=\"slideshow_container\">";
|
|
|
|
// Search for extra actions (hyperlinks/etc.)?
|
|
$header_value = explode(";", $header_labels["line" . $label_index]);
|
|
echo "<div class=\"slideshow_label\" style=\"z-index:0\">" . $header_value[0] . "</div>";
|
|
|
|
if (isset($header_value[1])) {
|
|
switch(trim(strtolower($header_value[1]))) {
|
|
case "hyper_button":
|
|
echo "<a id=\"header_button\" target=\"_blank\" href=\"" . $header_value[3] . "\">";
|
|
echo utf8_encode($header_value[2]);
|
|
echo "</a><br>";
|
|
break;
|
|
default:
|
|
echo utf8_encode($footer_value[0]) . "<br>";
|
|
break;
|
|
}
|
|
}
|
|
echo "</div>";
|
|
}
|
|
echo "</li>";
|
|
}
|
|
}
|
|
echo "</ul>";
|
|
}
|
|
echo "</div>\n";
|
|
echo "</div>\n";
|
|
}
|
|
|
|
// ibox workaround => preload image
|
|
echo "<div style=\"position:absolute;visibility:hidden\">\n";
|
|
echo "<img src=\"" . IMAGE_DIR . "ibox_bg.png\">\n";
|
|
|
|
// IE workaround => indicator does not work when preloaded
|
|
if (browser() != "IE") {
|
|
echo "<img src=\"" . IMAGE_DIR . "ibox_indicator.gif\">\n";
|
|
}
|
|
echo "</div>\n";
|
|
|
|
// Message of the day
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['login'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) {
|
|
$motd = db_fetch_system_maint_mes();
|
|
if (is_array($motd)) {
|
|
foreach ($motd as $item) {
|
|
if ($item['i18n'] == $_SESSION[$_PAGE_INFO['id']]['i18n']) {
|
|
if (strlen($item['onderhoud'])) {
|
|
echo "<!-- Message of the day -->\n";
|
|
echo "<div id=\"motd\">\n";
|
|
echo "<center><div id=\"motd_col0\">\n";
|
|
echo htmlspecialchars(strip_tags($item['onderhoud']));
|
|
echo "</div></center>\n";
|
|
echo "</div>\n";
|
|
}
|
|
else {
|
|
echo "<div id=\"motd_no_msg\">\n";
|
|
echo "</div>\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Extended view & project
|
|
if ((!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) && (isset($_SESSION[$_PAGE_INFO['id']]['extended_view']))) {
|
|
echo "<a id=\"arrow_right_href\" href=\"javascript:Extend_Menu('show','" . $_PAGE_INFO['id'] . "');\">";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<span id=\"arrow_right_span\" style=\"display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" . IMAGE_DIR . "arrow_right.png');\">";
|
|
echo "<![endif]-->";
|
|
echo "<img id=\"arrow_right\" src=\"" . IMAGE_DIR . "arrow_right.png\" alt=\"\">";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "</span>";
|
|
echo "<![endif]-->";
|
|
echo "</a>\n";
|
|
|
|
echo "<a id=\"arrow_left_bg_href\" href=\"javascript:Extend_Menu('hide','" . $_PAGE_INFO['id'] . "');\">";
|
|
echo "<img id=\"arrow_left_bg\" src=\"" . IMAGE_DIR . "arrow_left_bg.png\" alt=\"\">";
|
|
echo "</a>\n";
|
|
|
|
echo "<a id=\"arrow_left_href\" href=\"javascript:Extend_Menu('hide','" . $_PAGE_INFO['id'] . "');\">";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<span id=\"arrow_left_span\" style=\"display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" . IMAGE_DIR . "arrow_left.png');\">";
|
|
echo "<![endif]-->";
|
|
echo "<img id=\"arrow_left\" src=\"" . IMAGE_DIR . "arrow_left.png\" alt=\"\">";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "</span>";
|
|
echo "<![endif]-->";
|
|
echo "</a>\n";
|
|
}
|
|
|
|
echo "</div>\n";
|
|
|
|
// Page content
|
|
echo "<!-- Page content -->\n";
|
|
echo "<div id=\"content\">\n";
|
|
echo "<div id=\"content_table\">\n";
|
|
|
|
if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) {
|
|
echo "<div id=\"content_table_col1\">\n";
|
|
// Login info
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['login'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_view']))) {
|
|
echo "<div id=\"menu_border\">";
|
|
echo "<div class=\"menu\" id=\"login_info\">\n";
|
|
echo "<h1>" . _("Login info") . "</h1>\n";
|
|
echo "<ul>\n";
|
|
$extra_user_info = "";
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['dbg']['enabled'])) {
|
|
$extra_user_info = " (dbg ";
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['dbg']['mask'])) {
|
|
$extra_user_info .= strtoupper(dechex($_SESSION[$_PAGE_INFO['id']]['dbg']['mask']));
|
|
}
|
|
else {
|
|
$extra_user_info .= "0";
|
|
}
|
|
$extra_user_info .= ")";
|
|
}
|
|
$username = shorten_text(ucwords(getUser()) . $extra_user_info,31);
|
|
// Redirect to user info page?
|
|
if (db_ver_rights_user_one_valid($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "menu:gebruikers&menu:gebruikers:zoeken,menu:gebruikers:root")) {
|
|
echo "<li><a href=\"?id=" . $_PAGE_INFO['id'] . "&href=page/menu_user_info&action=user_info&login=1" . $_PAGE_INFO['page_project'] . "\" onClick=\"javascript:onclick_handler();\" oncontextmenu=\"javascript:ShowPopup(this);\"";
|
|
|
|
// Tooltip? => When value was too long
|
|
if (($username != ucwords(getUser()) . $extra_user_info) || (stristr($username, "..") !== FALSE)) {
|
|
echo " onmouseover=\"Tip('" . ucwords(htmlspecialchars(addslashes(getUser()))) . $extra_user_info . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" ";
|
|
}
|
|
|
|
echo ">" . htmlspecialchars($username) . "</a></li>\n";
|
|
}
|
|
else {
|
|
echo "<li";
|
|
|
|
// Tooltip? => When value was too long
|
|
if (($username != ucwords(getUser()) . $extra_user_info) || (stristr($username, "..") !== FALSE)) {
|
|
echo " onmouseover=\"Tip('" . ucwords(htmlspecialchars(addslashes(getUser()))) . $extra_user_info . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" ";
|
|
}
|
|
|
|
echo ">" . htmlspecialchars($username) . "</li>\n";
|
|
}
|
|
echo "<li class=\"seperator\"></li>\n";
|
|
$customer = db_fetch_customer($_SESSION[$_PAGE_INFO['id']]['login']['customer']['id'], 1);
|
|
$customername = shorten_text(ucfirst($customer['bedrijfsnaam']),31);
|
|
// Redirect to customer info page?
|
|
if (db_ver_rights_user_one_valid($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "menu:klanten&menu:klanten:zoeken,menu:klanten:root")) {
|
|
echo "<li><a href=\"?id=" . $_PAGE_INFO['id'] . "&href=page/menu_cust_info&action=cust_info&login=1" . $_PAGE_INFO['page_project'] . "\" onClick=\"javascript:onclick_handler();\" oncontextmenu=\"javascript:ShowPopup(this);\"";
|
|
|
|
// Tooltip? => When value was too long
|
|
if (($customername != ucfirst($customer['bedrijfsnaam'])) || (stristr($customername, "..") !== FALSE)) {
|
|
echo " onmouseover=\"Tip('" . ucfirst(htmlspecialchars(addslashes($customer['bedrijfsnaam']))) . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" ";
|
|
}
|
|
|
|
echo ">" . htmlspecialchars($customername) . "</a></li>\n";
|
|
}
|
|
else {
|
|
echo "<li";
|
|
|
|
// Tooltip? => When value was too long
|
|
if (($customername != ucfirst($customer['bedrijfsnaam'])) || (stristr($customername, "..") !== FALSE)) {
|
|
echo " onmouseover=\"Tip('" . ucfirst(htmlspecialchars(addslashes($customer['bedrijfsnaam']))) . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" ";
|
|
}
|
|
|
|
echo ">" . htmlspecialchars($customername) . "</li>\n";
|
|
}
|
|
// Display project name (when selected)
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['name'])) && (($_SESSION[$_PAGE_INFO['id']]['login']['project']['name'] != "skip") || ($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'] != -1)) ) {
|
|
$project = db_fetch_project($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", 1);
|
|
$projectname = shorten_text(ucfirst($project['naam']),(31 - 12));
|
|
echo "<li class=\"seperator\"></li>\n";
|
|
echo "<li><a href=\"?id=" . $_PAGE_INFO['id'] . "&href=page/menu" . $_PAGE_INFO['page_project'] . "\" onClick=\"javascript:onclick_handler();\" oncontextmenu=\"javascript:ShowPopup(this);\"";
|
|
|
|
// Tooltip? => When value was too long
|
|
if (($projectname != ucfirst($project['naam'])) || (stristr($projectname, "..") !== FALSE)) {
|
|
echo " onmouseover=\"Tip('" . ucfirst(htmlspecialchars(addslashes($project['naam']))) . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" ";
|
|
}
|
|
|
|
echo ">" . _("Project") . " : " . htmlspecialchars($projectname) . "</a></li>\n";
|
|
}
|
|
// Display period name (when selected)
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['period'])) && (is_valid_action("lance_use_relay","switch_code"))) {
|
|
echo "<li class=\"seperator\"></li>\n";
|
|
echo "<li>" . _("Period") . " : " . htmlspecialchars($_SESSION[$_PAGE_INFO['id']]['project_info']["naam_" . $_SESSION[$_PAGE_INFO['id']]['login']['project']['period']]) . "</li>\n";
|
|
}
|
|
|
|
// Display number of unread messages (only login needed)
|
|
$messages = db_fetch_messages_user($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "marked");
|
|
$unread = (is_array($messages)) ? sizeof($messages) : 0;
|
|
// Pop-up when new message has been received
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['unread_messages'])) && ($_SESSION[$_PAGE_INFO['id']]['unread_messages'] < $unread) && (!is_valid_action("messages_read", "messages_new", "messages_inbox"))) {
|
|
$_SESSION[$_PAGE_INFO['id']]['errormsg']['text'] = _("New message received, go to inbox?");
|
|
$_SESSION[$_PAGE_INFO['id']]['errormsg']['type'] = "confirm";
|
|
$_SESSION[$_PAGE_INFO['id']]['errormsg']['redirect'] = "?id=" . $_PAGE_INFO['id'] . "&href=page/menu_messages&action=messages_inbox" . $_PAGE_INFO['page_project'] . "";
|
|
}
|
|
$_SESSION[$_PAGE_INFO['id']]['unread_messages'] = $unread;
|
|
echo "<li class=\"seperator\"></li>\n";
|
|
echo "<li><a href=\"?id=" . $_PAGE_INFO['id'] . "&href=page/menu_messages&action=messages_inbox" . $_PAGE_INFO['page_project'] . "\" onClick=\"javascript:onclick_handler();\" oncontextmenu=\"javascript:ShowPopup(this);\">" . _("Inbox") . " (" . $_SESSION[$_PAGE_INFO['id']]['unread_messages'] . ")" . "</a></li>\n";
|
|
echo "</ul>\n";
|
|
echo "</div>\n";
|
|
echo "</div>\n";
|
|
}
|
|
|
|
// History menu (became menu structure!)
|
|
if ((!empty($_PAGE_INFO['history_menu_buttons'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_view']))) {
|
|
echo "<div id=\"menu_border\">";
|
|
echo "<div id=\"menu_struct\" class=\"menu\">\n";
|
|
echo "<h1>" . _("Menu structure") . "</h1>\n";
|
|
echo "<ul>\n";
|
|
for ($i = 0; $i < sizeof($_PAGE_INFO['history_menu_buttons']); $i++) {
|
|
if ($i) {
|
|
echo "<li class=\"seperator\"></li>\n";
|
|
}
|
|
// Hyperlink? and catch project exception: no "magazijn" rigths => no projects page
|
|
$projects = db_fetch_user_projects($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "normaal");
|
|
|
|
$valid_project = 0;
|
|
if (is_array($projects)) {
|
|
foreach($projects as $project) {
|
|
// Check for non-closed projects
|
|
// normal project => planning status must be finished
|
|
// rc project => planning and design status must be validated
|
|
if (($project['status'] != "afgesloten") &&
|
|
((($project['type'] == "normaal") && ($project['pstatus'] == "gereed")) ||
|
|
(($project['type'] == "rc") && (($project['pstatus'] == "gevalideerd") && ($project['ostatus'] == "gevalideerd"))))) {
|
|
$valid_project = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
$value = shorten_text(_($_PAGE_INFO['history_menu_buttons'][$i]),31);
|
|
if ((empty($_PAGE_INFO['history_menu_links'][$i])) ||
|
|
(($_PAGE_INFO['history_menu_links'][$i] == PAGE_PROJECT) &&
|
|
((!db_ver_rights_user_one_valid($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "menu:projecten:root,menu:projecten&projecten:d")))) &&
|
|
(!$valid_project)) {
|
|
echo "<li";
|
|
|
|
// Tooltip? => When value was too long
|
|
if (($value != _($_PAGE_INFO['history_menu_buttons'][$i])) || (stristr($value, "..") !== FALSE)) {
|
|
echo " onmouseover=\"Tip('" . _($_PAGE_INFO['history_menu_buttons'][$i]) . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" ";
|
|
}
|
|
|
|
echo ">" . $value . "</li>\n";
|
|
}
|
|
else {
|
|
echo "<li><a href=\"?id=" . $_PAGE_INFO['id'] . "&href=" . $_PAGE_INFO['history_menu_links'][$i] . "\" onClick=\"javascript:onclick_handler();\" oncontextmenu=\"javascript:ShowPopup(this);\"";
|
|
|
|
// Tooltip? => When value was too long
|
|
if (($value != _($_PAGE_INFO['history_menu_buttons'][$i])) || (stristr($value, "..") !== FALSE)) {
|
|
echo " onmouseover=\"Tip('" . _($_PAGE_INFO['history_menu_buttons'][$i]) . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" ";
|
|
}
|
|
|
|
echo">" . $value . "</a></li>\n";
|
|
}
|
|
}
|
|
echo "</ul>\n";
|
|
echo "</div>\n";
|
|
echo "</div>\n";
|
|
}
|
|
|
|
// Shortcut menu
|
|
if ((!empty($_PAGE_INFO['shortcut_menu_buttons'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_view']))) {
|
|
echo "<div id=\"menu_border\">";
|
|
echo "<div id=\"menu_shortcut\" class=\"menu\">\n";
|
|
echo "<h1>" . _("Shortcuts") . "</h1>\n";
|
|
echo "<ul>\n";
|
|
|
|
for ($i = 0; $i < sizeof($_PAGE_INFO['shortcut_menu_buttons']); $i++) {
|
|
if ($i) {
|
|
echo "<li class=\"seperator\"></li>\n";
|
|
}
|
|
|
|
// Hyperlink?
|
|
$value = shorten_text(_($_PAGE_INFO['shortcut_menu_buttons'][$i]),31);
|
|
if ((empty($_PAGE_INFO['shortcut_menu_links'][$i])) ||
|
|
((strlen($_PAGE_INFO['shortcut_menu_rights'][$i])) && (!db_ver_rights_user_one_valid($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], $_PAGE_INFO['shortcut_menu_rights'][$i])))) {
|
|
echo "<li";
|
|
|
|
// Tooltip? => When value was too long
|
|
if (($value != _($_PAGE_INFO['shortcut_menu_buttons'][$i])) || (stristr($value, "..") !== FALSE)) {
|
|
echo " onmouseover=\"Tip('" . _($_PAGE_INFO['shortcut_menu_buttons'][$i]) . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" ";
|
|
}
|
|
|
|
echo ">" . $value . "</li>\n";
|
|
}
|
|
else {
|
|
// Start with javascript:
|
|
if (stristr($_PAGE_INFO['shortcut_menu_links'][$i], "javascript:")) {
|
|
echo "<li><a href=\"" . $_PAGE_INFO['shortcut_menu_links'][$i] . "\"";
|
|
}
|
|
else {
|
|
echo "<li><a href=\"?id=" . $_PAGE_INFO['id'] . "&href=" . $_PAGE_INFO['shortcut_menu_links'][$i] . "\"";
|
|
}
|
|
|
|
// Open in new "tab"
|
|
if (stristr($_PAGE_INFO['shortcut_menu_links'][$i], "&renew=1") !== FALSE) {
|
|
echo " target=\"_blank\"";
|
|
}
|
|
|
|
echo " onClick=\"javascript:onclick_handler();\" oncontextmenu=\"javascript:ShowPopup(this);\"";
|
|
|
|
// Tooltip? => When value was too long
|
|
if (($value != _($_PAGE_INFO['shortcut_menu_buttons'][$i])) || (stristr($value, "..") !== FALSE)) {
|
|
echo " onmouseover=\"Tip('" . _($_PAGE_INFO['shortcut_menu_buttons'][$i]) . "',BGCOLOR,'" . $_PAGE_INFO['ini']['tooltip']['background'] . "',BORDERCOLOR, '" . $_PAGE_INFO['ini']['tooltip']['border'] . "');\" onmouseout=\"UnTip();\" ";
|
|
}
|
|
|
|
echo">" . $value . "</a></li>\n";
|
|
}
|
|
}
|
|
echo "</ul>\n";
|
|
echo "</div>\n";
|
|
echo "</div>\n";
|
|
}
|
|
echo "</div>\n"; // id="content_table_col1"
|
|
}
|
|
|
|
// Page content (forms, menus, etc)
|
|
echo "<div id=\"content_table_col0\">\n";
|
|
echo "<div id=\"content_xmlhttp\">";
|
|
|
|
// Display extended menu
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) {
|
|
echo "<div id=\"extended_menu\">\n";
|
|
// Store extended menu id when not exist
|
|
if ((!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu_id'])) || (!strlen($_SESSION[$_PAGE_INFO['id']]['extended_menu_id']))) {
|
|
$_SESSION[$_PAGE_INFO['id']]['extended_menu_id'] = UniqSessionId();
|
|
}
|
|
|
|
// Create iframe
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) {
|
|
// Project selected => lance use & shortcuts
|
|
echo "<iframe src=\"?id=" . $_PAGE_INFO['id'] . "&new_id=" . $_SESSION[$_PAGE_INFO['id']]['extended_menu_id'] . "&href=page/menu_lance_use&action=lance_use" . $_PAGE_INFO['page_project'] . "&extended_menu=1\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\"></iframe>";
|
|
}
|
|
else {
|
|
// No project selected => Select lances & shortcuts
|
|
echo "<iframe src=\"?id=" . $_PAGE_INFO['id'] . "&new_id=" . $_SESSION[$_PAGE_INFO['id']]['extended_menu_id'] . "&href=page/menu_rt&action=" . $_SESSION[$_PAGE_INFO['id']]['action'] . "&extended_menu=1" . $rt_shortcuts ."\" width=\"100%\" height=\"100%\" frameborder=\"0\" scrolling=\"auto\"></iframe>";
|
|
}
|
|
echo "</div>\n";
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* Add xmlhttp request header
|
|
*
|
|
*/
|
|
function print_xml_header($ypos = 0, $extra_header_HTML="")
|
|
{
|
|
GLOBAL $_PAGE_INFO;
|
|
|
|
// Add extra header tags to include more JavaScript and CSS than usual
|
|
$extra_header_HTML .=
|
|
"<script type=\"text/javascript\">
|
|
// global variables
|
|
var finished = 1;
|
|
var initial_action = '';
|
|
var hide_ibox;
|
|
var sts_first;
|
|
var sts_finished;
|
|
var sts_status;
|
|
var sts_process_finished = 1;
|
|
var sts_timer;
|
|
var value;
|
|
|
|
|
|
/*
|
|
* This function sets current value
|
|
*/
|
|
function current_value(id)
|
|
{
|
|
value = getElement(id).value;
|
|
}
|
|
|
|
|
|
/*
|
|
* This function checks if the value has been changed (prevents extra data)
|
|
*/
|
|
function new_value(id, func)
|
|
{
|
|
var new_value = getElement(id).value;
|
|
if (value != new_value) {
|
|
value = new_value;
|
|
|
|
try {
|
|
func();
|
|
}
|
|
catch (err) {}
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
* This function handles the status menu
|
|
*/
|
|
function status_handler(params, href, timeout, unique_id)
|
|
{
|
|
// variables
|
|
var page_project = '';
|
|
|
|
// Unique id not set yet? => Make new id (session id and msecs since 1970)
|
|
if (sts_first) {
|
|
var unique_id = '';
|
|
if (getURLParam('id').length) {
|
|
var unique_id = getURLParam('id');
|
|
}
|
|
var date = new Date();
|
|
var ms = date.getTime();
|
|
unique_id += '_' + ms;
|
|
}
|
|
|
|
// CSRF protection
|
|
var csrf_token = '" . csrf_create_token('status_handler') . "';
|
|
|
|
// Get current time
|
|
var now = new Date();
|
|
duration = (timeout != -1) ? (timeout <= ((now - sts_timer)/1000)) ? 0 : (timeout - ((now - sts_timer)/1000)) : -1;
|
|
|
|
// Add project page?
|
|
if (" . (strlen($_GET['page_project'])) . ") {
|
|
page_project = '&page_project=" . $_GET['page_project'] . "';
|
|
}
|
|
|
|
switch(sts_state) {
|
|
case 0:
|
|
if (((sts_status == 1) || (sts_first)) && (sts_finished == 0)) {
|
|
|
|
sts_status = 0;
|
|
sts_process_finished = 0;
|
|
|
|
// Function called at the end of the xml request
|
|
var func_sts = function (result) {
|
|
// Reload errormsg & debug divs
|
|
xmlhttp_data('include/errormsg.php','error', 1, '" . $_SESSION[$_PAGE_INFO['id']]['base'] . "', '" . $_PAGE_INFO['id'] . "','&xml=1' + '&__csrf_token__=' + csrf_token,page_project);
|
|
if (" . (($_SESSION[$_PAGE_INFO['id']]['dbg']['mask'] & 0x01) ? 1 : 0) . ") {
|
|
xmlhttp_data('include/debug_info.php','debug', 1, '" . $_SESSION[$_PAGE_INFO['id']]['base'] . "', '" . $_PAGE_INFO['id'] . "','&xml=1' + '&__csrf_token__=' + csrf_token, page_project);
|
|
}
|
|
|
|
// Response? Otherwhise the process is running in the background
|
|
if (result.length > 0) {
|
|
// Update div
|
|
try {
|
|
getElement('content_xmlhttp').innerHTML = result;
|
|
}
|
|
catch (err) {
|
|
alert(err);
|
|
}
|
|
finally {
|
|
// Set flag, process finished
|
|
sts_process_finished = 1;
|
|
|
|
// Next state
|
|
sts_state = 1;
|
|
}
|
|
}
|
|
|
|
// Rerun loop, this could be different state depends on result
|
|
sts_status = 1;
|
|
}
|
|
|
|
// asynchronous call
|
|
xmlhttp_data('','', 1, '" . $_SESSION[$_PAGE_INFO['id']]['base'] . "', '" . $_PAGE_INFO['id'] . "',params + '&first=' + sts_first + '&background_id=' + unique_id + '&disable_cache=' + now.getTime() + '&__csrf_token__=' + csrf_token,'&href=' + href + page_project, func_sts);
|
|
}
|
|
break;
|
|
case 1:
|
|
if (sts_status == 1) {
|
|
sts_status = 0;
|
|
|
|
// Function called at the end of the xml request
|
|
var func_sts = function (result) {
|
|
sts_status = 1;
|
|
|
|
// Next state
|
|
sts_state = 2;
|
|
}
|
|
|
|
// asynchronous call
|
|
xmlhttp_data('include/status.php','status_content', 1, '" . $_SESSION[$_PAGE_INFO['id']]['base'] . "', '" . $_PAGE_INFO['id'] . "','&timeout=' + duration + '&disable_cache=' + now.getTime() + '&__csrf_token__=' + csrf_token,'', func_sts);
|
|
}
|
|
break;
|
|
case 2:
|
|
if (sts_status == 1) {
|
|
sts_status = 0;
|
|
|
|
// Function called at the end of the xml request
|
|
var func_sts = function (result) {
|
|
sts_finished = result;
|
|
sts_status = 1;
|
|
|
|
// Next state
|
|
sts_state = 0;
|
|
}
|
|
|
|
// asynchronous call
|
|
xmlhttp_data('include/fetch_info.php', '', 1,'" . $_SESSION[$_PAGE_INFO['id']]['base'] . "','" . $_PAGE_INFO['id'] . "','&session_info=sts,finished&disable_cache=' + now.getTime() + '&__csrf_token__=' + csrf_token, '', func_sts)
|
|
}
|
|
break;
|
|
}
|
|
|
|
// Clear first variable
|
|
sts_first = 0;
|
|
|
|
// Always wait for the background process
|
|
if (((sts_finished == 0) && (duration != 0)) || (sts_process_finished == 0)) {
|
|
// Reload timer
|
|
setTimeout('status_handler(\"' + params + '\",\"' + href + '\",\"' + timeout + '\",\"' + unique_id + '\")','100');
|
|
}
|
|
else {
|
|
// Last recall to be sure that the button is visible
|
|
xmlhttp_data('include/status.php','status_content', 1, '" . $_SESSION[$_PAGE_INFO['id']]['base'] . "', '" . $_PAGE_INFO['id'] . "','&timeout=' + duration + '&disable_cache=' + now.getTime() + '&__csrf_token__=' + csrf_token, '', func_sts);
|
|
}
|
|
}
|
|
</script>";
|
|
|
|
$extra_header_HTML .=
|
|
"<script type=\"text/javascript\">
|
|
//Global variables
|
|
var finished = 1;
|
|
var initial_action = '';
|
|
var hide_ibox;
|
|
|
|
/*
|
|
* This function handles all form actions xml or non-xml
|
|
*/
|
|
function FormAction(href) {
|
|
// Initial values
|
|
var xml = 0;
|
|
var xml_status = 0;
|
|
var params = '';
|
|
var page_project = '';
|
|
|
|
// CSRF protection
|
|
var csrf_token = '" . csrf_create_token('status_handler') . "';
|
|
|
|
// Restore initial action
|
|
if (initial_action != '') {
|
|
// Restore original action (download/upload file)
|
|
document.form.action = initial_action;
|
|
|
|
// Clear initial action
|
|
initial_action = '';
|
|
}
|
|
|
|
// Get form elements
|
|
var x = getElement('form');
|
|
for (var i = 0; i < x.length; i++) {
|
|
xml = (x.elements[i].name == 'xml') ? 1 : xml;
|
|
if (x.elements[i].name == 'xml_status') {
|
|
xml_status = x.elements[i].value;
|
|
}
|
|
if ((x.elements[i].name.length) && (((x.elements[i].type != 'checkbox') && (x.elements[i].type != 'radio')) || (x.elements[i].checked))) {
|
|
if (x.elements[i].type == 'select-multiple') {
|
|
for (var j = 0; j < x.elements[i].options.length; j++) {
|
|
if (x.elements[i].options[j].selected) {
|
|
params += '&' + x.elements[i].name + '=';
|
|
params += encodeURIComponent(x.elements[i].options[j].value);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
params += '&' + x.elements[i].name + '=' + encodeURIComponent(x.elements[i].value);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (xml) {
|
|
if (!xml_status) {
|
|
// Clear flag
|
|
finished = 0;
|
|
|
|
// Add project page?
|
|
if (" . (strlen($_GET['page_project'])) . ") {
|
|
page_project = '&page_project=" . $_GET['page_project'] . "';
|
|
}
|
|
|
|
// Function called at the end of the xml request
|
|
var func_xml = function (result) {
|
|
if (hide_ibox) {
|
|
// hide ibox
|
|
iBox.hide();
|
|
}
|
|
// Remove tooltip
|
|
UnTip();
|
|
|
|
// restore the position of scrollable divs
|
|
var scrollable_divs = getElementsByClassName(document, 'div', 'scrollable_div');
|
|
var i;
|
|
for( i = 0; i < scrollable_divs.length; i++ ) {
|
|
var div_id = scrollable_divs[i].id != '' ? scrollable_divs[i].id : i;
|
|
var y_pos_div = getElement('y_position_div[' + div_id + ']');
|
|
if( y_pos_div != undefined ) scrollable_divs[i].scrollTop = y_pos_div.value;
|
|
}
|
|
|
|
// Clear flag
|
|
finished = 1;
|
|
|
|
// Reload errormsg & debug divs
|
|
xmlhttp_data('include/errormsg.php','error', 1, '" . $_SESSION[$_PAGE_INFO['id']]['base'] . "', '" . $_PAGE_INFO['id'] . "','&xml=1' + '&__csrf_token__=' + csrf_token, page_project);
|
|
if (" . (($_SESSION[$_PAGE_INFO['id']]['dbg']['mask'] & 0x01) ? 1 : 0) . ") {
|
|
xmlhttp_data('include/debug_info.php','debug', 1, '" . $_SESSION[$_PAGE_INFO['id']]['base'] . "', '" . $_PAGE_INFO['id'] . "','&xml=1' + '&__csrf_token__=' + csrf_token, page_project);
|
|
}
|
|
}
|
|
|
|
// Reload content
|
|
xmlhttp_data('','content_xmlhttp', 1, '" . $_SESSION[$_PAGE_INFO['id']]['base'] . "', '" . $_PAGE_INFO['id'] . "',params + '&__csrf_token__=' + csrf_token,'&href=' + href + page_project, func_xml);
|
|
}
|
|
else {
|
|
// Init status variables
|
|
sts_first = 1;
|
|
sts_finished = 0;
|
|
sts_state = 0;
|
|
sts_timer = new Date();
|
|
|
|
// Call status handler
|
|
setTimeout('status_handler(\"' + params + '\",\"' + href + '\",\"' + xml_status + '\")','250');
|
|
}
|
|
}
|
|
else {
|
|
// Create dummy form and submit
|
|
var temp=document.createElement('form');
|
|
temp['name'] = 'test';
|
|
if (" . (strlen($_GET['page_project'])) . ") {
|
|
temp['action']= '?id=" . $_PAGE_INFO['id'] . "&href=' + href + '&page_project=" . $_GET['page_project'] . "';
|
|
}
|
|
else {
|
|
temp['action']= '?id=" . $_PAGE_INFO['id'] . "&href=' + href;
|
|
}
|
|
temp['method']= 'POST';
|
|
|
|
// CSRF protection
|
|
var csrf_element = document.createElement('input');
|
|
csrf_element['type'] = 'hidden';
|
|
csrf_element['name'] = '__csrf_token__';
|
|
csrf_element['value'] = csrf_token;
|
|
temp.appendChild(csrf_element);
|
|
|
|
// Get form elements
|
|
var x = getElement('form');
|
|
for (var i = 0; i < x.length; i++) {
|
|
if ((x.elements[i].name.length) && (((x.elements[i].type != 'checkbox') && (x.elements[i].type != 'radio')) || (x.elements[i].checked))) {
|
|
if (x.elements[i].type == 'select-multiple') {
|
|
for (var j = 0; j < x.elements[i].options.length; j++) {
|
|
if (x.elements[i].options[j].selected) {
|
|
var opt = document.createElement(\"input\");
|
|
opt['type'] = 'hidden';
|
|
opt['name'] = x.elements[i].name;
|
|
opt['value'] = x.elements[i].options[j].value;
|
|
temp.appendChild(opt);
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
var opt = document.createElement(\"input\");
|
|
opt['type'] = 'hidden';
|
|
opt['name'] = x.elements[i].name;
|
|
opt['value'] = x.elements[i].value;
|
|
temp.appendChild(opt);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Add form
|
|
document.body.appendChild(temp);
|
|
|
|
// Submit form
|
|
temp.submit();
|
|
}
|
|
}
|
|
|
|
/*
|
|
* This function is called by each xmlhttp reload
|
|
*/
|
|
function onSubmit(value, post_action, xml, action, arg1, arg2, arg3, arg4) {
|
|
if (finished) {
|
|
var new_action = ((typeof(post_action) != 'undefined') && (post_action != '')) ? 1 : 0;
|
|
var xml_action = (((typeof(xml) != 'undefined') && (xml != '')) || (xml == 1))? 1 : 0;
|
|
|
|
if (new_action) {
|
|
// store initial action
|
|
initial_action = document.form.action;
|
|
|
|
// New form action
|
|
document.form.action = post_action;
|
|
}
|
|
|
|
// CSRF protection
|
|
var csrf_token = '" . csrf_create_token('status_handler') . "';
|
|
|
|
// Remove old recall/xml/y_position values
|
|
var x = getElement('form');
|
|
for (var i = (x.length - 1); i >= 0; i--) {
|
|
if (x.elements[i]['name'].indexOf('recall_') != -1) {
|
|
try {
|
|
x.removeChild(getElement(x.elements[i]['name']));
|
|
}
|
|
catch (err) {}
|
|
}
|
|
else if (x.elements[i]['name'] == 'xml') {
|
|
try {
|
|
x.removeChild(getElement(x.elements[i]['name']));
|
|
}
|
|
catch (err) {}
|
|
}
|
|
else if (x.elements[i]['name'] == 'y_position') {
|
|
try {
|
|
x.removeChild(getElement(x.elements[i]['name']));
|
|
}
|
|
catch (err) {}
|
|
}
|
|
else if (x.elements[i]['name'].substr(0,14) == 'y_position_div') {
|
|
try {
|
|
x.removeChild(getElement(x.elements[i]['name']));
|
|
}
|
|
catch (err) {}
|
|
}
|
|
else if (x.elements[i]['name'] == 'xml_status') {
|
|
try {
|
|
x.removeChild(getElement(x.elements[i]['name']));
|
|
}
|
|
catch (err) {}
|
|
}
|
|
}
|
|
|
|
// Remove test form
|
|
try {
|
|
document.body.removeChild(getElement('test'));
|
|
}
|
|
catch (err) {}
|
|
|
|
// Add xml action
|
|
if (xml_action) {
|
|
xml = document.createElement('input');
|
|
xml['type'] = 'hidden';
|
|
xml['name'] = 'xml';
|
|
xml['value'] = '1';
|
|
document.form.appendChild(xml);
|
|
}
|
|
else {
|
|
// Store y position
|
|
try {
|
|
// Add y_position
|
|
y_pos = document.createElement('input');
|
|
y_pos['type'] = 'hidden';
|
|
y_pos['name'] = 'y_position';
|
|
y_pos['value'] = getScrollY();
|
|
document.form.appendChild(y_pos);
|
|
}
|
|
catch (err) {
|
|
}
|
|
}
|
|
|
|
// CSRF protection
|
|
var csrf_element = document.createElement('input');
|
|
csrf_element['type'] = 'hidden';
|
|
csrf_element['name'] = '__csrf_token__';
|
|
csrf_element['value'] = csrf_token;
|
|
document.form.appendChild(csrf_element);
|
|
|
|
// Add new recall value
|
|
if (value != '') {
|
|
var recall = document.createElement('input');
|
|
recall['type'] = 'hidden';
|
|
recall['name'] = 'recall_' + value;
|
|
recall['value'] = '1';
|
|
document.form.appendChild(recall);
|
|
}
|
|
|
|
// Add action
|
|
if ((typeof(action) != 'undefined') && (action == 'busy')) {
|
|
busy();
|
|
}
|
|
else if ((typeof(action) != 'undefined') && (action == 'status')) {
|
|
status(arg2,arg3,arg4);
|
|
|
|
// xml_status element
|
|
var sts = document.createElement('input');
|
|
sts['type'] = 'hidden';
|
|
sts['name'] = 'xml_status';
|
|
// Define timeout value
|
|
sts['value'] = arg1;
|
|
document.form.appendChild(sts);
|
|
}
|
|
|
|
// save the position of scrollable divs
|
|
var scrollable_divs = getElementsByClassName(document, 'div', 'scrollable_div');
|
|
var i;
|
|
for( i = 0; i < scrollable_divs.length; i++ ) {
|
|
var div_id = scrollable_divs[i].id != '' ? scrollable_divs[i].id : i;
|
|
y_pos_div = document.createElement('input');
|
|
y_pos_div['type'] = 'hidden';
|
|
y_pos_div['name'] = 'y_position_div[' + div_id + ']';
|
|
y_pos_div['value'] = scrollable_divs[i].scrollTop;
|
|
document.form.appendChild(y_pos_div);
|
|
}
|
|
|
|
// Submit form
|
|
document.form.submit();
|
|
}
|
|
}
|
|
|
|
/*
|
|
* This function is called on reload
|
|
*/
|
|
function onLoad() {
|
|
// Restore y-position (used by upload/download files)
|
|
if (" . $ypos . ") {
|
|
setScrollY(" . $ypos . ");
|
|
}
|
|
}
|
|
</script>";
|
|
|
|
// Show page header
|
|
$body = "<body onload=\"onLoad();\" oncontextmenu=\"return false;\">";
|
|
print_page_header($extra_header_HTML, $body);
|
|
}
|
|
|
|
|
|
/**
|
|
* Print the framework footer
|
|
*/
|
|
function print_page_footer() {
|
|
GLOBAL $_PAGE_INFO;
|
|
|
|
echo "</div>";
|
|
|
|
// contextmenu popup menu
|
|
if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu'])) {
|
|
echo "<div id=\"popupdiv\" style=\"border-collapse:collapse;position:absolute;display:none;top:0px;left:0px;z-index:10000;\" onmouseover=\"javascript:overPopupMenu=true;\" onmouseout=\"javascript:overPopupMenu=false;\">\n";
|
|
echo "<table width=200 cellspacing=1 cellpadding=0 bgcolor=black>\n";
|
|
echo "<tr><td>\n";
|
|
echo "<table style=\"margin:0px\" width=200 cellspacing=0 cellpadding=0>\n";
|
|
// Window/tab support?
|
|
if (browser() == "FIREFOX") {
|
|
echo "<tr>\n";
|
|
echo "<td id=\"item1\" bgcolor=\"#FFFFFF\" onMouseOver=\"this.style.backgroundColor='#EFEFEF'\" onMouseOut=\"this.style.backgroundColor='#FFFFFF'\"><p id='link1' style='cursor:pointer;height:8px;' onclick=''> " . _("Open link in new window") . "</p></td>\n";
|
|
echo "</tr>\n";
|
|
echo "<tr>\n";
|
|
echo "<td id=\"item2\" bgcolor=\"#FFFFFF\" onMouseOver=\"this.style.backgroundColor='#EFEFEF'\" onMouseOut=\"this.style.backgroundColor='#FFFFFF'\"><p id='link2' style='cursor:pointer;height:8px;' onclick=''> " . _("Open link in new tab") . "</p></td>\n";
|
|
echo "</tr>\n";
|
|
}
|
|
else {
|
|
echo "<tr>\n";
|
|
echo "<td id=\"item1\" bgcolor=\"#FFFFFF\" height=\"18\" onMouseOver=\"this.style.backgroundColor='#EFEFEF'\" onMouseOut=\"this.style.backgroundColor='#FFFFFF'\"><p id='link1' style='cursor:pointer;height:8px;' onclick=''> " . _("Open link in new tab/window") . "</p></td>\n";
|
|
echo "</tr>\n";
|
|
}
|
|
echo "</table>\n";
|
|
echo "</td></tr>\n";
|
|
echo "</table>\n";
|
|
echo "</div>\n";
|
|
}
|
|
|
|
echo "</div>\n"; // id="content_xmlhttp"
|
|
echo "</div>\n"; // id="content_table_col1"
|
|
echo "</div>\n"; // id="content_table"
|
|
echo "</div>\n\n"; // id="content"
|
|
|
|
if ((!isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) {
|
|
echo "<!-- Footer template -->\n";
|
|
echo "<div id=\"footer_container\">\n";
|
|
echo "<div id=\"footer\">\n";
|
|
// Get footer blocks (max 4 blocks)
|
|
for ($i=0; $i < 4; $i++) {
|
|
// Default block name
|
|
$block = $_PAGE_INFO['ini']["footer" . $i];
|
|
|
|
// Check for i18n block name
|
|
if (isset($_PAGE_INFO['ini']["footer" . $i . "_" . $_SESSION[$_PAGE_INFO['id']]['i18n']])) {
|
|
$block = $_PAGE_INFO['ini']["footer" . $i . "_" . $_SESSION[$_PAGE_INFO['id']]['i18n']];
|
|
}
|
|
|
|
if (isset($block)) {
|
|
echo "<div class=\"block\">\n";
|
|
|
|
$found = TRUE;
|
|
$count = 0;
|
|
do {
|
|
// Check if line exists
|
|
$found = (isset($block["line" . $count])) ? $found : FALSE;
|
|
|
|
if ($found) {
|
|
if (!$count) {
|
|
echo "<h3>";
|
|
}
|
|
|
|
// Search for extra actions (hyperlinks/images/etc.)?
|
|
$footer_value = explode(";", $block["line" . $count]);
|
|
|
|
if (isset($footer_value[1])) {
|
|
switch(trim(strtolower($footer_value[1]))) {
|
|
case "newsletter":
|
|
echo "<input type=\"text\" id=\"footer_email_input\" name=\"email\" value=\"" . _("email") . " " . strtolower(_("Adres")) . "\" onFocus=\"javascript:getElement('email').value = '';\">";
|
|
echo "<a href=\"#\" id=\"footer_button\" ";
|
|
echo "onClick=\"javascript:xmlhttp_data('include/set_info.php','', 0,'" . $_SESSION[$_PAGE_INFO['id']]['base'] . "','" . $_PAGE_INFO['id'] . "',";
|
|
echo "'&newsletter=1&footerblock=" . $i . "&email=' + getElement('email').value); getElement('email').value='" . _("email") . " " . strtolower(_("Adres")) . "'; return false;\">>></a><br>";
|
|
break;
|
|
case "hyper_button":
|
|
echo "<a target=\"_blank\" id=\"footer_button\" href=\"" . $footer_value[2] . "\">";
|
|
echo utf8_encode($footer_value[0]);
|
|
echo "</a><br>";
|
|
break;
|
|
case "hyper_twitter":
|
|
echo "<a target=\"_blank\" href=\"" . $footer_value[2] . "\">";
|
|
echo utf8_encode($footer_value[0]);
|
|
echo "</a>";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<span style=\"display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" . IMAGE_DIR . "twit-bird.png');\">";
|
|
echo "<![endif]-->";
|
|
echo "<span>";
|
|
echo "<img id=\"twit-bird\" src='" . IMAGE_DIR . "twit-bird.png' alt=\"twitter\">";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "</span>";
|
|
echo "<![endif]-->";
|
|
echo "</span><br>";
|
|
break;
|
|
case "hyper":
|
|
echo "<a target=\"_blank\" href=\"" . $footer_value[2] . "\">";
|
|
echo utf8_encode($footer_value[0]);
|
|
echo "</a><br>";
|
|
break;
|
|
case "last_tweets":
|
|
// To be sure the twitter functionality is available
|
|
require_once("twitter.php");
|
|
$timeline = TwitterPublicTimeline(trim($footer_value[2]));
|
|
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<span style=\"display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" . IMAGE_DIR . "twitter-block.png');\">";
|
|
echo "<![endif]-->";
|
|
echo "<div class=\"container-tweet\">";
|
|
echo "</div>";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "</span>";
|
|
echo "<![endif]-->";
|
|
|
|
echo "<div class=\"tweet\">";
|
|
if (is_array($timeline)) {
|
|
echo "<ul class=\"tweet_list\" style=\"margin-top:0px;\">";
|
|
echo "<div id=\"all_tweets\" style=\"margin-top:0px;\">";
|
|
foreach($timeline as $item) {
|
|
echo "<li style=\"display:list-item;\">";
|
|
echo $item['user'] . ": " . $item['text'];
|
|
echo "</li>";
|
|
}
|
|
echo "</div>";
|
|
echo "</ul>";
|
|
}
|
|
echo "</div>";
|
|
|
|
if (sizeof($timeline) > 1) {
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "function tweet_plugin(step) {";
|
|
echo "switch(step) {";
|
|
echo "case 0:";
|
|
echo "case 1:";
|
|
echo "case 2:";
|
|
echo "getElement(\"all_tweets\").style.marginTop = parseInt(getElement(\"all_tweets\").style.marginTop) - 10 + 'px';";
|
|
echo "step++; delay = 100;";
|
|
echo "break;";
|
|
echo "case 3:";
|
|
echo "var index = getElement(\"all_tweets\").innerHTML.toLowerCase().search('</li>');";
|
|
echo "if (index != -1) {";
|
|
echo "var old_element = getElement(\"all_tweets\").innerHTML.substring(0, index + '</li>'.length);";
|
|
echo "getElement(\"all_tweets\").innerHTML = getElement(\"all_tweets\").innerHTML.substring(index + '</li>'.length) + old_element;";
|
|
echo "getElement(\"all_tweets\").style.marginTop = 0 + 'px'";
|
|
echo "}";
|
|
echo "step = 0; delay = 5000;";
|
|
echo "default:";
|
|
echo "break;";
|
|
echo "}";
|
|
echo "setTimeout('tweet_plugin(' + step + ');',delay);";
|
|
echo "}";
|
|
echo "setTimeout('tweet_plugin(0);','5000');";
|
|
echo "</script>\n";
|
|
}
|
|
break;
|
|
case "media_icons":
|
|
// Initial values
|
|
$icons_found = TRUE;
|
|
$icons_count = 0;
|
|
echo "<div id=\"social_media_spacer\">";
|
|
do {
|
|
$icons_found = (isset($footer_value[2 + $icons_count])) ? $icons_found : FALSE;
|
|
|
|
if ($icons_found) {
|
|
switch(trim(strtolower($footer_value[2 + $icons_count]))) {
|
|
case "facebook":
|
|
echo "<a target=\"_blank\" href=\"" . $footer_value[3 + $icons_count] . "\">";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<span style=\"display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" . IMAGE_DIR . "icon_facebook.png');\">";
|
|
echo "<![endif]-->";
|
|
echo "<img class=\"social_media_icons\" id=\"social_media_icons\" alt=\"facebook\" src='" . IMAGE_DIR . "icon_facebook.png'>";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "</span>";
|
|
echo "<![endif]-->";
|
|
echo "</a>";
|
|
break;
|
|
case "linked_in":
|
|
echo "<a target=\"_blank\" href=\"" . $footer_value[3 + $icons_count] . "\">";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<span style=\"display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" . IMAGE_DIR . "icon_linkedin.png');\">";
|
|
echo "<![endif]-->";
|
|
echo "<img class=\"social_media_icons\" alt=\"linked-in\" src='" . IMAGE_DIR . "icon_linkedin.png'>";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "</span>";
|
|
echo "<![endif]-->";
|
|
echo "</a>";
|
|
break;
|
|
case "youtube":
|
|
echo "<a target=\"_blank\" href=\"" . $footer_value[3 + $icons_count] . "\">";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "<span style=\"display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" . IMAGE_DIR . "icon_youtube.png');\">";
|
|
echo "<![endif]-->";
|
|
echo "<img class=\"social_media_icons\" alt=\"youtube\" src='" . IMAGE_DIR . "icon_youtube.png'>";
|
|
echo "<!--[if lte IE 6]>";
|
|
echo "</span>";
|
|
echo "<![endif]-->";
|
|
echo "</a>";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
// Increment icon counter
|
|
$icons_count++;
|
|
} while ($icons_found);
|
|
echo "</div>";
|
|
break;
|
|
default:
|
|
echo utf8_encode($footer_value[0]) . "<br>";
|
|
break;
|
|
}
|
|
}
|
|
else {
|
|
echo utf8_encode($footer_value[0]) . "<br>";
|
|
}
|
|
|
|
if (!$count) {
|
|
echo "</h3>";
|
|
}
|
|
}
|
|
|
|
// Increment line counter
|
|
$count++;
|
|
} while ($found);
|
|
echo "</div>\n";
|
|
}
|
|
}
|
|
echo "</div>\n";
|
|
echo "</div>\n\n";
|
|
}
|
|
|
|
// Define extended view div height (content div)
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) {
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "ContentSize()";
|
|
echo "</script>\n";
|
|
}
|
|
|
|
// Display error alert/confirm message?
|
|
echo "<div id=\"error\">\n";
|
|
echo "</div>\n";
|
|
|
|
// Project & Right checker (recursive funtion, only the parent!)
|
|
if ((isset($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'])) && (!isset($_SESSION[$_PAGE_INFO['id']]['extended_menu']))) {
|
|
// Project defined?
|
|
$project = (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) ? "&project=" . $_SESSION[$_PAGE_INFO['id']]['login']['project']['id'] : "";
|
|
$csrf_token = csrf_create_token("status_check");
|
|
echo "<script type=\"text/javascript\">";
|
|
echo "var func_right_checker = function (result) {\n";
|
|
echo "if (result == 'green') { getElement('greenled').style.visibility = 'visible'; getElement('redled').style.visibility = 'hidden'; }";
|
|
echo "else { getElement('greenled').style.visibility = 'hidden'; getElement('redled').style.visibility = 'visible'; }";
|
|
echo "setTimeout('xmlhttp_data(\"include/fetch_info.php\", \"\", 1,\"" . $_SESSION[$_PAGE_INFO['id']]['base'] . "\",\"" . $_PAGE_INFO['id'] . "\",\"&check_rights=1&__csrf_token__=" . $csrf_token . "\", \"&user=" . $_SESSION[$_PAGE_INFO['id']]['login']['user']['id'] . $project . "\", func_right_checker)','5000');\n";
|
|
echo "}\n";
|
|
echo "setTimeout('xmlhttp_data(\"include/fetch_info.php\", \"\", 1,\"" . $_SESSION[$_PAGE_INFO['id']]['base'] . "\",\"" . $_PAGE_INFO['id'] . "\",\"&check_rights=1&__csrf_token__=" . $csrf_token . "\", \"&user=" . $_SESSION[$_PAGE_INFO['id']]['login']['user']['id'] . $project . "\", func_right_checker)','5000');\n";
|
|
echo "</script>";
|
|
}
|
|
|
|
// Display debug info
|
|
if (!isset($_SESSION[$_PAGE_INFO['id']]['extended_view'])) {
|
|
echo "<div id=\"debug\">\n";
|
|
include("include/debug_info.php");
|
|
echo "</div>\n";
|
|
}
|
|
|
|
// Include errormessage
|
|
include("include/errormsg.php");
|
|
|
|
echo "</body>\n\n";
|
|
|
|
echo "</html>\n";
|
|
}
|
|
|
|
|
|
/**
|
|
* Verify Rights (login), valid project (when req) and log page
|
|
*
|
|
* Inputs:
|
|
* - rights Rights needed for current page
|
|
* - menu menu name which will be logged in db
|
|
* - log_info extra db log info (optional)
|
|
*
|
|
* Return: 1 (ok)/0 (false)
|
|
*/
|
|
function Ver_Rights_Project_Log($rights, $menu = "", $log_info = "") {
|
|
GLOBAL $_PAGE_INFO;
|
|
|
|
// Initial return value
|
|
$result = 0;
|
|
|
|
// Verify "login" rights and check if user is allowed at this time (begin/end date)!
|
|
if (db_ver_right_user($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "login")) {
|
|
// Verify if the user is still on the selected project and check if the project is still running
|
|
if (isset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'])) {
|
|
$valid_project = 0;
|
|
$row_users = db_fetch_project_users($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", array("normaal","wbu","wbv"));
|
|
|
|
if (is_array($row_users)) {
|
|
foreach ($row_users as $row_user) {
|
|
if ($row_user['id'] == $_SESSION[$_PAGE_INFO['id']]['login']['user']['id']) {
|
|
$valid_project = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($valid_project) {
|
|
// Retrieve project info
|
|
$row_project = db_fetch_project($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", 1);
|
|
|
|
// Check for non-closed projects
|
|
// normal project => planning status must be finished
|
|
// rc project => planning and design status must be validated and the project must be released
|
|
// App => Also show projects which are ready for release
|
|
if (($row_project['status'] == "afgesloten") ||
|
|
((($row_project['type'] == "normaal") && ($row_project['pstatus'] != "gereed")) ||
|
|
(($row_project['type'] == "rc") && (($row_project['pstatus'] != "gevalideerd") || ($row_project['ostatus'] != "gevalideerd") || ($row_project['sstatus'] != "vrijgegeven"))))) {
|
|
//(($row_project['sstatus'] != "vrijgegeven") && (!is_dev("APP"))))))) {
|
|
$valid_project = 0;
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
// No project selected
|
|
$valid_project = 1;
|
|
}
|
|
|
|
if ($valid_project) {
|
|
// Verify rights for current menu
|
|
if ((empty($rights)) || ($rights == "login") || (db_ver_rights_user_one_valid($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], $rights))) {
|
|
// Valid
|
|
$result = 1;
|
|
|
|
// Get link
|
|
$href = (isset($_GET['action'])) ? $_GET['href'] . "&action=" . $_GET['action'] : $_GET['href'];
|
|
$href .= (isset($_GET['page_project'])) ? "&page_project=" . $_GET['page_project'] : "";
|
|
|
|
// Log action to db?
|
|
if (($_SESSION[$_PAGE_INFO['id']]['href_history'] != $href) && (strlen($menu))) {
|
|
// Log data
|
|
if (is_array($log_info)) {
|
|
switch($log_info['table']) {
|
|
case "log_gebruiker_project":
|
|
$_PAGE_INFO['user_log_id'] = db_log_user_project($log_info['project_id'], $menu, $log_info['log_info']);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
else {
|
|
$_PAGE_INFO['user_log_id'] = db_log_user($menu, $log_info);
|
|
}
|
|
|
|
// Store var (help function)
|
|
$_SESSION[$_PAGE_INFO['id']]['MTinfo_menu'] = $menu;
|
|
}
|
|
|
|
// href changed? => Store old value!
|
|
if ($_SESSION[$_PAGE_INFO['id']]['href_history'] != $href) {
|
|
store_history($href);
|
|
}
|
|
}
|
|
else {
|
|
// Redirect page back to login page
|
|
$_SESSION[$_PAGE_INFO['id']]['login_info']['errormsg'] = "No user rights";
|
|
$_SESSION[$_PAGE_INFO['id']]['login_info']['username'] = $_SESSION[$_PAGE_INFO['id']]['login']['user']['name'];
|
|
$_SESSION[$_PAGE_INFO['id']]['login_info']['customer'] = $_SESSION[$_PAGE_INFO['id']]['login']['customer']['name'];
|
|
header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=" . PAGE_LOGIN . "");
|
|
}
|
|
}
|
|
else {
|
|
// Redirect page back to login page
|
|
$_SESSION[$_PAGE_INFO['id']]['login_info']['errormsg'] = "No valid project";
|
|
$_SESSION[$_PAGE_INFO['id']]['login_info']['username'] = $_SESSION[$_PAGE_INFO['id']]['login']['user']['name'];
|
|
$_SESSION[$_PAGE_INFO['id']]['login_info']['customer'] = $_SESSION[$_PAGE_INFO['id']]['login']['customer']['name'];
|
|
header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=" . PAGE_LOGIN . "");
|
|
}
|
|
}
|
|
else {
|
|
// Redirect page back to login page
|
|
$_SESSION[$_PAGE_INFO['id']]['login_info']['errormsg'] = "Account has been blocked";
|
|
$_SESSION[$_PAGE_INFO['id']]['login_info']['username'] = $_SESSION[$_PAGE_INFO['id']]['login']['user']['name'];
|
|
$_SESSION[$_PAGE_INFO['id']]['login_info']['customer'] = $_SESSION[$_PAGE_INFO['id']]['login']['customer']['name'];
|
|
header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=" . PAGE_LOGIN . "");
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
?>
|