From e524a44dade6bce996494d8178060f95105ab5d5 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Fri, 28 Dec 2001 04:08:35 +0000 Subject: [PATCH] different field editor --- addressbook/addfield.php | 81 ------------------- addressbook/deletefield.php | 73 ------------------ addressbook/editfield.php | 103 ------------------------- addressbook/fields.php | 95 ----------------------- addressbook/inc/class.uifields.inc.php | 5 +- 5 files changed, 3 insertions(+), 354 deletions(-) delete mode 100644 addressbook/addfield.php delete mode 100644 addressbook/deletefield.php delete mode 100644 addressbook/editfield.php delete mode 100644 addressbook/fields.php diff --git a/addressbook/addfield.php b/addressbook/addfield.php deleted file mode 100644 index dc53338dde..0000000000 --- a/addressbook/addfield.php +++ /dev/null @@ -1,81 +0,0 @@ - * - * ----------------------------------------------- * - * 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$ */ - - $GLOBALS['phpgw_info'] = array(); - $GLOBALS['phpgw_info']['flags']['currentapp'] = 'addressbook'; - include('../header.inc.php'); - - if(!$GLOBALS['phpgw']->acl->check('run',1,'admin')) - { - echo lang('access not permitted'); - $GLOBALS['phpgw']->common->phpgw_footer(); - $GLOBALS['phpgw']->common->phpgw_exit(); - } - - $field = $HTTP_POST_VARS['field']; - $field_name = $HTTP_POST_VARS['field_name']; - $start = $HTTP_POST_VARS['start']; - $query = $HTTP_POST_VARS['query']; - $sort = $HTTP_POST_VARS['sort']; - - $GLOBALS['phpgw']->template->set_file(array('form' => 'field_form.tpl')); - $GLOBALS['phpgw']->template->set_block('form','add','addhandle'); - $GLOBALS['phpgw']->template->set_block('form','edit','edithandle'); - - if ($HTTP_POST_VARS['submit']) - { - $errorcount = 0; - - if (!$field_name) - { - $error[$errorcount++] = lang('Please enter a name for that field !'); - } - - $fields = read_custom_fields($start,$limit,$field_name); - if ($fields[0]['name']) - { - $error[$errorcount++] = lang('That field name has been used already !'); - } - - if (! $error) - { - $field_name = addslashes($field_name); - save_custom_field($field,$field_name); - } - } - - if ($errorcount) { $GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); } - if (($submit) && (! $error) && (! $errorcount)) { $GLOBALS['phpgw']->template->set_var('message',lang('Field x has been added !', $field_name)); } - if ((! $submit) && (! $error) && (! $errorcount)) { $GLOBALS['phpgw']->template->set_var('message',''); } - - $GLOBALS['phpgw']->template->set_var('title_fields',lang('Add'). ' ' . lang('Custom Field')); - $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/addressbook/addfield.php')); - $GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/addressbook/fields.php')); - $GLOBALS['phpgw']->template->set_var('hidden_vars',''); - - $GLOBALS['phpgw']->template->set_var('lang_name',lang('Field name')); - - $GLOBALS['phpgw']->template->set_var('lang_add',lang('Add')); - $GLOBALS['phpgw']->template->set_var('lang_reset',lang('Clear Form')); - $GLOBALS['phpgw']->template->set_var('lang_done',lang('Done')); - - $GLOBALS['phpgw']->template->set_var('field_name',$field_name); - - $GLOBALS['phpgw']->template->set_var('edithandle',''); - $GLOBALS['phpgw']->template->set_var('addhandle',''); - $GLOBALS['phpgw']->template->pparse('out','form'); - $GLOBALS['phpgw']->template->pparse('addhandle','add'); - - $GLOBALS['phpgw']->common->phpgw_footer(); -?> diff --git a/addressbook/deletefield.php b/addressbook/deletefield.php deleted file mode 100644 index c7237b779f..0000000000 --- a/addressbook/deletefield.php +++ /dev/null @@ -1,73 +0,0 @@ - True, - 'nonavbar' => True - ); - } - - $GLOBALS['phpgw_info']['flags']['currentapp'] = 'addressbook'; - include('../header.inc.php'); - - if (!$HTTP_POST_VARS['field']) - { - Header('Location: ' . $GLOBALS['phpgw']->link('/addressbook/fields.php')); - } - - $field = $HTTP_POST_VARS['field']; - $field_id = $HTTP_POST_VARS['field_id'] ? $HTTP_POST_VARS['field_id'] : $HTTP_GET_VARS['field_id']; - $start = $HTTP_POST_VARS['start']; - $query = $HTTP_POST_VARS['query']; - $sort = $HTTP_POST_VARS['sort']; - - if ($HTTP_POST_VARS['confirm']) - { - save_custom_field($field); - Header('Location: ' . $GLOBALS['phpgw']->link('/addressbook/fields.php',"start=$start&query=$query&sort=$sort")); - } - else - { - $hidden_vars = '' . "\n" - . '' . "\n" - . '' . "\n" - . '' . "\n" - . '' . "\n"; - - $GLOBALS['phpgw']->template->set_file(array('field_delete' => 'delete_common.tpl')); - $GLOBALS['phpgw']->template->set_var('messages',lang('Are you sure you want to delete this field?')); - - $nolinkf = $GLOBALS['phpgw']->link('/addressbook/fields.php',"field_id=$field_id&start=$start&query=$query&sort=$sort"); - $nolink = '' . lang('No') . ''; - $phpgw->template->set_var('no',$nolink); - - $yeslinkf = $GLOBALS['phpgw']->link('/addressbook/deletefield.php','field_id=' . $field_id . '&confirm=True'); - $yeslinkf = '
' - . $hidden_vars - . '' - . '' - . '' - . '
'; - - $yeslink = '' . lang('Yes') . ''; - $yeslink = $yeslinkf; - $GLOBALS['phpgw']->template->set_var('yes',$yeslink); - - $GLOBALS['phpgw']->template->pparse('out','field_delete'); - } - - $GLOBALS['phpgw']->common->phpgw_footer(); -?> diff --git a/addressbook/editfield.php b/addressbook/editfield.php deleted file mode 100644 index 0a26d3a444..0000000000 --- a/addressbook/editfield.php +++ /dev/null @@ -1,103 +0,0 @@ -acl->check('run',1,'admin')) - { - echo lang('access not permitted'); - $GLOBALS['phpgw']->common->phpgw_footer(); - $GLOBALS['phpgw']->common->phpgw_exit(); - - } - - $field = $HTTP_POST_VARS['field']; - $field_name = $HTTP_POST_VARS['field_name']; - $start = $HTTP_POST_VARS['start']; - $query = $HTTP_POST_VARS['query']; - $sort = $HTTP_POST_VARS['sort']; - - if (!$field) - { - Header('Location: ' . $GLOBALS['phpgw']->link('/addressbook/fields.php',"sort=$sort&query=$query&start=$start")); - } - - $GLOBALS['phpgw']->template->set_file(array('form' => 'field_form.tpl')); - $GLOBALS['phpgw']->template->set_block('form','add','addhandle'); - $GLOBALS['phpgw']->template->set_block('form','edit','edithandle'); - - $hidden_vars = '' . "\n" - . '' . "\n" - . '' . "\n" - . '' . "\n"; - - if ($HTTP_POST_VARS['submit']) - { - $errorcount = 0; - if (!$field_name) { $error[$errorcount++] = lang('Please enter a name for that field!'); } - - $field_name = addslashes($field_name); - - if (! $error) - { - save_custom_field($field,$field_name); - } - } - - if ($errorcount) - { - $GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); - } - if (($submit) && (! $error) && (! $errorcount)) - { - $GLOBALS['phpgw']->template->set_var('message',lang('Field x has been updated !', $field_name)); - } - if ((! $submit) && (! $error) && (! $errorcount)) - { - $GLOBALS['phpgw']->template->set_var('message',''); - } - - if ($submit) - { - $field = $field_name; - } - else - { - $fields = read_custom_fields($start,$limit,$field); - $field = $GLOBALS['phpgw']->strip_html($fields[0]['name']); - } - - $GLOBALS['phpgw']->template->set_var('title_fields',lang('Edit Field')); - $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/addressbook/editfield.php')); - $GLOBALS['phpgw']->template->set_var('deleteurl',$GLOBALS['phpgw']->link('/addressbook/deletefield.php',"field=$field&start=$start&query=$query&sort=$sort")); - $GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/addressbook/fields.php',"start=$start&query=$query&sort=$sort")); - - $GLOBALS['phpgw']->template->set_var('hidden_vars',$hidden_vars); - $GLOBALS['phpgw']->template->set_var('lang_name',lang('Field name')); - - $GLOBALS['phpgw']->template->set_var('lang_done',lang('Done')); - $GLOBALS['phpgw']->template->set_var('lang_edit',lang('Edit')); - $GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete')); - - $GLOBALS['phpgw']->template->set_var('field_name',$field); - - $GLOBALS['phpgw']->template->set_var('edithandle',''); - $GLOBALS['phpgw']->template->set_var('addhandle',''); - - $GLOBALS['phpgw']->template->pparse('out','form'); - $GLOBALS['phpgw']->template->pparse('edithandle','edit'); - - $GLOBALS['phpgw']->common->phpgw_footer(); -?> diff --git a/addressbook/fields.php b/addressbook/fields.php deleted file mode 100644 index 57ab4a9c5c..0000000000 --- a/addressbook/fields.php +++ /dev/null @@ -1,95 +0,0 @@ - 'addressbook', - 'enable_nextmatchs_class' => True - ); - - include('../header.inc.php'); - - $GLOBALS['phpgw']->template->set_file(array( - 'field_list_t' => 'listfields.tpl', - 'field_list' => 'listfields.tpl' - )); - $GLOBALS['phpgw']->template->set_block('field_list_t','field_list','list'); - - $field = $HTTP_POST_VARS['field']; - $start = $HTTP_POST_VARS['start']; - $query = $HTTP_POST_VARS['query']; - $sort = $HTTP_POST_VARS['sort']; - $order = $HTTP_POST_VARS['order']; - $filter = $HTTP_POST_VARS['filter']; - - $common_hidden_vars = - '' . "\n" - . '' . "\n" - . '' . "\n" - . '' . "\n" - . '' . "\n"; - - $GLOBALS['phpgw']->template->set_var('lang_action',lang('Custom Fields')); - $GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/addressbook/addfield.php')); - $GLOBALS['phpgw']->template->set_var('lang_add',lang('Add')); - $GLOBALS['phpgw']->template->set_var('title_fields',lang('addressbook').' - '.lang('Custom Fields')); - $GLOBALS['phpgw']->template->set_var('lang_search',lang('Search')); - $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/addressbook/fields.php')); - $GLOBALS['phpgw']->template->set_var('lang_done',lang('Done')); - $GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/admin/index.php')); - - if (!$start) - { - $start = 0; - } - - if (!$sort) - { - $sort = 'ASC'; - } - - $fields = read_custom_fields($start,$limit,$query,$sort,$order); - $total_records = count($fields); - - $GLOBALS['phpgw']->template->set_var('left',$GLOBALS['phpgw']->nextmatchs->left('/addressbook/fields.php',$start,$total_records)); - $GLOBALS['phpgw']->template->set_var('right',$GLOBALS['phpgw']->nextmatchs->right('/addressbook/fields.php',$start,$total_records)); - - $GLOBALS['phpgw']->template->set_var('lang_showing',$GLOBALS['phpgw']->nextmatchs->show_hits($total_records,$start)); - - $GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']); - $GLOBALS['phpgw']->template->set_var('sort_field',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'name',$order,'/addressbook/fields.php',lang('Name'))); - $GLOBALS['phpgw']->template->set_var('lang_edit',lang('Edit')); - $GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete')); - - for ($i=0;$inextmatchs->alternate_row_color($tr_color); - $GLOBALS['phpgw']->template->set_var(tr_color,$tr_color); - - $field = $fields[$i]['name']; - - $GLOBALS['phpgw']->template->set_var('cfield',$field); - - $GLOBALS['phpgw']->template->set_var('edit',$GLOBALS['phpgw']->link('/addressbook/editfield.php',"field=$field&start=$start&query=$query&sort=$sort&order=$order&filter=$filter")); - $GLOBALS['phpgw']->template->set_var('lang_edit_entry',lang('Edit')); - - $GLOBALS['phpgw']->template->set_var('delete',$GLOBALS['phpgw']->link('/addressbook/deletefield.php',"field=$field&start=$start&query=$query&sort=$sort&order=$order&filter=$filter")); - $GLOBALS['phpgw']->template->set_var('lang_delete_entry',lang('Delete')); - $GLOBALS['phpgw']->template->parse('list','field_list',True); - } - - $GLOBALS['phpgw']->template->parse('out','field_list_t',True); - $GLOBALS['phpgw']->template->p('out'); - - $GLOBALS['phpgw']->common->phpgw_footer(); -?> diff --git a/addressbook/inc/class.uifields.inc.php b/addressbook/inc/class.uifields.inc.php index 0ffc9456ca..c9e23de015 100644 --- a/addressbook/inc/class.uifields.inc.php +++ b/addressbook/inc/class.uifields.inc.php @@ -210,6 +210,7 @@ $start = $GLOBALS['HTTP_POST_VARS']['start'] ? $GLOBALS['HTTP_POST_VARS']['start'] : $GLOBALS['HTTP_GET_VARS']['start']; $query = $GLOBALS['HTTP_POST_VARS']['query'] ? $GLOBALS['HTTP_POST_VARS']['query'] : $GLOBALS['HTTP_GET_VARS']['query']; $sort = $GLOBALS['HTTP_POST_VARS']['sort'] ? $GLOBALS['HTTP_POST_VARS']['sort'] : $GLOBALS['HTTP_GET_VARS']['sort']; + $submit = $GLOBALS['HTTP_POST_VARS']['submit']; if (!$field) { @@ -225,7 +226,7 @@ . '' . "\n" . '' . "\n"; - if ($GLOBALS['HTTP_POST_VARS']['submit']) + if ($submit) { $errorcount = 0; if (!$field_name) { $error[$errorcount++] = lang('Please enter a name for that field!'); } @@ -266,7 +267,7 @@ $GLOBALS['phpgw']->template->set_var('title_fields',lang('Edit Field')); $GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uifields.edit')); - $GLOBALS['phpgw']->template->set_var('deleteurl',$GLOBALS['phpgw']->link('/index.php',"menuaction=addressbook.uifieldsdelete&field=$field&start=$start&query=$query&sort=$sort")); + $GLOBALS['phpgw']->template->set_var('deleteurl',$GLOBALS['phpgw']->link('/index.php',"menuaction=addressbook.uifields.delete&field=$field&start=$start&query=$query&sort=$sort")); $GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/index.php',"menuaction=addressbook.uifields.index&start=$start&query=$query&sort=$sort")); $GLOBALS['phpgw']->template->set_var('hidden_vars',$hidden_vars);