mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
Add initial framework for alternate contact types (not enabled), cleanup formatting
This commit is contained in:
parent
ac7a91b8fa
commit
bbbd26dc4b
@ -136,6 +136,10 @@
|
||||
|
||||
if($tsvfile['type'] == 'application/zip')
|
||||
{
|
||||
if(!@function_exists('zip_open'))
|
||||
{
|
||||
return False;
|
||||
}
|
||||
$fp = $this->unzip($tsvfile['tmp_name'],$contacts->type);
|
||||
}
|
||||
else
|
||||
|
@ -82,15 +82,15 @@
|
||||
$this->use_session = True;
|
||||
}
|
||||
/* _debug_array($_POST); */
|
||||
/* Might change this to '' at the end---> */
|
||||
$_start = get_var('start',array('POST','GET'));
|
||||
$_query = get_var('query',array('POST','GET'),'_UNSET_');
|
||||
$_cquery = get_var('cquery', array('GET','POST'),'_UNSET_');
|
||||
$_sort = get_var('sort',array('POST','GET'));
|
||||
$_order = get_var('order',array('POST','GET'));
|
||||
$_filter = get_var('filter',array('POST','GET'));
|
||||
$_cat_id = get_var('cat_id',array('POST','GET'));
|
||||
// $_cat_id = get_var('cat_id',array('POST','GET'));
|
||||
$_fcat_id = get_var('fcat_id',array('POST','GET'));
|
||||
$_typeid = get_var('typeid',array('POST','GET'),'_UNSET_');
|
||||
|
||||
if(!empty($_start) || ($_start == '0') || ($_start == 0))
|
||||
{
|
||||
@ -111,6 +111,15 @@
|
||||
$this->cquery = $_cquery;
|
||||
}
|
||||
|
||||
if($_typeid != '_UNSET_')
|
||||
{
|
||||
$this->typeid = $_typeid;
|
||||
}
|
||||
if(!@in_array($this->typeid,array('n','c')))
|
||||
{
|
||||
$this->typeid = 'n';
|
||||
}
|
||||
|
||||
if(isset($_POST['fcat_id']) || isset($_POST['fcat_id']))
|
||||
{
|
||||
$this->cat_id = $_fcat_id;
|
||||
@ -120,6 +129,17 @@
|
||||
$this->cat_id = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
if(isset($_POST['typeid']) || isset($_POST['typeid']))
|
||||
{
|
||||
$this->typeid = $typeid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->typeid = 'n';
|
||||
}
|
||||
*/
|
||||
|
||||
if(isset($_sort) && !empty($_sort))
|
||||
{
|
||||
if($this->debug) { echo '<br>overriding $sort: "' . $this->sort . '" now "' . $_sort . '"'; }
|
||||
@ -139,11 +159,6 @@
|
||||
}
|
||||
|
||||
if($this->debug) { $this->_debug_sqsof(); }
|
||||
|
||||
$this->xmlrpc_methods[] = array(
|
||||
'name' => 'read_entries',
|
||||
'description' => 'Get list of addressbook items'
|
||||
);
|
||||
}
|
||||
|
||||
function _debug_sqsof()
|
||||
@ -156,69 +171,13 @@
|
||||
'sort' => $this->sort,
|
||||
'order' => $this->order,
|
||||
'filter' => $this->filter,
|
||||
'cat_id' => $this->cat_id
|
||||
'cat_id' => $this->cat_id,
|
||||
'typeid' => $this->typeid
|
||||
);
|
||||
echo '<br>BO:';
|
||||
_debug_array($data);
|
||||
}
|
||||
|
||||
function list_methods($_type='xmlrpc')
|
||||
{
|
||||
/*
|
||||
This handles introspection or discovery by the logged in client,
|
||||
in which case the input might be an array. The server always calls
|
||||
this function to fill the server dispatch map using a string.
|
||||
*/
|
||||
if(is_array($_type))
|
||||
{
|
||||
$_type = $_type['type'] ? $_type['type'] : $_type[0];
|
||||
}
|
||||
switch($_type)
|
||||
{
|
||||
case 'xmlrpc':
|
||||
$xml_functions = array(
|
||||
'read' => array(
|
||||
'function' => 'read_entry',
|
||||
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||
'docstring' => lang('Read a single entry by passing the id and fieldlist.')
|
||||
),
|
||||
'add' => array(
|
||||
'function' => 'add_entry',
|
||||
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||
'docstring' => lang('Add a single entry by passing the fields.')
|
||||
),
|
||||
'save' => array(
|
||||
'function' => 'update_entry',
|
||||
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||
'docstring' => lang('Update a single entry by passing the fields.')
|
||||
),
|
||||
'delete' => array(
|
||||
'function' => 'delete_entry',
|
||||
'signature' => array(array(xmlrpcInt,xmlrpcInt)),
|
||||
'docstring' => lang('Delete a single entry by passing the id.')
|
||||
),
|
||||
'read_list' => array(
|
||||
'function' => 'read_entries',
|
||||
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||
'docstring' => lang('Read a list of entries.')
|
||||
),
|
||||
'list_methods' => array(
|
||||
'function' => 'list_methods',
|
||||
'signature' => array(array(xmlrpcStruct,xmlrpcString)),
|
||||
'docstring' => lang('Read this list of methods.')
|
||||
)
|
||||
);
|
||||
return $xml_functions;
|
||||
break;
|
||||
case 'soap':
|
||||
return $this->soap_functions;
|
||||
break;
|
||||
default:
|
||||
return array();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function save_sessiondata($data)
|
||||
{
|
||||
if($this->use_session)
|
||||
@ -241,6 +200,7 @@
|
||||
$this->order = $data['order'];
|
||||
$this->filter = $data['filter'];
|
||||
$this->cat_id = $data['cat_id'];
|
||||
$this->typeid = $data['typeid'];
|
||||
if($this->debug) { echo '<br>read_sessiondata();'; $this->_debug_sqsof(); }
|
||||
}
|
||||
|
||||
@ -465,5 +425,63 @@
|
||||
|
||||
$GLOBALS['phpgw']->preferences->save_repository(True);
|
||||
}
|
||||
|
||||
function list_methods($_type='xmlrpc')
|
||||
{
|
||||
/*
|
||||
This handles introspection or discovery by the logged in client,
|
||||
in which case the input might be an array. The server always calls
|
||||
this function to fill the server dispatch map using a string.
|
||||
*/
|
||||
if(is_array($_type))
|
||||
{
|
||||
$_type = $_type['type'] ? $_type['type'] : $_type[0];
|
||||
}
|
||||
switch($_type)
|
||||
{
|
||||
case 'xmlrpc':
|
||||
$xml_functions = array(
|
||||
'read' => array(
|
||||
'function' => 'read_entry',
|
||||
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||
'docstring' => lang('Read a single entry by passing the id and fieldlist.')
|
||||
),
|
||||
'add' => array(
|
||||
'function' => 'add_entry',
|
||||
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||
'docstring' => lang('Add a single entry by passing the fields.')
|
||||
),
|
||||
'save' => array(
|
||||
'function' => 'update_entry',
|
||||
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||
'docstring' => lang('Update a single entry by passing the fields.')
|
||||
),
|
||||
'delete' => array(
|
||||
'function' => 'delete_entry',
|
||||
'signature' => array(array(xmlrpcInt,xmlrpcInt)),
|
||||
'docstring' => lang('Delete a single entry by passing the id.')
|
||||
),
|
||||
'read_list' => array(
|
||||
'function' => 'read_entries',
|
||||
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||
'docstring' => lang('Read a list of entries.')
|
||||
),
|
||||
'list_methods' => array(
|
||||
'function' => 'list_methods',
|
||||
'signature' => array(array(xmlrpcStruct,xmlrpcString)),
|
||||
'docstring' => lang('Read this list of methods.')
|
||||
)
|
||||
);
|
||||
return $xml_functions;
|
||||
break;
|
||||
case 'soap':
|
||||
return $this->soap_functions;
|
||||
break;
|
||||
default:
|
||||
return array();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -3,12 +3,12 @@
|
||||
* eGroupWare API - Palm Database Access *
|
||||
* This file written by Miles Lott <milos@groupwhere.org> *
|
||||
* Access to palm OS database structures (?) *
|
||||
* -------------------------------------------------------------------------*
|
||||
* ------------------------------------------------------------------------ *
|
||||
* Portions of code from ToPTIP *
|
||||
* Copyright (C) 2000-2001 Pierre Dittgen *
|
||||
* This file is a translation of the txt2pdbdoc tool *
|
||||
* written in C Paul J. Lucas (plj@best.com) *
|
||||
* -------------------------------------------------------------------------*
|
||||
* ------------------------------------------------------------------------ *
|
||||
* This library may be part of the eGroupWare API *
|
||||
* ------------------------------------------------------------------------ *
|
||||
* This library is free software; you can redistribute it and/or modify it *
|
||||
@ -45,7 +45,7 @@
|
||||
*/
|
||||
function int2($value)
|
||||
{
|
||||
return sprintf("%c%c", $value / 256, $value % 256);
|
||||
return sprintf("%c%c", $value / 256, $value % 256);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@
|
||||
*/
|
||||
function int4($value)
|
||||
{
|
||||
for ($i=0; $i<4; $i++)
|
||||
for($i=0; $i<4; $i++)
|
||||
{
|
||||
$b[$i] = $value % 256;
|
||||
$value = (int)(($value - $b[$i]) / 256);
|
||||
@ -69,14 +69,14 @@
|
||||
{
|
||||
// ============ File header =========================================
|
||||
// Title of the document, it's limited to 31 characters
|
||||
if (strlen($title) > 31)
|
||||
if(strlen($title) > 31)
|
||||
{
|
||||
$title = substr($title, 0, 31);
|
||||
}
|
||||
fwrite($fd, $title);
|
||||
|
||||
// Completion with null '\0' characters
|
||||
for ($i=0; $i<32-strlen($title); $i++)
|
||||
for($i=0; $i<32-strlen($title); $i++)
|
||||
{
|
||||
fwrite($fd, sprintf("%c", 0), 1);
|
||||
}
|
||||
@ -107,7 +107,7 @@
|
||||
$full_tr = (int)($content_length / $this->record_size);
|
||||
$notfull_tr = $content_length % $this->record_size;
|
||||
$num_records = $full_tr;
|
||||
if ($notfull_tr != 0)
|
||||
if($notfull_tr != 0)
|
||||
{
|
||||
$num_records++;
|
||||
}
|
||||
@ -124,7 +124,7 @@
|
||||
fwrite($fd, $this->int4($index++));
|
||||
|
||||
$val = 110 + ($num_offsets - 2) * 8;
|
||||
while (--$num_offsets != 0)
|
||||
while(--$num_offsets != 0)
|
||||
{
|
||||
fwrite($fd, $this->int4($val));
|
||||
$val += 4096;
|
||||
@ -171,7 +171,7 @@
|
||||
$title = fread(31,$fd);
|
||||
|
||||
// Completion with null '\0' characters
|
||||
for ($i=0; $i<32-strlen($title); $i++)
|
||||
for($i=0; $i<32-strlen($title); $i++)
|
||||
{
|
||||
fwrite($fd, sprintf("%c", 0), 1);
|
||||
}
|
||||
@ -202,7 +202,7 @@
|
||||
$full_tr = (int)($content_length / $this->record_size);
|
||||
$notfull_tr = $content_length % $this->record_size;
|
||||
$num_records = $full_tr;
|
||||
if ($notfull_tr != 0)
|
||||
if($notfull_tr != 0)
|
||||
{
|
||||
$num_records++;
|
||||
}
|
||||
@ -219,7 +219,7 @@
|
||||
fwrite($fd, $this->int4($index++));
|
||||
|
||||
$val = 110 + ($num_offsets - 2) * 8;
|
||||
while (--$num_offsets != 0)
|
||||
while(--$num_offsets != 0)
|
||||
{
|
||||
fwrite($fd, $this->int4($val));
|
||||
$val += 4096;
|
||||
|
@ -157,7 +157,7 @@
|
||||
$i=0; $myfilearray = '';
|
||||
while($file = readdir($dir_handle))
|
||||
{
|
||||
if((substr($file, 0, 1) != '.') && is_file(PHPGW_APP_INC . SEP . 'import' . SEP . $file) )
|
||||
if((substr($file, 0, 1) != '.') && is_file(PHPGW_APP_INC . SEP . 'import' . SEP . $file))
|
||||
{
|
||||
$myfilearray[$i] = $file;
|
||||
$i++;
|
||||
@ -191,14 +191,12 @@
|
||||
$this->template->set_var('query',$this->query);
|
||||
$this->template->set_var('cat_id',$this->cat_id);
|
||||
$this->template->set_var('lang_import_instructions',lang('import_instructions'));
|
||||
$this->template->set_var('zip_note','');
|
||||
if(extension_loaded('zip'))
|
||||
{
|
||||
$this->template->set_var('zip_note',lang('zip_note'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->template->set_var('zip_note','');
|
||||
}
|
||||
|
||||
$this->template->set_var('lang_exported_file',lang('enter the path to the exported file here'));
|
||||
$this->template->set_var('lang_conv_type',lang('select the type of conversion'));
|
||||
$this->template->set_var('lang_mark_priv',lang('Mark records as private'));
|
||||
@ -232,7 +230,7 @@
|
||||
|
||||
$buffer = $this->bo->export($conv_type,$cat_id);
|
||||
|
||||
if(($download == 'on') || ($conv_type == 'Palm_PDB') )
|
||||
if(($download == 'on') || ($conv_type == 'Palm_PDB'))
|
||||
{
|
||||
// filename, default application/octet-stream, length of file, default nocache True
|
||||
$this->browser->content_header($tsvfilename,'application/x-octet-stream',strlen($buffer));
|
||||
@ -262,7 +260,7 @@
|
||||
$i=0; $myfilearray = '';
|
||||
while($file = readdir($dir_handle))
|
||||
{
|
||||
if((substr($file, 0, 1) != '.') && is_file(PHPGW_APP_INC . SEP . 'export' . SEP . $file) )
|
||||
if((substr($file, 0, 1) != '.') && is_file(PHPGW_APP_INC . SEP . 'export' . SEP . $file))
|
||||
{
|
||||
$myfilearray[$i] = $file;
|
||||
$i++;
|
||||
|
@ -48,6 +48,15 @@
|
||||
'address3' => 'address3'
|
||||
);
|
||||
|
||||
var $contact_types = array(
|
||||
'n' => 'People',
|
||||
'c' => 'Companies'
|
||||
);
|
||||
var $contact_type = array(
|
||||
'n' => 'Person',
|
||||
'c' => 'Company'
|
||||
);
|
||||
|
||||
function uiaddressbook()
|
||||
{
|
||||
$GLOBALS['phpgw']->country = CreateObject('phpgwapi.country');
|
||||
@ -65,14 +74,15 @@
|
||||
|
||||
function _set_sessiondata()
|
||||
{
|
||||
$this->start = $this->bo->start;
|
||||
$this->limit = $this->bo->limit;
|
||||
$this->query = $this->bo->query;
|
||||
$this->cquery = $this->bo->cquery;
|
||||
$this->sort = $this->bo->sort;
|
||||
$this->order = $this->bo->order;
|
||||
$this->filter = $this->bo->filter;
|
||||
$this->cat_id = $this->bo->cat_id;
|
||||
$this->start = $this->bo->start;
|
||||
$this->limit = $this->bo->limit;
|
||||
$this->query = $this->bo->query;
|
||||
$this->cquery = $this->bo->cquery;
|
||||
$this->sort = $this->bo->sort;
|
||||
$this->order = $this->bo->order;
|
||||
$this->filter = $this->bo->filter;
|
||||
$this->cat_id = $this->bo->cat_id;
|
||||
$this->typeid = $this->bo->typeid;
|
||||
if($this->debug) { $this->_debug_sqsof(); }
|
||||
}
|
||||
|
||||
@ -86,7 +96,8 @@
|
||||
'sort' => $this->sort,
|
||||
'order' => $this->order,
|
||||
'filter' => $this->filter,
|
||||
'cat_id' => $this->cat_id
|
||||
'cat_id' => $this->cat_id,
|
||||
'typeid' => $this->typeid
|
||||
);
|
||||
echo '<br>UI:';
|
||||
_debug_array($data);
|
||||
@ -103,7 +114,8 @@
|
||||
'sort' => $this->sort,
|
||||
'order' => $this->order,
|
||||
'filter' => $this->filter,
|
||||
'cat_id' => $this->cat_id
|
||||
'cat_id' => $this->cat_id,
|
||||
'typeid' => $this->typeid
|
||||
);
|
||||
$this->bo->save_sessiondata($data);
|
||||
}
|
||||
@ -120,7 +132,7 @@
|
||||
{
|
||||
$select .= '<option value="">' . lang('Please Select') . '</option>'."\n";
|
||||
}
|
||||
// while(list($key,$val) = each($list))
|
||||
settype($list,'array');
|
||||
foreach($list as $key => $val)
|
||||
{
|
||||
$select .= '<option value="' . $key . '"';
|
||||
@ -132,7 +144,8 @@
|
||||
}
|
||||
|
||||
$select .= '</select>'."\n";
|
||||
$select .= '<noscript><input type="submit" name="' . $name . '_select" value="True"></noscript>' . "\n";
|
||||
$select .= '<noscript><input type="submit" name="' . $name . '_select" value="'
|
||||
. lang('Submit') . '"></noscript>' . "\n";
|
||||
|
||||
return $select;
|
||||
}
|
||||
@ -408,7 +421,7 @@
|
||||
Set qfilter to display entries where tid=n (normal contact entry),
|
||||
else they may be accounts, etc.
|
||||
*/
|
||||
$qfilter = 'tid=n';
|
||||
$qfilter = 'tid=' . (string)$this->typeid;
|
||||
switch($this->filter)
|
||||
{
|
||||
case 'blank':
|
||||
@ -483,6 +496,15 @@
|
||||
$GLOBALS['phpgw']->template->set_var('searchreturn',$noprefs . ' ' . $searchreturn);
|
||||
$GLOBALS['phpgw']->template->set_var('lang_showing',$lang_showing);
|
||||
$GLOBALS['phpgw']->template->set_var('search_filter',$search_filter);
|
||||
/*
|
||||
$GLOBALS['phpgw']->template->set_var('lang_show',lang('Show') . ':');
|
||||
$GLOBALS['phpgw']->template->set_var('contact_type_list',$this->formatted_list('typeid',$this->contact_types,$this->typeid,False,True));
|
||||
$GLOBALS['phpgw']->template->set_var('self_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.index'));
|
||||
*/
|
||||
$GLOBALS['phpgw']->template->set_var('lang_show','');
|
||||
$GLOBALS['phpgw']->template->set_var('contact_type_list','');
|
||||
$GLOBALS['phpgw']->template->set_var('self_url','');
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('cats',lang('Category'));
|
||||
$GLOBALS['phpgw']->template->set_var('cats_url',$GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.index'));
|
||||
/* $GLOBALS['phpgw']->template->set_var('cats_link',$this->cat_option($this->cat_id)); */
|
||||
@ -1604,7 +1626,7 @@
|
||||
|
||||
if(strlen($bday) > 2)
|
||||
{
|
||||
list( $month, $day, $year ) = split( '/', $bday );
|
||||
list($month, $day, $year) = split('/', $bday);
|
||||
$temp_month[$month] = ' selected';
|
||||
$bday_month = '<select name="entry[bday_month]">'
|
||||
. '<option value=""' . $temp_month[0] . '>' . '</option>'
|
||||
|
@ -101,7 +101,7 @@
|
||||
$title = $fields[$i]['title'];
|
||||
|
||||
$GLOBALS['phpgw']->template->set_var('cfield',$title);
|
||||
|
||||
|
||||
$params = array(
|
||||
'menuaction' => 'addressbook.uifields.edit',
|
||||
'field' => urlencode($field),
|
||||
|
@ -22,6 +22,10 @@ function check_all(which)
|
||||
{lang_showing}
|
||||
<br>{searchreturn}
|
||||
{search_filter}
|
||||
<!-- <table width="95%" border="1" cellspacing="1" cellpadding="3">
|
||||
<form name="addr_type" action="{self_url}" method="POST">
|
||||
<tr bgcolor="{th_bg}"><td>{lang_show} {contact_type_list}</td></tr></form>
|
||||
</table>-->
|
||||
<table width="95%" border="1" cellspacing="1" cellpadding="3">
|
||||
<tr>{alphalinks}
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user