switched to a new distributed pref and admin which allow add-on apps to have their settings put into the main screens

This commit is contained in:
seek3r 2000-09-23 01:25:17 +00:00
parent f2ccf04753
commit 23950abfe9
4 changed files with 74 additions and 214 deletions

View File

@ -388,14 +388,18 @@ function month_name ( $m ) {
. "WHERE webcal_entry.cal_id = webcal_entry_repeats.cal_id " . "WHERE webcal_entry.cal_id = webcal_entry_repeats.cal_id "
. "AND webcal_entry.cal_id = webcal_entry_user.cal_id " . "AND webcal_entry.cal_id = webcal_entry_user.cal_id "
. "AND webcal_entry_groups.cal_id = webcal_entry.cal_id " . "AND webcal_entry_groups.cal_id = webcal_entry.cal_id "
. "AND (webcal_entry_user.cal_login = '" . $phpgw_info["user"]["userid"] . "' OR (webcal_entry.cal_access='group' AND ("; . "AND (webcal_entry_user.cal_login = '" . $phpgw_info["user"]["userid"] . "' OR (webcal_entry.cal_access='group' ";
$group_names = $phpgw->accounts->read_group_names(); $group_names = $phpgw->accounts->read_group_names();
if ($group_names) {
$sql .= " AND (";
for ($i=0;$i<count($group_names);$i++) { for ($i=0;$i<count($group_names);$i++) {
$sql .= "webcal_entry_groups.groups like '%".$group_names[$i][1]."%'"; $sql .= "webcal_entry_groups.groups like '%".$group_names[$i][1]."%'";
if (count($group_names) != 0 && $i != count($group_names)-1) if (count($group_names) != 0 && $i != count($group_names)-1)
$sql .= " OR "; $sql .= " OR ";
} }
$sql .= "))) AND webcal_entry.cal_type='M'"; $sql .= ")";
}
$sql .= ")) AND webcal_entry.cal_type='M'";
$phpgw->db->query($sql); $phpgw->db->query($sql);

View File

@ -0,0 +1,30 @@
<?php
{
$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("Account Preferences",$img);
// Actual content
echo "<br><a href=\"" . $phpgw->link("changepassword.php") . "\">"
. lang("change your password") . "</a>";
echo "<br><a href=\"" . $phpgw->link("changetheme.php") . "\">"
. lang("select different theme") . "</a>";
echo "<br><a href=\"" . $phpgw->link("settings.php") . "\">"
. lang("change your settings") . "</a>";
echo "<br><a href=\"" . $phpgw->link("changeprofile.php") . "\">"
. lang("change your profile") . "</a>";
section_end();
}
?>

View File

@ -21,17 +21,39 @@
exit; exit;
} }
echo "<br><a href=\"" . $phpgw->link("changepassword.php") . "\">" // This func called by the includes to dump a row header
. lang("change your password") . "</a>"; function section_start($name="",$icon="") {
echo "<br><a href=\"" . $phpgw->link("changetheme.php") . "\">" global $phpgw,$phpgw_info;
. lang("select different theme") . "</a>"; //echo "<TABLE WIDTH=\"75%\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" BGCOLOR=\"".$phpgw_info["theme"]["navbar_bg"]."\">\n";
echo "<br><a href=\"" . $phpgw->link("settings.php") . "\">" echo "<TABLE WIDTH=\"75%\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">\n";
. lang("change your settings") . "</a>"; //echo "<TR BGCOLOR=\"".$phpgw_info["theme"]["navbar_bg"]."\">";
echo "<br><a href=\"" . $phpgw->link("changeprofile.php") . "\">" echo "<TR>";
. lang("change your profile") . "</a>"; if ($icon != "") {
// if ($phpgw_info["user"]["permissions"]["nntp"]) echo "<TD WIDTH='5%'><img src='".$icon."' ALT='[Icon]' align='middle'></TD>";
if ($phpgw_info["user"]["apps"]["nntp"]) echo "<TD><fontsize='+2'>".lang($name)."</font></TD>";
echo "<br><a href=\"" . $phpgw->link("nntp.php") . "\">" } else {
. lang("monitor newsgroups") . "</a>"; echo "<TD colspan='2'><font size='+2'>$name</font></TD>";
}
echo "</TR>\n";
echo "<TR><TD colspan='2'>\n";
}
function section_end() {
echo "</TD></TR></TABLE>\n\n";
}
// The account stuff that should be at the top of the list
$appname = "preferences";
$f = $phpgw_info["server"]["server_root"] . "/" . $appname . "/inc/prefrences.inc.php";
if (file_exists($f)) {
include($f);
}
while (list(,$appname) = each($phpgw_info["user"]["app_perms"])) {
$f = $phpgw_info["server"]["server_root"] . "/" . $appname . "/inc/prefrences.inc.php";
if (file_exists($f)) {
echo "<p>\n";
include($f);
}
}
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php"); include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");

View File

@ -1,196 +0,0 @@
<?php
/**************************************************************************\
* phpGroupWare - NNTP administration *
* 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"] = "preferences";
include("../header.inc.php");
$phpgw->translation->add_app("nntp");
function get_tg()
{
global $phpgw;
$phpgw->db->query("SELECT count(con) FROM newsgroups WHERE active='Y'");
$phpgw->db->next_record();
return $phpgw->db->f(0);
}
if(!$submit && !$nntplist) {
$phpgw->db->query("SELECT con FROM accounts WHERE loginid='".$phpgw_info["user"]["userid"]."'");
$phpgw->db->next_record();
$usercon = $phpgw->db->f("con");
$urlname = $phpgw_info["server"]["webserver_url"]."/preferences/nntp.php";
$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 (! $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 GROUP $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 name FROM newsgroups WHERE active='Y'$orderby");
$j = 0;
$i = 0;
while($phpgw->db->next_record())
{
if (stristr($phpgw->db->f("name"),$query)) {
if($i==$query_result) {
$start = $j;
break;
} else
$i++;
}
$j++;
}
}
$phpgw->db->query("SELECT con, name FROM newsgroups WHERE active='Y'$orderby LIMIT "
.$phpgw->nextmatchs->sql_limit($start));
while($phpgw->db->next_record())
{
$nntpavailgroups["con"][] = $phpgw->db->f("con");
$nntpavailgroups["name"][] = $phpgw->db->f("name");
}
$first = min($nntpavailgroups["con"]);
$common_hidden_vars = "<input type=\"hidden\" name=\"start\" value=\"".$start."\">\n"
. "<input type=\"hidden\" name=\"first\" value=\"".$first."\">\n"
. "<input type=\"hidden\" name=\"tg\" value=\"".$tg."\">\n"
. "<input type=\"hidden\" name=\"usercon\" value=\"".$usercon."\">\n"
. "<input type=\"hidden\" name=\"order\" value=\"".$order."\">\n"
. "<input type=\"hidden\" name=\"sort\" value=\"".$sort."\">\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");
$phpgw->db->query("select newsgroup from users_newsgroups where owner=$usercon");
while ($phpgw->db->next_record())
{
$found[$phpgw->db->f("newsgroup")] = " checked";
}
for($i=0;$i<count($nntpavailgroups["con"]);$i++)
{
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$t->set_var("tr_color",$tr_color);
$con = $nntpavailgroups["con"][$i];
$t->set_var("con",$con);
if (! $nntpavailgroups["name"][$i]) $nntpavailgroups["name"][$i] = "&nbsp;";
$t->set_var("group",$nntpavailgroups["name"][$i]);
$active_var = "<input type=\"checkbox\" name=\"nntplist[]\" value=\"$con\"".$found[$con].">";
$t->set_var("active",$active_var);
if ($i+1 <> count($nntpavailgroups["con"]))
$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");
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");
} else {
$phpgw->db->lock(array("users_newsgroups","accounts"));
$orderby = "";
if ($order)
{
switch ($order)
{
case 1:
$orderby = " ORDER BY CON $sort";
break;
case 2:
$orderby = " ORDER BY GROUP $sort";
break;
case 3:
$orderby = " ORDER BY ACTIVE $sort";
break;
}
}
$phpgw->db->query("DELETE FROM users_newsgroups WHERE newsgroup>=$first AND owner=$usercon$orderby LIMIT "
.$phpgw->nextmatchs->sql_limit(0));
for ($i=0;$i<count($nntplist);$i++)
{
$phpgw->db->query("INSERT INTO users_newsgroups VALUES($usercon,".$nntplist[$i].")");
}
$phpgw->db->unlock();
Header("Location: " . $phpgw->link($urlname,"start=$start&tg=$tg"));
}
?>