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') 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'] . '"'; $s .= '<option value="' . $cat['cat_id'] . '"';
if (in_array($cats[$i]['cat_id'],$selected)) if (in_array($cat['cat_id'],$selected))
{ {
$s .= ' selected'; $s .= ' selected';
} }
$s .= '>'; $s .= '>';
for ($j=0;$j<$cats[$i]['level'];$j++) for ($j=0;$j<$cat['level'];$j++)
{ {
$s .= '&nbsp;.&nbsp;'; $s .= '&nbsp;.&nbsp;';
} }
$s .= $GLOBALS['phpgw']->strip_html($cats[$i]['name']); $s .= $GLOBALS['phpgw']->strip_html($cat['name']);
if ($cats[$i]['app_name'] == 'phpgw') if ($cat['app_name'] == 'phpgw')
{ {
$s .= '&nbsp;&lt;' . lang('Global') . '&gt;'; $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;'; $s .= '&nbsp;&lt;' . lang('Global') . '&nbsp;' . lang($this->app_name) . '&gt;';
} }

View File

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

View File

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

View File

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