mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
fix for bug 1286
This commit is contained in:
parent
d9815720e3
commit
0ae563ca08
@ -34,25 +34,25 @@
|
||||
|
||||
function uicategories()
|
||||
{
|
||||
$this->bo = CreateObject('admin.bocategories');
|
||||
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||
$this->bo = CreateObject('admin.bocategories');
|
||||
$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;
|
||||
$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(); }
|
||||
}
|
||||
|
||||
function _debug_sqsof()
|
||||
{
|
||||
$data = array(
|
||||
'start' => $this->start,
|
||||
'query' => $this->query,
|
||||
'sort' => $this->sort,
|
||||
'order' => $this->order,
|
||||
'cat_id' => $this->cat_id
|
||||
'start' => $this->start,
|
||||
'query' => $this->query,
|
||||
'sort' => $this->sort,
|
||||
'order' => $this->order,
|
||||
'cat_id' => $this->cat_id
|
||||
);
|
||||
echo '<br>UI:<br>';
|
||||
_debug_array($data);
|
||||
@ -62,10 +62,10 @@
|
||||
{
|
||||
$data = array
|
||||
(
|
||||
'start' => $this->start,
|
||||
'query' => $this->query,
|
||||
'sort' => $this->sort,
|
||||
'order' => $this->order
|
||||
'start' => $this->start,
|
||||
'query' => $this->query,
|
||||
'sort' => $this->sort,
|
||||
'order' => $this->order
|
||||
);
|
||||
|
||||
if(isset($this->cat_id))
|
||||
@ -335,20 +335,18 @@
|
||||
|
||||
$this->set_langs();
|
||||
|
||||
$new_parent = $GLOBALS['HTTP_POST_VARS']['new_parent'];
|
||||
$submit = $GLOBALS['HTTP_POST_VARS']['submit'];
|
||||
$cat_parent = $GLOBALS['HTTP_POST_VARS']['cat_parent'];
|
||||
$cat_name = $GLOBALS['HTTP_POST_VARS']['cat_name'];
|
||||
$cat_description = $GLOBALS['HTTP_POST_VARS']['cat_description'];
|
||||
$new_parent = $GLOBALS['HTTP_POST_VARS']['new_parent'];
|
||||
$submit = $GLOBALS['HTTP_POST_VARS']['submit'];
|
||||
$cat_parent = $GLOBALS['HTTP_POST_VARS']['cat_parent'];
|
||||
$cat_name = $GLOBALS['HTTP_POST_VARS']['cat_name'];
|
||||
$cat_description = $GLOBALS['HTTP_POST_VARS']['cat_description'];
|
||||
$old_parent = $GLOBALS['HTTP_POST_VARS']['old_parent'];
|
||||
|
||||
$GLOBALS['phpgw']->template->set_file(array('cat_form' => 'category_form.tpl'));
|
||||
$GLOBALS['phpgw']->template->set_block('cat_form','add');
|
||||
$GLOBALS['phpgw']->template->set_block('cat_form','edit');
|
||||
$GLOBALS['phpgw']->template->set_block('cat_form','form');
|
||||
|
||||
|
||||
$hidden_vars = '<input type="hidden" name="cat_id" value="' . $this->cat_id . '">' . "\n";
|
||||
$GLOBALS['phpgw']->template->set_var('hidden_vars',$hidden_vars);
|
||||
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
|
||||
if ($new_parent)
|
||||
@ -360,11 +358,12 @@
|
||||
{
|
||||
$values = array
|
||||
(
|
||||
'id' => $this->cat_id,
|
||||
'parent' => $cat_parent,
|
||||
'descr' => $cat_description,
|
||||
'name' => $cat_name,
|
||||
'access' => 'public'
|
||||
'id' => $this->cat_id,
|
||||
'old_parent' => $old_parent,
|
||||
'parent' => $cat_parent,
|
||||
'descr' => $cat_description,
|
||||
'name' => $cat_name,
|
||||
'access' => 'public'
|
||||
);
|
||||
|
||||
$error = $this->bo->check_values($values);
|
||||
@ -374,7 +373,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->bo->save_cat($values);
|
||||
$this->cat_id = $this->bo->save_cat($values);
|
||||
$GLOBALS['phpgw']->template->set_var('message',lang('Category x has been updated !',$cat_name));
|
||||
}
|
||||
}
|
||||
@ -390,6 +389,10 @@
|
||||
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit global category'));
|
||||
}
|
||||
|
||||
$hidden_vars = '<input type="hidden" name="cat_id" value="' . $this->cat_id . '">' . "\n"
|
||||
. '<input type="hidden" name="old_parent" value="' . $cats[0]['parent'] . '">' . "\n";
|
||||
$GLOBALS['phpgw']->template->set_var('hidden_vars',$hidden_vars);
|
||||
|
||||
$link_data['menuaction'] = 'admin.uicategories.edit';
|
||||
$link_data['cat_id'] = $this->cat_id;
|
||||
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
@ -398,13 +401,10 @@
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('cat_name',$GLOBALS['phpgw']->strip_html($cats[0]['name']));
|
||||
$GLOBALS['phpgw']->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cats[0]['description']));
|
||||
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->formatted_list(array(
|
||||
'select' => 'select',
|
||||
'all' => 'all',
|
||||
'cat_parent' => $cats[0]['parent'],
|
||||
'global_cats' => $global_cats
|
||||
)));
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->formatted_list(array('select' => 'select',
|
||||
'all' => 'all',
|
||||
'cat_parent' => $cats[0]['parent'],
|
||||
'global_cats' => $global_cats)));
|
||||
$GLOBALS['phpgw']->template->parse('buttons','edit');
|
||||
$GLOBALS['phpgw']->template->fp('phpgw_body','form');
|
||||
}
|
||||
|
@ -19,11 +19,9 @@
|
||||
}
|
||||
}
|
||||
</SCRIPT>
|
||||
<div style="width: 100%; height: 100%; overflow: auto;">
|
||||
<table width="75%" border="0" cellspacing="0" cellpadding="0">
|
||||
{rows}
|
||||
</table>
|
||||
</div>
|
||||
<!-- END list -->
|
||||
|
||||
<!-- BEGIN app_row -->
|
||||
|
@ -649,26 +649,35 @@
|
||||
*/
|
||||
function edit($cat_values)
|
||||
{
|
||||
if ($cat_values['parent'] && ($cat_values['parent'] != 0))
|
||||
if (intval($cat_values['old_parent']) != $cat_values['parent'])
|
||||
{
|
||||
$cat_values['main'] = $this->id2name($cat_values['parent'],'main');
|
||||
$cat_values['level'] = $this->id2name($cat_values['parent'],'level')+1;
|
||||
$this->delete(array('cat_id' => $cat_values['id'],'drop_subs' => False,'modify_subs' => True));
|
||||
return $this->add($cat_values);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cat_values['main'] = $cat_values['id'];
|
||||
$cat_values['level'] = 0;
|
||||
if ($cat_values['parent'] && ($cat_values['parent'] != 0))
|
||||
{
|
||||
$cat_values['main'] = intval($this->id2name($cat_values['parent'],'main'));
|
||||
$cat_values['level'] = intval($this->id2name($cat_values['parent'],'level')+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cat_values['main'] = intval($cat_values['id']);
|
||||
$cat_values['level'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$cat_values['descr'] = $this->db->db_addslashes($cat_values['descr']);
|
||||
$cat_values['name'] = $this->db->db_addslashes($cat_values['name']);
|
||||
|
||||
$sql = "UPDATE phpgw_categories SET cat_name='" . $cat_values['name'] . "', cat_description='" . $cat_values['descr']
|
||||
. "', cat_data='" . $cat_values['data'] . "', cat_parent='" . $cat_values['parent'] . "', cat_access='"
|
||||
. $cat_values['access'] . "', cat_main='" . $cat_values['main'] . "', cat_level='" . $cat_values['level'] . "' "
|
||||
. "WHERE cat_appname='" . $this->app_name . "' AND cat_id='" . $cat_values['id'] . "'";
|
||||
. "', cat_data='" . $cat_values['data'] . "', cat_parent=" . $cat_values['parent'] . ", cat_access='"
|
||||
. $cat_values['access'] . "', cat_main=" . $cat_values['main'] . ", cat_level=" . $cat_values['level']
|
||||
. " WHERE cat_appname='" . $this->app_name . "' AND cat_id=" . intval($cat_values['id']);
|
||||
|
||||
$this->db->query($sql,__LINE__,__FILE__);
|
||||
return intval($cat_values['id']);
|
||||
}
|
||||
|
||||
function name2id($cat_name)
|
||||
|
@ -1,20 +1,19 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - Preferences - categories *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Bettina Gille [ceb@phpgroupware.org] *
|
||||
* ----------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
/* $Id$ */
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - Preferences - categories *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Bettina Gille [ceb@phpgroupware.org] *
|
||||
* ----------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
/* $Id$ */
|
||||
|
||||
class uicategories
|
||||
{
|
||||
var $bo;
|
||||
var $t;
|
||||
|
||||
var $start;
|
||||
var $query;
|
||||
@ -24,34 +23,35 @@
|
||||
|
||||
var $public_functions = array
|
||||
(
|
||||
'index' => True,
|
||||
'add' => True,
|
||||
'edit' => True,
|
||||
'delete' => True
|
||||
'index' => True,
|
||||
'add' => True,
|
||||
'edit' => True,
|
||||
'delete' => True
|
||||
);
|
||||
|
||||
function uicategories()
|
||||
{
|
||||
|
||||
$this->bo = CreateObject('preferences.bocategories',$cats_app);
|
||||
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||
$this->account = $GLOBALS['phpgw_info']['user']['account_id'];
|
||||
$this->user = $GLOBALS['phpgw_info']['user']['fullname'];
|
||||
$cats_app = get_var('cats_app',array('POST','GET'));
|
||||
|
||||
$this->start = $this->bo->start;
|
||||
$this->query = $this->bo->query;
|
||||
$this->sort = $this->bo->sort;
|
||||
$this->order = $this->bo->order;
|
||||
$this->bo = CreateObject('preferences.bocategories',$cats_app);
|
||||
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
||||
$this->account = $GLOBALS['phpgw_info']['user']['account_id'];
|
||||
$this->user = $GLOBALS['phpgw_info']['user']['fullname'];
|
||||
|
||||
$this->start = $this->bo->start;
|
||||
$this->query = $this->bo->query;
|
||||
$this->sort = $this->bo->sort;
|
||||
$this->order = $this->bo->order;
|
||||
}
|
||||
|
||||
function save_sessiondata($cats_app)
|
||||
{
|
||||
$data = array
|
||||
(
|
||||
'start' => $this->start,
|
||||
'query' => $this->query,
|
||||
'sort' => $this->sort,
|
||||
'order' => $this->order
|
||||
'start' => $this->start,
|
||||
'query' => $this->query,
|
||||
'sort' => $this->sort,
|
||||
'order' => $this->order
|
||||
);
|
||||
$this->bo->save_sessiondata($data,$cats_app);
|
||||
}
|
||||
@ -94,11 +94,11 @@
|
||||
|
||||
$link_data = array
|
||||
(
|
||||
'menuaction' => 'preferences.uicategories.index',
|
||||
'cats_app' => $cats_app,
|
||||
'extra' => $extra,
|
||||
'global_cats' => $global_cats,
|
||||
'cats_level' => $cats_level
|
||||
'menuaction' => 'preferences.uicategories.index',
|
||||
'cats_app' => $cats_app,
|
||||
'extra' => $extra,
|
||||
'global_cats' => $global_cats,
|
||||
'cats_level' => $cats_level
|
||||
);
|
||||
|
||||
if ($extra)
|
||||
@ -392,12 +392,13 @@
|
||||
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php',$link_data));
|
||||
}
|
||||
|
||||
$new_parent = get_var('new_parent',Array('POST'));
|
||||
$cat_parent = get_var('cat_parent',Array('POST'));
|
||||
$cat_name = get_var('cat_name',Array('POST'));
|
||||
$cat_description = get_var('cat_description',Array('POST'));
|
||||
$cat_data = get_var('cat_data',Array('POST'));
|
||||
$cat_access = get_var('cat_access',Array('POST'));
|
||||
$new_parent = get_var('new_parent',Array('POST'));
|
||||
$cat_parent = get_var('cat_parent',Array('POST'));
|
||||
$cat_name = get_var('cat_name',Array('POST'));
|
||||
$cat_description = get_var('cat_description',Array('POST'));
|
||||
$cat_data = get_var('cat_data',Array('POST'));
|
||||
$cat_access = get_var('cat_access',Array('POST'));
|
||||
$old_parent = get_var('old_parent',array('POST'));
|
||||
|
||||
if ($new_parent)
|
||||
{
|
||||
@ -410,12 +411,13 @@
|
||||
|
||||
$values = array
|
||||
(
|
||||
'id' => $cat_id,
|
||||
'parent' => $cat_parent,
|
||||
'descr' => $cat_description,
|
||||
'name' => $cat_name,
|
||||
'access' => $cat_access,
|
||||
'data' => $data
|
||||
'id' => $cat_id,
|
||||
'parent' => $cat_parent,
|
||||
'old_parent' => $old_parent,
|
||||
'descr' => $cat_description,
|
||||
'name' => $cat_name,
|
||||
'access' => $cat_access,
|
||||
'data' => $data
|
||||
);
|
||||
|
||||
$error = $this->bo->check_values($values);
|
||||
@ -425,7 +427,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->bo->save_cat($values);
|
||||
$cat_id = $this->bo->save_cat($values);
|
||||
$message = lang('Category x has been updated !',$cat_name);
|
||||
}
|
||||
}
|
||||
@ -442,6 +444,8 @@
|
||||
|
||||
$cats = $this->bo->cats->return_single($cat_id);
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('hidden_vars','<input type="hidden" name="old_parent" value="' . $cats[0]['parent'] . '">');
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit x category for',lang($cats_app)));
|
||||
$GLOBALS['phpgw']->template->set_var('message',$message);
|
||||
$GLOBALS['phpgw']->template->set_var('lang_app',lang($cats_app));
|
||||
|
@ -28,6 +28,3 @@ time format preferences en Time format
|
||||
your current theme is: x preferences en </b>
|
||||
you must enter a password preferences en You must enter a password
|
||||
your preferences preferences en Your Preferences
|
||||
|
||||
|
||||
|
||||
|
@ -59,6 +59,7 @@
|
||||
<table width="80%" border="0" cellspacing="2" cellpadding="2">
|
||||
<tr valign="bottom">
|
||||
<td height="50">
|
||||
{hidden_vars}
|
||||
<input type="submit" name="submit" value="{lang_save}"></form></td>
|
||||
<td height="50" align="center">
|
||||
{delete}</td>
|
||||
|
@ -1,5 +1,4 @@
|
||||
<!-- BEGIN list -->
|
||||
<div style="width: 100%; height: 100%; overflow: auto;">
|
||||
<table border="0" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align="left">{tabs}</td>
|
||||
@ -9,7 +8,6 @@
|
||||
<table width="75%" border="0" cellspacing="0" cellpadding="0">
|
||||
{rows}
|
||||
</table>
|
||||
</div>
|
||||
<!-- END list -->
|
||||
|
||||
<!-- BEGIN app_row -->
|
||||
|
Loading…
Reference in New Issue
Block a user