egroupware/preferences/settings.php

319 lines
13 KiB
PHP
Raw Normal View History

2000-08-18 05:24:22 +02:00
<?php
/**************************************************************************\
* phpGroupWare - preferences *
* http://www.phpgroupware.org *
* This file written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
2000-08-18 05:24:22 +02:00
$phpgw_info["flags"]["currentapp"] = "preferences";
2000-08-18 05:24:22 +02:00
include("../header.inc.php");
if ($phpgw_info["user"]["permissions"]["anonymous"]) {
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/"));
exit;
} else if (! $submit) {
$phpgw->common->phpgw_header();
2000-08-18 05:24:22 +02:00
$phpgw->common->navbar();
}
2000-09-13 00:14:33 +02:00
function display_option($text,$check,$option,$indent) {
2000-08-18 05:24:22 +02:00
global $phpgw, $phpgw_info;
2000-09-05 08:03:15 +02:00
if ($phpgw_info["user"]["apps"][$check]) {
2000-08-18 05:24:22 +02:00
?>
<tr>
<td>
2000-09-13 00:14:33 +02:00
<?php
for ($i=0; $i < $indent; $i++, print '<blockquote>') {};
echo lang($text);
for ($i=0; $i < $indent; $i++, print '</blockquote>') {};
?>
2000-08-18 05:24:22 +02:00
</td>
<td>
<input type="checkbox" name="<?php echo $option; ?>" value="True"<?php if ($phpgw_info["user"]["preferences"][$option]) echo " checked"; ?>>
</td>
</tr>
<?php
if ($check == "email") {
?>
<tr>
<td>
2000-09-07 23:35:30 +02:00
<?php echo lang("email signature"); ?>
2000-08-18 05:24:22 +02:00
</td>
<td>
<textarea name="email_sig" rows="3" cols="30"><?php echo $phpgw_info["user"]["preferences"]["email_sig"]; ?></textarea>
</td>
</tr>
<?php
}
}
}
if (! $submit) {
?>
2000-09-05 04:45:44 +02:00
<form method="POST" action="<?php echo $phpgw->link("settings.php"); ?>">
2000-08-18 05:24:22 +02:00
<table border=0>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("max matchs per page"); ?>: </td>
2000-08-18 05:24:22 +02:00
<td>
<input name="maxmatchs" value="<?php
echo $phpgw_info["user"]["preferences"]["maxmatchs"]; ?>" size="2">
</td>
</tr>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("Show text on navigation icons"); ?>: </td>
2000-08-18 05:24:22 +02:00
<td>
<input type="checkbox" name="navbar_text"<?php
if ($phpgw_info["user"]["preferences"]["navbar_text"])
echo " checked";
; ?>>
</td>
</tr>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("time zone offset"); ?>: </td>
2000-08-18 05:24:22 +02:00
<td>
<select name="tz_offset"><?php
for ($i = -23; $i<24; $i++) {
echo "<option value=\"$i\"";
if ($i == $phpgw_info["user"]["preferences"]["tz_offset"])
echo " selected";
if ($i < 1)
echo ">$i</option>\n";
else
echo ">+$i</option>\n";
}
?></select>
2000-09-07 23:35:30 +02:00
<?php echo lang("This server is located in the x timezone",strftime("%Z")); ?>
2000-08-18 05:24:22 +02:00
</td>
</tr>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("date format"); ?>:</td>
2000-08-18 05:24:22 +02:00
<td>
<?php $df[$phpgw_info["user"]["preferences"]["dateformat"]] = " selected"; ?>
<select name="dateformat">
<option value="m/d/Y"<?php echo $df["m/d/Y"]; ?>>m/d/y</option>
<option value="m-d-Y"<?php echo $df["m-d-Y"]; ?>>m-d-y</option>
<option value="m.d.Y"<?php echo $df["m.d.Y"]; ?>>m.d.y</option>
<option value="Y/d/m"<?php echo $df["Y/d/m"]; ?>>y/d/m</option>
<option value="Y-d-m"<?php echo $df["Y-d-m"]; ?>>y-d-m</option>
<option value="Y.d.m"<?php echo $df["Y.d.m"]; ?>>y.d.m</option>
<option value="Y/m/d"<?php echo $df["Y/m/d"]; ?>>y/m/d</option>
<option value="Y-m-d"<?php echo $df["Y-m-d"]; ?>>y-m-d</option>
<option value="Y.m.d"<?php echo $df["Y.m.d"]; ?>>y.m.d</option>
<option value="d/m/Y"<?php echo $df["d/m/Y"]; ?>>d/m/y</option>
<option value="d-m-Y"<?php echo $df["d-m-Y"]; ?>>d-m-y</option>
<option value="d.m.Y"<?php echo $df["d.m.Y"]; ?>>d.m.y</option>
</select>
</td>
</tr>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("time format"); ?>:</td>
2000-08-18 05:24:22 +02:00
<td><?php
$timeformat_select[$phpgw_info["user"]["preferences"]["timeformat"]] = " selected";
echo "<select name=\"timeformat\">"
. "<option value=\"12\"$timeformat_select[12]>12 Hour</option>"
. "<option value=\"24\"$timeformat_select[24]>24 Hour</option>"
. "</select>\n";
?>
</td>
</tr>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("language"); ?></td>
2000-08-18 05:24:22 +02:00
<td>
<?php $lang_select[$phpgw_info["user"]["preferences"]["lang"]] = " selected"; ?>
<select name="lang">
<option value="en"<?php echo $lang_select["en"]; ?>>English</option>
<option value="de"<?php echo $lang_select["de"]; ?>>Deutsch</option>
2000-10-06 22:55:31 +02:00
<option value="dk"<?php echo $lang_select["da"]; ?>>Danish</option>
2000-08-18 05:24:22 +02:00
<option value="sp"<?php echo $lang_select["sp"]; ?>>Spanish</option>
<option value="br"<?php echo $lang_select["br"]; ?>>Brazilian Portuguese</option>
<option value="no"<?php echo $lang_select["no"]; ?>>Norwegien</option>
<option value="it"<?php echo $lang_select["it"]; ?>>Italian</option>
<option value="fr"<?php echo $lang_select["fr"]; ?>>French</option>
<option value="nl"<?php echo $lang_select["nl"]; ?>>Dutch</option>
2000-10-06 22:55:31 +02:00
<option value="kr"<?php echo $lang_select["ko"]; ?>>Korean</option>
2000-10-06 12:02:04 +02:00
<option value="cs"<?php echo $lang_select["cs"]; ?>>Czechoslovakian</option>
2000-08-18 05:24:22 +02:00
</select>
</td>
</tr>
<?php
2000-09-13 00:14:33 +02:00
display_option("show current users on navigation bar","admin","show_currentusers",0);
display_option("show new messages on main screen","email","mainscreen_showmail",0);
display_option("show birthday reminders on main screen","addressbook","mainscreen_showbirthdays",0);
2000-08-18 05:24:22 +02:00
2000-09-05 08:03:15 +02:00
if ($phpgw_info["user"]["apps"]["calendar"]) {
?>
2000-08-18 05:24:22 +02:00
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("show high priority events on main screen"); ?> ?</td>
2000-08-18 05:24:22 +02:00
<td><input type="checkbox" name="mainscreen_showevents" value="Y" <?php if ($phpgw_info["user"]["preferences"]["mainscreen_showevents"] == "Y") echo " checked"; ?>></td>
</tr>
<?php
$t_weekday[$phpgw_info["user"]["preferences"]["weekdaystarts"]] = " selected";
?>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("weekday starts on"); ?></td>
2000-08-18 05:24:22 +02:00
<td>
<select name="weekdaystarts">
2000-09-07 23:35:30 +02:00
<option value="Monday"<?php echo $t_weekday["monday"]; ?>><?php echo lang("monday"); ?></option>
<option value="Sunday"<?php echo $t_weekday["sunday"]; ?>><?php echo lang("sunday"); ?></option>
2000-08-18 05:24:22 +02:00
</select>
</td>
<?php
$t_workdaystarts[$phpgw_info["user"]["preferences"]["workdaystarts"]] = " selected";
?>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("work day starts on"); ?></td>
2000-08-18 05:24:22 +02:00
<td>
<select name="workdaystarts">
<?php
for ($i=0; $i<24; $i++)
echo "<option value=\"$i\"" . $t_workdaystarts[$i] . ">"
2000-08-30 11:32:08 +02:00
. $phpgw->common->formattime($i+1,"00") . "</option>";
2000-08-18 05:24:22 +02:00
?>
</select>
</td>
</tr>
<?php $t_workdayends[$phpgw_info["user"]["preferences"]["workdayends"]] = " selected"; ?>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("work day ends on"); ?></td>
2000-08-18 05:24:22 +02:00
<td>
<select name="workdayends">
<?php
for ($i=0; $i<24; $i++)
echo "<option value=\"$i\"" . $t_workdayends[$i] . ">"
2000-08-30 11:32:08 +02:00
. $phpgw->common->formattime($i+1,"00") . "</option>";
2000-08-18 05:24:22 +02:00
?>
</select>
</td>
</tr>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("Default application"); ?></td>
2000-09-05 08:03:15 +02:00
<td><select name="default_app">
2000-08-18 05:24:22 +02:00
<option value="">&nbsp;</option>
<?php
2000-09-05 08:03:15 +02:00
$db_perms = $phpgw->accounts->read_apps($phpgw_info["user"]["userid"]);
2000-08-18 05:24:22 +02:00
while ($permission = each($db_perms)) {
if ($phpgw_info["apps"][$permission[0]]["enabled"]) {
echo "<option value=\"" . $permission[0] . "\"";
if ($phpgw_info["user"]["preferences"]["default_app"] == $permission[0]) {
echo " selected";
}
2000-09-07 23:35:30 +02:00
echo ">" . lang($phpgw_info["apps"][$permission[0]]["title"])
2000-08-18 05:24:22 +02:00
. "</option>";
}
}
?></select></td>
</tr>
<tr>
2000-09-07 23:35:30 +02:00
<td><?php echo lang("Default sorting order"); ?></td>
2000-08-18 05:24:22 +02:00
<td><?php
$default_order_display[$phpgw_info["user"]["preferences"]["default_sorting"]] = " selected"; ?>
<select name="default_sorting">
<option value="old_new"<?php echo $default_order_display["old_new"]; ?>>oldest -> newest</option>
<option value="new_old"<?php echo $default_order_display["new_old"]; ?>>newest -> oldest</option>
</select>
</td>
</tr>
<?php
}
2000-09-13 00:14:33 +02:00
if ($phpgw_info["user"]["apps"]["addressbook"]) {
echo "<tr><td>Addressbook columns :</td><tr>";
$abc = get_abc(); # AddressBook Columns
while (list($col, $descr) = each($abc)) {
display_option($descr,"addressbook","addressbook_view_".$col,1);
}
}
2000-08-18 05:24:22 +02:00
2000-09-05 08:03:15 +02:00
if ($phpgw_info["user"]["apps"]["headlines"]) {
2000-08-18 05:24:22 +02:00
?>
<?php
}
?>
<tr>
<td colspan="2" align="center">
2000-09-07 23:35:30 +02:00
<input type="submit" name="submit" value="<?php echo lang("submit"); ?>">
2000-08-18 05:24:22 +02:00
</td>
</tr>
</table>
</form>
2000-08-21 07:47:57 +02:00
2000-08-18 05:24:22 +02:00
<?php
} else {
$phpgw->common->preferences_delete("notheme",$phpgw_info["user"]["userid"]);
2000-08-18 05:24:22 +02:00
// If they don't have permissions to the headlines,
// we don't need to lock the table.
2000-09-07 00:00:41 +02:00
if ($phpgw_info["user"]["apps"]["headlines"]) {
2000-08-18 05:24:22 +02:00
$phpgw->db->lock(array("preferences","users_headlines"));
} else {
$phpgw->db->lock("preferences");
}
2000-09-05 04:45:44 +02:00
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"maxmatchs");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"tz_offset");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"dateformat");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"timeformat");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"lang");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"default_sorting");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"default_app");
2000-08-18 05:24:22 +02:00
if ($navbar_text) {
2000-09-05 04:45:44 +02:00
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"navbar_text");
2000-08-18 05:24:22 +02:00
}
2000-09-07 00:00:41 +02:00
if ($phpgw_info["user"]["apps"]["admin"]) {
2000-08-18 05:24:22 +02:00
if ($show_currentusers) {
2000-09-05 04:45:44 +02:00
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"show_currentusers");
2000-08-18 05:24:22 +02:00
}
}
2000-09-07 00:00:41 +02:00
if ($phpgw_info["user"]["apps"]["email"]) {
2000-08-18 05:24:22 +02:00
if ($mainscreen_showmail) {
2000-09-05 04:45:44 +02:00
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showmail");
2000-08-18 05:24:22 +02:00
}
2000-09-05 04:45:44 +02:00
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"email_sig");
2000-08-18 05:24:22 +02:00
}
2000-09-07 00:00:41 +02:00
if ($phpgw_info["user"]["apps"]["addressbook"]) {
2000-08-18 05:24:22 +02:00
if ($mainscreen_showbirthdays) {
2000-09-05 04:45:44 +02:00
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showbirthdays");
2000-08-18 05:24:22 +02:00
}
2000-09-13 00:14:33 +02:00
$abc = get_abc(); # AddressBook Columns
while (list($col, $descr) = each($abc)) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"addressbook_view_".$col);
}
2000-08-18 05:24:22 +02:00
}
2000-09-07 00:00:41 +02:00
if ($phpgw_info["user"]["apps"]["calendar"]) {
2000-09-05 04:45:44 +02:00
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"weekdaystarts");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"workdaystarts");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"workdayends");
2000-08-18 05:24:22 +02:00
if ($mainscreen_showevents) {
2000-09-05 04:45:44 +02:00
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showevents");
2000-08-18 05:24:22 +02:00
}
}
$phpgw->db->unlock();
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]
. "/preferences/"));
}
$phpgw->common->phpgw_footer();
2000-09-05 08:05:55 +02:00
?>