Working on changing all of the preferecnes to work of a new type of array. I added a column for appname

This commit is contained in:
jengo 2000-10-12 17:36:47 +00:00
parent e9039ac2ea
commit 660c80f4e9
9 changed files with 287 additions and 213 deletions

View File

@ -25,7 +25,7 @@
section_start("Address Book",$img);
$pg = $phpgw->link($phpgw_info["server"]["webserver_url"]."/addressbook/preferences.php");
echo "<A href=".$pg.">Select columns to display</A>";
echo "<A href=".$pg.">" . lang("Select columns to display") . "</A>";
section_end();
}

View File

@ -75,16 +75,17 @@
$phpgw->db->query("select count(*) from addressbook where $filtermethod");
$phpgw->db->next_record();
}
if($phpgw_info["apps"]["timetrack"]["enabled"])
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$company_sortorder = "c.company_name";
else
} else {
$company_sortorder = "ab_company";
}
//$phpgw->db->next_record();
if ($phpgw->db->f(0) > $phpgw_info["user"]["preferences"]["maxmatchs"])
if ($phpgw->db->f(0) > $phpgw_info["user"]["preferences"]["common"]["maxmatchs"])
echo "<br>" . lang("showing x - x of x",($start + 1),
($start + $phpgw_info["user"]["preferences"]["maxmatchs"]),$phpgw->db->f(0));
($start + $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]),$phpgw->db->f(0));
else
echo "<br>" . lang("showing x",$phpgw->db->f(0));
?>
@ -97,34 +98,34 @@
<table width=75% border=0 cellspacing=1 cellpadding=3>
<tr bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>">
<?php
if ( $phpgw_info["user"]["preferences"]["addressbook_view_company"] == "True" ) {
if ($phpgw_info["user"]["preferences"]["addressbook"]["company"]) {
echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,$company_sortorder,$order,"index.php",lang("Company Name"));
echo '</font></td>';
}
if ( $phpgw_info["user"]["preferences"]["addressbook_view_lastname"] == "True" ) {
if ($phpgw_info["user"]["preferences"]["addressbook"]["lastname"]) {
echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"ab_lastname",$order,"index.php",
lang("Last Name"));
echo '</font></td>';
}
if ( $phpgw_info["user"]["preferences"]["addressbook_view_firstname"] == "True" ) {
if ($phpgw_info["user"]["preferences"]["addressbook"]["firstname"]) {
echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"ab_firstname",$order,"index.php",
lang("First Name"));
echo '</font></td>';
}
if ( $phpgw_info["user"]["preferences"]["addressbook_view_email"] == "True" ) {
if ($phpgw_info["user"]["preferences"]["addressbook"]["email"]) {
echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"ab_email",$order,"index.php",
lang("Email"));
echo '</font></td>';
}
if ( $phpgw_info["user"]["preferences"]["addressbook_view_wphone"] == "True" ) {
if ($phpgw_info["user"]["preferences"]["addressbook"]["wphone"]) {
echo '<td height="21">';
echo '<font size="-1" face="Arial, Helvetica, sans-serif">';
echo $phpgw->nextmatchs->show_sort_order($sort,"ab_wphone",$order,"index.php",
@ -188,10 +189,11 @@
$firstname = $phpgw->db->f("ab_firstname");
$lastname = $phpgw->db->f("ab_lastname");
$email = $phpgw->db->f("ab_email");
if($phpgw_info["apps"]["timetrack"]["enabled"])
if ($phpgw_info["apps"]["timetrack"]["enabled"]) {
$company = $phpgw->db->f("company_name");
else
} else {
$company = $phpgw->db->f("company");
}
$wphone = $phpgw->db->f("ab_wphone");
$ab_id = $phpgw->db->f("ab_id");
@ -204,31 +206,31 @@
?>
<?php
echo '<tr bgcolor="#'.$tr_color.'";>';
if ( $phpgw_info["user"]["preferences"]["addressbook_view_company"] == 'True' ) {
if ($phpgw_info["user"]["preferences"]["addressbook"]["company"]) {
echo '<td valign=top>';
echo '<font face=Arial, Helvetica, sans-serif size=2>';
echo $company;
echo '</font></td>';
};
if ( $phpgw_info["user"]["preferences"]["addressbook_view_lastname"] == 'True' ) {
if ($phpgw_info["user"]["preferences"]["addressbook"]["lastname"]) {
echo '<td valign=top>';
echo '<font face=Arial, Helvetica, sans-serif size=2>';
echo $lastname;
echo '</font></td>';
};
if ( $phpgw_info["user"]["preferences"]["addressbook_view_firstname"] == 'True' ) {
if ($phpgw_info["user"]["preferences"]["addressbook"]["firstname"]) {
echo '<td valign=top>';
echo '<font face=Arial, Helvetica, sans-serif size=2>';
echo $firstname;
echo '</font></td>';
};
if ( $phpgw_info["user"]["preferences"]["addressbook_view_email"] == 'True' ) {
if ($phpgw_info["user"]["preferences"]["addressbook"]["email"]) {
echo '<td valign=top>';
echo '<font face=Arial, Helvetica, sans-serif size=2>';
echo '<a href="mailto:' . $email . '">' . $email . '</a>';
echo '</font></td>';
};
if ( $phpgw_info["user"]["preferences"]["addressbook_view_wphone"] == 'True' ) {
if ($phpgw_info["user"]["preferences"]["addressbook"]["wphone"]) {
echo '<td valign=top>';
echo '<font face=Arial, Helvetica, sans-serif size=2>';
echo $wphone;

View File

@ -23,7 +23,7 @@
if (! $totalerrors) {
$phpgw->common->preferences_delete("byapp",$phpgw_info["user"]["userid"],"addressbook");
while ($pref = each($ab_selected)) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],$pref[0],"addressbook",$pref[1]);
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],$pref[0],"addressbook","addressbook_" . $pref[1]);
}
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/preferences/index.php"));
}
@ -51,7 +51,7 @@
while (list($col, $descr) = each($abc)) {
$i++; $j++;
echo '<td><input type="checkbox" name="ab_selected[' . $col . ']" value="True"'
. ($phpgw_info["user"]["preferences"][$col]?" checked":"") . '>' . $descr
. ($phpgw_info["user"]["preferences"]["addressbook"][$col]?" checked":"") . '>' . $descr
. '</option></td>';
if ($i ==3) {

View File

@ -16,17 +16,17 @@
exit;
}
if (! $phpgw_info["flags"]["nocalendarfooter"]) {
?>
<BR CLEAR="all">
<HR CLEAR="all">
<FONT SIZE="-1">
<TABLE BORDER=0 WIDTH=100% CELLPADDING=0 CELLSPACING=0>
<FORM ACTION="<?php echo $phpgw->link("index.php"); ?>" method="post" name="SelectMonth">
<TR><TD VALIGN="top" WIDTH=33%><FONT SIZE="-1">
<TR>
<TD VALIGN="top" WIDTH=33%><FONT SIZE="-1">
<B><?php echo lang("Month"); ?>:</B>
<SELECT NAME="date" ONCHANGE="document.SelectMonth.submit()">
<?php
if ($thisyear && $thismonth) {
@ -53,15 +53,11 @@
}
?>
</SELECT>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT>
</FONT></TD>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT></FONT>
</TD>
</FORM>
<FORM ACTION="<?php echo $phpgw->link("week.php"); ?>" method="post" name="SelectWeek">
<TD VALIGN="top" align="center" WIDTH=33%><FONT SIZE="-1">
<B><?php echo lang("Week"); ?>:</B>
<TD VALIGN="top" align="center" WIDTH=33%><FONT SIZE="-1"><B><?php echo lang("Week"); ?>:</B>
<SELECT NAME="date" ONCHANGE="document.SelectWeek.submit()">
<?php
@ -85,8 +81,7 @@
$tsun = $sun + (3600 * 24 * 7 * $i);
$tsat = $tsun + (3600 * 24 * 6);
echo "<OPTION VALUE=\"" . date("Ymd", $tsun) . "\"";
if (date("Ymd", $tsun) <= $thisdate &&
date("Ymd", $tsat) >= $thisdate)
if (date("Ymd", $tsun) <= $thisdate && date("Ymd", $tsat) >= $thisdate)
echo " SELECTED";
echo ">" . lang(date("F",$tsun)) . strftime(" %d", $tsun) . "-"
. lang(date("F",$tsat)) . strftime(" %d", $tsat);
@ -95,8 +90,8 @@
?>
</SELECT>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT>
</FONT></TD>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT></FONT>
</TD>
</FORM>
<FONT SIZE="-1">
@ -128,3 +123,7 @@
</TR>
</TABLE>
<?php
}
?>

View File

@ -1,3 +1,7 @@
<?php
if (! $phpgw_info["flags"]["nocalendarheader"]) {
?>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="2%">
@ -31,3 +35,6 @@
</td>
</tr>
</table>
<?php
}
?>

View File

@ -0,0 +1,32 @@
<?php
/**************************************************************************\
* phpGroupWare - Calendar *
* http://www.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$ */
{
$img = "/" . $appname . "/images/" . $appname .".gif";
if (file_exists($phpgw_info["server"]["server_root"].$img)) {
$img = $phpgw_info["server"]["webserver_url"].$img;
} else {
$img = "/" . $appname . "/images/navbar.gif";
if (file_exists($phpgw_info["server"]["server_root"].$img)) {
$img=$phpgw_info["server"]["webserver_url"].$img;
} else {
$img = "";
}
}
section_start("Calendar",$img);
$pg = $phpgw->link($phpgw_info["server"]["webserver_url"]."/calendar/preferences.php");
echo "<a href=".$pg.">" . lang("Calendar preferences") . "</a>";
section_end();
}
?>

100
calendar/preferences.php Normal file
View File

@ -0,0 +1,100 @@
<?php
/**************************************************************************\
* phpGroupWare - Calendar *
* http://www.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, "currentapp" => "calendar",
"nocalendarheader" => True, "nocalendarfooter" => True);
include("../header.inc.php");
if ($submit) {
$phpgw->common->preferences_delete("byapp",$phpgw_info["user"]["userid"],"calendar");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"weekdaystarts","calendar");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"workdaystarts","calendar");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"workdayends","calendar");
if ($mainscreen_showevents) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showevents","calendar");
}
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/preferences/index.php"));
exit;
}
$phpgw->common->phpgw_header();
$phpgw->common->navbar();
if ($totalerrors) {
echo "<p><center>" . $phpgw->common->error_list($errors) . "</center>";
}
echo "<p><b>" . lang("Calendar preferences") . ":" . "</b><hr><p>";
?>
<form action="<?php echo $phpgw->link(); ?>" method="POST">
<table border="0" align="center" width="50%">
<tr bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>">
<td colspan="2">&nbsp;</td>
</tr>
<?php $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); ?>
<tr bgcolor="<?php echo $tr_color; ?>">
<td><?php echo lang("show high priority events on main screen"); ?> ?</td>
<td align="center"><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_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
?>
<tr bgcolor="<?php echo $tr_color; ?>">
<td><?php echo lang("weekday starts on"); ?></td>
<td align="center">
<select name="weekdaystarts">
<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>
</select>
</td>
<?php
$t_workdaystarts[$phpgw_info["user"]["preferences"]["workdaystarts"]] = " selected";
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
?>
<tr bgcolor="<?php echo $tr_color; ?>">
<td><?php echo lang("work day starts on"); ?></td>
<td align="center">
<select name="workdaystarts">
<?php
for ($i=0; $i<24; $i++)
echo "<option value=\"$i\"" . $t_workdaystarts[$i] . ">"
. $phpgw->common->formattime($i+1,"00") . "</option>";
?>
</select>
</td>
</tr>
<?php
$t_workdayends[$phpgw_info["user"]["preferences"]["workdayends"]] = " selected";
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
?>
<tr bgcolor="<?php echo $tr_color; ?>">
<td><?php echo lang("work day ends on"); ?></td>
<td align="center">
<select name="workdayends">
<?php
for ($i=0; $i<24; $i++) {
echo "<option value=\"$i\"" . $t_workdayends[$i] . ">"
. $phpgw->common->formattime($i+1,"00") . "</option>";
}
?>
</select>
</td>
</tr>
<tr><td align="center"><input type="submit" name="submit" value="<?php echo lang("submit"); ?>"></td></tr>
</table>
</form>
<?php include($phpgw_info["server"]["api_dir"] . "/footer.inc.php"); ?>

View File

@ -12,19 +12,13 @@
/* $Id$ */
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "preferences");
$phpgw_info["flags"]["currentapp"] = "preferences";
include("../header.inc.php");
if ($phpgw_info["user"]["permissions"]["anonymous"]) {
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/"));
exit;
}
if ($ntheme) {
$theme = $ntheme;
$phpgw->common->preferences_update($phpgw_info["user"]["userid"],"theme");
$phpgw->common->preferences_update($phpgw_info["user"]["userid"],"theme","common");
Header("location: " . $phpgw->link("changetheme.php"));
exit;
}

View File

@ -152,58 +152,11 @@
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);
if ($phpgw_info["user"]["apps"]["calendar"]) {
?>
<tr>
<td><?php echo lang("show high priority events on main screen"); ?> ?</td>
<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>
<td><?php echo lang("weekday starts on"); ?></td>
<td>
<select name="weekdaystarts">
<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>
</select>
</td>
<?php
$t_workdaystarts[$phpgw_info["user"]["preferences"]["workdaystarts"]] = " selected";
?>
<tr>
<td><?php echo lang("work day starts on"); ?></td>
<td>
<select name="workdaystarts">
<?php
for ($i=0; $i<24; $i++)
echo "<option value=\"$i\"" . $t_workdaystarts[$i] . ">"
. $phpgw->common->formattime($i+1,"00") . "</option>";
?>
</select>
</td>
</tr>
<?php $t_workdayends[$phpgw_info["user"]["preferences"]["workdayends"]] = " selected"; ?>
<tr>
<td><?php echo lang("work day ends on"); ?></td>
<td>
<select name="workdayends">
<?php
for ($i=0; $i<24; $i++)
echo "<option value=\"$i\"" . $t_workdayends[$i] . ">"
. $phpgw->common->formattime($i+1,"00") . "</option>";
?>
</select>
</td>
</tr>
<tr>
<td><?php echo lang("Default application"); ?></td>
<td><select name="default_app">
<td>
<select name="default_app">
<option value="">&nbsp;</option>
<?php
$db_perms = $phpgw->accounts->read_apps($phpgw_info["user"]["userid"]);
@ -217,7 +170,8 @@
. "</option>";
}
}
?></select></td>
?></select>
</td>
</tr>
<tr>
@ -231,7 +185,7 @@
</td>
</tr>
<?php
}
// }
?>
<tr>
@ -254,54 +208,40 @@
$phpgw->db->lock("preferences");
}
$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");
$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");
if ($navbar_text) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"navbar_text");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"navbar_text","common");
}
if ($phpgw_info["user"]["apps"]["admin"]) {
if ($show_currentusers) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"show_currentusers");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"show_currentusers","common");
}
}
if ($phpgw_info["user"]["apps"]["email"]) {
if ($mainscreen_showmail) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showmail");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showmail","email");
}
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"email_sig");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"email_sig","email");
}
if ($phpgw_info["user"]["apps"]["addressbook"]) {
if ($mainscreen_showbirthdays) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showbirthdays");
}
$abc = get_abc(); # AddressBook Columns
while (list($col, $descr) = each($abc)) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"addressbook_view_".$col);
}
}
if ($phpgw_info["user"]["apps"]["calendar"]) {
$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");
if ($mainscreen_showevents) {
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showevents");
$phpgw->common->preferences_add($phpgw_info["user"]["userid"],"mainscreen_showbirthdays","addressbook");
}
}
$phpgw->db->unlock();
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"]
. "/preferences/"));
Header("Location: " . $phpgw->link("index.php"));
}
$phpgw->common->phpgw_footer();
?>