[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] [21037] Fix vcard, use yui tabs instead of buttons 47
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] [21037] Fix vcard, use yui tabs instead of buttons 4746:4909 |
Date: |
Wed, 24 Feb 2010 21:42:34 +0000 |
Revision: 21037
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=21037
Author: sigurdne
Date: 2010-02-24 21:42:34 +0000 (Wed, 24 Feb 2010)
Log Message:
-----------
Fix vcard, use yui tabs instead of buttons 4746:4909
Modified Paths:
--------------
people/sigurdne/modules/addressbook/trunk/inc/class.boaddressbook.inc.php
people/sigurdne/modules/addressbook/trunk/inc/class.soaddressbook.inc.php
people/sigurdne/modules/addressbook/trunk/inc/class.uiaddressbook.inc.php
people/sigurdne/modules/addressbook/trunk/inc/class.uivcard.inc.php
people/sigurdne/modules/addressbook/trunk/setup/default_records.inc.php
people/sigurdne/modules/addressbook/trunk/templates/base/add.tpl
people/sigurdne/modules/addressbook/trunk/templates/base/css/base.css
people/sigurdne/modules/addressbook/trunk/templates/base/form.tpl
people/sigurdne/modules/addressbook/trunk/templates/base/index.tpl
people/sigurdne/modules/addressbook/trunk/templates/base/principal_tabs.tpl
people/sigurdne/modules/addressbook/trunk/templates/base/tab.tpl
people/sigurdne/modules/addressbook/trunk/templates/probusiness/add.tpl
people/sigurdne/modules/addressbook/trunk/templates/probusiness/form.tpl
Modified:
people/sigurdne/modules/addressbook/trunk/inc/class.boaddressbook.inc.php
===================================================================
--- people/sigurdne/modules/addressbook/trunk/inc/class.boaddressbook.inc.php
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/inc/class.boaddressbook.inc.php
2010-02-24 21:42:34 UTC (rev 21037)
@@ -266,6 +266,7 @@
function get_persons($fields, $start='', $limit='',
$orderby='', $sort='', $criteria='', $token_criteria='')
{
$entries = $this->so->get_persons($fields, $start,
$limit, $orderby, $sort, $criteria, $token_criteria);
+ $persons = array();
if(is_array($entries))
{
foreach($entries as $data)
@@ -273,10 +274,6 @@
$persons[$data['contact_id']] = $data;
}
}
- else
- {
- $persons = array();
- }
$this->total = $this->so->contacts->total_records;
return $persons;
}
Modified:
people/sigurdne/modules/addressbook/trunk/inc/class.soaddressbook.inc.php
===================================================================
--- people/sigurdne/modules/addressbook/trunk/inc/class.soaddressbook.inc.php
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/inc/class.soaddressbook.inc.php
2010-02-24 21:42:34 UTC (rev 21037)
@@ -469,7 +469,7 @@
}
$comm_preferred = $fields['tab_comms']['preferred'];
-
+
//FIXME this is a hack cos i am sick of fixing broken
written by lazy developers! skwashd 20060908
@$this->upgrade_comms($fields['edit_comms']['insert'],
$fields['edit_comms']['delete'],
@@ -500,15 +500,18 @@
}
/* Update the first and last name in accounts */
- $account_id =
$this->contacts->get_account_id($person_id);
- if($account_id)
+ if($fields['tab_person_data'])
{
- $account =
CreateObject('phpgwapi.accounts',$account_id,'u');
- $account_data = $account->read();
- $account_data->firstname =
$fields['tab_person_data']['per_first_name'];
- $account_data->lastname =
$fields['tab_person_data']['per_last_name'];
- $account->update_data($account_data);
- $account->save_repository();
+ $account_id =
$this->contacts->get_account_id($person_id);
+ if($account_id)
+ {
+ $account =
CreateObject('phpgwapi.accounts',$account_id,'u');
+ $account_data = $account->read();
+ $account_data->firstname =
$fields['tab_person_data']['per_first_name'];
+ $account_data->lastname =
$fields['tab_person_data']['per_last_name'];
+ $account->update_data($account_data);
+ $account->save_repository();
+ }
}
$this->contacts->finalize_edit($person_id);
@@ -886,8 +889,8 @@
{
$data = array();
}
-
$this->edit_comms_by_contact($contact_id,
array('comm_preferred'=>'N'), PHPGW_SQL_RUN_SQL);
+
foreach($data as $key => $value)
{
if(array_key_exists($value['comm_description'],
$del_comms))
@@ -906,7 +909,7 @@
$preferred = 'N';
}
-
$this->edit_comms($value['key_comm_id'],
+ $this->edit_comms($value['key_comm_id'],
array('comm_data' =>
$edit_comms[$value['comm_description']],
'comm_preferred' => $preferred),
PHPGW_SQL_RUN_SQL);
Modified:
people/sigurdne/modules/addressbook/trunk/inc/class.uiaddressbook.inc.php
===================================================================
--- people/sigurdne/modules/addressbook/trunk/inc/class.uiaddressbook.inc.php
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/inc/class.uiaddressbook.inc.php
2010-02-24 21:42:34 UTC (rev 21037)
@@ -1077,7 +1077,8 @@
$fields['owner'] = isset($fields['owner']) ? $fields['owner'] :
$this->owner;
if ($this->bo->check_delete($this->contact_id))
{
- $delete = '<input type="submit" name="delete" value="'
. lang('Delete') . '">';
+ // $delete = '<input type="submit" name="delete" value="'
. lang('Delete') . '">';
+ $delete = '<input type="button" name="button3"
onclick="submit_form(\'delete\')" value="' . lang('Delete') . '">';
}
$this->template->set_file(array('form' => 'form.tpl'));
@@ -1117,22 +1118,20 @@
switch ($form_tab)
{
case $this->tab_orgs:
- $this->template->set_var('onsubjs',
-
'onsubmit="process_list(\'entry[all_orgs][]\',
- \'entry[my_orgs][]\')"');
+ $this->template->set_var('onsubjs1',
'entry[all_orgs][]');
+ $this->template->set_var('onsubjs2',
'entry[my_orgs][]');
break;
case $this->tab_cats:
- $this->template->set_var('onsubjs',
-
'onsubmit="process_list(\'entry[all_cats][]\',
- \'entry[my_cats][]\')"');
+ $this->template->set_var('onsubjs1',
'entry[all_cats][]');
+ $this->template->set_var('onsubjs2',
'entry[my_cats][]');
break;
case $this->tab_persons:
- $this->template->set_var('onsubjs',
-
'onsubmit="process_list(\'entry[all_person][]\',
- \'entry[my_person][]\')"');
+ $this->template->set_var('onsubjs1',
'entry[all_person][]');
+ $this->template->set_var('onsubjs2',
'entry[my_person][]');
break;
default:
- $this->template->set_var('onsubjs', '');
+ $this->template->set_var('onsubjs1', '');
+ $this->template->set_var('onsubjs2', '');
}
switch ($section)
@@ -1897,7 +1896,23 @@
$this->submit = 'delete';
$this->firsttime = false;
}
+ elseif(phpgw::get_var('_submit') == 'submit')
+ {
+ $this->submit = 'save';
+ $this->firsttime = false;
+ }
+ elseif(phpgw::get_var('_submit') == 'cancel')
+ {
+ $this->submit = 'cancel';
+ $this->firsttime = false;
+ }
+ elseif(phpgw::get_var('_submit') == 'delete')
+ {
+ $this->submit = 'delete';
+ $this->firsttime = false;
+ }
+
//set add/edit/delete action
if(phpgw::get_var('address_add_row'))
{
@@ -2782,13 +2797,13 @@
return;
}
-
+ $this->template->set_root(PHPGW_APP_TPL);
$this->template->set_file(array('delete' => 'delete.tpl'));
if ($confirm != 'true')
{
- $GLOBALS['phpgw']->common->phpgw_header();
- echo parse_navbar();
+ $GLOBALS['phpgw']->common->phpgw_header(true);
+ // echo parse_navbar();
$this->template->set_var('lang_sure',lang('Are you sure
you want to delete this entry ?'));
$this->template->set_var('no_link',$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'addressbook.uiaddressbook.index','section'=>$contact_type)));
$this->template->set_var('lang_no',lang('NO'));
@@ -3301,9 +3316,10 @@
*/
function java_script()
{
- return '
+ $code = <<<JS
<script type="text/javascript">
- function move(fboxname, tboxname, sboxname, cboxname) {
+ function move(fboxname, tboxname, sboxname, cboxname)
+ {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
@@ -3354,10 +3370,14 @@
tbox[c] = no;
}
- move_cbo(sboxname, cboxname);
+ if(sboxname && cboxname)
+ {
+ move_cbo(sboxname, cboxname);
+ }
}
- function move_cbo(sboxname, cboxname) {
+ function move_cbo(sboxname, cboxname)
+ {
sbox = document.body_form.elements[sboxname];
cbox = document.body_form.elements[cboxname];
if(sbox.length > 0)
@@ -3386,11 +3406,15 @@
}
}
- function process_list(allboxname, myboxname) {
- mybox = document.body_form.elements[myboxname];
- for(c = 0; c < mybox.options.length; c++)
+ function process_list(allboxname, myboxname)
+ {
+ if(myboxname)
{
- mybox.options[c].selected = true;
+ mybox = document.body_form.elements[myboxname];
+ for(c = 0; c < mybox.options.length; c++)
+ {
+ mybox.options[c].selected = true;
+ }
}
}
@@ -3400,7 +3424,9 @@
if (oDiv)
oDiv.style.display = oDiv.style.display ==
"none" ? "" : "none";
}
- </script>';
+ </script>'
+JS;
+ return $code;
}
function get_comm_descr($comm_selected, $type='')
Modified: people/sigurdne/modules/addressbook/trunk/inc/class.uivcard.inc.php
===================================================================
--- people/sigurdne/modules/addressbook/trunk/inc/class.uivcard.inc.php
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/inc/class.uivcard.inc.php
2010-02-24 21:42:34 UTC (rev 21037)
@@ -71,9 +71,9 @@
function out()
{
- $ab_id = $GLOBALS['HTTP_GET_VARS']['ab_id'] ?
$GLOBALS['HTTP_GET_VARS']['ab_id'] : $GLOBALS['HTTP_POST_VARS']['ab_id'];
- $nolname = $GLOBALS['HTTP_GET_VARS']['nolname'];
- $nofname = $GLOBALS['HTTP_GET_VARS']['nofname'];
+ $ab_id = phpgw::get_var('ab_id');
+ $nolname = phpgw::get_var('nolname');
+ $nofname = phpgw::get_var('nofname');
if($nolname || $nofname)
{
@@ -266,4 +266,3 @@
}
}
}
-?>
Modified:
people/sigurdne/modules/addressbook/trunk/setup/default_records.inc.php
===================================================================
--- people/sigurdne/modules/addressbook/trunk/setup/default_records.inc.php
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/setup/default_records.inc.php
2010-02-24 21:42:34 UTC (rev 21037)
@@ -9,3 +9,6 @@
*/
$GLOBALS['phpgw']->locations->add('org_person', "Allow custom fields on
relation org_person", 'addressbook', false, 'phpgw_contact_org_person');
+ $GLOBALS['phpgw']->locations->add('person', "Allow custom fields on
table person", 'addressbook', false, 'phpgw_contact_person');
+ $GLOBALS['phpgw']->locations->add('organisation', "Allow custom fields
on table org", 'addressbook', false, 'phpgw_contact_org');
+
Modified: people/sigurdne/modules/addressbook/trunk/templates/base/add.tpl
===================================================================
--- people/sigurdne/modules/addressbook/trunk/templates/base/add.tpl
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/templates/base/add.tpl
2010-02-24 21:42:34 UTC (rev 21037)
@@ -1,15 +1,14 @@
<!-- BEGIN add -->
- <table border="0" cellPadding="0" cellSpacing="0" width="77%">
+ <table align = 'center' border="0" cellPadding="0" cellSpacing="0"
width="77%">
<tr>
<td width="10%">
- <input type="submit" name="submit" value="{lang_save}" {js_submit}>
+ <input type="button" name="button1" onclick="submit_form('submit')"
value="{lang_save}">
</td>
-
<td width="10%">
- <input type="submit" name="cancel" value="{lang_cancel}" {js_submit}>
+ <input type="button" name="button2" onclick="submit_form('cancel')"
value="{lang_cancel}">
</td>
<td width="60%">
Modified: people/sigurdne/modules/addressbook/trunk/templates/base/css/base.css
===================================================================
--- people/sigurdne/modules/addressbook/trunk/templates/base/css/base.css
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/templates/base/css/base.css
2010-02-24 21:42:34 UTC (rev 21037)
@@ -6,7 +6,7 @@
td.contacts_v_label
{
- text-align: right;
+ text-align: left;
width: 30%;
}
Modified: people/sigurdne/modules/addressbook/trunk/templates/base/form.tpl
===================================================================
--- people/sigurdne/modules/addressbook/trunk/templates/base/form.tpl
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/templates/base/form.tpl
2010-02-24 21:42:34 UTC (rev 21037)
@@ -1,23 +1,41 @@
<!-- BEGIN TABHOLDER -->
<table width="80%" border="0" align="center" cellspacing="2" cellpadding="2">
<tbody>
- <tr>
- {principal_tabs_inc}
- </tr>
- <form action="{action}" method="post" name="body_form" cellspacing="0"
cellpadding="0" {onsubjs}>
- <tr>
- {tab}
- </tr>
- <tr>
- <input type="hidden" name="{old_tab_name}" value="{old_tab}">
- <input type="hidden" name="referer" value="{referer}">
- <input type="hidden" name="ab_id" value="{ab_id}">
- <input type="hidden" name="owner" value="{owner}">
- <input type="hidden" name="record_name" value="{record_name}">
- {current_tab_body}
- </tr>
- {control_buttons}
- </form>
+ <tr>
+ {principal_tabs_inc}
+ </tr>
+ <form action="{action}" method="post" name="body_form"
cellspacing="0" cellpadding="0">
+ <input type="hidden" name="bname" />
+ <input type="hidden" name="_submit" />
+ <script language="JavaScript" type="text/javascript">
+ <!--
+ function changetab(selectedtype)
+ {
+ document.body_form.bname.value =
selectedtype ;
+ document.body_form.submit();
+ }
+ function submit_form(selectedtype)
+ {
+ process_list('{onsubjs1}',
'{onsubjs2}');
+ document.body_form._submit.value =
selectedtype ;
+ document.body_form.submit();
+ }
+ -->
+ </script>
+
+ <tr>
+ {tab}
+ </tr>
+ <tr>
+ <input type="hidden" name="{old_tab_name}"
value="{old_tab}">
+ <input type="hidden" name="referer"
value="{referer}">
+ <input type="hidden" name="ab_id"
value="{ab_id}">
+ <input type="hidden" name="owner"
value="{owner}">
+ <input type="hidden" name="record_name"
value="{record_name}">
+ {current_tab_body}
+ </tr>
+ {control_buttons}
+ </form>
</tbody>
</table>
<!-- END TABHOLDER -->
Modified: people/sigurdne/modules/addressbook/trunk/templates/base/index.tpl
===================================================================
--- people/sigurdne/modules/addressbook/trunk/templates/base/index.tpl
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/templates/base/index.tpl
2010-02-24 21:42:34 UTC (rev 21037)
@@ -10,10 +10,10 @@
<thead>
<tr>
{cols}
- <th>{lang_view}</th>
- <th>{lang_vcard}</th>
- <th>{lang_edit}</th>
- <th>{lang_owner}</th>
+ <th width="5%">{lang_view}</th>
+ <th width="5%">{lang_vcard}</th>
+ <th width="5%">{lang_edit}</th>
+ <th width="5%">{lang_owner}</th>
</tr>
</thead>
<tbody>
Modified:
people/sigurdne/modules/addressbook/trunk/templates/base/principal_tabs.tpl
===================================================================
--- people/sigurdne/modules/addressbook/trunk/templates/base/principal_tabs.tpl
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/templates/base/principal_tabs.tpl
2010-02-24 21:42:34 UTC (rev 21037)
@@ -7,5 +7,5 @@
<!-- END principal_tab -->
<!-- BEGIN principal_button -->
- <li {principal_tab_css}><a
href="{principal_action}">{principal_value}</a>
+ <li {principal_tab_css}><a
href="{principal_action}"><em>{principal_value}</em></a></li>
<!-- END principal_button -->
Modified: people/sigurdne/modules/addressbook/trunk/templates/base/tab.tpl
===================================================================
--- people/sigurdne/modules/addressbook/trunk/templates/base/tab.tpl
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/templates/base/tab.tpl
2010-02-24 21:42:34 UTC (rev 21037)
@@ -7,7 +7,7 @@
<!-- END tab -->
<!-- BEGIN button -->
- <li class="{tab_css}"><input type="submit" name="{tab_name}"
value="{tab_caption}"></li>
+ <li class="{tab_css}"><a
href="javascript:changetab('{tab_caption}')"><em>{tab_caption}</em></a></li>
<!-- END button -->
Modified:
people/sigurdne/modules/addressbook/trunk/templates/probusiness/add.tpl
===================================================================
--- people/sigurdne/modules/addressbook/trunk/templates/probusiness/add.tpl
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/templates/probusiness/add.tpl
2010-02-24 21:42:34 UTC (rev 21037)
@@ -1,9 +1,13 @@
<!-- BEGIN add -->
<table class="padding" align="center">
<tr>
- <td> <input type="submit" name="submit" value="{lang_save}" {js_submit}
/></td>
+ <td>
+ <input type="button" name="button1" onclick="submit_form('submit')"
value="{lang_save}">
+ </td>
<td> </td>
- <td><input type="submit" name="cancel" value="{lang_cancel}" {js_submit}
/></td>
+ <td>
+ <input type="button" name="button2" onclick="submit_form('cancel')"
value="{lang_cancel}">
+ </td>
<td></td>
<td>{lang_delete}</td>
<td> </td>
Modified:
people/sigurdne/modules/addressbook/trunk/templates/probusiness/form.tpl
===================================================================
--- people/sigurdne/modules/addressbook/trunk/templates/probusiness/form.tpl
2010-02-24 21:39:43 UTC (rev 21036)
+++ people/sigurdne/modules/addressbook/trunk/templates/probusiness/form.tpl
2010-02-24 21:42:34 UTC (rev 21037)
@@ -5,7 +5,25 @@
<tr>
{principal_tabs_inc}
</tr>
- <form action="{action}" method="post" name="body_form"
cellspacing="0" cellpadding="0" {onsubjs}>
+ <form action="{action}" method="post" name="body_form"
cellspacing="0" cellpadding="0">
+ <input type="hidden" name="bname" />
+ <input type="hidden" name="_submit" />
+ <script language="JavaScript" type="text/javascript">
+ <!--
+ function changetab(selectedtype)
+ {
+ document.body_form.bname.value =
selectedtype ;
+ document.body_form.submit();
+ }
+ function submit_form(selectedtype)
+ {
+ process_list('{onsubjs1}',
'{onsubjs2}');
+ document.body_form._submit.value =
selectedtype ;
+ document.body_form.submit();
+ }
+ -->
+ </script>
+
<tr>
{tab}
</tr>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] [21037] Fix vcard, use yui tabs instead of buttons 4746:4909,
Sigurd Nes <=