Updating more of the preferences

This commit is contained in:
jengo 2000-10-12 18:18:03 +00:00
parent b900c632b7
commit d9abb263a5
9 changed files with 32 additions and 215 deletions

View File

@ -44,22 +44,22 @@
if (! $error) {
$phpgw->db->lock(array("accounts","preferences"));
$phpgw->common->preferences_add($n_loginid,"maxmatchs","15");
$phpgw->common->preferences_add($n_loginid,"theme","default");
$phpgw->common->preferences_add($n_loginid,"tz_offset","0");
$phpgw->common->preferences_add($n_loginid,"dateformat","m/d/Y");
$phpgw->common->preferences_add($n_loginid,"timeformat","12");
$phpgw->common->preferences_add($n_loginid,"lang","en");
$phpgw->common->preferences_add($n_loginid,"addressbook_view_company","True");
$phpgw->common->preferences_add($n_loginid,"addressbook_view_lastname","True");
$phpgw->common->preferences_add($n_loginid,"addressbook_view_firstname","True");
$phpgw->common->preferences_add($n_loginid,"maxmatchs","15","common");
$phpgw->common->preferences_add($n_loginid,"theme","default","common");
$phpgw->common->preferences_add($n_loginid,"tz_offset","0","common");
$phpgw->common->preferences_add($n_loginid,"dateformat","m/d/Y","common");
$phpgw->common->preferences_add($n_loginid,"timeformat","12","common");
$phpgw->common->preferences_add($n_loginid,"lang","en","common");
$phpgw->common->preferences_add($n_loginid,"company","True","addressbook");
$phpgw->common->preferences_add($n_loginid,"lastname","True","addressbook");
$phpgw->common->preferences_add($n_loginid,"firstname","True","addressbook");
// Even if they don't have access to the calendar, we will add these.
// Its better then the calendar being all messed up, they will be deleted
// the next time the update there preferences.
$phpgw->common->preferences_add($n_loginid,"weekstarts","Monday");
$phpgw->common->preferences_add($n_loginid,"workdaystarts","9");
$phpgw->common->preferences_add($n_loginid,"workdayends","17");
$phpgw->common->preferences_add($n_loginid,"weekstarts","Monday","calendar");
$phpgw->common->preferences_add($n_loginid,"workdaystarts","9","calendar");
$phpgw->common->preferences_add($n_loginid,"workdayends","17","calendar");
while ($permission = each($new_permissions)) {
if ($phpgw_info["apps"][$permission[0]]["enabled"]) {

View File

@ -1,189 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare module (NNTP) *
* http://www.phpgroupware.org *
* Written by Mark Peters <mpeters@satx.rr.com> *
* -------------------------------------------- *
* 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$ */
if ($submit && $nntplist) {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
}
$phpgw_info["flags"]["currentapp"] = "admin";
$phpgw_info["flags"]["disable_network_class"] = True;
$phpgw_info["flags"]["disable_message_class"] = True;
$phpgw_info["flags"]["disable_send_class"] = True;
$phpgw_info["flags"]["disable_vfs_class"] = True;
include("../header.inc.php");
function get_tg()
{
global $phpgw;
$phpgw->db->query("SELECT count(con) FROM newsgroups");
$phpgw->db->next_record();
return $phpgw->db->f(0);
}
if(!$submit && !$nntplist) {
$t = new Template($phpgw_info["server"]["template_dir"]);
$t->set_file(array( "nntp_header" => "nntp.tpl",
"nntp_list" => "nntp.tpl",
"nntp_footer" => "nntp.tpl" ));
$t->set_block("nntp_header","nntp_list","nntp_footer","output");
if (! $tg)
{
$tg = get_tg();
}
if ($tg == 0)
{
set_time_limit(0);
include($phpgw_info["server"]["include_root"]
. "/../nntp/inc/functions.inc.php");
$nntp = new NNTP;
$nntp->load_table();
$tg = get_tg();
}
if (! $start) $start = 0;
if (! $query_result) $query_result = 0;
$orderby = "";
if ($order)
{
switch ($order)
{
case 1:
$orderby = " ORDER BY CON $sort";
break;
case 2:
$orderby = " ORDER BY NAME $sort";
break;
case 3:
$orderby = " ORDER BY ACTIVE $sort";
break;
}
}
if ($search || $next) {
if ($search)
$query_result = 0;
else
$query_result++;
$phpgw->db->query("SELECT con FROM newsgroups "
."WHERE name LIKE '%$query%'$orderby LIMIT "
.$phpgw->nextmatchs->sql_limit($query_result));
$phpgw->db->next_record();
$start = $phpgw->db->f("con") - 1;
}
$urlname = $phpgw_info["server"]["webserver_url"]."/admin/nntp.php";
$common_hidden_vars = "<input type=\"hidden\" name=\"start\" value=\"".$start."\">\n"
. "<input type=\"hidden\" name=\"stop\" value=\""
. ($start + $phpgw_info["user"]["preferences"]["maxmatchs"])."\">\n"
. "<input type=\"hidden\" name=\"tg\" value=\"".$tg."\">\n"
. "<input type=\"hidden\" name=\"query_result\" value=\"".$query_result."\">\n";
$t->set_var("search_value",$query);
$t->set_var("search",lang("search"));
$t->set_var("next",lang("next"));
$t->set_var("nml",$phpgw->nextmatchs->left($urlname,$start,$tg,
"&tg=$tg&sort=$sort&order=$order"));
$t->set_var("nmr",$phpgw->nextmatchs->right($urlname,$start,$tg,
"&tg=$tg&sort=$sort&order=$order"));
$t->set_var("title",lang("Newsgroups"));
$t->set_var("action_url",$phpgw->link($urlname));
$t->set_var("common_hidden_vars",$common_hidden_vars);
$t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
$t->set_var("th_font",$phpgw_info["theme"]["font"]);
$t->set_var("sort_con",$phpgw->nextmatchs->show_sort_order($sort,"1",$order,$urlname," # ","&tg=$tg"));
$t->set_var("sort_group",$phpgw->nextmatchs->show_sort_order($sort,"2",$order,$urlname,"Group","&tg=$tg"));
$t->set_var("sort_active",$phpgw->nextmatchs->show_sort_order($sort,"3",$order,$urlname," Active ","&tg=$tg"));
$t->parse("out","nntp_header");
if ($phpgw_info["user"]["preferences"]["maxmatchs"] <= $tg - $start)
$totaltodisplay = $phpgw_info["user"]["preferences"]["maxmatchs"];
else
$totaltodisplay = ($tg - $start);
$orderby = "";
if ($order)
{
switch ($order)
{
case 1:
$orderby = " ORDER BY CON $sort";
break;
case 2:
$orderby = " ORDER BY NAME $sort";
break;
case 3:
$orderby = " ORDER BY ACTIVE $sort";
break;
}
}
$phpgw->db->query("SELECT con, name, active FROM newsgroups$orderby LIMIT "
.$phpgw->nextmatchs->sql_limit($start,$totaltodisplay));
for ($i=0;$i<$totaltodisplay;$i++)
{
$phpgw->db->next_record();
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$t->set_var("tr_color",$tr_color);
$con = $phpgw->db->f("con");
$t->set_var("con",$con);
$name = $phpgw->db->f("name");
if (! $name) $name = "&nbsp;";
$group_name = "<a href=\"" . $phpgw->link(
$phpgw_info["server"]["webserver_url"]
."/admin/editnntp.php","con=$con")
. "\">$name</a>";
$t->set_var("group",$group_name);
$active = $phpgw->db->f("active");
if ($active == "Y") $checked = " checked"; else $checked = "";
$active_var = "<input type=\"checkbox\" name=\"nntplist[]\" value=\"$con\"$checked>";
$t->set_var("active",$active_var);
if ($i+1 <> $totaltodisplay)
$t->parse("output","nntp_list",True);
}
$t->set_var("lang_update",lang("update"));
$t->set_var("checkmark",$phpgw_info["server"]["webserver_url"]."/email/images/check.gif");
$t->pparse("out","nntp_footer");
$phpgw->common->phpgw_footer();
} else {
$phpgw->db->lock("newsgroups");
$phpgw->db->query("UPDATE newsgroups SET active='N' WHERE con>=$start AND con<=$stop");
for ($i=0;$i<count($nntplist);$i++)
{
$phpgw->db->query("UPDATE newsgroups SET active='Y' WHERE con=".$nntplist[$i]);
}
$phpgw->db->unlock();
Header("Location: " . $phpgw->link($urlname,"start=$start&tg=$tg"));
}
?>

View File

@ -183,7 +183,7 @@ function validate_and_submit() {
<?php
$h12 = $hour;
$amsel = "CHECKED"; $pmsel = "";
if ($phpgw_info["user"]["preferences"]["timeformat"] == "12") {
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
if ($h12 < 12) {
$amsel = "CHECKED"; $pmsel = "";
} else {
@ -200,7 +200,7 @@ function validate_and_submit() {
echo $h12;?>" MAXLENGTH=2>:<INPUT NAME="minute" SIZE=2 VALUE="<?php
if ($hour > 0) printf ("%02d", $minute); ?>" MAXLENGTH=2>
<?php
if ($phpgw_info["user"]["preferences"]["timeformat"] == "12") {
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
echo "<INPUT TYPE=radio NAME=ampm VALUE=\"am\" $amsel>am\n";
echo "<INPUT TYPE=radio NAME=ampm VALUE=\"pm\" $pmsel>pm\n";
}

View File

@ -63,7 +63,7 @@
// first check for any schedule conflicts
if (strlen($hour) > 0) {
$date = mktime(0,0,0,$month,$day,$year);
if ($phpgw_info["user"]["preferences"]["timeformat"] == "12") {
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
$hour %= 12;
if ($ampm == "pm")
$hour += 12;
@ -131,7 +131,7 @@ if (! $error) {
$date = mktime(0,0,0,$month,$day,$year);
$sql .= date("Ymd", $date) . ", ";
if (strlen($hour) > 0) {
if ($phpgw_info["user"]["preferences"]["timeformat"] == "12") {
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
$hour %= 12;
if ($ampm == "pm")
$hour += 12;

View File

@ -410,7 +410,7 @@
if ($phpgw->db->f(2) == 3)
echo "<font color=\"CC0000\">"; // ***** put into theme
if ($phpgw->db->f(3) > 0) {
if ($phpgw_info["user"]["preferences"]["timeformat"] == "24")
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "24")
printf ("%02d:%02d",$phpgw->db->f(3) / 10000, ($phpgw->db->f(3) / 100) % 100);
else {
$h = ((int)($phpgw->db->f(3) / 10000)) % 12;
@ -443,7 +443,7 @@
global $phpgw, $phpgw_info;
$hour = (int)($time / 10000);
$min = ($time / 100) % 100;
if ($phpgw_info["user"]["preferences"]["timeformat"] == "12") {
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
$ampm = $hour >= 12 ? "pm" : "am";
$hour %= 12;
if ($hour == 0)
@ -554,8 +554,8 @@
$phpgw->db->query($sql);
$hour_arr = Array();
$first_hour = ($phpgw_info["user"]["preferences"]["workdaystarts"] + 1);
$last_hour = ($phpgw_info["user"]["preferences"]["workdayends"] + 1);
$first_hour = ($phpgw_info["user"]["preferences"]["common"]["workdaystarts"] + 1);
$last_hour = ($phpgw_info["user"]["preferences"]["common"]["workdayends"] + 1);
$rowspan_arr = Array();

View File

@ -49,7 +49,7 @@
</tr>
<?php
$t_weekday[$phpgw_info["user"]["preferences"]["weekdaystarts"]] = " selected";
$t_weekday[$phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"]] = " selected";
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
?>
<tr bgcolor="<?php echo $tr_color; ?>">
@ -61,7 +61,7 @@
</select>
</td>
<?php
$t_workdaystarts[$phpgw_info["user"]["preferences"]["workdaystarts"]] = " selected";
$t_workdaystarts[$phpgw_info["user"]["preferences"]["calendar"]["workdaystarts"]] = " selected";
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
?>
<tr bgcolor="<?php echo $tr_color; ?>">
@ -77,7 +77,7 @@
</td>
</tr>
<?php
$t_workdayends[$phpgw_info["user"]["preferences"]["workdayends"]] = " selected";
$t_workdayends[$phpgw_info["user"]["preferences"]["calendar"]["workdayends"]] = " selected";
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
?>
<tr bgcolor="<?php echo $tr_color; ?>">

View File

@ -152,10 +152,10 @@
//$date = $i + ($j * 24 * 3600);
/* $thirsday=$j+24*3600*4;
if ($phpgw_info["user"]["preferences"]["weekdaystarts"] == "Sunday" && $j == 0) {
if ($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] == "Sunday" && $j == 0) {
echo '<font size=-2><a href="' . $phpgw->link("week.php","date=" . date("Ymd",$date)) . '">week ' .(int)((date("z",$thirsday)+7)/7) . '</a></font>';
}
if ($phpgw_info["user"]["preferences"]["weekdaystarts"] == "Monday" && $j == 1) {
if ($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] == "Monday" && $j == 1) {
echo '<font size=-2><a href="' . $phpgw->link("week.php","date=" . date("Ymd",$date)) . '">week ' . (int)((date("z",$thirsday)+7)/7) . '</a></font>';
}*/

View File

@ -12,6 +12,9 @@
- Now ISO 639 compliant with language translation id.
- Applied Patch #101828 - Swedish lang translation. Thanks Kjell Claesson <keyson@users.sourceforge.net>
- Fixed group management with new groups and navbar problems.
- Changed around the way the preferences work. The $phpgw_info array is also handled a little
differently for preferences. It now looks like:
$phpgw_info["user"]["preferences"][appname][preference name]
[0.9.1] - Fixed a few missing variables with templates.
- editing a product in the inventory program now forwards you back to the category

View File

@ -119,5 +119,8 @@
$db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','theme','default','common')");
$db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','tz_offset','0','common')");
$db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','lang','en','common')");
$db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','firstname','True','addressbook')");
$db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','lastname','True','addressbook')");
$db->query("insert into preferences (preference_owner, preference_name, preference_value, preference_appname) values ('demo','company','True','addressbook')");
?>