update data field to only show if extra exists

This commit is contained in:
bettina 2001-04-02 00:29:26 +00:00
parent fa3e1b36c0
commit 2bec31eacd
6 changed files with 75 additions and 43 deletions

View File

@ -23,6 +23,7 @@
. "<input type=\"hidden\" name=\"query\" value=\"$query\">\n"
. "<input type=\"hidden\" name=\"start\" value=\"$start\">\n"
. "<input type=\"hidden\" name=\"cats_app\" value=\"$cats_app\">\n"
. "<input type=\"hidden\" name=\"extra\" value=\"$extra\">\n"
. "<input type=\"hidden\" name=\"filter\" value=\"$filter\">\n";
@ -62,19 +63,28 @@
$t->set_var('hidden_vars',$hidden_vars);
$t->set_var('user_name',$phpgw_info["user"]["fullname"]);
$t->set_var('doneurl',$phpgw->link('/preferences/categories.php'));
$t->set_var('title_categories',lang('Add category for'));
$t->set_var('title_categories',lang("Add $cats_app category for"));
$t->set_var('actionurl',$phpgw->link('/preferences/addcategory.php'));
$t->set_var('lang_parent',lang('Parent category'));
$t->set_var('lang_select_parent',lang('Select parent category'));
$t->set_var('lang_access',lang('Private'));
$t->set_var('lang_data',lang('Data'));
if ($access) { $t->set_var('access', '<input type="checkbox" name="access" value="True" checked>'); }
else { $t->set_var('access', '<input type="checkbox" name="access" value="True"'); }
$t->set_var('lang_name',lang('Name'));
$t->set_var('lang_descr',lang('Description'));
$t->set_var('cat_name',$cat_name);
$t->set_var('cat_description',$cat_description);
$t->set_var('cat_data',$cat_data);
if ($extra) {
$t->set_var('td_data','<input name="cat_data" size="50" value="' . $cat_data . '">');
$t->set_var('lang_data',lang($extra));
}
else {
$t->set_var('cat_data','');
$t->set_var('lang_data','');
}
$t->set_var('lang_add',lang('Add'));
$t->set_var('lang_reset',lang('Clear Form'));
$t->set_var('lang_done',lang('Done'));

View File

@ -29,16 +29,17 @@
. "<input type=\"hidden\" name=\"query\" value=\"$query\">\n"
. "<input type=\"hidden\" name=\"start\" value=\"$start\">\n"
. "<input type=\"hidden\" name=\"cats_app\" value=\"$cats_app\">\n"
. "<input type=\"hidden\" name=\"extra\" value=\"$extra\">\n"
. "<input type=\"hidden\" name=\"filter\" value=\"$filter\">\n";
$t->set_var('font',$phpgw_info["theme"]["font"]);
$t->set_var('user_name',$phpgw_info["user"]["fullname"]);
$t->set_var('title_categories',lang('Categories for'));
$t->set_var('title_categories',lang('categories for'));
$t->set_var('lang_action',lang('Category list'));
$t->set_var('add_action',$phpgw->link('/preferences/addcategory.php',"cats_app=$cats_app"));
$t->set_var('add_action',$phpgw->link('/preferences/addcategory.php',"cats_app=$cats_app&extra=$extra"));
$t->set_var('lang_add',lang('Add'));
$t->set_var('lang_search',lang('Search'));
$t->set_var('actionurl',$phpgw->link('/preferences/categories.php',"cats_app=$cats_app"));
$t->set_var('actionurl',$phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra"));
$t->set_var('lang_done',lang('Done'));
$t->set_var('doneurl',$phpgw->link('/preferences/'));
@ -55,8 +56,8 @@
//--------------------------------- nextmatch --------------------------------------------
$left = $phpgw->nextmatchs->left('/preferneces/categories.php',$start,$c->total_records,"&cats_app=$cats_app");
$right = $phpgw->nextmatchs->right('/preferences/categories.php',$start,$c->total_records,"&cats_app=$cats_app");
$left = $phpgw->nextmatchs->left('/preferneces/categories.php',$start,$c->total_records,"&cats_app=$cats_app&extra=$extra");
$right = $phpgw->nextmatchs->right('/preferences/categories.php',$start,$c->total_records,"&cats_app=$cats_app&extra=$extra");
$t->set_var('left',$left);
$t->set_var('right',$right);
@ -70,9 +71,14 @@
//------------------- list header variable template-declarations -------------------------
$t->set_var('th_bg',$phpgw_info["theme"][th_bg]);
$t->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,'cat_name',$order,'/preferences/categories.php',lang('Name'),"&cats_app=$cats_app"));
$t->set_var('sort_description',$phpgw->nextmatchs->show_sort_order($sort,'cat_description',$order,'/preferences/categories.php',lang('Description'),"&cats_app=$cats_app"));
$t->set_var('sort_data',$phpgw->nextmatchs->show_sort_order($sort,'cat_data',$order,'/preferences/categories.php',lang('Data'),"&cats_app=$cats_app"));
$t->set_var('sort_name',$phpgw->nextmatchs->show_sort_order($sort,'cat_name',$order,'/preferences/categories.php',lang('Name'),"&cats_app=$cats_app&extra=$extra"));
$t->set_var('sort_description',$phpgw->nextmatchs->show_sort_order($sort,'cat_description',$order,'/preferences/categories.php',lang('Description'),"&cats_app=$cats_app&extra=$extra"));
if ($extra) {
$t->set_var('sort_data','<td bgcolor="' . $phpgw_info["theme"][th_bg] . '"><font face="' . $phpgw_info["theme"]["font"] . '">'
. $phpgw->nextmatchs->show_sort_order($sort,'cat_data',$order,'/preferences/categories.php',lang($extra),"&cats_app=$cats_app&extra=$extra") . '</td>');
}
else { $t->set_var('sort_data',''); }
$t->set_var('lang_app',lang($cats_app));
$t->set_var('lang_edit',lang('Edit'));
$t->set_var('lang_delete',lang('Delete'));
@ -92,8 +98,13 @@
$descr = $phpgw->strip_html($categories[$i]['description']);
if (! $descr) { $descr = '&nbsp;'; }
if ($extra) {
$data = $categories[$i]['data'];
if (! $data) { $data = '&nbsp;'; }
$t->set_var('td_data','<td><font face=' . $phpgw_info["theme"]["font"] . '>' . $data . '</font></td>');
}
else { $t->set_var('td_data',''); }
if ($categories[$i]['parent'] == 0) {
$name = '<font color=FF0000><b>' . $phpgw->strip_html($categories[$i]['name']) . '</b></font>';
@ -104,14 +115,13 @@
//-------------------------- template declaration for list records ---------------------------
$t->set_var(array('name' => $name,
'descr' => $descr,
'data' => $data));
'descr' => $descr));
$t->set_var('app_url',$phpgw->link('/' . $phpgw_info['flags']['currentapp'] . '/index.php',"cat_id=$cat_id"));
if ($categories[$i]["owner"] == $phpgw_info["user"]["account_id"]) {
$t->set_var('edit',$phpgw->link('/preferences/editcategory.php',"cat_id=$cat_id&cats_app=$cats_app"));
$t->set_var('edit',$phpgw->link('/preferences/editcategory.php',"cat_id=$cat_id&cats_app=$cats_app&extra=$extra"));
$t->set_var('lang_edit_entry',lang('Edit'));
}
else {
@ -119,7 +129,7 @@
$t->set_var('lang_edit_entry','&nbsp;');
}
if ($categories[$i]["owner"] == $phpgw_info["user"]["account_id"]) {
$t->set_var('delete',$phpgw->link('/preferences/deletecategory.php',"cat_id=$cat_id&cats_app=$cats_app"));
$t->set_var('delete',$phpgw->link('/preferences/deletecategory.php',"cat_id=$cat_id&cats_app=$cats_app&extra=$extra"));
$t->set_var('lang_delete_entry',lang('Delete'));
}
else {

View File

@ -26,22 +26,23 @@
$c->app_name = $cats_app;
if (! $cat_id) {
Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app"));
Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra"));
}
if ($confirm) {
$c->delete($cat_id);
Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app"));
Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app&extra=$extra"));
}
else {
$hidden_vars = "<input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\">\n"
. $hidden_vars = "<input type=\"hidden\" name=\"cats_app\" value=\"$cats_app\">\n";
. $hidden_vars = "<input type=\"hidden\" name=\"cats_app\" value=\"$cats_app\">\n"
. $hidden_vars = "<input type=\"hidden\" name=\"extra\" value=\"$extra\">\n";
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('preferences'));
$t->set_file(array('category_delete' => 'delete.tpl'));
$t->set_var('deleteheader',lang('Are you sure you want to delete this category ?'));
$t->set_var('font',$phpgw_info["theme"]["font"]);
$nolinkf = $phpgw->link('/preferences/categories.php',"cat_id=$cat_id&cats_app=$cats_app");
$nolinkf = $phpgw->link('/preferences/categories.php',"cat_id=$cat_id&cats_app=$cats_app&extra=$extra");
$nolink = "<a href=\"$nolinkf\">" . lang('No') ."</a>";
$t->set_var("nolink",$nolink);

View File

@ -11,11 +11,10 @@
\**************************************************************************/
/* $Id$ */
$phpgw_flags = array('currentapp' => $cats_app,
'noappheader' => True,
'noappfooter' => True);
$phpgw_info['flags']['currentapp'] = $cats_app;
$phpgw_info['flags']['noappheader'] = True;
$phpgw_info['flags']['noappfooter'] = True;
$phpgw_info['flags'] = $phpgw_flags;
include('../header.inc.php');
$hidden_vars = "<input type=\"hidden\" name=\"sort\" value=\"$sort\">\n"
@ -23,11 +22,13 @@
. "<input type=\"hidden\" name=\"query\" value=\"$query\">\n"
. "<input type=\"hidden\" name=\"start\" value=\"$start\">\n"
. "<input type=\"hidden\" name=\"cats_app\" value=\"$cats_app\">\n"
. "<input type=\"hidden\" name=\"cat_id\" value=\"$cat_id\">\n"
. "<input type=\"hidden\" name=\"extra\" value=\"$extra\">\n"
. "<input type=\"hidden\" name=\"filter\" value=\"$filter\">\n";
if (! $cat_id) {
Header('Location: ' . $phpgw->link('/preferences/categories.php',"sort=$sort&order=$order&query=$query&start=$start"
. "&filter=$filter&cats_app=$cats_app"));
. "&filter=$filter&cats_app=$cats_app&extra=$extra"));
}
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('preferences'));
@ -56,7 +57,7 @@
if ($access) { $cat_access = 'private'; }
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); }
}
if ($errorcount) { $t->set_var('message',$phpgw->common->error_list($error)); }
@ -69,8 +70,7 @@
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False'));
$t->set_var('font',$phpgw_info["theme"]["font"]);
$t->set_var('user_name',$phpgw_info["user"]["fullname"]);
$t->set_var('title_categories',lang('Edit category for'));
$t->set_var('lang_action',lang('Edit category'));
$t->set_var('title_categories',lang("Edit $cats_app category for"));
$t->set_var('doneurl',$phpgw->link('/preferences/categories.php'));
$t->set_var('actionurl',$phpgw->link('/preferences/editcategory.php'));
$t->set_var('deleteurl',$phpgw->link('/preferences/deletecategory.php'));
@ -78,7 +78,6 @@
$t->set_var('lang_parent',lang('Parent category'));
$t->set_var('lang_name',lang('Name'));
$t->set_var('lang_descr',lang('Description'));
$t->set_var('lang_data',lang('Data'));
$t->set_var('lang_select_parent',lang('Select parent category'));
$t->set_var('lang_access',lang('Private'));
if ($cats[0]['access']=='private') { $t->set_var('access', '<input type="checkbox" name="access" value="True" checked>'); }
@ -88,7 +87,15 @@
$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_data',$cats[0]['data']);
if ($extra) {
$t->set_var('td_data','<input name="cat_data" size="50" value="' . $cats[0]['data'] . '">');
$t->set_var('lang_data',lang($extra));
}
else {
$t->set_var('td_data','');
$t->set_var('lang_data','');
}
$t->set_var('lang_edit',lang('Edit'));
$t->set_var('lang_delete',lang('Delete'));

View File

@ -10,23 +10,23 @@
<table border="0" width="80%" cellspacing="2" cellpadding="2">
<form name="form" action="{actionurl}" method="POST">
<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>
</tr>
<tr>
<td><font face="{font}">{lang_name}:</font></td>
<td><font face="{font}">{lang_name}</font></td>
<td><font face="{font}"><input name="cat_name" size="50" value="{cat_name}"></font></td>
</tr>
<tr>
<td><font face="{font}">{lang_descr}:</font></td>
<td><font face="{font}">{lang_descr}</font></td>
<td colspan=2><font face="{font}"><textarea name="cat_description" rows="4" cols="50" wrap="virtual">{cat_description}</textarea></font></td>
</tr>
<tr>
<td><font face="{font}">{lang_data}:</font></td>
<td><font face="{font}"><input name="cat_data" size="50" value="{cat_data}"></font></td>
<td><font face="{font}">{lang_data}</font></td>
<td><font face="{font}">{td_data}</font></td>
</tr>
<tr>
<td><font face="{font}">{lang_access}:</font></td>
<td><font face="{font}">{lang_access}</font></td>
<td colspan=2>{access}</td>
</tr>
</table>

View File

@ -1,11 +1,11 @@
<!-- $Id$ -->
<center>
<table border="0" cellspacing="2" cellpadding="2">
<table border="0" cellspacing="0" cellpadding="0" width="80%">
<tr>
<td colspan="6" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>{title_categories}:&nbsp;{user_name}<b/></font></td>
<td colspan="3" width="80%" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>{lang_app}&nbsp;{title_categories}:&nbsp;{user_name}<b/></font></td>
</tr>
<tr>
<td colspan="6" align=left>
<td colspan="3" align=left>
<table border="0" width="100%">
<tr>
{left}
@ -17,15 +17,17 @@
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="5" align=right>
<td colspan="3" align=right>
<form method="post" action="{actionurl}">
<font face="{font}"><input type="text" name="query">&nbsp;<input type="submit" name="search" value="{lang_search}"></font>
</form></td>
</tr>
</table>
<table border="0" cellspacing="2" cellpadding="2" width="80%">
<tr bgcolor="{th_bg}">
<td bgcolor="{th_bg}"><font face="{font}">{sort_name}</font></td>
<td bgcolor="{th_bg}"><font face="{font}">{sort_description}</font></td>
<td bgcolor="{th_bg}"><font face="{font}">{sort_data}</font></td>
{sort_data}
<td bgcolor="{th_bg}" align="center"><font face="{font}">{lang_app}</font></td>
<td bgcolor="{th_bg}" align=center><font face="{font}">{lang_edit}</font></td>
<td bgcolor="{th_bg}" align=center><font face="{font}">{lang_delete}</font></td>
@ -35,21 +37,23 @@
<tr bgcolor="{tr_color}">
<td><font face="{font}">{name}</font></td>
<td><font face="{font}">{descr}</font></td>
<td><font face="{font}">{data}</font></td>
{td_data}
<td align="center"><font face="{font}"><a href="{app_url}">{lang_app}</a></font></td>
<td align="center"><font face="{font}"><a href="{edit}">{lang_edit_entry}</a></font></td>
<td align="center"><font face="{font}"><a href="{delete}">{lang_delete_entry}</font></td>
</tr>
<!-- END cat_list -->
<!-- BEGINN add -->
</table>
<table border="0" cellspacing="2" cellpadding="2" width="80%">
<tr valign="bottom">
<td colspan="5">
<td width="50%">
<form method="POST" action="{add_action}">
{hidden_vars}
<font face="{font}"><input type="submit" value="{lang_add}"></font>
</form>
</td>
<td align="right">
<td width="50%" align="right">
<form method="POST" action="{doneurl}">
{hidden_vars}
<font face="{font}"><input type="submit" name="done" value="{lang_done}"></font>