forked from extern/egroupware
update sort categories
This commit is contained in:
parent
b0199b263f
commit
7144eef917
@ -36,21 +36,25 @@
|
|||||||
$cat_description = addslashes($cat_description);
|
$cat_description = addslashes($cat_description);
|
||||||
$cat_access = 'public';
|
$cat_access = 'public';
|
||||||
|
|
||||||
$c->add($cat_name,$cat_parent,$cat_description,$cat_data,$cat_access);
|
$c->add($cat_name,$cat_parent,$cat_description,$cat_data,$cat_access,$cat_main);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); }
|
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); }
|
||||||
if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang("Category x has been added !", $cat_name)); }
|
if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang('Category x has been added !', $cat_name)); }
|
||||||
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
|
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
|
||||||
|
|
||||||
$t->set_var('title_categories',lang('Add global category'));
|
$t->set_var('title_categories',lang('Add global category'));
|
||||||
$t->set_var('actionurl',$phpgw->link('/admin/addcategory.php'));
|
$t->set_var('actionurl',$phpgw->link('/admin/addcategory.php'));
|
||||||
$t->set_var('doneurl',$phpgw->link('/admin/categories.php'));
|
$t->set_var('doneurl',$phpgw->link('/admin/categories.php'));
|
||||||
$t->set_var('hidden_vars','<input type="hidden" name="cat_id" value="' . $cat_id . '">');
|
$t->set_var('hidden_vars','<input type="hidden" name="cat_id" value="' . $cat_id . '">');
|
||||||
$t->set_var('lang_select_parent',lang('Select parent category'));
|
|
||||||
|
|
||||||
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False'));
|
$t->set_var('lang_main',lang('Main category'));
|
||||||
|
$t->set_var('lang_new_main',lang('New main category'));
|
||||||
|
$t->set_var('main_category_list',$c->formated_list('select','mains',$cat_main));
|
||||||
|
$t->set_var('lang_parent',lang('Parent category'));
|
||||||
|
$t->set_var('lang_select_parent',lang('Select parent category'));
|
||||||
|
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent));
|
||||||
$t->set_var('lang_name',lang('Category name'));
|
$t->set_var('lang_name',lang('Category name'));
|
||||||
$t->set_var('lang_descr',lang('Category description'));
|
$t->set_var('lang_descr',lang('Category description'));
|
||||||
$t->set_var('cat_name',$cat_name);
|
$t->set_var('cat_name',$cat_name);
|
||||||
|
@ -82,15 +82,20 @@
|
|||||||
|
|
||||||
$cat_id = $categories[$i]['id'];
|
$cat_id = $categories[$i]['id'];
|
||||||
$owner = $categories[$i]['owner'];
|
$owner = $categories[$i]['owner'];
|
||||||
$space = " ";
|
$space = ' ';
|
||||||
if ($categories[$i]['parent'] > 0) { $name = $space . $phpgw->strip_html($categories[$i]['name']); }
|
$level = $categories[$i]['level'];
|
||||||
|
|
||||||
|
if ($level > 0) {
|
||||||
|
$spaceset = str_repeat($space,$level);
|
||||||
|
$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 = " "; }
|
if (! $descr) { $descr = ' '; }
|
||||||
|
|
||||||
if ($categories[$i]['parent'] == 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 ---------------------------
|
||||||
|
@ -51,12 +51,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); }
|
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); }
|
||||||
if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang("Category x has been updated !",$cat_name)); }
|
if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang('Category x has been updated !',$cat_name)); }
|
||||||
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
|
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
|
||||||
|
|
||||||
$cats = $c->return_single($cat_id);
|
$cats = $c->return_single($cat_id);
|
||||||
|
|
||||||
$t->set_var('title_categories',lang('Edit global category'));
|
$t->set_var('title_categories',lang('Edit global category'));
|
||||||
|
$t->set_var('lang_parent',lang('Parent category'));
|
||||||
$t->set_var('lang_select_parent',lang('Select parent category'));
|
$t->set_var('lang_select_parent',lang('Select parent category'));
|
||||||
$t->set_var('actionurl',$phpgw->link('/admin/editcategory.php'));
|
$t->set_var('actionurl',$phpgw->link('/admin/editcategory.php'));
|
||||||
$t->set_var('deleteurl',$phpgw->link('/admin/deletecategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
|
$t->set_var('deleteurl',$phpgw->link('/admin/deletecategory.php',"cat_id=$cat_id&start=$start&query=$query&sort=$sort&order=$order&filter=$filter"));
|
||||||
@ -69,12 +70,15 @@
|
|||||||
$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'));
|
||||||
|
|
||||||
|
$cat_main = $cats[0]['main'];
|
||||||
|
$t->set_var('lang_main',lang('Main category'));
|
||||||
|
$t->set_var('lang_new_main',lang('New main category'));
|
||||||
|
$t->set_var('main_category_list',$c->formated_list('select','mains',$cat_main));
|
||||||
$cat_id = $cats[0]['id'];
|
$cat_id = $cats[0]['id'];
|
||||||
$cat_parent = $cats[0]['parent'];
|
$cat_parent = $cats[0]['parent'];
|
||||||
|
|
||||||
$t->set_var('cat_name',$phpgw->strip_html($cats[0]['name']));
|
$t->set_var('cat_name',$phpgw->strip_html($cats[0]['name']));
|
||||||
$t->set_var('cat_description',$phpgw->strip_html($cats[0]['description']));
|
$t->set_var('cat_description',$phpgw->strip_html($cats[0]['description']));
|
||||||
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False'));
|
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent));
|
||||||
|
|
||||||
$t->set_var('edithandle','');
|
$t->set_var('edithandle','');
|
||||||
$t->set_var('addhandle','');
|
$t->set_var('addhandle','');
|
||||||
@ -83,4 +87,4 @@
|
|||||||
$t->pparse('edithandle','edit');
|
$t->pparse('edithandle','edit');
|
||||||
|
|
||||||
$phpgw->common->phpgw_footer();
|
$phpgw->common->phpgw_footer();
|
||||||
?>
|
?>
|
@ -10,7 +10,11 @@
|
|||||||
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
||||||
<form name="form" action="{actionurl}" method="POST">
|
<form name="form" action="{actionurl}" method="POST">
|
||||||
<tr>
|
<tr>
|
||||||
<td> </td>
|
<td>{lang_main}</td>
|
||||||
|
<td><select name="cat_main"><option value="">{lang_new_main}</option>{main_category_list}</select></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{lang_parent}</td>
|
||||||
<td><select name="cat_parent"><option value="">{lang_select_parent}</option>{category_list}</select></td>
|
<td><select name="cat_parent"><option value="">{lang_select_parent}</option>{category_list}</select></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -59,4 +63,4 @@
|
|||||||
</table>
|
</table>
|
||||||
</center>
|
</center>
|
||||||
<!-- END edit -->
|
<!-- END edit -->
|
||||||
<!-- END form -->
|
<!-- END form -->
|
@ -10,7 +10,11 @@
|
|||||||
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
||||||
<form name="form" action="{actionurl}" method="POST">
|
<form name="form" action="{actionurl}" method="POST">
|
||||||
<tr>
|
<tr>
|
||||||
<td> </td>
|
<td>{lang_main}</td>
|
||||||
|
<td><select name="cat_main"><option value="">{lang_new_main}</option>{main_category_list}</select></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{lang_parent}</td>
|
||||||
<td><select name="cat_parent"><option value="">{lang_select_parent}</option>{category_list}</select></td>
|
<td><select name="cat_parent"><option value="">{lang_select_parent}</option>{category_list}</select></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -59,4 +63,4 @@
|
|||||||
</table>
|
</table>
|
||||||
</center>
|
</center>
|
||||||
<!-- END edit -->
|
<!-- END edit -->
|
||||||
<!-- END form -->
|
<!-- END form -->
|
@ -10,7 +10,11 @@
|
|||||||
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
||||||
<form name="form" action="{actionurl}" method="POST">
|
<form name="form" action="{actionurl}" method="POST">
|
||||||
<tr>
|
<tr>
|
||||||
<td> </td>
|
<td>{lang_main}</td>
|
||||||
|
<td><select name="cat_main"><option value="">{lang_new_main}</option>{main_category_list}</select></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{lang_parent}</td>
|
||||||
<td><select name="cat_parent"><option value="">{lang_select_parent}</option>{category_list}</select></td>
|
<td><select name="cat_parent"><option value="">{lang_select_parent}</option>{category_list}</select></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -59,4 +63,4 @@
|
|||||||
</table>
|
</table>
|
||||||
</center>
|
</center>
|
||||||
<!-- END edit -->
|
<!-- END edit -->
|
||||||
<!-- END form -->
|
<!-- END form -->
|
@ -93,9 +93,7 @@
|
|||||||
{
|
{
|
||||||
global $phpgw, $phpgw_info;
|
global $phpgw, $phpgw_info;
|
||||||
|
|
||||||
$this->db2 = $this->db;
|
if ($public)
|
||||||
|
|
||||||
if ($public)
|
|
||||||
{
|
{
|
||||||
$public_cats = " OR cat_appname='phpgw' ";
|
$public_cats = " OR cat_appname='phpgw' ";
|
||||||
}
|
}
|
||||||
@ -113,7 +111,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ordermethod = " order by cat_parent asc";
|
$ordermethod = " order by cat_main asc";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($this->grants))
|
if (is_array($this->grants))
|
||||||
@ -138,14 +136,11 @@
|
|||||||
|
|
||||||
if ($query)
|
if ($query)
|
||||||
{
|
{
|
||||||
$sql = "SELECT * from phpgw_categories WHERE (cat_appname='" . $this->app_name . "' $public_cats $parent_filter) AND "
|
$querymethod = " AND (cat_name like '%$query%' OR cat_description like '%$query%') ";
|
||||||
. " $grant_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 $parent_filter) AND "
|
|
||||||
. " $grant_cats $filter $ordermethod";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT * from phpgw_categories WHERE (cat_appname='" . $this->app_name . "' $public_cats $parent_filter) AND "
|
||||||
|
. " $grant_cats $querymethod $filter $ordermethod";
|
||||||
|
|
||||||
$this->db2->query($sql,__LINE__,__FILE__);
|
$this->db2->query($sql,__LINE__,__FILE__);
|
||||||
$this->total_records = $this->db2->num_rows();
|
$this->total_records = $this->db2->num_rows();
|
||||||
@ -155,14 +150,16 @@
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
while ($this->db->next_record())
|
while ($this->db->next_record())
|
||||||
{
|
{
|
||||||
$cats[$i]['id'] = $this->db->f('cat_id');
|
$cats[$i]['id'] = $this->db->f('cat_id');
|
||||||
$cats[$i]['owner'] = $this->db->f('cat_owner');
|
$cats[$i]['owner'] = $this->db->f('cat_owner');
|
||||||
$cats[$i]['access'] = $this->db->f('cat_access');
|
$cats[$i]['access'] = $this->db->f('cat_access');
|
||||||
$cats[$i]['app_name'] = $this->db->f('cat_appname');
|
$cats[$i]['app_name'] = $this->db->f('cat_appname');
|
||||||
$cats[$i]['parent'] = $this->db->f('cat_parent');
|
$cats[$i]['main'] = $this->db->f('cat_main');
|
||||||
$cats[$i]['name'] = $this->db->f('cat_name');
|
$cats[$i]['level'] = $this->db->f('cat_level');
|
||||||
$cats[$i]['description'] = $this->db->f('cat_description');
|
$cats[$i]['parent'] = $this->db->f('cat_parent');
|
||||||
$cats[$i]['data'] = $this->db->f('cat_data');
|
$cats[$i]['name'] = $this->db->f('cat_name');
|
||||||
|
$cats[$i]['description'] = $this->db->f('cat_description');
|
||||||
|
$cats[$i]['data'] = $this->db->f('cat_data');
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
return $cats;
|
return $cats;
|
||||||
@ -182,14 +179,16 @@
|
|||||||
|
|
||||||
$this->db->next_record();
|
$this->db->next_record();
|
||||||
|
|
||||||
$cats[0]['id'] = $this->db->f('cat_id');
|
$cats[0]['id'] = $this->db->f('cat_id');
|
||||||
$cats[0]['owner'] = $this->db->f('cat_owner');
|
$cats[0]['owner'] = $this->db->f('cat_owner');
|
||||||
$cats[0]['access'] = $this->db->f('cat_access');
|
$cats[0]['access'] = $this->db->f('cat_access');
|
||||||
$cats[0]['parent'] = $this->db->f('cat_parent');
|
$cats[0]['main'] = $this->db->f('cat_main');
|
||||||
$cats[0]['name'] = $this->db->f('cat_name');
|
$cats[0]['level'] = $this->db->f('cat_level');
|
||||||
$cats[0]['description'] = $this->db->f('cat_description');
|
$cats[0]['parent'] = $this->db->f('cat_parent');
|
||||||
$cats[0]['data'] = $this->db->f('cat_data');
|
$cats[0]['name'] = $this->db->f('cat_name');
|
||||||
|
$cats[0]['description'] = $this->db->f('cat_description');
|
||||||
|
$cats[0]['data'] = $this->db->f('cat_data');
|
||||||
|
|
||||||
return $cats;
|
return $cats;
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@ -212,6 +211,7 @@
|
|||||||
$this->account_id = $account_id;
|
$this->account_id = $account_id;
|
||||||
$this->app_name = $app_name;
|
$this->app_name = $app_name;
|
||||||
$this->db = $phpgw->db;
|
$this->db = $phpgw->db;
|
||||||
|
$this->db2 = $this->db;
|
||||||
$this->total_records = $this->db->num_rows();
|
$this->total_records = $this->db->num_rows();
|
||||||
$this->grants = $phpgw->acl->get_grants($app_name);
|
$this->grants = $phpgw->acl->get_grants($app_name);
|
||||||
$this->cats = $this->return_array($type,$start,$limit,$query,$sort,$order,$public);
|
$this->cats = $this->return_array($type,$start,$limit,$query,$sort,$order,$public);
|
||||||
@ -265,12 +265,33 @@
|
|||||||
@param $cat_description category description defaults to ''
|
@param $cat_description category description defaults to ''
|
||||||
@param $cat_data category data defaults to ''
|
@param $cat_data category data defaults to ''
|
||||||
*/
|
*/
|
||||||
function add($cat_name,$cat_parent,$cat_description = '', $cat_data = '',$cat_access = '')
|
function add($cat_name,$cat_parent,$cat_description = '', $cat_data = '',$cat_access = '',$cat_main)
|
||||||
{
|
{
|
||||||
$this->db->query('insert into phpgw_categories (cat_parent,cat_owner,cat_access,cat_appname,cat_name,'
|
|
||||||
|
if ($cat_main)
|
||||||
|
{
|
||||||
|
$this->db2->query("Select cat_level from phpgw_categories where cat_id='$cat_parent'",__LINE__,__FILE__);
|
||||||
|
$this->db2->next_record();
|
||||||
|
$cat_level = $this->db2->f('cat_level')+1;
|
||||||
|
|
||||||
|
$this->db->query("insert into phpgw_categories (cat_parent,cat_owner,cat_access,cat_appname,cat_name,"
|
||||||
. "cat_description,cat_data) values ('$cat_parent','" . $this->account_id . "','$cat_access','"
|
. "cat_description,cat_data) values ('$cat_parent','" . $this->account_id . "','$cat_access','"
|
||||||
. $this->app_name . "','" . addslashes($cat_name) . "','" . addslashes($cat_description)
|
. $this->app_name . "','" . addslashes($cat_name) . "','" . addslashes($cat_description)
|
||||||
. "','$cat_data')",__LINE__,__FILE__);
|
. "','$cat_data','$cat_main','$cat_level')",__LINE__,__FILE__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->query("insert into phpgw_categories (cat_parent,cat_owner,cat_access,cat_appname,cat_name,"
|
||||||
|
. "cat_description,cat_data,cat_main,cat_level) values ('$cat_parent','" . $this->account_id . "','$cat_access','"
|
||||||
|
. $this->app_name . "','" . addslashes($cat_name) . "','" . addslashes($cat_description)
|
||||||
|
. "','$cat_data','$cat_main','$cat_level')",__LINE__,__FILE__);
|
||||||
|
|
||||||
|
$this->db2->query("select max(cat_id) as max from phpgw_categories",__LINE__,__FILE__);
|
||||||
|
$this->db2->next_record();
|
||||||
|
$this->db->query("update phpgw_categories set cat_main='" . $this->db2->f('max') . "' where cat_id='"
|
||||||
|
. $this->db2->f('max') . "'",__LINE__,__FILE__);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/*!
|
/*!
|
||||||
@function delete
|
@function delete
|
||||||
@ -296,12 +317,32 @@
|
|||||||
@param $cat_description category description defaults to ''
|
@param $cat_description category description defaults to ''
|
||||||
@param $cat_data category data defaults to ''
|
@param $cat_data category data defaults to ''
|
||||||
*/
|
*/
|
||||||
function edit($cat_id,$cat_parent,$cat_name,$cat_description = '',$cat_data = '',$cat_access = '')
|
function edit($cat_id,$cat_parent,$cat_name,$cat_description = '',$cat_data = '',$cat_access = '',$cat_main)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ($cat_main)
|
||||||
|
{
|
||||||
|
$this->db2->query("Select cat_level from phpgw_categories where cat_id='$cat_parent'",__LINE__,__FILE__);
|
||||||
|
$this->db2->next_record();
|
||||||
|
$cat_level = $this->db2->f('cat_level')+1;
|
||||||
|
|
||||||
$this->db->query("update phpgw_categories set cat_name='" . addslashes($cat_name) . "', "
|
$this->db->query("update phpgw_categories set cat_name='" . addslashes($cat_name) . "', "
|
||||||
. "cat_description='" . addslashes($cat_description) . "', cat_data='"
|
. "cat_description='" . addslashes($cat_description) . "', cat_data='"
|
||||||
. "$cat_data', cat_parent='$cat_parent', cat_access='$cat_access' where cat_appname='"
|
. "$cat_data', cat_parent='$cat_parent', cat_access='$cat_access', cat_main='$cat_main', cat_level='$cat_level' "
|
||||||
. $this->app_name . "' and cat_id='$cat_id'",__LINE__,__FILE__);
|
. "where cat_appname='" . $this->app_name . "' and cat_id='$cat_id'",__LINE__,__FILE__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->query("update phpgw_categories set cat_name='" . addslashes($cat_name) . "', "
|
||||||
|
. "cat_description='" . addslashes($cat_description) . "', cat_data='"
|
||||||
|
. "$cat_data', cat_parent='$cat_parent', cat_access='$cat_access', cat_main='$cat_main', cat_level='$cat_level' "
|
||||||
|
. "where cat_appname='" . $this->app_name . "' and cat_id='$cat_id'",__LINE__,__FILE__);
|
||||||
|
|
||||||
|
$this->db2->query("select max(cat_id) as max from phpgw_categories",__LINE__,__FILE__);
|
||||||
|
$this->db2->next_record();
|
||||||
|
$this->db->query("update phpgw_categories set cat_main='" . $this->db2->f('max') . "' where cat_id='"
|
||||||
|
. $this->db2->f('max') . "'",__LINE__,__FILE__);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function name2id($cat_name)
|
function name2id($cat_name)
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
if ($access) { $cat_access = 'private'; }
|
if ($access) { $cat_access = 'private'; }
|
||||||
else { $cat_access = 'public'; }
|
else { $cat_access = 'public'; }
|
||||||
|
|
||||||
$c->add($cat_name,$cat_parent,$cat_description,$cat_data,$cat_access);
|
$c->add($cat_name,$cat_parent,$cat_description,$cat_data,$cat_access,$cat_main);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,10 +63,14 @@
|
|||||||
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
|
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
|
||||||
|
|
||||||
|
|
||||||
$t->set_var('font',$phpgw_info["theme"]["font"]);
|
|
||||||
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False'));
|
$t->set_var('lang_main',lang('Main category'));
|
||||||
|
$t->set_var('lang_new_main',lang('New main category'));
|
||||||
|
$t->set_var('font',$phpgw_info['theme']['font']);
|
||||||
|
$t->set_var('main_category_list',$c->formated_list('select','mains',$cat_main));
|
||||||
|
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent));
|
||||||
$t->set_var('hidden_vars',$hidden_vars);
|
$t->set_var('hidden_vars',$hidden_vars);
|
||||||
$t->set_var('user_name',$phpgw_info["user"]["fullname"]);
|
$t->set_var('user_name',$phpgw_info['user']['fullname']);
|
||||||
$t->set_var('doneurl',$phpgw->link('/preferences/categories.php'));
|
$t->set_var('doneurl',$phpgw->link('/preferences/categories.php'));
|
||||||
$t->set_var('title_categories',lang("Add x category for",$cats_app));
|
$t->set_var('title_categories',lang("Add x category for",$cats_app));
|
||||||
$t->set_var('actionurl',$phpgw->link('/preferences/addcategory.php'));
|
$t->set_var('actionurl',$phpgw->link('/preferences/addcategory.php'));
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
$c = CreateObject('phpgwapi.categories');
|
$c = CreateObject('phpgwapi.categories');
|
||||||
$c->app_name = $cats_app;
|
$c->app_name = $cats_app;
|
||||||
$categories = $c->return_array('all',$start,$limit,$query,$sort,$order,'False');
|
$categories = $c->return_array('all',$start,$limit,$query,$sort,$order);
|
||||||
|
|
||||||
//--------------------------------- nextmatch --------------------------------------------
|
//--------------------------------- nextmatch --------------------------------------------
|
||||||
|
|
||||||
@ -92,28 +92,28 @@
|
|||||||
|
|
||||||
$cat_id = $categories[$i]['id'];
|
$cat_id = $categories[$i]['id'];
|
||||||
$owner = $categories[$i]['owner'];
|
$owner = $categories[$i]['owner'];
|
||||||
|
$level = $categories[$i]['level'];
|
||||||
$space = ' ';
|
$space = ' ';
|
||||||
if ($categories[$i]['parent'] > 0)
|
|
||||||
{
|
if ($level > 0) {
|
||||||
$parent_data = $c->return_single($categories[$i]['parent']);
|
$spaceset = str_repeat($space,$level);
|
||||||
$name = $space . $phpgw->strip_html($parent_data[0]['name'] . ' :: ' . $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 = ' '; }
|
if (! $descr) { $descr = ' '; }
|
||||||
|
|
||||||
|
|
||||||
if ($extra) {
|
if ($extra) {
|
||||||
$data = $categories[$i]['data'];
|
$data = $categories[$i]['data'];
|
||||||
if (! $data) { $data = ' '; }
|
if (! $data) { $data = ' '; }
|
||||||
$t->set_var('td_data','<td><font face=' . $phpgw_info["theme"]["font"] . '>' . $data . '</font></td>');
|
$t->set_var('td_data','<td><font face=' . $phpgw_info["theme"]["font"] . '>' . $data . '</font></td>');
|
||||||
}
|
}
|
||||||
else { $t->set_var('td_data',''); }
|
else { $t->set_var('td_data',''); }
|
||||||
|
|
||||||
if ($categories[$i]['parent'] == 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>';
|
||||||
$data = '<font color=FF0000><b>' . $data . '</b></font>';
|
$data = '<font color="FF0000"><b>' . $data . '</b></font>';
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------- template declaration for list records ---------------------------
|
//-------------------------- template declaration for list records ---------------------------
|
||||||
|
@ -52,20 +52,24 @@
|
|||||||
if ($access) { $cat_access = 'private'; }
|
if ($access) { $cat_access = 'private'; }
|
||||||
else { $cat_access = 'public'; }
|
else { $cat_access = 'public'; }
|
||||||
|
|
||||||
if (! $error) { $c->edit($cat_id,$cat_parent,$cat_name,$cat_description,$cat_data,$cat_access); }
|
if (! $error) { $c->edit($cat_id,$cat_parent,$cat_name,$cat_description,$cat_data,$cat_access,$cat_main); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); }
|
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); }
|
||||||
if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang("Category x has been updated !",$cat_name)); }
|
if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang('Category x has been updated !',$cat_name)); }
|
||||||
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
|
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
|
||||||
|
|
||||||
$cats = $c->return_single($cat_id);
|
$cats = $c->return_single($cat_id);
|
||||||
|
|
||||||
|
$cat_main = $cats[0]['main'];
|
||||||
|
$t->set_var('lang_main',lang('Main category'));
|
||||||
|
$t->set_var('lang_new_main',lang('New main category'));
|
||||||
|
$t->set_var('main_category_list',$c->formated_list('select','mains',$cat_main));
|
||||||
$cat_parent = $cats[0]['parent'];
|
$cat_parent = $cats[0]['parent'];
|
||||||
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False'));
|
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent));
|
||||||
$t->set_var('font',$phpgw_info["theme"]["font"]);
|
$t->set_var('font',$phpgw_info['theme']['font']);
|
||||||
$t->set_var('user_name',$phpgw_info["user"]["fullname"]);
|
$t->set_var('user_name',$phpgw_info['user']['fullname']);
|
||||||
$t->set_var('title_categories',lang("Edit x category for",$cats_app));
|
$t->set_var('title_categories',lang('Edit x category for',$cats_app));
|
||||||
$t->set_var('doneurl',$phpgw->link('/preferences/categories.php'));
|
$t->set_var('doneurl',$phpgw->link('/preferences/categories.php'));
|
||||||
$t->set_var('actionurl',$phpgw->link('/preferences/editcategory.php'));
|
$t->set_var('actionurl',$phpgw->link('/preferences/editcategory.php'));
|
||||||
$t->set_var('deleteurl',$phpgw->link('/preferences/deletecategory.php'));
|
$t->set_var('deleteurl',$phpgw->link('/preferences/deletecategory.php'));
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
<font face="{font}">{message}</font>
|
<font face="{font}">{message}</font>
|
||||||
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
<table border="0" width="80%" cellspacing="2" cellpadding="2">
|
||||||
<form name="form" action="{actionurl}" method="POST">
|
<form name="form" action="{actionurl}" method="POST">
|
||||||
|
<tr>
|
||||||
|
<td><font face="{font}">{lang_main}</font></td>
|
||||||
|
<td><font face="{font}"><select name="cat_main"><option value="">{lang_new_main}</option>{main_category_list}</select></font></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><font face="{font}">{lang_parent}</font></td>
|
<td><font face="{font}">{lang_parent}</font></td>
|
||||||
<td><font face="{font}"><select name="cat_parent"><option value="">{lang_select_parent}</option>{category_list}</select></font></td>
|
<td><font face="{font}"><select name="cat_parent"><option value="">{lang_select_parent}</option>{category_list}</select></font></td>
|
||||||
|
@ -11,5 +11,5 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
$phpgw_info['server']['versions']['phpgwapi'] = '0.9.11.002';
|
$phpgw_info['server']['versions']['phpgwapi'] = '0.9.11.003';
|
||||||
$phpgw_info['server']['versions']['current_header'] = '1.11';
|
$phpgw_info['server']['versions']['current_header'] = '1.11';
|
||||||
|
Loading…
Reference in New Issue
Block a user