mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
added cat_access
This commit is contained in:
parent
88e2bbd08d
commit
acb00bf31c
@ -24,8 +24,11 @@
|
||||
if ($submit) {
|
||||
$errorcount = 0;
|
||||
|
||||
$exists = $c->exists('main',$cat_name);
|
||||
if ($exists == True) { $error[$errorcount++] = lang('That category name has been used already !'); }
|
||||
$exists_main = $c->exists('main',$cat_name);
|
||||
if ($exists_main == True) { $error[$errorcount++] = lang('That main category name has been used already !'); }
|
||||
|
||||
$exists_sub = $c->exists('subs',$cat_name);
|
||||
if ($exists_subs == True) { $error[$errorcount++] = lang('That sub category name has been used already !'); }
|
||||
|
||||
if (!$cat_name) { $error[$errorcount++] = lang('Please enter a name for that category !'); }
|
||||
|
||||
@ -53,8 +56,8 @@
|
||||
$t->set_var('lang_choose',lang('Choose the category'));
|
||||
$t->set_var('lang_select_parent',lang('Select parent category'));
|
||||
$t->set_var('lang_access',lang('Private'));
|
||||
if ($access) { $t->set_var('access', '<input type="checkbox" name="private" value="True" checked>'); }
|
||||
else { $t->set_var('access', '<input type="checkbox" name="private" value="True"'); }
|
||||
if ($access) { $t->set_var('access', '<input type="checkbox" name="access" value="True" checked>'); }
|
||||
else { $t->set_var('access', '<input type="checkbox" name="access" value="True"'); }
|
||||
$t->set_var('lang_name',lang('Category name'));
|
||||
$t->set_var('lang_descr',lang('Category description'));
|
||||
$t->set_var('cat_name',$cat_name);
|
||||
|
@ -30,15 +30,21 @@
|
||||
$errorcount = 0;
|
||||
if (!$cat_name) { $error[$errorcount++] = lang('Please enter a name for that category !'); }
|
||||
$phpgw->db->query("SELECT count(*) from phpgw_categories WHERE cat_name='$cat_name' AND cat_id !='$cat_id' AND cat_appname='"
|
||||
. $phpgw_info["flags"]["currentapp"] ."'");
|
||||
. $phpgw_info["flags"]["currentapp"] ."' AND cat_parent='0'");
|
||||
$phpgw->db->next_record();
|
||||
if ($phpgw->db->f(0) != 0) { $error[$errorcount++] = lang('That category name has been used already !'); }
|
||||
if ($phpgw->db->f(0) != 0) { $error[$errorcount++] = lang('That main category name has been used already !'); }
|
||||
|
||||
$phpgw->db->query("SELECT count(*) from phpgw_categories WHERE cat_name='$cat_name' AND cat_id !='$cat_id' AND cat_appname='"
|
||||
. $phpgw_info["flags"]["currentapp"] ."' AND cat_parent != '0'");
|
||||
$phpgw->db->next_record();
|
||||
if ($phpgw->db->f(0) != 0) { $error[$errorcount++] = lang('That sub category name has been used already !'); }
|
||||
|
||||
$cat_name = addslashes($cat_name);
|
||||
$cat_description = addslashes($cat_description);
|
||||
if ($access) { $cat_access = 'private'; }
|
||||
else { $cat_access = 'public'; }
|
||||
|
||||
|
||||
if (! $error) { $c->edit($cat_id,$cat_parent,$cat_name,$cat_description,$cat_data); }
|
||||
if (! $error) { $c->edit($cat_id,$cat_parent,$cat_name,$cat_description,$cat_data,$cat_access); }
|
||||
}
|
||||
|
||||
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); }
|
||||
@ -47,7 +53,8 @@
|
||||
|
||||
$cats = $c->return_single($cat_id);
|
||||
|
||||
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False'));
|
||||
$cat_parent = $cats[0]['parent'];
|
||||
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False'));
|
||||
$t->set_var('font',$font);
|
||||
$t->set_var('user_name',$phpgw_info["user"]["fullname"]);
|
||||
$t->set_var('title_categories',lang('Edit category for'));
|
||||
@ -61,8 +68,8 @@
|
||||
$t->set_var('lang_descr',lang('Category description'));
|
||||
$t->set_var('lang_select_parent',lang('Select parent category'));
|
||||
$t->set_var('lang_access',lang('Private'));
|
||||
if ($access) { $t->set_var('access', '<input type="checkbox" name="private" value="True" checked>'); }
|
||||
else { $t->set_var('access', '<input type="checkbox" name="private" value="True"'); }
|
||||
if ($cats[0]['access']=='private') { $t->set_var('access', '<input type="checkbox" name="access" value="True" checked>'); }
|
||||
else { $t->set_var('access', '<input type="checkbox" name="access" value="True"'); }
|
||||
|
||||
$cat_id = $cats[0]['id'];
|
||||
|
||||
@ -71,7 +78,7 @@
|
||||
|
||||
$t->set_var('lang_edit',lang('Edit'));
|
||||
$t->set_var('lang_delete',lang('Delete'));
|
||||
$t->set_var('lang_done',lang('Done'));
|
||||
$t->set_var('lang_done',lang('Done'));
|
||||
|
||||
$t->set_var('edithandle','');
|
||||
$t->set_var('addhandle','');
|
||||
|
@ -34,6 +34,7 @@
|
||||
var $cats;
|
||||
var $db;
|
||||
var $total_records;
|
||||
var $grants;
|
||||
/*!
|
||||
@function filter
|
||||
@abstract ?
|
||||
@ -61,7 +62,7 @@
|
||||
{
|
||||
case 'app': $w = " cat_appname='" . $this->app_name . "'"; break;
|
||||
case 'subs': $w = " cat_parent != '0'"; break;
|
||||
case 'mains': $w = " cat_parent = '0'"; break;
|
||||
case 'mains': $w = " cat_parent = '0'"; break;
|
||||
default: return False;
|
||||
|
||||
}
|
||||
@ -108,15 +109,30 @@
|
||||
$ordermethod = " order by cat_parent asc";
|
||||
}
|
||||
|
||||
if (is_array($this->grants))
|
||||
{
|
||||
$grants = $this->grants;
|
||||
while(list($user) = each($grants))
|
||||
{
|
||||
$public_user_list[] = $user;
|
||||
}
|
||||
reset($public_user_list);
|
||||
$grant_cats = " (cat_owner='" . $this->account_id . "' OR cat_access='public' OR cat_owner in(" . implode(',',$public_user_list) . ")) ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$grant_cats = " (cat_owner='" . $this->account_id . "' OR cat_access='public') ";
|
||||
}
|
||||
|
||||
if ($query)
|
||||
{
|
||||
$sql = "select * from phpgw_categories where cat_appname='" . $this->app_name . "' $public_cats and "
|
||||
. "(cat_name like '%$query%' or cat_description like '%$query%') $filter $ordermethod";
|
||||
$sql = "SELECT * from phpgw_categories WHERE cat_appname='" . $this->app_name . "' AND "
|
||||
. " $grant_cats $public_cats AND (cat_name like '%$query%' OR cat_description like '%$query%') $filter $ordermethod";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "select * from phpgw_categories where cat_appname='" . $this->app_name . "'"
|
||||
. "$public_cats $filter $ordermethod";
|
||||
$sql = "SELECT * from phpgw_categories WHERE cat_appname='" . $this->app_name . "' AND "
|
||||
. " $grant_cats $public_cats $filter $ordermethod";
|
||||
}
|
||||
|
||||
$this->db2->query($sql,__LINE__,__FILE__);
|
||||
@ -183,6 +199,7 @@
|
||||
$this->app_name = $app_name;
|
||||
$this->db = $phpgw->db;
|
||||
$this->total_records = $this->db->num_rows();
|
||||
$this->grants = $phpgw->acl->get_grants($app_name);
|
||||
$this->cats = $this->return_array($type,$start,$limit,$query,$sort,$order,$public);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user