<?php
require_once ("inc/constants.inc.php");
require_once ("inc/properties.inc.php");
require_once ("inc/tools.inc.php");
require_once ("inc/db.inc.php");
require_once ("inc/i18n.inc.php");
if (!isset($_SESSION['user'])) {
header("Location: ./index.php");
die();
}
/*
* Groups
*/
$listeGroupes = "";
$sql = "SELECT G.*, count(P.id) as nb FROM `group` G LEFT JOIN `person` P ON (P.idgroup = G.id) " .
"WHERE G.iduser = '". $_SESSION['user'] ."'" .
"GROUP BY G.id " .
"ORDER BY G.name";
$result = mysql_query($sql) or die("Error in SQL : " . $sql);
if ($result && mysql_num_rows($result) > 0) {
while ($line = mysql_fetch_assoc($result)) {
$listeGroupes .= "<li><a href=\"#\" onclick=\"return showGroup(". $line["id"] .");\">". htmlentities($line['name']) ."</a> (". (($line['nb'] == '') ? '0' : $line['nb']) .")</li>\r\n";
}
}
/*
* Mailing-lists
*/
$listeMailingLists = "";
$sql = "SELECT M.*, count(C.idcontact) as nb FROM `mailing_list` M LEFT JOIN `mailing_list_contact` C ON (C.idmailinglist = M.id) " .
"WHERE M.iduser = '". $_SESSION['user'] ."'" .
"GROUP BY M.id " .
"ORDER BY M.name";
$result = mysql_query($sql);
if ($result && mysql_num_rows($result) > 0) {
while ($line = mysql_fetch_assoc($result)) {
$listeMailingLists .= "<li><a href=\"#\" onclick=\"return getMailingListToShow(". $line["id"] .");\">". $line['name'] ."</a> (". (($line['nb'] == '') ? '0' : $line['nb']) .")</li>\r\n";
}
}
/*
* Tips
*/
$jsTips = "var tabTips = new Array(";
$lenTips = sizeof($_TIPS);
$iTip = rand(0, ($lenTips - 1));
$sepTip = "";
for ($cTip = 0; $cTip < $lenTips; $cTip++) {
$jsTips .= $sepTip . "\"" . addslashes($_TIPS[$iTip]) . "\"";
$sepTip = ",";
$iTip++;
if ($iTip >= $lenTips)
$iTip = 0;
}
$jsTips .= ");";
/*
* Closed frames
*/
$sql = "SELECT `key` FROM `closed_frame`" .
"WHERE iduser = '". $_SESSION['user'] ."'";
$result = mysql_query($sql);
$closedFrames = array();
if ($result && mysql_num_rows($result) > 0) {
while ($line = mysql_fetch_assoc($result)) {
$closedFrames[$line['key']] = true;
}
}
function getSign($key) {
global $closedFrames;
return (isset($closedFrames[$key])) ? SIGN_SHOW : SIGN_HIDE;
}
function getStyle($key) {
global $closedFrames;
return (isset($closedFrames[$key])) ? " style=\"display: none;\"" : "";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo strtolower($_SESSION['lang']); ?>" lang="<?php echo strtolower($_SESSION['lang']); ?>">
<head>
<title><?php echo APP_TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo ENCODING; ?>" />
<link rel="StyleSheet" type="text/css" href="css/common.css" title="Default" media="screen" />
<link rel="StyleSheet" type="text/css" href="css/print.css" title="Default" media="print" />
<?php require_once("inc/translatedLabels.inc.php");?>
<script src="js/requestor.js" type="text/javascript"></script>
<script src="js/actions.js" type="text/javascript"></script>
<script src="js/actionsAddress.js" type="text/javascript"></script>
<script src="js/actionsContact.js" type="text/javascript"></script>
<script src="js/actionsGroup.js" type="text/javascript"></script>
<script src="js/actionsMailingList.js" type="text/javascript"></script>
<script src="js/actionsPerson.js" type="text/javascript"></script>
<script src="js/html.js" type="text/javascript"></script>
<script src="js/htmlGroup.js" type="text/javascript"></script>
<script src="js/htmlMailingList.js" type="text/javascript"></script>
<script src="js/htmlPerson.js" type="text/javascript"></script>
<script src="js/verif.js" type="text/javascript"></script>
<script src="js/dynamicCombo.js" type="text/javascript"></script>
</head>
<body>
<!-- Header -->
<div id="bandeau">
<h1 id="logo"><?php echo APP_NAME; ?></h1>
<div id="search">
<input type="text" id="searchedText" size="20" maxlength="20"/><input type="button" name="search" value="<?php echo SEARCH_ACTION; ?>" onclick="askSearch(document.getElementById('searchedText'));" />
</div>
<div id="rightItems">
<div id="languageBar">
<a href="?change_language=<?php echo FRENCH; ?>" class="<?php echo $languageStyle[FRENCH]; ?>" title="<?php echo A_FR_TITLE; ?>"><?php echo A_FR; ?></a> |
<a href="?change_language=<?php echo ENGLISH; ?>" class="<?php echo $languageStyle[ENGLISH]; ?>" title="<?php echo A_EN_TITLE; ?>"><?php echo A_EN; ?></a> |
<a href="?change_language=<?php echo GERMAN; ?>" class="<?php echo $languageStyle[GERMAN]; ?>" title="<?php echo A_GE_TITLE; ?>"><?php echo A_GE; ?></a> |
<a href="?change_language=<?php echo SPANISH; ?>" class="<?php echo $languageStyle[SPANISH]; ?>" title="<?php echo A_ES_TITLE; ?>"><?php echo A_ES; ?></a> |
<a href="?change_language=<?php echo ITALIAN; ?>" class="<?php echo $languageStyle[ITALIAN]; ?>" title="<?php echo A_IT_TITLE; ?>"><?php echo A_IT; ?></a> |
<a href="?change_language=<?php echo POLISH; ?>" class="<?php echo $languageStyle[POLISH]; ?>" title="<?php echo A_PL_TITLE; ?>"><?php echo A_PL; ?></a> |
<a href="?change_language=<?php echo CZECH; ?>" class="<?php echo $languageStyle[CZECH]; ?>" title="<?php echo A_CZ_TITLE; ?>"><?php echo A_CZ; ?></a>
</div>
<div id="actionsInterface">
<a href="#" title="<?php echo CLS; ?>" onclick="return clearScreen('<?php echo WELCOME_MESSAGE; ?>');"><?php echo CLS; ?></a> -
<a href="#" onclick="openAll();"><?php echo SHOW; ?></a> / <a href="#" onclick="closeAll();"><?php echo HIDE; ?></a> <?php echo ALL_DETAILS; ?>
</div>
</div>
<div style="clear: both;"></div>
</div>
<!-- Tips zone -->
<div id="divTips">
<span class="showHideCadre"><a href="#" title="<?php echo SHOW . " / " . HIDE; ?>" onclick="return showOrHideFrame(this, 'tips');" /><?php echo getSign('tips'); ?></a></span>
<h3><?php echo TIPS_OF_THE_DAYS; ?></h3>
<div id="tips" <?php echo getStyle('tips'); ?>>
<span id="navTips"> <a href="#" title="<?php echo PREVIOUS_TIP; ?>" onclick="return previousTip();"><</a> | <a href="#" title="<?php echo NEXT_TIP; ?>" onclick="return nextTip();">></a> </span>
<span id="tip"></span>
</div>
</div>
<!-- Left Part -->
<div id="leftPart">
<div class="cadre" id="divActions">
<span class="showHideCadre"><a href="#" title="<?php echo SHOW . " / " . HIDE; ?>" onclick="return showOrHideFrame(this, 'actions');"/><?php echo getSign('actions'); ?></a></span>
<h3><?php echo ACTIONS; ?></h3>
<div id="actions" <?php echo getStyle('actions'); ?>>
<ul>
<li><a href="#" onclick="return getNewPersonForm();"><?php echo ACTION_ADD_NEW_PERSON; ?></a></li>
<li><a href="#" onclick="return getGroupMgtForm()"><?php echo ACTION_GROUP_MANAGEMENT; ?></a></li>
<li><a href="logout.php"><?php echo ACTION_LOG_OUT; ?></a></li>
<li><a href="#" onclick="return getBirthdaysToPrint();"><?php echo ACTION_SHOW_BIRTHDAYS; ?></a></li>
<li><a href="#" onclick="return getNewMailingListForm()"><?php echo ACTION_ADD_MAILING_LIST; ?></a></li>
<li><a href="actions/exportExcel.php"><?php echo ACTION_EXPORT_EXCELL; ?></a></li>
<li><a href="#" onclick="return getPreferencesForm()"><?php echo ACTION_PREFERENCES; ?></a></li>
<li><a href="#" onclick="return getChgPasswdForm()"><?php echo ACTION_CHANGE_PASSWORD; ?></a></li>
</ul>
</div>
</div>
<div class="cadre" id="divListeGroupes">
<span class="showHideCadre"><a href="#" title="<?php echo SHOW . " / " . HIDE; ?>" onclick="return showOrHideFrame(this, 'listeGroupes');"/><?php echo getSign('listeGroupes'); ?></a></span>
<h3><?php echo GROUPS; ?></h3>
<div id="listeGroupes" <?php echo getStyle('listeGroupes'); ?>>
<ul>
<?php echo $listeGroupes; ?>
</ul>
</div>
</div>
<div class="cadre" id="divAnniversaires">
<span class="showHideCadre"><a href="#" title="<?php echo SHOW . " / " . HIDE; ?>" onclick="return showOrHideFrame(this, 'anniversaires');"/><?php echo getSign('anniversaires'); ?></a></span>
<h3><?php echo NEXT_BIRTHDAYS; ?></h3>
<div id="anniversaires" <?php echo getStyle('anniversaires'); ?>>
</div>
</div>
<div class="cadre" id="divListeMailingList">
<span class="showHideCadre"><a href="#" title="<?php echo SHOW . " / " . HIDE; ?>" onclick="return showOrHideFrame(this, 'listeMailingList');"/><?php echo getSign('listeMailingList'); ?></a></span>
<h3><?php echo MAILING_LIST; ?></h3>
<div id="listeMailingList" <?php echo getStyle('listeMailingList'); ?>>
<ul>
<?php echo $listeMailingLists; ?>
</ul>
</div>
</div>
</div>
<!-- Right Part -->
<div class="cadre" id="content"><?php echo WELCOME_MESSAGE; ?></div>
<!-- Debug zone -->
<div id="debug" style="border: 1px solid black;"></div>
<script type="text/javascript">
/*
* Hide the debug zone
*/
document.getElementById("debug").style.display = (debug) ? 'block' : 'none';
/*
* Set focus to searched text field.
*/
document.getElementById("searchedText").focus();
/*
* Updating birthdays zone
*/
getBirthdays();
/*
* Search
*/
function search_onkeypress(evt){
if (window.event) key=window.event.keyCode;
else key=evt.which;
if (key == 13)
askSearch(document.getElementById('searchedText'));
return true;
}
document.getElementById("searchedText").onkeypress = search_onkeypress
/*
* Array of tips
*/
<?php echo $jsTips; ?>
var iTip = 0;
document.getElementById("tip").innerHTML = tabTips[iTip];
/*
* Show the next tip
*/
function nextTip() {
iTip++;
if (iTip == tabTips.length)
iTip = 0;
document.getElementById("tip").innerHTML = tabTips[iTip];
return true;
}
/*
* Show the previous tip
*/
function previousTip() {
iTip--;
if (iTip < 0)
iTip = tabTips.length - 1;
document.getElementById("tip").innerHTML = tabTips[iTip];
return true;
}
</script>
</body>
</html>