This commit is contained in:
ceb 2003-06-24 22:33:40 +00:00
parent 1e8c937f2d
commit b1aa23e5d0
4 changed files with 52 additions and 55 deletions

View File

@ -440,24 +440,24 @@
if ($format == 'select')
{
for ($i=0;$i<count($cats);$i++)
while (is_array($cats) && list(,$cat)=each($cats))
{
$s .= '<option value="' . $cats[$i]['cat_id'] . '"';
if (in_array($cats[$i]['cat_id'],$selected))
$s .= '<option value="' . $cat['cat_id'] . '"';
if (in_array($cat['cat_id'],$selected))
{
$s .= ' selected';
}
$s .= '>';
for ($j=0;$j<$cats[$i]['level'];$j++)
for ($j=0;$j<$cat['level'];$j++)
{
$s .= '&nbsp;.&nbsp;';
}
$s .= $GLOBALS['phpgw']->strip_html($cats[$i]['name']);
if ($cats[$i]['app_name'] == 'phpgw')
$s .= $GLOBALS['phpgw']->strip_html($cat['name']);
if ($cat['app_name'] == 'phpgw')
{
$s .= '&nbsp;&lt;' . lang('Global') . '&gt;';
}
if ($cats[$i]['owner'] == '-1')
if ($cat['owner'] == '-1')
{
$s .= '&nbsp;&lt;' . lang('Global') . '&nbsp;' . lang($this->app_name) . '&gt;';
}

View File

@ -31,7 +31,7 @@
function uicategories()
{
$cats_app = get_var('cats_app',array('POST','GET'));
$cats_app = get_var('cats_app',array('GET','POST'));
$this->bo = CreateObject('preferences.bocategories',$cats_app);
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
@ -70,6 +70,7 @@
$GLOBALS['phpgw']->template->set_var('user_name',$this->user);
$GLOBALS['phpgw']->template->set_var('lang_search',lang('Search'));
$GLOBALS['phpgw']->template->set_var('lang_done',lang('Done'));
$GLOBALS['phpgw']->template->set_var('lang_cancel',lang('cancel'));
$GLOBALS['phpgw']->template->set_var('lang_sub',lang('Add sub'));
$GLOBALS['phpgw']->template->set_var('lang_edit',lang('Edit'));
$GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete'));
@ -92,10 +93,10 @@
function index()
{
$cats_app = get_var('cats_app',array('POST','GET'));
$extra = get_var('extra',array('POST','GET'));
$global_cats = get_var('global_cats',array('POST','GET'));
$cats_level = get_var('cats_level',array('POST','GET'));
$cats_app = get_var('cats_app',array('GET','POST'));
$extra = get_var('extra',array('GET','POST'));
$global_cats = get_var('global_cats',array('GET','POST'));
$cats_level = get_var('cats_level',array('GET','POST'));
$link_data = array
(
@ -130,7 +131,6 @@
$global_cats = False;
}
$this->bo->cats->app_name = $cats_app;
$cats = $this->bo->get_list($global_cats);
//--------------------------------- nextmatch --------------------------------------------
@ -290,7 +290,7 @@
$parent = get_var('parent',array('GET'));
$cat_data = get_var('cat_data',array('POST'));
if (get_var('submit',Array('POST')))
if ($_POST['save'])
{
if (is_array($cat_data))
{
@ -315,7 +315,7 @@
}
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Add %1 category for',
$GLOBALS['phpgw_info']['apps'][$cats_app]['title']).':&nbsp;'.$this->user;
$GLOBALS['phpgw_info']['apps'][$cats_app]['title']).':&nbsp;'.$this->user;
$GLOBALS['phpgw']->common->phpgw_header();
$GLOBALS['phpgw']->template->set_file(array('cat_form' => 'category_form.tpl'));
@ -375,7 +375,7 @@
}
$link_data['menuaction'] = 'preferences.uicategories.index';
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->set_var('cancel_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->parse('buttons','add');
$GLOBALS['phpgw']->template->fp('phpgw_body','form');
@ -409,7 +409,7 @@
$GLOBALS['phpgw_info']['apps'][$cats_app]['title']).':&nbsp;'.$this->user;
$GLOBALS['phpgw']->common->phpgw_header();
if (get_var('submit',Array('POST')))
if ($_POST['save'])
{
if (is_array($cat_data))
{
@ -447,7 +447,7 @@
$GLOBALS['phpgw']->template->set_var('title_categories',lang('Edit %1 category for',lang($cats_app)));
$GLOBALS['phpgw']->template->set_var('message',$message);
$GLOBALS['phpgw']->template->set_var('lang_app',lang($cats_app));
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->set_var('cancel_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
$link_data['menuaction'] = 'preferences.uicategories.edit';
$link_data['cat_id'] = $this->cat_id;
@ -474,7 +474,8 @@
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formatted_list(array('format' => 'select',
'type' => $type,
'selected' => $cats['parent'],
'globals' => $global_cats)));
'globals' => $global_cats,
'self' => $this->cat_id)));
$GLOBALS['phpgw']->template->set_var('access',$cats['access'] == 'private'?' checked':'');
@ -495,7 +496,7 @@
$GLOBALS['phpgw']->template->set_var('rows','');
}
if ($cats[0]['owner'] == $this->account)
if ($cats['owner'] == $this->account)
{
$link_data['menuaction'] = 'preferences.uicategories.delete';
$GLOBALS['phpgw']->template->set_var('delete','<form method="POST" action="' . $GLOBALS['phpgw']->link('/index.php',$link_data)
@ -531,13 +532,11 @@
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
}
$this->bo->cats->app_name = $cats_app;
if (get_var('confirm',array('POST')))
if ($_POST['confirm'])
{
if (get_var('subs',array('POST')))
if ($_POST['subs'])
{
switch (get_var('subs',array('POST')))
switch ($_POST['subs'])
{
case 'move':
$this->bo->delete(array('cat_id' => $this->cat_id,'modify_subs' => True));

View File

@ -1,68 +1,66 @@
<!-- $Id$ -->
<!-- BEGIN form -->
<br>
<center>
{message}<br>
<table border="0" width="80%" cellspacing="2" cellpadding="2">
<form name="form" action="{actionurl}" method="POST">
<tr class="th">
<td>{lang_parent}</td>
<tr class="row_off">
<td colspan="2">{lang_parent}</td>
<td><select name="values[parent]"><option value="">{lang_none}</option>{category_list}</select></td>
</tr>
<tr class="row_on">
<td>{lang_name}</td>
<td colspan="2">{lang_name}</td>
<td><input name="values[name]" size="50" value="{cat_name}"></td>
</tr>
<tr class="row_off">
<td>{lang_descr}</td>
<td colspan="2">{lang_descr}</td>
<td><textarea name="values[descr]" rows="4" cols="50" wrap="virtual">{cat_description}</textarea></td>
</tr>
<tr class="row_on">
<td>{lang_access}</td>
<td colspan="2">{lang_access}</td>
<td><input type="checkbox" name="values[access]" value="True" {access}></td>
</tr>
{rows}
</table>
{buttons}
</table>
</center>
<!-- END form -->
<!-- BEGIN add -->
<table width="80%" border="0" cellspacing="5">
<tr valign="top">
<td><input type="submit" name="submit" value="{lang_save}"></form></td>
<td><form method="POST" action="{doneurl}"><input type="submit" name="done" value="{lang_done}"></form></td>
<td width="80%">&nbsp;</td>
<tr valign="bottom" height="50">
<td colspan="2"><input type="submit" name="save" value="{lang_save}"></form></td>
<td align="right">
<form method="POST" action="{cancel_url}"><input type="submit" name="cancel" value="{lang_cancel}"></form>
</td>
</tr>
</table>
<!-- END add -->
<!-- BEGIN edit -->
<table width="80%" border="0" cellspacing="5">
<tr valign="top">
<tr valign="bottom" height="50">
<td>
<input type="hidden" name="values[old_parent]" value="{old_parent}">
<input type="submit" name="submit" value="{lang_save}"></form></td>
<input type="submit" name="save" value="{lang_save}"></form></td>
<td>
<form method="POST" action="{doneurl}">
<input type="submit" name="done" value="{lang_done}"></form></td>
<td width="80%" align="right">{delete}</td>
<form method="POST" action="{cancel_url}">
<input type="submit" name="cancel" value="{lang_cancel}"></form></td>
<td align="right">{delete}</td>
</tr>
</table>
<!-- END edit -->
<!-- BEGIN data_row -->
<tr class="{tr_color}">
<td>{lang_data}</td>
<tr class="row_off">
<td colspan="2">{lang_data}</td>
<td>{td_data}</td>
</tr>

View File

@ -39,18 +39,18 @@
{rows}
</table>
<table border="0" cellspacing="5" width="80%">
<tr valign="bottom">
<table border="0" cellpadding="2" cellspacing="2" width="80%">
<tr valign="bottom" height="50">
<td>
<form method="POST" action="{add_action}">
<input type="submit" value="{lang_add}">
</form></td>
<td>
<form method="POST" action="{doneurl}">
<input type="submit" name="done" value="{lang_done}">
<input type="submit" value="{lang_add}">
</form>
</td>
<td align="right">
<form method="POST" action="{doneurl}">
<input type="submit" name="done" value="{lang_done}">
</form>
</td>
<td width="80%">&nbsp;</td>
</tr>
</table>