[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: admin/inc class.bocategories.inc.php,1.2,1.3 cla
From: |
Bettina gille <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: admin/inc class.bocategories.inc.php,1.2,1.3 class.uicategories.inc.php,1.5,1.6 |
Date: |
Sat, 12 Jan 2002 13:27:04 -0500 |
Update of /cvsroot/phpgroupware/admin/inc
In directory subversions:/tmp/cvs-serv1369/inc
Modified Files:
class.bocategories.inc.php class.uicategories.inc.php
Log Message:
update cats
Index: class.bocategories.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.bocategories.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.bocategories.inc.php 22 Dec 2001 16:14:31 -0000 1.2
--- class.bocategories.inc.php 12 Jan 2002 18:27:02 -0000 1.3
***************
*** 94,108 ****
{
if($this->debug) { echo '<br>querying: "' .
$this->query . '"'; }
! return
$this->cats->return_array('all',$this->start,True,$this->query,$this->sort,$this->order,True);
}
! function edit($data)
{
! return $this->cats->edit($data);
! }
!
! function add($data)
! {
! return $this->cats->add($data);
}
--- 94,110 ----
{
if($this->debug) { echo '<br>querying: "' .
$this->query . '"'; }
! return
$this->cats->return_sorted_array($this->start,True,$this->query,$this->sort,$this->order,True);
}
! function save_cat($values)
{
! if ($values['id'] && $values['id'] != 0)
! {
! return $this->cats->edit($values);
! }
! else
! {
! return $this->cats->add($values);
! }
}
***************
*** 122,125 ****
--- 124,171 ----
{
return $this->cats->delete($cat_id,$subs);
+ }
+
+ function check_values($values)
+ {
+ if (strlen($values['descr']) >= 255)
+ {
+ $error[] = lang('Description can not exceed 255
characters in length !');
+ }
+
+ if (!$values['name'])
+ {
+ $error[] = lang('Please enter a name');
+ }
+ else
+ {
+ if (!$values['cat_parent'])
+ {
+ $exists = $this->exists(array
+ (
+ 'type' => 'appandmains',
+ 'cat_name' => $values['name'],
+ 'cat_id' => $values['id']
+ ));
+ }
+ else
+ {
+ $exists = $this->exists(array
+ (
+ 'type' => 'appandsubs',
+ 'cat_name' => $values['name'],
+ 'cat_id' => $values['id']
+ ));
+ }
+
+ if ($exists == True)
+ {
+ $error[] = lang('That name has been
used already');
+ }
+ }
+
+ if (is_array($error))
+ {
+ return $error;
+ }
}
}
Index: class.uicategories.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.uicategories.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.uicategories.inc.php 23 Dec 2001 23:03:17 -0000 1.5
--- class.uicategories.inc.php 12 Jan 2002 18:27:02 -0000 1.6
***************
*** 10,14 ****
* option) any later version. *
\**************************************************************************/
-
/* $Id$ */
--- 10,13 ----
***************
*** 25,29 ****
var $debug = False;
! var $public_functions = array(
'index' => True,
'add' => True,
--- 24,29 ----
var $debug = False;
! var $public_functions = array
! (
'index' => True,
'add' => True,
***************
*** 31,46 ****
'delete' => True
);
!
function uicategories()
{
! $this->bo = CreateObject('admin.bocategories');
! $this->template = $GLOBALS['phpgw']->template;
! $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
!
! $this->start = $this->bo->start;
! $this->query = $this->bo->query;
! $this->sort = $this->bo->sort;
! $this->order = $this->bo->order;
! $this->cat_id = $this->bo->cat_id;
if($this->debug) { $this->_debug_sqsof(); }
}
--- 31,46 ----
'delete' => True
);
!
function uicategories()
{
! $this->bo =
CreateObject('admin.bocategories');
! $this->template = $GLOBALS['phpgw']->template;
! $this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
!
! $this->start = $this->bo->start;
! $this->query = $this->bo->query;
! $this->sort = $this->bo->sort;
! $this->order = $this->bo->order;
! $this->cat_id = $this->bo->cat_id;
if($this->debug) { $this->_debug_sqsof(); }
}
***************
*** 75,78 ****
--- 75,95 ----
}
+ function set_langs()
+ {
+
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
+ $this->template->set_var('lang_save',lang('Save'));
+ $this->template->set_var('lang_search',lang('Search'));
+ $this->template->set_var('lang_sub',lang('Add sub'));
+ $this->template->set_var('lang_edit',lang('Edit'));
+ $this->template->set_var('lang_delete',lang('Delete'));
+ $this->template->set_var('lang_parent',lang('Parent
category'));
+ $this->template->set_var('lang_none',lang('None'));
+ $this->template->set_var('lang_name',lang('Name'));
+
$this->template->set_var('lang_descr',lang('Description'));
+ $this->template->set_var('lang_add',lang('Add'));
+ $this->template->set_var('lang_reset',lang('Clear
Form'));
+ $this->template->set_var('lang_done',lang('Done'));
+ }
+
function index()
{
***************
*** 80,105 ****
echo parse_navbar();
! $this->template->set_file(array(
! 'cat_list_t' => 'listcats.tpl',
! 'cat_list' => 'listcats.tpl'
! ));
$this->template->set_block('cat_list_t','cat_list','list');
! /*
! $common_hidden_vars = '<input type="hidden" name="sort"
value="' . $this->sort . '">' . "\n"
! . '<input type="hidden" name="order" value="' .
$this->order . '">' . "\n"
! . '<input type="hidden" name="query" value="' .
$this->query . '">' . "\n"
! . '<input type="hidden" name="start" value="' .
$this->start . '">' . "\n"
! . '<input type="hidden" name="filter" value="'
. $this->filter . '">' . "\n";
! */
$this->template->set_var('lang_action',lang('Category
list'));
$this->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.add'));
- $this->template->set_var('lang_add',lang('Add'));
$this->template->set_var('title_categories',lang('Global categories'));
- $this->template->set_var('lang_search',lang('Search'));
$this->template->set_var('query',$this->query);
$this->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'));
- $this->template->set_var('lang_done',lang('Done'));
$this->template->set_var('doneurl',$GLOBALS['phpgw']->link('/admin/index.php'));
--- 97,110 ----
echo parse_navbar();
! $this->template->set_file(array('cat_list_t' =>
'listcats.tpl'));
$this->template->set_block('cat_list_t','cat_list','list');
! $this->set_langs();
$this->template->set_var('lang_action',lang('Category
list'));
$this->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.add'));
$this->template->set_var('title_categories',lang('Global categories'));
$this->template->set_var('query',$this->query);
$this->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'));
$this->template->set_var('doneurl',$GLOBALS['phpgw']->link('/admin/index.php'));
***************
*** 119,128 ****
$this->template->set_var('lang_showing',$this->nextmatchs->show_hits($this->bo->cats->total_records,$this->start));
-
$this->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
$this->template->set_var('sort_name',$this->nextmatchs->show_sort_order($this->sort,'cat_name',$this->order,'/index.php',lang('Name'),'&menuaction=admin.uicategories.index'));
$this->template->set_var('sort_description',$this->nextmatchs->show_sort_order($this->sort,'cat_description',$this->order,'/index.php',lang('Description'),'&menuaction=admin.uicategories.index'));
- $this->template->set_var('lang_sub',lang('Add sub'));
- $this->template->set_var('lang_edit',lang('Edit'));
- $this->template->set_var('lang_delete',lang('Delete'));
for ($i=0;$i<count($categories);$i++)
--- 124,129 ----
***************
*** 160,170 ****
$this->template->set_var('lang_delete_entry',lang('Delete'));
! $this->template->parse('list','cat_list',True);
}
$this->save_sessiondata();
!
! $this->template->parse('out','cat_list_t',True);
! $this->template->p('out');
}
--- 161,169 ----
$this->template->set_var('lang_delete_entry',lang('Delete'));
! $this->template->fp('list','cat_list',True);
}
$this->save_sessiondata();
! $this->template->pfp('out','cat_list_t',True);
}
***************
*** 174,177 ****
--- 173,178 ----
echo parse_navbar();
+ $this->set_langs();
+
$new_parent = $GLOBALS['HTTP_POST_VARS']['new_parent'];
$submit = $GLOBALS['HTTP_POST_VARS']['submit'];
***************
*** 193,273 ****
if ($submit)
{
! $errorcount = 0;
! if (!$cat_name)
{
! $error[$errorcount++] = lang('Please
enter a name');
! }
!
! if (!$error)
! {
! if (!$cat_parent)
! {
! $exists =
$this->bo->exists(array(
! 'type' =>
'appandmains',
! 'cat_name' => $cat_name,
! 'cat_id' => ''
! ));
! }
! else
! {
! $exists =
$this->bo->exists(array(
! 'type' =>
'appandsubs',
! 'cat_name' => $cat_name,
! 'cat_id' => ''
! ));
! }
!
! if ($exists == True)
! {
! $error[$errorcount++] =
lang('That name has been used already');
! }
}
!
! if (!$error)
{
! $this->bo->add(array(
! 'parent' => $cat_parent,
! 'descr' => $cat_description,
! 'name' => $cat_name,
! 'access' => 'public'
! ));
}
}
- if ($errorcount)
- {
-
$this->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
- }
-
- if (($submit) && (! $error) && (! $errorcount))
- {
-
$this->template->set_var('message',lang('Category x has been added !',
$cat_name));
- }
-
- if ((! $submit) && (! $error) && (! $errorcount))
- {
- $this->template->set_var('message','');
- }
-
$this->template->set_var('title_categories',lang('Add
global category'));
$this->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.add'));
$this->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'));
$this->template->set_var('hidden_vars','<input
type="hidden" name="cat_id" value="' . $this->cat_id . '">');
- $this->template->set_var('lang_parent',lang('Parent
category'));
- $this->template->set_var('lang_none',lang('None'));
$this->template->set_var('category_list',$this->bo->formatted_list(array('select'
=> 'select','all' => 'all','cat_parent' => $cat_parent)));
- $this->template->set_var('lang_name',lang('Name'));
-
$this->template->set_var('lang_descr',lang('Description'));
$this->template->set_var('cat_name',$cat_name);
$this->template->set_var('cat_description',$cat_description);
- $this->template->set_var('lang_add',lang('Add'));
- $this->template->set_var('lang_reset',lang('Clear
Form'));
- $this->template->set_var('lang_done',lang('Done'));
$this->template->set_var('edithandle','');
$this->template->set_var('addhandle','');
! $this->template->pparse('out','form');
! $this->template->pparse('addhandle','add');
}
--- 194,230 ----
if ($submit)
{
! $values = array
! (
! 'id' => '',
! 'parent' => $cat_parent,
! 'descr' => $cat_description,
! 'name' => $cat_name,
! 'access' => 'public'
! );
! $error = $this->bo->check_values($values);
! if (is_array($error))
{
!
$this->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
}
! else
{
! $this->bo->save_cat($values);
!
$this->template->set_var('message',lang('Category x has been added !',
$cat_name));
}
}
$this->template->set_var('title_categories',lang('Add
global category'));
$this->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.add'));
$this->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'));
$this->template->set_var('hidden_vars','<input
type="hidden" name="cat_id" value="' . $this->cat_id . '">');
$this->template->set_var('category_list',$this->bo->formatted_list(array('select'
=> 'select','all' => 'all','cat_parent' => $cat_parent)));
$this->template->set_var('cat_name',$cat_name);
$this->template->set_var('cat_description',$cat_description);
$this->template->set_var('edithandle','');
$this->template->set_var('addhandle','');
! $this->template->pfp('out','form');
! $this->template->pfp('addhandle','add');
}
***************
*** 282,285 ****
--- 239,244 ----
echo parse_navbar();
+ $this->set_langs();
+
$new_parent = $GLOBALS['HTTP_POST_VARS']['new_parent'];
$submit = $GLOBALS['HTTP_POST_VARS']['submit'];
***************
*** 303,379 ****
if ($submit)
{
! $errorcount = 0;
! if (!$cat_name)
{
! $error[$errorcount++] = lang('Please
enter a name');
}
!
! if (!$error)
! {
! if (!$cat_parent)
! {
! $exists =
$this->bo->exists(array(
! 'type' =>
'appandmains',
! 'cat_name' => $cat_name,
! 'cat_id' =>
$this->cat_id
! ));
! }
! else
! {
! $exists =
$this->bo->exists(array(
! 'type' =>
'appandsubs',
! 'cat_name' => $cat_name,
! 'cat_id' =>
$this->cat_id
! ));
! }
!
! if ($exists == True)
! {
! $error[$errorcount++] =
lang('That name has been used already');
! }
! }
!
! if (!$error)
{
! $this->bo->cats->edit(array(
! 'access' => 'public',
! 'parent' => $cat_parent,
! 'descr' => $cat_description,
! 'name' => $cat_name,
! 'id' => $this->cat_id
! ));
}
}
- if ($errorcount)
- {
-
$this->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
- }
-
- if (($submit) && (!$error) && (!$errorcount))
- {
-
$this->template->set_var('message',lang('Category x has been updated
!',$cat_name));
- }
-
- if ((!$submit) && (!$error) && (!$errorcount))
- {
- $this->template->set_var('message','');
- }
-
$cats = $this->bo->cats->return_single($this->cat_id);
$this->template->set_var('title_categories',lang('Edit
global category'));
- $this->template->set_var('lang_parent',lang('Parent
category'));
- $this->template->set_var('lang_none',lang('None'));
$this->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.edit'));
$this->template->set_var('deleteurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.delete&cat_id='
. $this->cat_id));
$this->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'));
$this->template->set_var('hidden_vars',$hidden_vars);
- $this->template->set_var('lang_name',lang('Name'));
-
$this->template->set_var('lang_descr',lang('Description'));
- $this->template->set_var('lang_done',lang('Done'));
- $this->template->set_var('lang_edit',lang('Edit'));
- $this->template->set_var('lang_delete',lang('Delete'));
$this->template->set_var('cat_name',$GLOBALS['phpgw']->strip_html($cats[0]['name']));
--- 262,293 ----
if ($submit)
{
! $values = array
! (
! 'id' => $this->cat_id,
! 'parent' => $cat_parent,
! 'descr' => $cat_description,
! 'name' => $cat_name,
! 'access' => 'public'
! );
! $error = $this->bo->check_values($values);
! if (is_array($error))
{
!
$this->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
}
! else
{
! $this->bo->save_cat($values);
!
$this->template->set_var('message',lang('Category x has been updated
!',$cat_name));
}
}
$cats = $this->bo->cats->return_single($this->cat_id);
$this->template->set_var('title_categories',lang('Edit
global category'));
$this->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.edit'));
$this->template->set_var('deleteurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.delete&cat_id='
. $this->cat_id));
$this->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'));
$this->template->set_var('hidden_vars',$hidden_vars);
$this->template->set_var('cat_name',$GLOBALS['phpgw']->strip_html($cats[0]['name']));
***************
*** 383,388 ****
$this->template->set_var('edithandle','');
$this->template->set_var('addhandle','');
! $this->template->pparse('out','form');
! $this->template->pparse('edithandle','edit');
}
--- 297,302 ----
$this->template->set_var('edithandle','');
$this->template->set_var('addhandle','');
! $this->template->pfp('out','form');
! $this->template->pfp('edithandle','edit');
}
***************
*** 435,443 ****
$this->template->set_var('subs','');
$this->template->set_var('nolink',$nolink);
-
$this->template->set_var('lang_done',lang('Done'));
$this->template->set_var('deletehandle','');
$this->template->set_var('donehandle','');
!
$this->template->pparse('out','category_delete');
!
$this->template->pparse('donehandle','done');
}
else
--- 349,356 ----
$this->template->set_var('subs','');
$this->template->set_var('nolink',$nolink);
$this->template->set_var('deletehandle','');
$this->template->set_var('donehandle','');
!
$this->template->pfp('out','category_delete');
!
$this->template->pfp('donehandle','done');
}
else
***************
*** 468,473 ****
$this->template->set_var('deletehandle','');
$this->template->set_var('donehandle','');
!
$this->template->pparse('out','category_delete');
!
$this->template->pparse('deletehandle','delete');
}
}
--- 381,386 ----
$this->template->set_var('deletehandle','');
$this->template->set_var('donehandle','');
!
$this->template->pfp('out','category_delete');
!
$this->template->pfp('deletehandle','delete');
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: admin/inc class.bocategories.inc.php,1.2,1.3 class.uicategories.inc.php,1.5,1.6,
Bettina gille <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: admin/templates/default category_form.tpl,1.6,1.7
- Next by Date:
[Phpgroupware-cvs] CVS: preferences/inc class.bocategories.inc.php,1.1,1.2 class.uicategories.inc.php,1.1,1.2
- Previous by thread:
[Phpgroupware-cvs] CVS: admin/templates/default category_form.tpl,1.6,1.7
- Next by thread:
[Phpgroupware-cvs] CVS: preferences/inc class.bocategories.inc.php,1.1,1.2 class.uicategories.inc.php,1.1,1.2
- Index(es):