corrected 'no vcard' if their are no names

This commit is contained in:
Ralf Becker 2001-05-29 19:40:40 +00:00
parent 4b240653bf
commit b416eeaf14
2 changed files with 57 additions and 77 deletions

View File

@ -33,40 +33,17 @@
<center> <center>
<TABLE border="0" cellpadding="1" cellspacing="1"> <TABLE border="0" cellpadding="1" cellspacing="1">
<TR> <TR>
<TD align="left"> <TD>
{edit_link}
<input type="hidden" name="ab_id" value="{ab_id}">
{edit_button} {edit_button}
</form>
</TD> </TD>
<TD align="left"> <TD>
{copy_link} {copy_button}
<input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}">
<input type="hidden" name="fields" value="{copy_fields}">
<input type="submit" name="submit" value="{lang_copy}">
</form>
</TD> </TD>
<TD align="left"> <TD>
{vcard_link} {vcard_button}
<input type="hidden" name="ab_id" value="{ab_id}">
<input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}">
<input type="submit" name="VCardform" value="{lang_vcard}">
</form>
</TD> </TD>
<TD align="left"> <TD>
{done_link} {done_button}
<input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}">
<input type="submit" name="Doneform" value="{lang_done}">
</form>
</TD> </TD>
</TR> </TR>
</TABLE> </TABLE>

View File

@ -239,63 +239,66 @@
$sfields = rawurlencode(serialize($fields[0])); $sfields = rawurlencode(serialize($fields[0]));
function html_input_hidden($vars) {
if (!is_array($vars)) return '';
while (list($name,$value) = each($vars)) {
if ($value != '') // dont need to send all the empty vars
$html .= "<input type=hidden name=\"$name\" value=\"$value\">\n";
}
return $html;
}
function html_submit_button($name,$lang) {
return "<input type=\"submit\" name=\"$name\" value=\"".lang($lang)."\">\n";
}
function phpgw_link($url,$vars='') {
global $phpgw;
if (is_array( $vars )) {
while(list($name,$value) = each($vars)) {
if ($value != '') // dont need to send all the empty vars
$v[] = "$name=$value";
}
$vars = implode('&',$v);
}
return $phpgw->link($url,$vars);
}
function html_1button_form($name,$lang,$hidden_vars,$url,$url_vars='',$method='POST') {
$html = "<form method=\"$method\" action=\"".phpgw_link($url,$url_vars)."\">\n";
$html .= html_input_hidden($hidden_vars);
$html .= html_submit_button($name,$lang);
$html .= "</form>\n";
return $html;
}
$common_vars = array('sort' => $sort,'order' => $order,'filter' => $filter,'start' => $start); // common vars for all buttons
if (($this->grants[$record_owner] & PHPGW_ACL_EDIT) || ($record_owner == $phpgw_info['user']['account_id'])) if (($this->grants[$record_owner] & PHPGW_ACL_EDIT) || ($record_owner == $phpgw_info['user']['account_id']))
{ {
if ($referer) $extra_vars = array('cd' => 16,'query' => $query,'cat_id' => $cat_id);
{
$t->set_var('edit_link','<form method="POST" action="' if ($referer) $extra_vars += array( 'referer' => urlencode($referer));
. $phpgw->link("/addressbook/edit.php",'referer=' . urlencode($referer),
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id").'">'); $t->set_var('edit_button',html_1button_form('edit','Edit',array('ab_id' => $ab_id),'/addressbook/edit.php',
} $common_vars + $extra_vars));
else }
{ $t->set_var('copy_button',html_1button_form('submit','copy',$common_vars+array( 'fields' => rawurlencode(serialize($fields[0]))),
$t->set_var('edit_link','<form method="POST" action="' '/addressbook/add.php'));
. $phpgw->link("/addressbook/edit.php",
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id").'">');
}
$t->set_var('edit_button','<input type="submit" name="edit" value="' . lang('Edit') . '">');
}
$copylink = '<form method="POST" action="' . $phpgw->link("/addressbook/add.php").'">';
if ($fields[0]['n_family'] && $fields[0]['n_given']) if ($fields[0]['n_family'] && $fields[0]['n_given'])
{ {
$vcardlink = '<form method="POST" action="' . $phpgw->link("/addressbook/vcardout.php").'">'; $t->set_var('vcard_button',html_1button_form('VCardForm','VCard',$common_vars+array( 'ab_id' => $ab_id),'/addressbook/vcardout.php'));
} }
else else
{ {
$vcardlink = lang('no').' '.lang('vcard'); $t->set_var('vcard_button',lang('no vcard'));
}
if ($referer)
{
$referer = ereg_replace('/phpgroupware','',$referer);
$donelink = '<form method="POST" action="'
. $phpgw->link($referer,
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query").'">';
}
else
{
$donelink = '<form method="POST" action="'
. $phpgw->link("/addressbook/index.php",
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query").'">';
} }
$t->set_var('done_button',html_1button_form('DoneForm','Done',$common_vars,
$referer ? ereg_replace('/phpgroupware','',$referer) : '/addressbook/index.php',
$common_vars + array('cd' => 16,'query' => $query)));
$t->set_var('access_link',$access_link); $t->set_var('access_link',$access_link);
$t->set_var('ab_id',$ab_id);
$t->set_var('sort',$sort);
$t->set_var('order',$order);
$t->set_var('filter',$filter);
$t->set_var('start',$start);
$t->set_var('cat_id',$cat_id);
$t->set_var('lang_ok',lang('ok'));
$t->set_var('lang_done',lang('done'));
$t->set_var('lang_copy',lang('copy'));
$t->set_var('copy_fields',$sfields);
$t->set_var('lang_submit',lang('submit'));
$t->set_var('lang_vcard',lang('vcard'));
$t->set_var('done_link',$donelink);
$t->set_var('copy_link',$copylink);
$t->set_var('vcard_link',$vcardlink);
$t->pfp('out','view_t'); $t->pfp('out','view_t');