egroupware_official/preferences/settings.php

248 lines
9.8 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>
2000-10-12 19:56:44 +02:00
<input type="checkbox" name="<?php echo $option; ?>" value="True"<?php if ($phpgw_info["user"]["preferences"]["common"][$option]) echo " checked"; ?>>
2000-08-18 05:24:22 +02:00
</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>
2000-10-12 19:56:44 +02:00
<textarea name="email_sig" rows="3" cols="30"><?php echo $phpgw_info["user"]["preferences"]["common"]["email_sig"]; ?></textarea>
2000-08-18 05:24:22 +02:00
</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
2000-10-12 19:56:44 +02:00
echo $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]; ?>" size="2">
2000-08-18 05:24:22 +02:00
</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
2000-10-12 19:56:44 +02:00
if ($phpgw_info["user"]["preferences"]["common"]["navbar_text"])
2000-08-18 05:24:22 +02:00
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\"";
2000-10-12 19:56:44 +02:00
if ($i == $phpgw_info["user"]["preferences"]["common"]["tz_offset"])
2000-08-18 05:24:22 +02:00
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>
2000-10-12 19:56:44 +02:00
<?php $df[$phpgw_info["user"]["preferences"]["common"]["dateformat"]] = " selected"; ?>
2000-08-18 05:24:22 +02:00
<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
2000-10-12 19:56:44 +02:00
$timeformat_select[$phpgw_info["user"]["preferences"]["common"]["timeformat"]] = " selected";
2000-08-18 05:24:22 +02:00
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>
2000-10-12 19:56:44 +02:00
<?php $lang_select[$phpgw_info["user"]["preferences"]["common"]["lang"]] = " selected"; ?>
2000-08-18 05:24:22 +02:00
<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-10 22:11:12 +02:00
<option value="da"<?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-10 22:11:12 +02:00
<option value="ko"<?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-10-10 22:11:12 +02:00
<option value="sv"<?php echo $lang_select["sv"]; ?>>Swedish</option>
2000-08-18 05:24:22 +02:00
</select>
</td>
</tr>
<?php
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);
?>
<tr>
<td><?php echo lang("Default application"); ?></td>
<td>
<select name="default_app">
<option value="">&nbsp;</option>
<?php
$db_perms = $phpgw->accounts->read_apps($phpgw_info["user"]["userid"]);
while ($permission = each($db_perms)) {
if ($phpgw_info["apps"][$permission[0]]["enabled"]) {
2000-08-18 05:24:22 +02:00
echo "<option value=\"" . $permission[0] . "\"";
2000-10-12 19:56:44 +02:00
if ($phpgw_info["user"]["preferences"]["common"]["default_app"] == $permission[0]) {
2000-08-18 05:24:22 +02:00
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>
<td><?php echo lang("Default sorting order"); ?></td>
2000-08-18 05:24:22 +02:00
<td><?php
2000-10-12 19:56:44 +02:00
$default_order_display[$phpgw_info["user"]["preferences"]["common"]["default_sorting"]] = " selected"; ?>
2000-08-18 05:24:22 +02:00
<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-08-18 05:24:22 +02:00
?>
<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 {
2000-10-12 19:56:44 +02:00
$phpgw->common->preferences_delete("byappnotheme",$phpgw_info["user"]["userid"],"common");
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");
}
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"maxmatchs","common");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"tz_offset","common");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"dateformat","common");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"timeformat","common");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"lang","common");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"default_sorting","common");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"default_app","common");
2000-08-18 05:24:22 +02:00
if ($navbar_text) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"navbar_text","common");
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) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"show_currentusers","common");
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) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showmail","email");
2000-08-18 05:24:22 +02:00
}
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"email_sig","email");
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) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showbirthdays","addressbook");
2000-08-18 05:24:22 +02:00
}
}
$phpgw->db->unlock();
Header("Location: " . $phpgw->link("index.php"));
2000-08-18 05:24:22 +02:00
}
$phpgw->common->phpgw_footer();
2000-09-05 08:05:55 +02:00
?>