Formatting

This commit is contained in:
Miles Lott 2001-05-10 11:21:06 +00:00
parent 8060a2efee
commit f4980ba34e
14 changed files with 668 additions and 567 deletions

View File

@ -19,7 +19,8 @@
{ {
global $phpgw; global $phpgw;
if ($query) { if ($query)
{
$querymethod = " AND (account_firstname LIKE '%$query%' OR account_lastname LIKE " $querymethod = " AND (account_firstname LIKE '%$query%' OR account_lastname LIKE "
. "'%$query%' OR account_lid LIKE '%$query%') "; . "'%$query%' OR account_lid LIKE '%$query%') ";
} }

View File

@ -11,7 +11,7 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"]["currentapp"] = 'admin'; $phpgw_info['flags']['currentapp'] = 'admin';
include('../header.inc.php'); include('../header.inc.php');
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); $t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
@ -22,22 +22,26 @@
$c = CreateObject('phpgwapi.categories'); $c = CreateObject('phpgwapi.categories');
$c->categories($phpgw_info['user']['account_id'],'phpgw'); $c->categories($phpgw_info['user']['account_id'],'phpgw');
if ($submit) { if ($submit)
{
$errorcount = 0; $errorcount = 0;
if (!$cat_name) { $error[$errorcount++] = lang('Please enter a name for that category !'); } if (!$cat_name) { $error[$errorcount++] = lang('Please enter a name for that category !'); }
if (!$error) { if (!$error)
{
if (!$cat_parent) { $exists = $c->exists('mains',$cat_name,$cat_id=''); } if (!$cat_parent) { $exists = $c->exists('mains',$cat_name,$cat_id=''); }
else { $exists = $c->exists('subs',$cat_name,$cat_id=''); } else { $exists = $c->exists('subs',$cat_name,$cat_id=''); }
if ($exists == True) { $error[$errorcount++] = lang('That category name has been used already !'); } if ($exists == True) { $error[$errorcount++] = lang('That category name has been used already !'); }
} }
if ($cat_main && $cat_parent) { if ($cat_main && $cat_parent)
{
$main = $c->return_main($cat_parent); $main = $c->return_main($cat_parent);
if ($main != $cat_main) { $error[$errorcount++] = lang('You selected an invalid main category !'); } if ($main != $cat_main) { $error[$errorcount++] = lang('You selected an invalid main category !'); }
} }
if (! $error) { if (!$error)
{
$cat_name = addslashes($cat_name); $cat_name = addslashes($cat_name);
$cat_description = addslashes($cat_description); $cat_description = addslashes($cat_description);
$cat_access = 'public'; $cat_access = 'public';

View File

@ -12,58 +12,72 @@
/* $Id$ */ /* $Id$ */
$phpgw_info = array(); $phpgw_info = array();
$phpgw_info["flags"] = array("currentapp" => "admin", "enable_nextmatchs_class" => True); $phpgw_info['flags'] = array(
include("../header.inc.php"); 'currentapp' => 'admin',
'enable_nextmatchs_class' => True
);
include('../header.inc.php');
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
$p->set_file(array("list" => "applications.tpl", $p->set_file(array(
"row" => "applications_row.tpl")); 'list' => 'applications.tpl',
'row' => 'applications_row.tpl'
));
if ($order) { if ($order)
{
$ordermethod = "order by $order $sort"; $ordermethod = "order by $order $sort";
} else { }
else
{
$ordermethod = "order by app_title asc"; $ordermethod = "order by app_title asc";
} }
if (! $sort) { if (!$sort)
{
$sort = "desc"; $sort = "desc";
} }
$p->set_var("lang_installed",lang("Installed applications")); $p->set_var('lang_installed',lang('Installed applications'));
$p->set_var("bg_color",$phpgw_info["theme"]["bg_color"]); $p->set_var('bg_color',$phpgw_info['theme']['bg_color']);
$p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); $p->set_var('th_bg',$phpgw_info['theme']['th_bg']);
$p->set_var("sort_title",$phpgw->nextmatchs->show_sort_order($sort,"app_title",$order,"/admin/applications.php",lang("title"))); $p->set_var('sort_title',$phpgw->nextmatchs->show_sort_order($sort,"app_title",$order,"/admin/applications.php",lang('title')));
$p->set_var("lang_edit",lang("Edit")); $p->set_var('lang_edit',lang('Edit'));
$p->set_var("lang_delete",lang("Delete")); $p->set_var('lang_delete',lang('Delete'));
$p->set_var("lang_enabled",lang("Enabled")); $p->set_var('lang_enabled',lang('Enabled'));
$phpgw->db->query("select * from phpgw_applications $ordermethod",__LINE__,__FILE__); $phpgw->db->query("select * from phpgw_applications $ordermethod",__LINE__,__FILE__);
while ($phpgw->db->next_record()) { while ($phpgw->db->next_record())
{
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$name = $phpgw->db->f("app_title"); $name = $phpgw->db->f("app_title");
if (! $phpgw->db->f("app_title")) $name = $phpgw->db->f("app_name"); if (! $phpgw->db->f('app_title')) $name = $phpgw->db->f('app_name');
if (! $name) $name = " "; if (! $name) $name = " ";
$p->set_var("tr_color",$tr_color); $p->set_var('tr_color',$tr_color);
$p->set_var("name",$name); $p->set_var('name',$name);
$p->set_var("edit",'<a href="' . $phpgw->link("/admin/editapplication.php","app_name=" . urlencode($phpgw->db->f("app_name"))) . '"> ' . lang("Edit") . ' </a>'); $p->set_var('edit','<a href="' . $phpgw->link('/admin/editapplication.php','app_name=' . urlencode($phpgw->db->f('app_name'))) . '"> ' . lang('Edit') . ' </a>');
$p->set_var("delete",'<a href="' . $phpgw->link("/admin/deleteapplication.php","app_name=" . urlencode($phpgw->db->f("app_name"))) . '"> ' . lang("Delete") . ' </a>'); $p->set_var('delete','<a href="' . $phpgw->link('/admin/deleteapplication.php','app_name=' . urlencode($phpgw->db->f('app_name'))) . '"> ' . lang('Delete') . ' </a>');
if ($phpgw->db->f("app_enabled") != 0) { if ($phpgw->db->f('app_enabled') != 0)
$status = lang("Yes"); {
} else { $status = lang('Yes');
$status = "<b>" . lang("No") . "</b>";
} }
$p->set_var("status",$status); else
{
$status = "<b>" . lang('No') . "</b>";
}
$p->set_var('status',$status);
$p->parse("rows","row",True); $p->parse('rows','row',True);
} }
$p->set_var("new_action",$phpgw->link("/admin/newapplication.php")); $p->set_var('new_action',$phpgw->link('/admin/newapplication.php'));
$p->set_var("lang_add",lang("add")); $p->set_var('lang_add',lang('add'));
$p->pparse('out','list');
$p->pparse("out","list");
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -11,15 +11,19 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"] = array('currentapp' => 'admin', $phpgw_info['flags'] = array(
'enable_nextmatchs_class' => True); 'currentapp' => 'admin',
'enable_nextmatchs_class' => True
);
include('../header.inc.php'); include('../header.inc.php');
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); $t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
$t->set_file(array('cat_list_t' => 'listcats.tpl', $t->set_file(array(
'cat_list' => 'listcats.tpl')); 'cat_list_t' => 'listcats.tpl',
'cat_list' => 'listcats.tpl'
));
$t->set_block('cat_list_t','cat_list','list'); $t->set_block('cat_list_t','cat_list','list');
$common_hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n" $common_hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n"
@ -39,44 +43,49 @@
if (! $start) { $start = 0; } if (! $start) { $start = 0; }
if($phpgw_info['user']['preferences']['common']['maxmatchs'] && $phpgw_info['user']['preferences']['common']['maxmatchs'] > 0) { if($phpgw_info['user']['preferences']['common']['maxmatchs'] && $phpgw_info['user']['preferences']['common']['maxmatchs'] > 0)
{
$limit = $phpgw_info['user']['preferences']['common']['maxmatchs']; $limit = $phpgw_info['user']['preferences']['common']['maxmatchs'];
} }
else { $limit = 15; } else
{
$limit = 15;
}
$c = CreateObject('phpgwapi.categories'); $c = CreateObject('phpgwapi.categories');
$c->categories($phpgw_info['user']['account_id'],'phpgw'); $c->categories($phpgw_info['user']['account_id'],'phpgw');
$categories = $c->return_array('all',$start,$limit,$query,$sort,$order); $categories = $c->return_array('all',$start,$limit,$query,$sort,$order);
//--------------------------------- nextmatch -------------------------------------------- //--------------------------------- nextmatch --------------------------------------------
$left = $phpgw->nextmatchs->left('/admin/categories.php',$start,$c->total_records); $left = $phpgw->nextmatchs->left('/admin/categories.php',$start,$c->total_records);
$right = $phpgw->nextmatchs->right('/admin/categories.php',$start,$c->total_records); $right = $phpgw->nextmatchs->right('/admin/categories.php',$start,$c->total_records);
$t->set_var('left',$left); $t->set_var('left',$left);
$t->set_var('right',$right); $t->set_var('right',$right);
if ($c->total_records > $limit) { if ($c->total_records > $limit)
$lang_showing=lang("showing x - x of x",($start + 1),($start + $limit),$c->total_records); {
$lang_showing=lang('showing x - x of x',($start + 1),($start + $limit),$c->total_records);
}
else
{
$lang_showing=lang('showing x',$c->total_records);
} }
else { $lang_showing=lang("showing x",$c->total_records); }
$t->set_var('lang_showing',$lang_showing); $t->set_var('lang_showing',$lang_showing);
// ------------------------------ end nextmatch ------------------------------------------ // ------------------------------ end nextmatch ------------------------------------------
//------------------- list header variable template-declarations -------------------------
//------------------- list header variable template-declarations -------------------------
$t->set_var('th_bg',$phpgw_info['theme']['th_bg']); $t->set_var('th_bg',$phpgw_info['theme']['th_bg']);
$t->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,'cat_name',$order,'/admin/categories.php',lang('Name'))); $t->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,'cat_name',$order,'/admin/categories.php',lang('Name')));
$t->set_var('sort_description',$phpgw->nextmatchs->show_sort_order($sort,'cat_description',$order,'/admin/categories.php',lang('Description'))); $t->set_var('sort_description',$phpgw->nextmatchs->show_sort_order($sort,'cat_description',$order,'/admin/categories.php',lang('Description')));
$t->set_var('lang_edit',lang('Edit')); $t->set_var('lang_edit',lang('Edit'));
$t->set_var('lang_delete',lang('Delete')); $t->set_var('lang_delete',lang('Delete'));
// -------------------------- end header declaration --------------------------------------
// -------------------------- end header declaration -------------------------------------- for ($i=0;$i<count($categories);$i++)
{
for ($i=0;$i<count($categories);$i++) { if ($categories[$i]['owner'] == $phpgw_info['user']['account_id'] && $categories[$i]['app_name'] == 'phpgw')
{
if ($categories[$i]['owner'] == $phpgw_info["user"]["account_id"] && $categories[$i]['app_name'] == 'phpgw') {
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$t->set_var(tr_color,$tr_color); $t->set_var(tr_color,$tr_color);
@ -85,45 +94,51 @@
$space = '&nbsp;&nbsp;'; $space = '&nbsp;&nbsp;';
$level = $categories[$i]['level']; $level = $categories[$i]['level'];
if ($level > 0) { if ($level > 0)
{
$spaceset = str_repeat($space,$level); $spaceset = str_repeat($space,$level);
$name = $spaceset . $phpgw->strip_html($categories[$i]['name']); $name = $spaceset . $phpgw->strip_html($categories[$i]['name']);
} }
$descr = $phpgw->strip_html($categories[$i]['description']); $descr = $phpgw->strip_html($categories[$i]['description']);
if (! $descr) { $descr = '&nbsp;'; } if (!$descr) { $descr = '&nbsp;'; }
if ($level == 0) { if ($level == 0)
{
$name = '<font color="FF0000"><b>' . $phpgw->strip_html($categories[$i]['name']) . '</b></font>'; $name = '<font color="FF0000"><b>' . $phpgw->strip_html($categories[$i]['name']) . '</b></font>';
$descr = '<font color="FF0000"><b>' . $descr . '</b></font>'; $descr = '<font color="FF0000"><b>' . $descr . '</b></font>';
} }
//-------------------------- template declaration for list records --------------------------- //-------------------------- template declaration for list records ---------------------------
$t->set_var(array(
'name' => $name,
'descr' => $descr
));
$t->set_var(array('name' => $name, if ($categories[$i]["owner"] == $phpgw_info['user']['account_id'])
'descr' => $descr)); {
if ($categories[$i]["owner"] == $phpgw_info["user"]["account_id"]) {
$t->set_var('edit',$phpgw->link('/admin/editcategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter")); $t->set_var('edit',$phpgw->link('/admin/editcategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
$t->set_var('lang_edit_entry',lang('Edit')); $t->set_var('lang_edit_entry',lang('Edit'));
} }
else { else
{
$t->set_var('edit',''); $t->set_var('edit','');
$t->set_var('lang_edit_entry','&nbsp;'); $t->set_var('lang_edit_entry','&nbsp;');
} }
if ($categories[$i]["owner"] == $phpgw_info["user"]["account_id"]) { if ($categories[$i]["owner"] == $phpgw_info['user']['account_id'])
{
$t->set_var('delete',$phpgw->link('/admin/deletecategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter")); $t->set_var('delete',$phpgw->link('/admin/deletecategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
$t->set_var('lang_delete_entry',lang('Delete')); $t->set_var('lang_delete_entry',lang('Delete'));
} }
else { else
{
$t->set_var('delete',''); $t->set_var('delete','');
$t->set_var('lang_delete_entry','&nbsp;'); $t->set_var('lang_delete_entry','&nbsp;');
} }
$t->parse('list','cat_list',True); $t->parse('list','cat_list',True);
} }
} }
// ---------------------------- end record declaration ----------------------------------------- // ---------------------------- end record declaration -----------------------------------------
$t->parse('out','cat_list_t',True); $t->parse('out','cat_list_t',True);
$t->p('out'); $t->p('out');

View File

@ -15,11 +15,14 @@
if ($delete_account || !$account_id) if ($delete_account || !$account_id)
{ {
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); $phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True
);
} }
$phpgw_info["flags"]["currentapp"] = "admin"; $phpgw_info['flags']['currentapp'] = 'admin';
include("../header.inc.php"); include('../header.inc.php');
// Make sure they are not attempting to delete their own account, or they have cancelled. // Make sure they are not attempting to delete their own account, or they have cancelled.
// If they are, they should not reach this point anyway. // If they are, they should not reach this point anyway.
if($cancel || $phpgw_info['user']['account_id'] == $account_id) if($cancel || $phpgw_info['user']['account_id'] == $account_id)
@ -30,7 +33,7 @@
if ($account_id && !$delete_account) if ($account_id && !$delete_account)
{ {
$phpgw->template->set_file(array("form" => "delete_account.tpl")); $phpgw->template->set_file(array('form' => 'delete_account.tpl'));
$phpgw->template->set_var('form_action',$phpgw->link('/admin/deleteaccount.php')); $phpgw->template->set_var('form_action',$phpgw->link('/admin/deleteaccount.php'));
$phpgw->template->set_var('account_id',$account_id); $phpgw->template->set_var('account_id',$account_id);
@ -51,7 +54,7 @@
$phpgw->template->set_var('new_owner_select',$str); $phpgw->template->set_var('new_owner_select',$str);
$phpgw->template->set_var('cancel',lang('cancel')); $phpgw->template->set_var('cancel',lang('cancel'));
$phpgw->template->set_var('delete',lang('delete')); $phpgw->template->set_var('delete',lang('delete'));
$phpgw->template->pparse("out","form"); $phpgw->template->pparse('out','form');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
} }
@ -90,7 +93,7 @@
$cd = 29; $cd = 29;
} }
Header("Location: " . $phpgw->link("/admin/accounts.php","cd=$cd")); Header("Location: " . $phpgw->link('/admin/accounts.php',"cd=$cd"));
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
?> ?>

View File

@ -11,29 +11,34 @@
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "admin"); $phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'admin'
);
if (! $app_name) { if (! $app_name)
Header("Location: " . $phpgw->link("/admin/applications.php")); {
Header("Location: " . $phpgw->link('/admin/applications.php'));
} }
include("../header.inc.php"); include('../header.inc.php');
$phpgw->template->set_file(array("body" => "delete_common.tpl")); $phpgw->template->set_file(array('body' => 'delete_common.tpl'));
if ($confirm) { if ($confirm)
{
$phpgw->db->query("delete from phpgw_applications where app_name='$app_name'",__LINE__,__FILE__); $phpgw->db->query("delete from phpgw_applications where app_name='$app_name'",__LINE__,__FILE__);
Header("Location: " . $phpgw->link("/admin/applications.php")); Header("Location: " . $phpgw->link('/admin/applications.php'));
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
$phpgw->template->set_var("messages",lang("Are you sure you want to delete this application ?")); $phpgw->template->set_var('messages',lang('Are you sure you want to delete this application ?'));
$phpgw->template->set_var("no",'<a href="' . $phpgw->link("/admin/applications.php") $phpgw->template->set_var('no','<a href="' . $phpgw->link("/admin/applications.php") . '">' . lang('No') . '</a>');
. '">' . lang("No") . '</a>'); $phpgw->template->set_var('yes','<a href="' . $phpgw->link("/admin/deleteapplication.php","app_name=" . urlencode($app_name) . "&confirm=True") . '">' . lang('Yes') . '</a>');
$phpgw->template->set_var("yes",'<a href="' . $phpgw->link("/admin/deleteapplication.php","app_name=" . urlencode($app_name) . "&confirm=True") . '">' . lang("Yes") . '</a>'); $phpgw->template->pparse('out','body');
$phpgw->template->pparse("out","body");
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -11,27 +11,33 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
if ($confirm) { if ($confirm)
$phpgw_info["flags"] = array('noheader' => True, {
'nonavbar' => True); $phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True
);
} }
$phpgw_info["flags"]["currentapp"] = 'admin'; $phpgw_info['flags']['currentapp'] = 'admin';
include('../header.inc.php'); include('../header.inc.php');
$c = CreateObject('phpgwapi.categories'); $c = CreateObject('phpgwapi.categories');
$c->categories($phpgw_info['user']['account_id'],'phpgw'); $c->categories($phpgw_info['user']['account_id'],'phpgw');
if (! $cat_id) { if (! $cat_id)
{
Header('Location: ' . $phpgw->link('/admin/categories.php')); Header('Location: ' . $phpgw->link('/admin/categories.php'));
} }
if ($confirm) { if ($confirm)
{
if ($subs) { $c->delete($cat_id,'True'); } if ($subs) { $c->delete($cat_id,'True'); }
else { $c->delete($cat_id); } else { $c->delete($cat_id); }
Header('Location: ' . $phpgw->link('/admin/categories.php',"start=$start&query=$query&sort=$sort&order=$order&filter=$filter")); Header('Location: ' . $phpgw->link('/admin/categories.php',"start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
} }
else { else
{
$hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n" $hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n"
. "<input type=\"hidden\" name=\"order\" value=\"$order\">\n" . "<input type=\"hidden\" name=\"order\" value=\"$order\">\n"
. "<input type=\"hidden\" name=\"query\" value=\"$query\">\n" . "<input type=\"hidden\" name=\"query\" value=\"$query\">\n"
@ -46,11 +52,13 @@
$exists = $c->exists('subs',$cat_name='',$cat_id); $exists = $c->exists('subs',$cat_name='',$cat_id);
if ($exists==True) { if ($exists==True)
{
$t->set_var('lang_subs',lang('Do you also want to delete all subcategories ?')); $t->set_var('lang_subs',lang('Do you also want to delete all subcategories ?'));
$t->set_var('subs','<input type="checkbox" name="subs" value="True">'); $t->set_var('subs','<input type="checkbox" name="subs" value="True">');
} }
else { else
{
$t->set_var('lang_subs',''); $t->set_var('lang_subs','');
$t->set_var('subs', ''); $t->set_var('subs', '');
} }
@ -64,5 +72,5 @@
$t->pparse('out','category_delete'); $t->pparse('out','category_delete');
} }
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -12,21 +12,32 @@
/* $Id$ */ /* $Id$ */
$phpgw_info = array(); $phpgw_info = array();
$phpgw_info['flags'] = array('noheader' => True, 'nonavbar' => True, 'currentapp' => 'admin'); $phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'admin'
);
if (! $group_id) { if (! $group_id)
{
Header('Location: ' . $phpgw->link('/admin/groups.php')); Header('Location: ' . $phpgw->link('/admin/groups.php'));
} }
include('../header.inc.php'); include('../header.inc.php');
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
$p->set_file(array('body' => 'delete_common.tpl',
'message_row' => 'message_row.tpl'));
if ((($group_id) && ($confirm)) || $removeusers) { $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
if ($removeusers) { $p->set_file(array(
'body' => 'delete_common.tpl',
'message_row' => 'message_row.tpl'
));
if ((($group_id) && ($confirm)) || $removeusers)
{
if ($removeusers)
{
$old_group_list = $phpgw->acl->get_ids_for_location(intval($group_id),1,'phpgw_group'); $old_group_list = $phpgw->acl->get_ids_for_location(intval($group_id),1,'phpgw_group');
@reset($old_group_list); @reset($old_group_list);
while($old_group_list && $id = each($old_group_list)) { while($old_group_list && $id = each($old_group_list))
{
$phpgw->acl->delete_repository('phpgw_group',$group_id,intval($id[1])); $phpgw->acl->delete_repository('phpgw_group',$group_id,intval($id[1]));
} }
} }
@ -34,7 +45,8 @@
$group_name = $phpgw->accounts->id2name($group_id); $group_name = $phpgw->accounts->id2name($group_id);
$old_group_list = $phpgw->acl->get_ids_for_location(intval($group_id),1,'phpgw_group'); $old_group_list = $phpgw->acl->get_ids_for_location(intval($group_id),1,'phpgw_group');
if ($old_group_list) { if ($old_group_list)
{
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
@ -46,7 +58,8 @@
$p->set_var('message_display','<tr><td><table border="0">'); $p->set_var('message_display','<tr><td><table border="0">');
$p->parse('messages','message_row',True); $p->parse('messages','message_row',True);
while (list(,$id) = each($old_group_list)) { while (list(,$id) = each($old_group_list))
{
$p->set_var('message_display','<tr><td><a href="' . $phpgw->link('/admin/editaccount.php','account_=' . $id) . '">' . $phpgw->common->grab_owner_name($id) . '</a></tr></td>'); $p->set_var('message_display','<tr><td><a href="' . $phpgw->link('/admin/editaccount.php','account_=' . $id) . '">' . $phpgw->common->grab_owner_name($id) . '</a></tr></td>');
$p->parse('messages','message_row',True); $p->parse('messages','message_row',True);
} }
@ -59,21 +72,27 @@
$p->pparse('out','body'); $p->pparse('out','body');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} elseif ($removeusers && !$confirm) { }
elseif ($removeusers && !$confirm)
{
Header('Location: ' . $phpgw->link('/admin/deletegroup.php','group_id='.$group_id.'&confirm=True')); Header('Location: ' . $phpgw->link('/admin/deletegroup.php','group_id='.$group_id.'&confirm=True'));
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
if ($confirm) { if ($confirm)
{
$phpgw->db->lock(array('phpgw_accounts','phpgw_acl')); $phpgw->db->lock(array('phpgw_accounts','phpgw_acl'));
$phpgw->db->query('DELETE FROM phpgw_accounts WHERE account_id='.$group_id,__LINE__,__FILE__); $phpgw->db->query('DELETE FROM phpgw_accounts WHERE account_id='.$group_id,__LINE__,__FILE__);
$phpgw->acl->delete_repository('%%','run',intval($group_id)); $phpgw->acl->delete_repository('%%','run',intval($group_id));
$basedir = $phpgw_info['server']['files_dir'] . SEP . 'groups' . SEP; $basedir = $phpgw_info['server']['files_dir'] . SEP . 'groups' . SEP;
if (! @rmdir($basedir . $group_name)) { if (! @rmdir($basedir . $group_name))
{
$cd = 38; $cd = 38;
} else { }
else
{
$cd = 32; $cd = 32;
} }
@ -82,8 +101,9 @@
Header('Location: ' . $phpgw->link('/admin/groups.php','cd='.$cd)); Header('Location: ' . $phpgw->link('/admin/groups.php','cd='.$cd));
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
} else { }
else
{
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();

View File

@ -405,7 +405,7 @@
} }
return; return;
////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
// //
// the old code // the old code
// //

View File

@ -12,63 +12,79 @@
/* $Id$ */ /* $Id$ */
$phpgw_info = array(); $phpgw_info = array();
if ($submit) { if ($submit)
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True); {
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True
);
} }
$phpgw_info["flags"]["currentapp"] = "admin"; $phpgw_info['flags']['currentapp'] = 'admin';
$phpgw_info["flags"]["enable_nextmatchs_class"] = True; $phpgw_info['flags']['enable_nextmatchs_class'] = True;
include("../header.inc.php"); include('../header.inc.php');
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
function display_row($label, $value) function display_row($label, $value)
{ {
global $phpgw,$p; global $phpgw,$p;
$p->set_var("tr_color",$phpgw->nextmatchs->alternate_row_color()); $p->set_var('tr_color',$phpgw->nextmatchs->alternate_row_color());
$p->set_var("label",$label); $p->set_var('label',$label);
$p->set_var("value",$value); $p->set_var('value',$value);
$p->parse("rows","row",True); $p->parse('rows','row',True);
} }
$p->set_file(array( $p->set_file(array(
"form" => "application_form.tpl", 'form' => 'application_form.tpl',
"row" => "application_form_row.tpl" 'row' => 'application_form_row.tpl'
)); ));
if ($submit) { if ($submit)
if (! $app_order) { {
if (! $app_order)
{
$app_order = 0; $app_order = 0;
} }
$totalerrors = 0; $totalerrors = 0;
if (! $n_app_name) if (! $n_app_name)
$error[$totalerrors++] = lang("You must enter an application name."); {
$error[$totalerrors++] = lang('You must enter an application name.');
}
if (! $n_app_title) if (! $n_app_title)
$error[$totalerrors++] = lang("You must enter an application title."); {
$error[$totalerrors++] = lang('You must enter an application title.');
}
if ($old_app_name != $n_app_name) { if ($old_app_name != $n_app_name)
{
$phpgw->db->query("select count(*) from phpgw_applications where app_name='" $phpgw->db->query("select count(*) from phpgw_applications where app_name='"
. addslashes($n_app_name) . "'",__LINE__,__FILE__); . addslashes($n_app_name) . "'",__LINE__,__FILE__);
$phpgw->db->next_record(); $phpgw->db->next_record();
if ($phpgw->db->f(0) != 0) { if ($phpgw->db->f(0) != 0)
$error[$totalerrors++] = lang("That application name already exists."); {
$error[$totalerrors++] = lang('That application name already exists.');
} }
} }
if (! $totalerrors) { if (! $totalerrors)
{
$phpgw->db->query("update phpgw_applications set app_name='" . addslashes($n_app_name) . "'," $phpgw->db->query("update phpgw_applications set app_name='" . addslashes($n_app_name) . "',"
. "app_title='" . addslashes($n_app_title) . "', app_enabled='" . "app_title='" . addslashes($n_app_title) . "', app_enabled='"
. "$n_app_status',app_order='$app_order' where app_name='$old_app_name'",__LINE__,__FILE__); . "$n_app_status',app_order='$app_order' where app_name='$old_app_name'",__LINE__,__FILE__);
if($n_app_anonymous) { if($n_app_anonymous)
{
$phpgw->acl->add_repository($n_app_name,'everywhere',0,PHPGW_ACL_READ); $phpgw->acl->add_repository($n_app_name,'everywhere',0,PHPGW_ACL_READ);
} else { }
else
{
$phpgw->acl->delete_repository($n_app_name,'everywhere',0); $phpgw->acl->delete_repository($n_app_name,'everywhere',0);
} }
@ -76,55 +92,60 @@
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
} }
$phpgw->db->query("select * from phpgw_applications where app_name='$app_name'",__LINE__,__FILE__); $phpgw->db->query("select * from phpgw_applications where app_name='$app_name'",__LINE__,__FILE__);
$phpgw->db->next_record(); $phpgw->db->next_record();
if ($totalerrors) { if ($totalerrors)
{
$phpgw->common->phpgw_header(); $phpgw->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
$p->set_var("error","<p><center>" . $phpgw->common->error_list($error) . "</center><br>"); $p->set_var('error',"<p><center>" . $phpgw->common->error_list($error) . "</center><br>");
} else { }
$p->set_var("error",""); else
{
$p->set_var('error','');
$n_app_name = $phpgw->db->f("app_name"); $n_app_name = $phpgw->db->f('app_name');
$n_app_title = $phpgw->db->f("app_title"); $n_app_title = $phpgw->db->f('app_title');
$n_app_status = $phpgw->db->f("app_enabled"); $n_app_status = $phpgw->db->f('app_enabled');
$old_app_name = $phpgw->db->f("app_name"); $old_app_name = $phpgw->db->f('app_name');
$app_order = $phpgw->db->f("app_order"); $app_order = $phpgw->db->f('app_order');
$n_app_anonymous = $phpgw->acl->check('everywhere', PHPGW_ACL_READ, $n_app_name); $n_app_anonymous = $phpgw->acl->check('everywhere', PHPGW_ACL_READ, $n_app_name);
} }
$p->set_var("lang_header",lang("Edit application")); $p->set_var('lang_header',lang('Edit application'));
$p->set_var("hidden_vars",'<input type="hidden" name="old_app_name" value="' . $old_app_name . '">'); $p->set_var('hidden_vars','<input type="hidden" name="old_app_name" value="' . $old_app_name . '">');
$p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); $p->set_var('th_bg',$phpgw_info['theme']['th_bg']);
$p->set_var("form_action",$phpgw->link("/admin/editapplication.php")); $p->set_var('form_action',$phpgw->link('/admin/editapplication.php'));
display_row(lang("application name"),'<input name="n_app_name" value="' . $n_app_name . '">'); display_row(lang('application name'),'<input name="n_app_name" value="' . $n_app_name . '">');
display_row(lang("application title"),'<input name="n_app_title" value="' . $n_app_title . '">'); display_row(lang('application title'),'<input name="n_app_title" value="' . $n_app_title . '">');
$p->set_var("lang_status",lang("Status")); $p->set_var('lang_status',lang('Status'));
$p->set_var("lang_submit_button",lang("edit")); $p->set_var('lang_submit_button',lang('edit'));
$selected[$n_app_status] = " selected"; $selected[$n_app_status] = " selected";
$status_html = '<option value="0"' . $selected[0] . '>' . lang("Disabled") . '</option>' $status_html = '<option value="0"' . $selected[0] . '>' . lang('Disabled') . '</option>'
. '<option value="1"' . $selected[1] . '>' . lang("Enabled") . '</option>' . '<option value="1"' . $selected[1] . '>' . lang('Enabled') . '</option>'
. '<option value="2"' . $selected[2] . '>' . lang("Enabled - Hidden from navbar") . '</option>'; . '<option value="2"' . $selected[2] . '>' . lang('Enabled - Hidden from navbar') . '</option>';
display_row(lang("Status"),'<select name="n_app_status">' . $status_html . '</select>'); display_row(lang("Status"),'<select name="n_app_status">' . $status_html . '</select>');
display_row(lang("Select which location this app should appear on the navbar, lowest (left) to highest (right)"),'<input name="app_order" value="' . $app_order . '">'); display_row(lang("Select which location this app should appear on the navbar, lowest (left) to highest (right)"),'<input name="app_order" value="' . $app_order . '">');
$str = '<input type="checkbox" name="n_app_anonymous" value="True"'; $str = '<input type="checkbox" name="n_app_anonymous" value="True"';
if ($n_app_anonymous) { if ($n_app_anonymous)
{
$str .= " checked"; $str .= " checked";
} }
$str .= ">"; $str .= ">";
display_row(lang("Allow Anonymous access to this app"),$str); display_row(lang('Allow Anonymous access to this app'),$str);
$p->set_var("select_status",$status_html); $p->set_var('select_status',$status_html);
$p->pparse("out","form"); $p->pparse('out','form');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -11,10 +11,11 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"]["currentapp"] = 'admin'; $phpgw_info['flags']['currentapp'] = 'admin';
include('../header.inc.php'); include('../header.inc.php');
if (! $cat_id) { if (! $cat_id)
{
Header('Location: ' . $phpgw->link('/admin/categories.php',"sort=$sort&order=$order&query=$query&start=$start" Header('Location: ' . $phpgw->link('/admin/categories.php',"sort=$sort&order=$order&query=$query&start=$start"
. "&filter=$filter")); . "&filter=$filter"));
} }
@ -34,18 +35,21 @@
. "<input type=\"hidden\" name=\"filter\" value=\"$filter\">\n" . "<input type=\"hidden\" name=\"filter\" value=\"$filter\">\n"
. "<input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\">\n"; . "<input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\">\n";
if ($submit) { if ($submit)
{
$errorcount = 0; $errorcount = 0;
if (!$cat_name) { $error[$errorcount++] = lang('Please enter a name for that category !'); } if (!$cat_name) { $error[$errorcount++] = lang('Please enter a name for that category !'); }
if (!$error) { if (!$error)
{
if (!$cat_parent) { $exists = $c->exists('mains',$cat_name,$cat_id); } if (!$cat_parent) { $exists = $c->exists('mains',$cat_name,$cat_id); }
else { $exists = $c->exists('subs',$cat_name,$cat_id); } else { $exists = $c->exists('subs',$cat_name,$cat_id); }
if ($exists == True) { $error[$errorcount++] = lang('That category name has been used already !'); } if ($exists == True) { $error[$errorcount++] = lang('That category name has been used already !'); }
} }
if ($cat_main && $cat_parent) { if ($cat_main && $cat_parent)
{
$main = $c->return_main($cat_parent); $main = $c->return_main($cat_parent);
if ($main != $cat_main) { $error[$errorcount++] = lang('You selected an invalid main category !'); } if ($main != $cat_main) { $error[$errorcount++] = lang('You selected an invalid main category !'); }
} }

View File

@ -12,8 +12,11 @@
/* $Id$ */ /* $Id$ */
$phpgw_info = array(); $phpgw_info = array();
$phpgw_info["flags"] = array("currentapp" => "admin", "enable_nextmatchs_class" => True); $phpgw_info['flags'] = array(
include("../header.inc.php"); 'currentapp' => 'admin',
'enable_nextmatchs_class' => True
);
include('../header.inc.php');
function account_total($query) function account_total($query)
{ {
@ -39,15 +42,15 @@
$total = account_total($query); $total = account_total($query);
$p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); $p->set_var('th_bg',$phpgw_info['theme']['th_bg']);
$p->set_var("left_nextmatchs",$phpgw->nextmatchs->left("/admin/groups.php",$start,$total)); $p->set_var('left_nextmatchs',$phpgw->nextmatchs->left('/admin/groups.php',$start,$total));
$p->set_var("right_nextmatchs",$phpgw->nextmatchs->right("/admin/groups.php",$start,$total)); $p->set_var('right_nextmatchs',$phpgw->nextmatchs->right('/admin/groups.php',$start,$total));
$p->set_var("lang_groups",lang("user groups")); $p->set_var('lang_groups',lang('user groups'));
$p->set_var("sort_name",$phpgw->nextmatchs->show_sort_order($sort,"account_lid",$order,"/admin/groups.php",lang("name"))); $p->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,"account_lid",$order,"/admin/groups.php",lang("name")));
$p->set_var("header_edit",lang("Edit")); $p->set_var('header_edit',lang('Edit'));
$p->set_var("header_delete",lang("Delete")); $p->set_var('header_delete',lang('Delete'));
$account_info = $phpgw->accounts->get_list('groups',$start,$sort, $order, $query, $total); $account_info = $phpgw->accounts->get_list('groups',$start,$sort, $order, $query, $total);
@ -66,23 +69,23 @@
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
$p->set_var("tr_color",$tr_color); $p->set_var("tr_color",$tr_color);
if (! $group_name) $group_name = '&nbsp;'; if (! $group_name) { $group_name = '&nbsp;'; }
$p->set_var("group_name",$group_name); $p->set_var('group_name',$group_name);
$p->set_var("edit_link",'<a href="' . $phpgw->link("/admin/editgroup.php","group_id=" . $group_id) . '"> ' . lang("Edit") . ' </a>'); $p->set_var('edit_link','<a href="' . $phpgw->link('/admin/editgroup.php','group_id=' . $group_id) . '"> ' . lang('Edit') . ' </a>');
$p->set_var("delete_link",'<a href="' . $phpgw->link("/admin/deletegroup.php","group_id=" . $group_id) . '"> ' . lang("Delete") . ' </a>'); $p->set_var('delete_link','<a href="' . $phpgw->link('/admin/deletegroup.php','group_id=' . $group_id) . '"> ' . lang('Delete') . ' </a>');
$p->parse("rows","row",True); $p->parse('rows','row',True);
} }
} }
$p->set_var("new_action",$phpgw->link("/admin/newgroup.php")); $p->set_var('new_action',$phpgw->link('/admin/newgroup.php'));
$p->set_var("lang_add",lang("add")); $p->set_var('lang_add',lang('add'));
$p->set_var("search_action",$phpgw->link("/admin/groups.php")); $p->set_var('search_action',$phpgw->link('/admin/groups.php'));
$p->set_var("lang_search",lang("search")); $p->set_var('lang_search',lang('search'));
$p->pparse("out","list"); $p->pparse('out','list');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -17,30 +17,33 @@
} }
$phpgw_info["flags"]["currentapp"] = "admin"; $phpgw_info["flags"]["currentapp"] = "admin";
include("../header.inc.php"); include("../header.inc.php");
if ($ksessionid == $phpgw_info["user"]["sessionid"]) { if ($ksessionid == $phpgw_info["user"]["sessionid"])
{
Header("Location: " . $phpgw->link("/admin/currentusers.php")); Header("Location: " . $phpgw->link("/admin/currentusers.php"));
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
if ($confirm) { if ($confirm)
{
$phpgw->db->query("delete from phpgw_sessions where session_id='$ksession'"); $phpgw->db->query("delete from phpgw_sessions where session_id='$ksession'");
Header("Location: " . $phpgw->link("/admin/currentusers.php","cd=19")); Header("Location: " . $phpgw->link("/admin/currentusers.php","cd=19"));
} else { }
?> else
{
?>
<center> <center>
<table border=0 with=65%> <table border="0" with="65%">
<tr colspan=2> <tr colspan="2">
<td align=center> <td align="center">
<?php echo lang("Are you sure you want to kill this session ?"); ?> <?php echo lang('Are you sure you want to kill this session ?'); ?>
<td> <td>
</tr> </tr>
<tr> <tr>
<td> <td>
<a href="<?php echo $phpgw->link("/admin/currentusers.php") . "\">" . lang("No"); ?></a> <a href="<?php echo $phpgw->link('/admin/currentusers.php') . '">' . lang('No'); ?></a>
</td> </td>
<td> <td>
<a href="<?php echo $phpgw->link("/admin/killsession.php","ksession=$ksession&confirm=true") <a href="<?php echo $phpgw->link('/admin/killsession.php','ksession=' . $ksession . '&confirm=true') . '">' . lang('Yes'); ?></a>
. "\">" . lang("Yes"); ?></a>
</td> </td>
</tr> </tr>
</table> </table>