included files to edit apps categories. each app can use the files in preferences dir

This commit is contained in:
bettina 2001-04-01 02:58:04 +00:00
parent 6223c14c96
commit e7a279a1f3
7 changed files with 71 additions and 53 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - Addressbook * * phpGroupWare - Categories *
* http://www.phpgroupware.org * * http://www.phpgroupware.org *
* Written by Bettina Gille [ceb@phpgroupware.org] * * Written by Bettina Gille [ceb@phpgroupware.org] *
* ----------------------------------------------- * * ----------------------------------------------- *
@ -56,22 +56,25 @@
if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang("Category $cat_name has been added !")); } if (($submit) && (! $error) && (! $errorcount)) { $t->set_var('message',lang("Category $cat_name has been added !")); }
if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); } if ((! $submit) && (! $error) && (! $errorcount)) { $t->set_var('message',''); }
$t->set_var('font',$phpgw_info["theme"]["font"]);
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False')); $t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False'));
$t->set_var('hidden_vars',$hidden_vars); $t->set_var('hidden_vars',$hidden_vars);
$t->set_var('font',$font);
$t->set_var('user_name',$phpgw_info["user"]["fullname"]); $t->set_var('user_name',$phpgw_info["user"]["fullname"]);
$t->set_var('doneurl',$phpgw->link('/preferences/categories.php')); $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 category for'));
$t->set_var('actionurl',$phpgw->link('/preferences/addcategory.php')); $t->set_var('actionurl',$phpgw->link('/preferences/addcategory.php'));
$t->set_var('lang_choose',lang('Choose the category')); $t->set_var('lang_parent',lang('Parent category'));
$t->set_var('lang_select_parent',lang('Select parent category')); $t->set_var('lang_select_parent',lang('Select parent category'));
$t->set_var('lang_access',lang('Private')); $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>'); } 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"'); } else { $t->set_var('access', '<input type="checkbox" name="access" value="True"'); }
$t->set_var('lang_name',lang('Category name')); $t->set_var('lang_name',lang('Name'));
$t->set_var('lang_descr',lang('Category description')); $t->set_var('lang_descr',lang('Description'));
$t->set_var('cat_name',$cat_name); $t->set_var('cat_name',$cat_name);
$t->set_var('cat_description',$cat_description); $t->set_var('cat_description',$cat_description);
$t->set_var('cat_data',$cat_data);
$t->set_var('lang_add',lang('Add')); $t->set_var('lang_add',lang('Add'));
$t->set_var('lang_reset',lang('Clear Form')); $t->set_var('lang_reset',lang('Clear Form'));
$t->set_var('lang_done',lang('Done')); $t->set_var('lang_done',lang('Done'));
@ -81,4 +84,4 @@
$t->pparse('addhandle','add'); $t->pparse('addhandle','add');
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
?> ?>

View File

@ -31,6 +31,7 @@
. "<input type=\"hidden\" name=\"cats_app\" value=\"$cats_app\">\n" . "<input type=\"hidden\" name=\"cats_app\" value=\"$cats_app\">\n"
. "<input type=\"hidden\" name=\"filter\" value=\"$filter\">\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('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('lang_action',lang('Category list'));
@ -71,6 +72,7 @@
$t->set_var('th_bg',$phpgw_info["theme"][th_bg]); $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_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_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('lang_app',lang($cats_app)); $t->set_var('lang_app',lang($cats_app));
$t->set_var('lang_edit',lang('Edit')); $t->set_var('lang_edit',lang('Edit'));
$t->set_var('lang_delete',lang('Delete')); $t->set_var('lang_delete',lang('Delete'));
@ -90,15 +92,20 @@
$descr = $phpgw->strip_html($categories[$i]['description']); $descr = $phpgw->strip_html($categories[$i]['description']);
if (! $descr) { $descr = '&nbsp;'; } if (! $descr) { $descr = '&nbsp;'; }
$data = $categories[$i]['data'];
if (! $data) { $data = '&nbsp;'; }
if ($categories[$i]['parent'] == 0) { if ($categories[$i]['parent'] == 0) {
$name = '<font color=FF0000><b>' . $phpgw->strip_html($categories[$i]['name']) . '</b></font>'; $name = '<font color=FF0000><b>' . $phpgw->strip_html($categories[$i]['name']) . '</b></font>';
$descr = '<font color=FF0000><b>' . $descr . '</b></font>'; $descr = '<font color=FF0000><b>' . $descr . '</b></font>';
$data = '<font color=FF0000><b>' . $data . '</b></font>';
} }
//-------------------------- template declaration for list records --------------------------- //-------------------------- template declaration for list records ---------------------------
$t->set_var(array('name' => $name, $t->set_var(array('name' => $name,
'descr' => $descr)); 'descr' => $descr,
'data' => $data));
$t->set_var('app_url',$phpgw->link('/' . $phpgw_info['flags']['currentapp'] . '/index.php',"cat_id=$cat_id")); $t->set_var('app_url',$phpgw->link('/' . $phpgw_info['flags']['currentapp'] . '/index.php',"cat_id=$cat_id"));

View File

@ -1,6 +1,6 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* phpGroupWare - Addressbook * * phpGroupWare - Categories *
* (http://www.phpgroupware.org) * * (http://www.phpgroupware.org) *
* Written by Bettina Gille [ceb@phpgroupware.org] * * Written by Bettina Gille [ceb@phpgroupware.org] *
* ----------------------------------------------- * * ----------------------------------------------- *
@ -20,17 +20,17 @@
$phpgw_info['flags']['noappheader'] = True; $phpgw_info['flags']['noappheader'] = True;
$phpgw_info['flags']['noappfooter'] = True; $phpgw_info['flags']['noappfooter'] = True;
include("../header.inc.php"); include('../header.inc.php');
$c = CreateObject('phpgwapi.categories'); $c = CreateObject('phpgwapi.categories');
$c->app_name = $cats_app; $c->app_name = $cats_app;
if (! $cat_id) { if (! $cat_id) {
Header('Location: ' . $phpgw->link('/preferences/categories.php')); Header('Location: ' . $phpgw->link('/preferences/categories.php',"cats_app=$cats_app"));
} }
if ($confirm) { if ($confirm) {
$c->delete($cat_id); $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"));
} }
else { else {
@ -40,7 +40,7 @@
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('preferences')); $t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('preferences'));
$t->set_file(array('category_delete' => 'delete.tpl')); $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('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");
$nolink = "<a href=\"$nolinkf\">" . lang('No') ."</a>"; $nolink = "<a href=\"$nolinkf\">" . lang('No') ."</a>";
$t->set_var("nolink",$nolink); $t->set_var("nolink",$nolink);

View File

@ -27,8 +27,8 @@
if (! $cat_id) { if (! $cat_id) {
Header('Location: ' . $phpgw->link('/preferences/categories.php',"sort=$sort&order=$order&query=$query&start=$start" Header('Location: ' . $phpgw->link('/preferences/categories.php',"sort=$sort&order=$order&query=$query&start=$start"
. "&filter=$filter")); . "&filter=$filter&cats_app=$cats_app"));
} }
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('preferences')); $t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('preferences'));
$t->set_file(array('form' => 'category_form.tpl')); $t->set_file(array('form' => 'category_form.tpl'));
@ -67,7 +67,7 @@
$cat_parent = $cats[0]['parent']; $cat_parent = $cats[0]['parent'];
$t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False')); $t->set_var('category_list',$c->formated_list('select','all',$cat_parent,'False'));
$t->set_var('font',$font); $t->set_var('font',$phpgw_info["theme"]["font"]);
$t->set_var('user_name',$phpgw_info["user"]["fullname"]); $t->set_var('user_name',$phpgw_info["user"]["fullname"]);
$t->set_var('title_categories',lang('Edit category for')); $t->set_var('title_categories',lang('Edit category for'));
$t->set_var('lang_action',lang('Edit category')); $t->set_var('lang_action',lang('Edit category'));
@ -75,8 +75,10 @@
$t->set_var('actionurl',$phpgw->link('/preferences/editcategory.php')); $t->set_var('actionurl',$phpgw->link('/preferences/editcategory.php'));
$t->set_var('deleteurl',$phpgw->link('/preferences/deletecategory.php')); $t->set_var('deleteurl',$phpgw->link('/preferences/deletecategory.php'));
$t->set_var('hidden_vars',$hidden_vars); $t->set_var('hidden_vars',$hidden_vars);
$t->set_var('lang_name',lang('Category name')); $t->set_var('lang_parent',lang('Parent category'));
$t->set_var('lang_descr',lang('Category description')); $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_select_parent',lang('Select parent category'));
$t->set_var('lang_access',lang('Private')); $t->set_var('lang_access',lang('Private'));
if ($cats[0]['access']=='private') { $t->set_var('access', '<input type="checkbox" name="access" value="True" checked>'); } if ($cats[0]['access']=='private') { $t->set_var('access', '<input type="checkbox" name="access" value="True" checked>'); }
@ -86,6 +88,7 @@
$t->set_var('cat_name',$phpgw->strip_html($cats[0]['name'])); $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_description',$phpgw->strip_html($cats[0]['description']));
$t->set_var('cat_data',$cats[0]['data']);
$t->set_var('lang_edit',lang('Edit')); $t->set_var('lang_edit',lang('Edit'));
$t->set_var('lang_delete',lang('Delete')); $t->set_var('lang_delete',lang('Delete'));

View File

@ -3,26 +3,30 @@
<center> <center>
<table border="0" width="80%" cellspacing="2" cellpadding="2"> <table border="0" width="80%" cellspacing="2" cellpadding="2">
<tr> <tr>
<td colspan="1" align="center" bgcolor="#c9c9c9"><b>{title_categories}:&nbsp;{user_name}<b/></td> <td colspan="1" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>{title_categories}:&nbsp;{user_name}<b/></font></td>
</tr> </tr>
</table> </table>
{message} <font face="{font}">{message}</font>
<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> <tr>
<td>&nbsp;</td> <td><font face="{font}">{lang_parent}:</font></td>
<td><select name="cat_parent"><option value="">{lang_select_parent}</option>{category_list}</select></td> <td><font face="{font}"><select name="cat_parent"><option value="">{lang_select_parent}</option>{category_list}</select></font></td>
</tr> </tr>
<tr> <tr>
<td>{lang_name}:</td> <td><font face="{font}">{lang_name}:</font></td>
<td><input name="cat_name" size="50" value="{cat_name}"></td> <td><font face="{font}"><input name="cat_name" size="50" value="{cat_name}"></font></td>
</tr> </tr>
<tr> <tr>
<td>{lang_descr}:</td> <td><font face="{font}">{lang_descr}:</font></td>
<td colspan=2><textarea name="cat_description" rows="4" cols="50" wrap="virtual">{cat_description}</textarea></td> <td colspan=2><font face="{font}"><textarea name="cat_description" rows="4" cols="50" wrap="virtual">{cat_description}</textarea></font></td>
</tr> </tr>
<tr> <tr>
<td>{lang_access}:</td> <td><font face="{font}">{lang_data}:</font></td>
<td><font face="{font}"><input name="cat_data" size="50" value="{cat_data}"></font></td>
</tr>
<tr>
<td><font face="{font}">{lang_access}:</font></td>
<td colspan=2>{access}</td> <td colspan=2>{access}</td>
</tr> </tr>
</table> </table>
@ -30,15 +34,15 @@
<!-- BEGIN add --> <!-- BEGIN add -->
<table width="50%" border="0" cellspacing="2" cellpadding="2"> <table width="50%" border="0" cellspacing="2" cellpadding="2">
<tr valign="bottom"> <tr valign="bottom">
<td height="50" align="center"> <td height="50" align="right">
{hidden_vars} {hidden_vars}
<input type="submit" name="submit" value="{lang_add}"></td> <font face="{font}"><input type="submit" name="submit" value="{lang_add}"></font></td>
<td height="50" align="center">
<input type="reset" name="reset" value="{lang_reset}"></form></td>
<td height="50" align="center"> <td height="50" align="center">
<font face="{font}"><input type="reset" name="reset" value="{lang_reset}"></font></form></td>
<td height="50">
<form method="POST" action="{doneurl}"> <form method="POST" action="{doneurl}">
{hidden_vars} {hidden_vars}
<input type="submit" name="done" value="{lang_done}"></form></td> <font face="{font}"><input type="submit" name="done" value="{lang_done}"></font></form></td>
</tr> </tr>
</table> </table>
</form> </form>
@ -48,17 +52,17 @@
<!-- BEGIN edit --> <!-- BEGIN edit -->
<table width="50%" border="0" cellspacing="2" cellpadding="2"> <table width="50%" border="0" cellspacing="2" cellpadding="2">
<tr valign="bottom"> <tr valign="bottom">
<td height="50" align="center"> <td height="50" align="right">
{hidden_vars} {hidden_vars}
<input type="submit" name="submit" value="{lang_edit}"></form></td> <font face="{font}"><input type="submit" name="submit" value="{lang_edit}"></font></form></td>
<td height="50" align="center"> <td height="50" align="center">
<form method="POST" action="{deleteurl}"> <form method="POST" action="{deleteurl}">
{hidden_vars} {hidden_vars}
<input type="submit" name="delete" value="{lang_delete}"></form></td> <font face="{font}"><input type="submit" name="delete" value="{lang_delete}"></font></form></td>
<td height="50" align="center"> <td height="50">
<form method="POST" action="{doneurl}"> <form method="POST" action="{doneurl}">
{hidden_vars} {hidden_vars}
<input type="submit" name="done" value="{lang_done}"></form></td> <font face="{font}"><input type="submit" name="done" value="{lang_done}"></font></form></td>
</tr> </tr>
</table> </table>
</center> </center>

View File

@ -3,14 +3,14 @@
<center> <center>
<table border=0 width=50% cellpadding=2 cellspacing=2> <table border=0 width=50% cellpadding=2 cellspacing=2>
<tr> <tr>
<td align=center>{deleteheader}</td> <td align=center><font face="{font}">{deleteheader}</font></td>
</tr> </tr>
<tr> <tr>
<td> <td>
<table border="0" width="30%" align="center"> <table border="0" width="30%" align="center">
<tr> <tr>
<td align="center">{nolink}</td> <td align="center"><font face="{font}">{nolink}</font></td>
<td align="center">{yeslink}</td> <td align="center"><font face="{font}">{yeslink}</font></td>
</tr> </tr>
</table> </table>
</td> </td>

View File

@ -2,10 +2,10 @@
<center> <center>
<table border="0" cellspacing="2" cellpadding="2"> <table border="0" cellspacing="2" cellpadding="2">
<tr> <tr>
<td colspan="5" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>{title_categories}:&nbsp;{user_name}<b/></font></td> <td colspan="6" align="center" bgcolor="#c9c9c9"><font face="{font}"><b>{title_categories}:&nbsp;{user_name}<b/></font></td>
</tr> </tr>
<tr> <tr>
<td colspan="5" align=left> <td colspan="6" align=left>
<table border="0" width="100%"> <table border="0" width="100%">
<tr> <tr>
{left} {left}
@ -23,31 +23,33 @@
</form></td> </form></td>
</tr> </tr>
<tr bgcolor="{th_bg}"> <tr bgcolor="{th_bg}">
<td width=20% bgcolor="{th_bg}"><font face="{font}">{sort_name}</font></td> <td bgcolor="{th_bg}"><font face="{font}">{sort_name}</font></td>
<td width=32% bgcolor="{th_bg}"><font face="{font}">{sort_description}</font></td> <td bgcolor="{th_bg}"><font face="{font}">{sort_description}</font></td>
<td width=8% bgcolor="{th_bg}" align="center"><font face="{font}">{lang_app}</font></td> <td bgcolor="{th_bg}"><font face="{font}">{sort_data}</font></td>
<td width=8% bgcolor="{th_bg}" align=center><font face="{font}">{lang_edit}</font></td> <td bgcolor="{th_bg}" align="center"><font face="{font}">{lang_app}</font></td>
<td width=8% bgcolor="{th_bg}" align=center><font face="{font}">{lang_delete}</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>
</tr> </tr>
<!-- BEGIN cat_list --> <!-- BEGIN cat_list -->
<tr bgcolor="{tr_color}"> <tr bgcolor="{tr_color}">
<td><font face="{font}">{name}</font></td> <td><font face="{font}">{name}</font></td>
<td><font face="{font}">{descr}</font></td> <td><font face="{font}">{descr}</font></td>
<td><font face="{font}">{data}</font></td>
<td align="center"><font face="{font}"><a href="{app_url}">{lang_app}</a></font></td> <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="{edit}">{lang_edit_entry}</a></font></td>
<td align="center"><font face="{font}"><a href="{delete}">{lang_delete_entry}</font></td> <td align="center"><font face="{font}"><a href="{delete}">{lang_delete_entry}</font></td>
</tr> </tr>
<!-- END cat_list --> <!-- END cat_list -->
<!-- BEGINN add --> <!-- BEGINN add -->
<tr valign="bottom"> <tr valign="bottom">
<td colspan="4"> <td colspan="5">
<form method="POST" action="{add_action}"> <form method="POST" action="{add_action}">
{hidden_vars} {hidden_vars}
<font face="{font}"><input type="submit" value="{lang_add}"></font> <font face="{font}"><input type="submit" value="{lang_add}"></font>
</form> </form>
</td> </td>
<td> <td align="right">
<form method="POST" action="{doneurl}"> <form method="POST" action="{doneurl}">
{hidden_vars} {hidden_vars}
<font face="{font}"><input type="submit" name="done" value="{lang_done}"></font> <font face="{font}"><input type="submit" name="done" value="{lang_done}"></font>
@ -56,5 +58,4 @@
</tr> </tr>
<!-- END add --> <!-- END add -->
</table> </table>
</center> </center>