[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] addressbook inc/class.uiaddressbook.inc.php inc...
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] addressbook inc/class.uiaddressbook.inc.php inc... |
Date: |
Mon, 11 Sep 2006 10:57:35 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: addressbook
Changes by: Dave Hall <skwashd> 06/09/11 10:57:35
Modified files:
inc : class.uiaddressbook.inc.php
class.uifields.inc.php
templates/base : listfields.tpl
Log message:
more notices, more CSS
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.uiaddressbook.inc.php?cvsroot=phpgroupware&r1=1.69&r2=1.70
http://cvs.savannah.gnu.org/viewcvs/addressbook/inc/class.uifields.inc.php?cvsroot=phpgroupware&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/addressbook/templates/base/listfields.tpl?cvsroot=phpgroupware&r1=1.2&r2=1.3
Patches:
Index: inc/class.uiaddressbook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.uiaddressbook.inc.php,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- inc/class.uiaddressbook.inc.php 9 Sep 2006 11:50:11 -0000 1.69
+++ inc/class.uiaddressbook.inc.php 11 Sep 2006 10:57:35 -0000 1.70
@@ -12,7 +12,7 @@
* option) any later version. *
\**************************************************************************/
-/* $Id: class.uiaddressbook.inc.php,v 1.69 2006/09/09 11:50:11 skwashd Exp $ */
+/* $Id: class.uiaddressbook.inc.php,v 1.70 2006/09/11 10:57:35 skwashd Exp $ */
class uiaddressbook
@@ -1424,12 +1424,22 @@
/**
* This function draw the others tab screen
*
- * @param array $fields The array with all data for show
- * in this screen
- * @return mixed The others screen whit all data
+ * @param array $fields Values to be shown on this "screen"
+ * @return string The html required for the "others screen"
*/
function others_form($fields)
{
+ if ( !isset($fields['tmp_data']['others'])
+ || !is_array($fields['tmp_data']['others']) )
+ {
+ $fields['tmp_data']['others'] = array
+ (
+ 'other_name' => '',
+ 'other_value' => '',
+ 'key_other_id' => 0,
+ 'action' => ''
+ );
+ }
//preparate vars to use, this are the html form objects
$other_descr='<input type="text" name="'
. 'entry[tmp_data][others][other_name]'
@@ -1459,17 +1469,13 @@
2 => array('Value', $other_value,
'special')));
//specified what html objects and data you want in the detail
- $types_data = array('data1' => array('type' => 'data',
+ $types_data = array('data1' => array
+ (
+ 'type' => 'data',
'field' => 'other_name'),
- 'text1' => array('type' => 'text',
- 'name' => 'entry[other_value]',
- 'field' => 'key_other_id',
- 'value' => 'other_value'),
- 'link1' => array('type' => 'link',
- 'mode' => 'delete',
- 'key' => 'key_other_id',
- 'action'=> 'other_del_row',
- 'extra' =>
'&owner='.$this->owner.'&ab_id='.$this->contact_id.'&record_name='.$this->record_name));
+ 'text1' => array('type' => 'text', 'name' =>
'entry[other_value]', 'field' => 'key_other_id', 'value' => 'other_value'),
+ 'link1' => array('type' => 'link', 'mode' => 'delete',
'key' => 'key_other_id', 'action' => 'other_del_row', 'extra' => array('owner'
=> $this->owner, 'ab_id' => $this->contact_id, 'record_name' =>
$this->record_name) )
+ );
//$this->array_data = $fields['others'];
$this->array_data = $this->read_tab_session('others_data');
$custom_fields = $this->get_custom_fields();
@@ -3039,9 +3045,7 @@
if($this->bo->check_edit($contact_id))
{
$this->template->set_var('edit_button',$this->html_1button_form('edit','Edit',
-
$GLOBALS['phpgw']->link('/index.php',
-
'menuaction=addressbook.uiaddressbook.edit_'. $type
- . '&ab_id='
.$contact_id)));
+ $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => "addressbook.uiaddressbook.edit_{$type}", 'ab_id' =>
$contact_id) ) ) );
}
else
{
@@ -3049,14 +3053,12 @@
}
$this->template->set_var('copy_button',$this->html_1button_form('submit','copy',
-
$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.copy_'
. $type
- . '&ab_id=' . $contact_id)));
+ $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => "addressbook.uiaddressbook.copy_{$type}", 'ab_id' =>
$contact_id) ) ) );
if ($contacts['per_first_name'] && $contacts['per_last_name'])
{
$this->template->set_var('vcard_button',$this->html_1button_form('VCardForm','VCard',
-
$GLOBALS['phpgw']->link('/index.php',
-
'menuaction=addressbook.uivcard.out&ab_id=' .$contact_id)));
+ $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'addressbook.uivcard.out', 'ab_id' => $contact_id) ) ) );
}
else
{
@@ -3064,16 +3066,19 @@
}
$this->template->set_var('done_button',$this->html_1button_form('DoneForm','Done',
- $referer ? $referer :
$GLOBALS['phpgw']->link('/index.php',
-
'menuaction=addressbook.uiaddressbook.index§ion='.$contact_type)));
+ isset($referer) && $referer
+ ? $referer
+ : $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'addressbook.uiaddressbook.index', 'action' =>
$contact_type) ) ) );
$this->template->pparse('out','view_t');
if($contact_type == $this->tab_main_persons)
{
- $GLOBALS['phpgw']->hooks->process(array(
+ $GLOBALS['phpgw']->hooks->process(array
+ (
'location' =>
'addressbook_view',
- 'ab_id' => $contact_id));
+ 'ab_id' => $contact_id
+ ));
}
}
Index: inc/class.uifields.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/inc/class.uifields.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- inc/class.uifields.inc.php 11 Sep 2006 07:59:44 -0000 1.17
+++ inc/class.uifields.inc.php 11 Sep 2006 10:57:35 -0000 1.18
@@ -11,7 +11,7 @@
* option) any later version. *
\**************************************************************************/
-/* $Id: class.uifields.inc.php,v 1.17 2006/09/11 07:59:44 skwashd Exp $ */
+/* $Id: class.uifields.inc.php,v 1.18 2006/09/11 10:57:35 skwashd Exp $ */
class uifields
{
@@ -25,7 +25,10 @@
function uifields()
{
+ if ( !isset($GLOBALS['phpgw']->template) ||
!is_object($GLOBALS['phpgw']->template) )
+ {
$GLOBALS['phpgw']->template =
createObject('phpgwapi.Template',PHPGW_APP_TPL);
+ }
$GLOBALS['phpgw']->nextmatchs =
createObject('phpgwapi.nextmatchs');
$this->config =
createObject('phpgwapi.config','addressbook');
}
@@ -34,13 +37,13 @@
{
if(!$GLOBALS['phpgw']->acl->check('run',1,'admin'))
{
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
+ $GLOBALS['phpgw']->common->phpgw_header(true);
echo lang('access not permitted');
$GLOBALS['phpgw']->common->phpgw_exit();
}
- $GLOBALS['phpgw']->template->set_file(array(
+ $GLOBALS['phpgw']->template->set_file(array
+ (
'field_list_t' =>
'listfields.tpl',
'field_list' =>
'listfields.tpl'
));
@@ -50,6 +53,9 @@
$start = (int) isset($_REQUEST['start']) ?
$_REQUEST['start'] : 0;
$query = isset($_REQUEST['query']) ?
$_REQUEST['query'] : '';
$sort = isset($_REQUEST['sort']) ? $_REQUEST['sort']
: 'ASC';
+ $order = isset($_REQUEST['order']) ?
$_REQUEST['order'] : '';
+ $filter = isset($_REQUEST['filter']) ?
$_REQUEST['filter'] : '';
+ $limit = (int) isset($_REQUEST['limit']) ?
$_REQUEST['limit'] :
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
$common_hidden_vars =
'<input type="hidden" name="sort" value="' .
$sort . '">' . "\n"
@@ -80,8 +86,7 @@
$fields =
$this->read_custom_fields($start,$limit,$query,$sort);
$total_records = count($fields);
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
+ $GLOBALS['phpgw']->common->phpgw_header(true);
$GLOBALS['phpgw']->template->set_var('left',$GLOBALS['phpgw']->nextmatchs->left('/index.php',$start,$total_records,'menuaction=addressbook.uifields.index'));
$GLOBALS['phpgw']->template->set_var('right',$GLOBALS['phpgw']->nextmatchs->right('/index.php',$start,$total_records,'menuaction=addressbook.uifields.index'));
@@ -92,10 +97,11 @@
$GLOBALS['phpgw']->template->set_var('lang_edit',lang('Edit'));
$GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete'));
+ $tr_class = '';
for($i=0;$i<count($fields);$i++)
{
- $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
-
$GLOBALS['phpgw']->template->set_var(tr_color,$tr_color);
+ $tr_class =
$GLOBALS['phpgw']->nextmatchs->alternate_row_class($tr_class);
+
$GLOBALS['phpgw']->template->set_var('tr_class', $tr_class);
$field = $fields[$i]['name'];
$title = $fields[$i]['title'];
@@ -123,8 +129,7 @@
$GLOBALS['phpgw']->template->parse('list','field_list',True);
}
-
$GLOBALS['phpgw']->template->parse('out','field_list_t',True);
- $GLOBALS['phpgw']->template->p('out');
+ $GLOBALS['phpgw']->template->pfp('out', 'field_list_t');
}
function add()
@@ -137,51 +142,50 @@
$GLOBALS['phpgw']->common->phpgw_exit();
}
- $field = stripslashes($_POST['field']);
- $field_name = stripslashes($_POST['field_name']);
- $apply_for = stripslashes($_POST['apply_for']);
- $start = $_POST['start'];
- $query = $_POST['query'];
- $sort = $_POST['sort'];
- $submit = $_POST['submit'];
-
$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($submit)
+ $field = '';
+ $field_name = '';
+
+ $submit = isset($_POST['submit']) && $_POST['submit'];
+ $error = array();
+ if ( $submit )
{
- $errorcount = 0;
+ $field = stripslashes($_POST['field']);
+ $field_name =
stripslashes($_POST['field_name']);
+ $apply_for = stripslashes($_POST['apply_for']);
if(!$field_name)
{
- $error[$errorcount++] = lang('Please
enter a name for that field !');
+ $error[] = lang('Please enter a name
for that field !');
}
- $fields =
$this->read_custom_fields($start,$limit,$field_name);
- if($fields[0]['name'])
+ $fields = $this->read_custom_fields(0, 1,
$field_name);
+ if ( isset($fields[0]['name']) )
{
- $error[$errorcount++] = lang('That
field name has been used already !');
+ $error[] = lang('That field name has
been used already !');
}
- if(!$error)
+ if ( !count($error) )
{
$this->save_custom_field($field,$field_name,$apply_for);
}
}
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
+ $GLOBALS['phpgw']->common->phpgw_header(true);
- if($errorcount)
+ if ( count($error) )
{
$GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
}
- if(($submit) && (! $error) && (! $errorcount))
+
+ if ( $submit && !count($error) )
{
$GLOBALS['phpgw']->template->set_var('message',lang('Field %1 has been added
!', $field_name));
}
- if((!$submit) && (! $error) && (! $errorcount))
+ if ( !$submit && !count($error) )
{
$GLOBALS['phpgw']->template->set_var('message','');
}
@@ -528,8 +532,8 @@
}
break;
default:
- $old_field =
$this->config->config_data['custom_fields'][$old];
- if(!$old_field)
+ $old_field = '';
+ if (
isset($this->config->config_data['custom_fields'][$old]) )
{
$old_field =
$this->config->config_data['custom_org_fields'][$old];
}
Index: templates/base/listfields.tpl
===================================================================
RCS file: /cvsroot/phpgroupware/addressbook/templates/base/listfields.tpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- templates/base/listfields.tpl 31 Dec 2004 04:55:24 -0000 1.2
+++ templates/base/listfields.tpl 11 Sep 2006 10:57:35 -0000 1.3
@@ -1,52 +1,40 @@
-<center>
-<table border="0" cellspacing="2" cellpadding="2">
- <tr>
- <td colspan="6" align="center" bgcolor="#c9c9c9"><b>{title_fields}<b/></td>
-</tr>
-<tr>
-<td colspan="6" align=left>
- <table border="0" width="100%">
+<h2>{title_fields}</h2>
+<table border="0" width="100%">
<tr>
{left}
<td align="center">{lang_showing}</td>
{right}
</tr>
- </table>
- </td>
- </tr>
+</table>
+
+<form method="post" action="{actionurl}"><input type="text"
name="query"> <input type="submit" name="search"
value="{lang_search}"></form>
+
+<table id="contacts_fields_list">
+ <thead>
<tr>
- <td align=right>
- <form method="post" action="{actionurl}">
- <input type="text" name="query"> <input type="submit" name="search"
value="{lang_search}"></form></td>
- </tr>
- <tr bgcolor="{th_bg}">
- <td width="16%" bgcolor="{th_bg}">{sort_field}</td>
- <td width="8%" bgcolor="{th_bg}" align="center">{lang_edit}</td>
- <td width="8%" bgcolor="{th_bg}" align="center">{lang_delete}</td>
+ <td>{sort_field}</td>
+ <td>{lang_edit}</td>
+ <td>{lang_delete}</td>
</tr>
-
-<!-- BEGIN field_list -->
- <tr bgcolor="{tr_color}">
+ </thead>
+ <tbody>
+ <!-- BEGIN field_list -->
+ <tr class="{tr_class}">
<td>{cfield}</td>
- <td align="center"><a href="{edit}">{lang_edit_entry}</a></td>
- <td align="center"><a href="{delete}">{lang_delete_entry}</a></td>
-</tr>
-<!-- END field_list -->
+ <td><a href="{edit}">{lang_edit_entry}</a></td>
+ <td><a href="{delete}">{lang_delete_entry}</a></td>
+ </tr>
+ <!-- END field_list -->
+ </tbody>
+</table>
<!-- BEGIN add -->
-<tr valign="bottom">
- <td>
- <form method="POST" action="{add_action}">
- <input type="submit" name="add" value="{lang_add}"></form>
- </td>
-</tr>
-<tr valign="bottom">
- <td>
- <form method="POST" action="{doneurl}">
- <input type="submit" name="done" value="{lang_done}"></form>
- </td>
-</tr>
+<div class="btngrp">
+ <form method="post" action="{add_action}">
+ <button type="submit" name="add" value="1">{lang_add}</button>
+ </form>
+ <form method="post" action="{doneurl}">
+ <button type="submit" name="done" value="1">{lang_done}</button>
+ </form>
+</div>
<!-- END add -->
-
-</table>
-</center>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] addressbook inc/class.uiaddressbook.inc.php inc...,
Dave Hall <=