documentation update and the usual code modernization (phpgw-->egw, ...)

This commit is contained in:
Ralf Becker 2005-04-06 11:05:57 +00:00
parent eeb73369b1
commit 3b32bccc49
13 changed files with 759 additions and 704 deletions

View File

@ -12,53 +12,53 @@
/* $Id$ */ /* $Id$ */
$GLOBALS['phpgw_info']['flags'] = array( $GLOBALS['egw_info']['flags'] = array(
'currentapp' => 'infolog', 'currentapp' => 'infolog',
'noheader' => True, 'noheader' => True,
'enable_contacts_class' => True, 'enable_contacts_class' => True,
); );
include('../header.inc.php'); include('../header.inc.php');
if (!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) || if (!isset($GLOBALS['egw_info']['user']['apps']['admin']) ||
!$GLOBALS['phpgw_info']['user']['apps']['admin']) // no admin !$GLOBALS['egw_info']['user']['apps']['admin']) // no admin
{ {
$GLOBALS['phpgw']->redirect_link('/home.php'); $GLOBALS['egw']->redirect_link('/home.php');
} }
if (isset($_FILES['csvfile']['tmp_name'])) if (isset($_FILES['csvfile']['tmp_name']))
{ {
$csvfile = tempnam($GLOBALS['phpgw_info']['server']['temp_dir'],$GLOBALS['phpgw_info']['flags']['currentapp']."_"); $csvfile = tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
$GLOBALS['phpgw']->session->appsession('csvfile','',$csvfile); $GLOBALS['egw']->session->appsession('csvfile','',$csvfile);
$_POST['action'] = move_uploaded_file($_FILES['csvfile']['tmp_name'],$csvfile) ? $_POST['action'] = move_uploaded_file($_FILES['csvfile']['tmp_name'],$csvfile) ?
'download' : ''; 'download' : '';
} }
else else
{ {
$csvfile = $GLOBALS['phpgw']->session->appsession('csvfile'); $csvfile = $GLOBALS['egw']->session->appsession('csvfile');
} }
if ($_POST['cancel']) if ($_POST['cancel'])
{ {
@unlink($csvfile); @unlink($csvfile);
$GLOBALS['phpgw']->redirect_link('/admin/index.php'); $GLOBALS['egw']->redirect_link('/admin/index.php');
} }
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog - Import CSV-File'); $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog - Import CSV-File');
$GLOBALS['phpgw']->common->phpgw_header(); $GLOBALS['egw']->common->egw_header();
$boinfolog = createobject('infolog.boinfolog'); $boinfolog = createobject('infolog.boinfolog');
$GLOBALS['phpgw']->template->set_file(array('import_t' => 'csv_import.tpl')); $GLOBALS['egw']->template->set_file(array('import_t' => 'csv_import.tpl'));
$GLOBALS['phpgw']->template->set_block('import_t','filename','filenamehandle'); $GLOBALS['egw']->template->set_block('import_t','filename','filenamehandle');
$GLOBALS['phpgw']->template->set_block('import_t','fheader','fheaderhandle'); $GLOBALS['egw']->template->set_block('import_t','fheader','fheaderhandle');
$GLOBALS['phpgw']->template->set_block('import_t','fields','fieldshandle'); $GLOBALS['egw']->template->set_block('import_t','fields','fieldshandle');
$GLOBALS['phpgw']->template->set_block('import_t','ffooter','ffooterhandle'); $GLOBALS['egw']->template->set_block('import_t','ffooter','ffooterhandle');
$GLOBALS['phpgw']->template->set_block('import_t','imported','importedhandle'); $GLOBALS['egw']->template->set_block('import_t','imported','importedhandle');
$GLOBALS['phpgw']->template->set_block('import_t','import','importhandle'); $GLOBALS['egw']->template->set_block('import_t','import','importhandle');
if(($_POST['action'] == 'download' || $_POST['action'] == 'continue') && (!$_POST['fieldsep'] || !$csvfile || !($fp=fopen($csvfile,'rb')))) if(($_POST['action'] == 'download' || $_POST['action'] == 'continue') && (!$_POST['fieldsep'] || !$csvfile || !($fp=fopen($csvfile,'rb'))))
{ {
$_POST['action'] = ''; $_POST['action'] = '';
} }
$GLOBALS['phpgw']->template->set_var("action_url",$GLOBALS['phpgw']->link("/infolog/csv_import.php")); $GLOBALS['egw']->template->set_var("action_url",$GLOBALS['egw']->link("/infolog/csv_import.php"));
$PSep = '||'; // Pattern-Separator, separats the pattern-replacement-pairs in trans $PSep = '||'; // Pattern-Separator, separats the pattern-replacement-pairs in trans
$ASep = '|>'; // Assignment-Separator, separats pattern and replacesment $ASep = '|>'; // Assignment-Separator, separats pattern and replacesment
@ -111,22 +111,22 @@ function cat_id($cats)
} }
else else
{ {
if (!is_object($GLOBALS['phpgw']->categories)) if (!is_object($GLOBALS['egw']->categories))
{ {
$GLOBALS['phpgw']->categories = createobject('phpgwapi.categories'); $GLOBALS['egw']->categories = createobject('phpgwapi.categories');
} }
if (is_numeric($cat) && $GLOBALS['phpgw']->categories->id2name($cat) != '--') if (is_numeric($cat) && $GLOBALS['egw']->categories->id2name($cat) != '--')
{ {
$cat2id[$cat] = $ids[$cat] = $cat; $cat2id[$cat] = $ids[$cat] = $cat;
} }
elseif ($id = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) )) elseif ($id = $GLOBALS['egw']->categories->name2id( addslashes($cat) ))
{ // cat exists { // cat exists
$cat2id[$cat] = $ids[$cat] = $id; $cat2id[$cat] = $ids[$cat] = $id;
} }
else else
{ // create new cat { // create new cat
$GLOBALS['phpgw']->categories->add( array('name' => $cat,'descr' => $cat )); $GLOBALS['egw']->categories->add( array('name' => $cat,'descr' => $cat ));
$cat2id[$cat] = $ids[$cat] = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) ); $cat2id[$cat] = $ids[$cat] = $GLOBALS['egw']->categories->name2id( addslashes($cat) );
} }
} }
} }
@ -139,45 +139,45 @@ function cat_id($cats)
return $id_str; return $id_str;
} }
if (!is_object($GLOBALS['phpgw']->html)) if (!is_object($GLOBALS['egw']->html))
{ {
$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html'); $GLOBALS['egw']->html =& CreateObject('phpgwapi.html');
} }
if ($_POST['next']) $_POST['action'] = 'next'; if ($_POST['next']) $_POST['action'] = 'next';
switch ($_POST['action']) switch ($_POST['action'])
{ {
case '': // Start, ask Filename case '': // Start, ask Filename
$GLOBALS['phpgw']->template->set_var('lang_csvfile',lang('CSV-Filename')); $GLOBALS['egw']->template->set_var('lang_csvfile',lang('CSV-Filename'));
$GLOBALS['phpgw']->template->set_var('lang_fieldsep',lang('Fieldseparator')); $GLOBALS['egw']->template->set_var('lang_fieldsep',lang('Fieldseparator'));
$GLOBALS['phpgw']->template->set_var('lang_charset',lang('Charset of file')); $GLOBALS['egw']->template->set_var('lang_charset',lang('Charset of file'));
$GLOBALS['phpgw']->template->set_var('select_charset', $GLOBALS['egw']->template->set_var('select_charset',
$GLOBALS['phpgw']->html->select('charset','', $GLOBALS['egw']->html->select('charset','',
$GLOBALS['phpgw']->translation->get_installed_charsets()+ $GLOBALS['egw']->translation->get_installed_charsets()+
array('utf-8' => 'utf-8 (Unicode)'),True)); array('utf-8' => 'utf-8 (Unicode)'),True));
$GLOBALS['phpgw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ','); $GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ',');
$GLOBALS['phpgw']->template->set_var('submit',lang('Import')); $GLOBALS['egw']->template->set_var('submit',lang('Import'));
$GLOBALS['phpgw']->template->set_var('enctype','ENCTYPE="multipart/form-data"'); $GLOBALS['egw']->template->set_var('enctype','ENCTYPE="multipart/form-data"');
$GLOBALS['phpgw']->template->parse('rows','filename'); $GLOBALS['egw']->template->parse('rows','filename');
break; break;
case 'continue': case 'continue':
case 'download': case 'download':
$GLOBALS['phpgw']->preferences->read_repository(); $GLOBALS['egw']->preferences->read_repository();
$defaults = $GLOBALS['phpgw_info']['user']['preferences']['infolog']['cvs_import']; $defaults = $GLOBALS['egw_info']['user']['preferences']['infolog']['cvs_import'];
if (!is_array($defaults)) if (!is_array($defaults))
{ {
$defaults = array(); $defaults = array();
} }
$GLOBALS['phpgw']->template->set_var('lang_csv_fieldname',lang('CSV-Fieldname')); $GLOBALS['egw']->template->set_var('lang_csv_fieldname',lang('CSV-Fieldname'));
$GLOBALS['phpgw']->template->set_var('lang_info_fieldname',lang('InfoLog-Fieldname')); $GLOBALS['egw']->template->set_var('lang_info_fieldname',lang('InfoLog-Fieldname'));
$GLOBALS['phpgw']->template->set_var('lang_translation',lang("Translation").' <a href="#help">'.lang('help').'</a>'); $GLOBALS['egw']->template->set_var('lang_translation',lang("Translation").' <a href="#help">'.lang('help').'</a>');
$GLOBALS['phpgw']->template->set_var('submit', $GLOBALS['egw']->template->set_var('submit',
$GLOBALS['phpgw']->html->submit_button('convert','Import') . '&nbsp;'. $GLOBALS['egw']->html->submit_button('convert','Import') . '&nbsp;'.
$GLOBALS['phpgw']->html->submit_button('cancel','Cancel')); $GLOBALS['egw']->html->submit_button('cancel','Cancel'));
$GLOBALS['phpgw']->template->set_var('lang_debug',lang('Test Import (show importable records <u>only</u> in browser)')); $GLOBALS['egw']->template->set_var('lang_debug',lang('Test Import (show importable records <u>only</u> in browser)'));
$GLOBALS['phpgw']->template->parse('rows','fheader'); $GLOBALS['egw']->template->parse('rows','fheader');
$info_names = array( $info_names = array(
'type' => 'Type: char(10) task,phone,note,confirm,reject,email,fax', 'type' => 'Type: char(10) task,phone,note,confirm,reject,email,fax',
@ -221,41 +221,41 @@ function cat_id($cats)
$info_name_options = "<option value=\"\">none\n"; $info_name_options = "<option value=\"\">none\n";
foreach($info_names as $field => $name) foreach($info_names as $field => $name)
{ {
$info_name_options .= "<option value=\"$field\">".$GLOBALS['phpgw']->strip_html($name)."\n"; $info_name_options .= "<option value=\"$field\">".$GLOBALS['egw']->strip_html($name)."\n";
} }
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
$csv_fields = $GLOBALS['phpgw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 2';
$csv_fields[] = 'no CSV 3'; $csv_fields[] = 'no CSV 3';
foreach($csv_fields as $csv_idx => $csv_field) foreach($csv_fields as $csv_idx => $csv_field)
{ {
$GLOBALS['phpgw']->template->set_var('csv_field',$csv_field); $GLOBALS['egw']->template->set_var('csv_field',$csv_field);
$GLOBALS['phpgw']->template->set_var('csv_idx',$csv_idx); $GLOBALS['egw']->template->set_var('csv_idx',$csv_idx);
if ($def = $defaults[$csv_field]) if ($def = $defaults[$csv_field])
{ {
list( $info,$trans ) = explode($PSep,$def,2); list( $info,$trans ) = explode($PSep,$def,2);
$GLOBALS['phpgw']->template->set_var('trans',$trans); $GLOBALS['egw']->template->set_var('trans',$trans);
$GLOBALS['phpgw']->template->set_var('info_fields',str_replace('="'.$info.'">','="'.$info.'" selected>',$info_name_options)); $GLOBALS['egw']->template->set_var('info_fields',str_replace('="'.$info.'">','="'.$info.'" selected>',$info_name_options));
} }
else else
{ {
$GLOBALS['phpgw']->template->set_var('trans',''); $GLOBALS['egw']->template->set_var('trans','');
$GLOBALS['phpgw']->template->set_var('info_fields',$info_name_options); $GLOBALS['egw']->template->set_var('info_fields',$info_name_options);
} }
$GLOBALS['phpgw']->template->parse('rows','fields',True); $GLOBALS['egw']->template->parse('rows','fields',True);
} }
$GLOBALS['phpgw']->template->set_var('lang_start',lang('Startrecord')); $GLOBALS['egw']->template->set_var('lang_start',lang('Startrecord'));
$GLOBALS['phpgw']->template->set_var('start',get_var('start',array('POST'),1)); $GLOBALS['egw']->template->set_var('start',get_var('start',array('POST'),1));
$msg = ($safe_mode = ini_get('safe_mode') == 'On') ? lang('to many might exceed your execution-time-limit'): $msg = ($safe_mode = ini_get('safe_mode') == 'On') ? lang('to many might exceed your execution-time-limit'):
lang('empty for all'); lang('empty for all');
$GLOBALS['phpgw']->template->set_var('lang_max',lang('Number of records to read (%1)',$msg)); $GLOBALS['egw']->template->set_var('lang_max',lang('Number of records to read (%1)',$msg));
$GLOBALS['phpgw']->template->set_var('max',get_var('max',array('POST'),$safe_mode ? 200 : '')); $GLOBALS['egw']->template->set_var('max',get_var('max',array('POST'),$safe_mode ? 200 : ''));
$GLOBALS['phpgw']->template->set_var('debug',get_var('debug',array('POST'),True)?' checked':''); $GLOBALS['egw']->template->set_var('debug',get_var('debug',array('POST'),True)?' checked':'');
$GLOBALS['phpgw']->template->parse('rows','ffooter',True); $GLOBALS['egw']->template->parse('rows','ffooter',True);
fclose($fp); fclose($fp);
$hiddenvars = $GLOBALS['phpgw']->html->input_hidden(array( $hiddenvars = $GLOBALS['egw']->html->input_hidden(array(
'action' => 'import', 'action' => 'import',
'fieldsep'=> $_POST['fieldsep'], 'fieldsep'=> $_POST['fieldsep'],
'charset' => $_POST['charset'] 'charset' => $_POST['charset']
@ -292,7 +292,7 @@ function cat_id($cats)
"will be automaticaly added.<p>". "will be automaticaly added.<p>".
"I hope that helped to understand the features, if not <a href='mailto:RalfBecker@outdoor-training.de'>ask</a>."; "I hope that helped to understand the features, if not <a href='mailto:RalfBecker@outdoor-training.de'>ask</a>.";
$GLOBALS['phpgw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this $GLOBALS['egw']->template->set_var('help_on_trans',lang($help_on_trans)); // I don't think anyone will translate this
break; break;
case 'next': case 'next':
@ -300,7 +300,7 @@ function cat_id($cats)
$_POST['trans'] = unserialize(stripslashes($_POST['trans'])); $_POST['trans'] = unserialize(stripslashes($_POST['trans']));
// fall-through // fall-through
case 'import': case 'import':
$hiddenvars = $GLOBALS['phpgw']->html->input_hidden(array( $hiddenvars = $GLOBALS['egw']->html->input_hidden(array(
'action' => 'continue', 'action' => 'continue',
'fieldsep'=> $_POST['fieldsep'], 'fieldsep'=> $_POST['fieldsep'],
'charset' => $_POST['charset'], 'charset' => $_POST['charset'],
@ -313,7 +313,7 @@ function cat_id($cats)
@set_time_limit(0); @set_time_limit(0);
$fp=fopen($csvfile,'r'); $fp=fopen($csvfile,'r');
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']); $csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
$csv_fields = $GLOBALS['phpgw']->translation->convert($csv_fields,$_POST['charset']); $csv_fields = $GLOBALS['egw']->translation->convert($csv_fields,$_POST['charset']);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments $csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2'; $csv_fields[] = 'no CSV 2';
$csv_fields[] = 'no CSV 3'; $csv_fields[] = 'no CSV 3';
@ -330,9 +330,9 @@ function cat_id($cats)
} }
} }
$GLOBALS['phpgw']->preferences->read_repository(); $GLOBALS['egw']->preferences->read_repository();
$GLOBALS['phpgw']->preferences->add('infolog','cvs_import',$defaults); $GLOBALS['egw']->preferences->add('infolog','cvs_import',$defaults);
$GLOBALS['phpgw']->preferences->save_repository(True); $GLOBALS['egw']->preferences->save_repository(True);
$log = "<table border=1>\n\t<tr><td>#</td>\n"; $log = "<table border=1>\n\t<tr><td>#</td>\n";
@ -377,7 +377,7 @@ function cat_id($cats)
{ {
break; // EOF break; // EOF
} }
$fields = $GLOBALS['phpgw']->translation->convert($fields,$_POST['charset']); $fields = $GLOBALS['egw']->translation->convert($fields,$_POST['charset']);
$log .= "\t</tr><tr><td>".($start+$anz)."</td>\n"; $log .= "\t</tr><tr><td>".($start+$anz)."</td>\n";
@ -445,7 +445,7 @@ function cat_id($cats)
{ {
if (isset($values[$user]) && !is_numeric($user)) if (isset($values[$user]) && !is_numeric($user))
{ {
$values[$user] = $GLOBALS['phpgw']->accounts->name2id($values[$user]); $values[$user] = $GLOBALS['egw']->accounts->name2id($values[$user]);
} }
} }
if (!in_array('access',$info_fields)) if (!in_array('access',$info_fields))
@ -468,19 +468,19 @@ function cat_id($cats)
} }
$log .= "\t</tr>\n</table>\n"; $log .= "\t</tr>\n</table>\n";
$GLOBALS['phpgw']->template->set_var('anz_imported',($_POST['debug'] ? $GLOBALS['egw']->template->set_var('anz_imported',($_POST['debug'] ?
lang('%1 records read (not yet imported, you may go %2back%3 and uncheck Test Import)', lang('%1 records read (not yet imported, you may go %2back%3 and uncheck Test Import)',
$anz,'','') : $anz,'','') :
lang('%1 records imported',$anz)). '&nbsp;'. lang('%1 records imported',$anz)). '&nbsp;'.
(!$_POST['debug'] && $fields ? $GLOBALS['phpgw']->html->submit_button('next','Import next set') . '&nbsp;':''). (!$_POST['debug'] && $fields ? $GLOBALS['egw']->html->submit_button('next','Import next set') . '&nbsp;':'').
$GLOBALS['phpgw']->html->submit_button('continue','Back') . '&nbsp;'. $GLOBALS['egw']->html->submit_button('continue','Back') . '&nbsp;'.
$GLOBALS['phpgw']->html->submit_button('cancel','Cancel')); $GLOBALS['egw']->html->submit_button('cancel','Cancel'));
$GLOBALS['phpgw']->template->set_var('log',$log); $GLOBALS['egw']->template->set_var('log',$log);
$GLOBALS['phpgw']->template->parse('rows','imported'); $GLOBALS['egw']->template->parse('rows','imported');
break; break;
} }
$GLOBALS['phpgw']->template->set_var('hiddenvars',str_replace('{','&#x7B;',$hiddenvars)); $GLOBALS['egw']->template->set_var('hiddenvars',str_replace('{','&#x7B;',$hiddenvars));
$GLOBALS['phpgw']->template->pfp('phpgw_body','import'); $GLOBALS['egw']->template->pfp('phpgw_body','import');
$GLOBALS['phpgw']->common->phpgw_footer(); $GLOBALS['egw']->common->egw_footer();
?> ?>

View File

@ -12,6 +12,13 @@
/* $Id$ */ /* $Id$ */
/**
* Class containing admin, preferences and sidebox-menus (used as hooks)
*
* @package infolog
* @author RalfBecker-At-outdoor-training.de
* @copyright GPL - GNU General Public License
*/
class admin_prefs_sidebox_hooks class admin_prefs_sidebox_hooks
{ {
function all_hooks($args) function all_hooks($args)
@ -23,20 +30,20 @@ class admin_prefs_sidebox_hooks
if ($location == 'sidebox_menu') if ($location == 'sidebox_menu')
{ {
$file = array( $file = array(
'infolog list' => $GLOBALS['phpgw']->link('/index.php',array( 'infolog list' => $GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.index' )), 'menuaction' => 'infolog.uiinfolog.index' )),
'add' => $GLOBALS['phpgw']->link('/index.php',array( 'add' => $GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.edit' )) 'menuaction' => 'infolog.uiinfolog.edit' ))
); );
display_sidebox($appname,$GLOBALS['phpgw_info']['apps']['infolog']['title'].' '.lang('Menu'),$file); display_sidebox($appname,$GLOBALS['egw_info']['apps']['infolog']['title'].' '.lang('Menu'),$file);
} }
if ($GLOBALS['phpgw_info']['user']['apps']['preferences'] && $location != 'admin') if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin')
{ {
$file = array( $file = array(
'Preferences' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname='.$appname), 'Preferences' => $GLOBALS['egw']->link('/preferences/preferences.php','appname='.$appname),
'Grant Access' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname), 'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
'Edit Categories' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True') 'Edit Categories' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
); );
if ($location == 'preferences') if ($location == 'preferences')
{ {
@ -48,18 +55,18 @@ class admin_prefs_sidebox_hooks
} }
} }
if ($GLOBALS['phpgw_info']['user']['apps']['admin'] && $location != 'preferences') if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
{ {
$file = Array( $file = Array(
'Site configuration' => $GLOBALS['phpgw']->link('/index.php',array( 'Site configuration' => $GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.admin' )), 'menuaction' => 'infolog.uiinfolog.admin' )),
'Global Categories' => $GLOBALS['phpgw']->link('/index.php',array( 'Global Categories' => $GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'admin.uicategories.index', 'menuaction' => 'admin.uicategories.index',
'appname' => $appname, 'appname' => $appname,
'global_cats'=> True)), 'global_cats'=> True)),
'Custom fields, typ and status' => $GLOBALS['phpgw']->link('/index.php',array( 'Custom fields, typ and status' => $GLOBALS['egw']->link('/index.php',array(
'menuaction' => 'infolog.uicustomfields.edit')), 'menuaction' => 'infolog.uicustomfields.edit')),
'CSV-Import' => $GLOBALS['phpgw']->link('/infolog/csv_import.php') 'CSV-Import' => $GLOBALS['egw']->link('/infolog/csv_import.php')
); );
if ($location == 'admin') if ($location == 'admin')
{ {

View File

@ -13,6 +13,16 @@
/* $Id$ */ /* $Id$ */
include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.soinfolog.inc.php');
include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.bolink.inc.php');
/**
* This class is the BO-layer of InfoLog, it also handles xmlrpc requests
*
* @package infolog
* @author RalfBecker-At-outdoor-training.de
* @copyright GPL - GNU General Public License
*/
class boinfolog // BO: buiseness objects: internal logic class boinfolog // BO: buiseness objects: internal logic
{ {
var $enums; var $enums;
@ -88,10 +98,10 @@
'ongoing' => 'ongoing', 'done' => 'done' 'ongoing' => 'ongoing', 'done' => 'done'
)); ));
$this->so = CreateObject('infolog.soinfolog'); $this->so =& new soinfolog();
$this->link = CreateObject('infolog.bolink'); $this->link =& new bolink();
$this->config = CreateObject('phpgwapi.config'); $this->config =& CreateObject('phpgwapi.config');
$this->config->read_repository(); $this->config->read_repository();
$this->customfields = array(); $this->customfields = array();
@ -127,7 +137,7 @@
* @var int $tz_offset_s offset in secconds between user and server-time, * @var int $tz_offset_s offset in secconds between user and server-time,
* it need to be add to a server-time to get the user-time or substracted from a user-time to get the server-time * it need to be add to a server-time to get the user-time or substracted from a user-time to get the server-time
*/ */
$this->tz_offset = $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']; $this->tz_offset = $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'];
$this->tz_offset_s = 60*60*$this->tz_offset; $this->tz_offset_s = 60*60*$this->tz_offset;
$this->user_time_now = time() + $this->tz_offset_s; $this->user_time_now = time() + $this->tz_offset_s;
@ -144,9 +154,11 @@
} }
} }
/*! /**
@function has_customfields * checks if there are customfields for typ $typ
@abstract checks if there are customfields for typ $typ *
* @param string $typ
* @return boolean True if there are customfields for $typ, else False
*/ */
function has_customfields($typ) function has_customfields($typ)
{ {
@ -160,19 +172,34 @@
return False; return False;
} }
/* /**
* check's if user has the requiered rights on entry $info_id * check's if user has the requiered rights on entry $info_id
*
* @param int $info_id id of infolog entry to check
* @param int $required_rights EGW_ACL_{READ|EDIT|ADD|DELETE}
* @return boolean
*/ */
function check_access( $info_id,$required_rights ) function check_access( $info_id,$required_rights )
{ {
return $this->so->check_access( $info_id,$required_rights ); return $this->so->check_access( $info_id,$required_rights );
} }
/**
* init internal data to be empty
*/
function init() function init()
{ {
$this->so->init(); $this->so->init();
} }
/**
* convert a link_id value into an info_from text
*
* @param array &$info infolog entry, key info_from gets set by this function
* @param string $not_app='' app to exclude
* @param string $not_id='' id to exclude
* @return boolean True if we have a linked item, False otherwise
*/
function link_id2from(&$info,$not_app='',$not_id='') function link_id2from(&$info,$not_app='',$not_id='')
{ {
//echo "<p>boinfolog::link_id2from(subject='$info[info_subject]', link_id='$info[info_link_id], from='$info[info_from]', not_app='$not_app', not_id='$not_id')"; //echo "<p>boinfolog::link_id2from(subject='$info[info_subject]', link_id='$info[info_link_id], from='$info[info_from]', not_app='$not_app', not_id='$not_id')";
@ -204,11 +231,20 @@
return False; return False;
} }
/**
* Create a subject from a description: truncate it and add ' ...'
*/
function subject_from_des($des) function subject_from_des($des)
{ {
return substr($des,0,60).' ...'; return substr($des,0,60).' ...';
} }
/**
* Read an infolog entry specified by $info_id
*
* @param int/array $info_id integer id or array with key 'info_id' of the entry to read
* @return array/boolean infolog entry or False if not found or no permission to read it
*/
function &read($info_id) function &read($info_id)
{ {
if (is_array($info_id)) if (is_array($info_id))
@ -224,7 +260,7 @@
} }
return False; return False;
} }
if (!$this->check_access($info_id,PHPGW_ACL_READ)) // check behind read, to prevent a double read if (!$this->check_access($info_id,EGW_ACL_READ)) // check behind read, to prevent a double read
{ {
if ($this->xmlrpc) if ($this->xmlrpc)
{ {
@ -252,6 +288,14 @@
return $data; return $data;
} }
/**
* Delete an infolog entry, evtl. incl. it's children / subs
*
* @param int/array $info_id int id or array with keys 'info_id', 'delete_children' and 'new_parent' setting all 3 params
* @param boolean $delete_children should the children be deleted
* @param int/boolean $new_parent parent to use for not deleted children if > 0
* @return boolean True if delete was successful, False otherwise ($info_id does not exist or no rights)
*/
function delete($info_id,$delete_children=False,$new_parent=False) function delete($info_id,$delete_children=False,$new_parent=False)
{ {
if (is_array($info_id)) if (is_array($info_id))
@ -268,7 +312,7 @@
} }
return False; return False;
} }
if (!$this->check_access($info_id,PHPGW_ACL_DELETE)) if (!$this->check_access($info_id,EGW_ACL_DELETE))
{ {
if ($this->xmlrpc) if ($this->xmlrpc)
{ {
@ -283,7 +327,9 @@
$this->so->delete($info_id,$delete_children,$new_parent); $this->so->delete($info_id,$delete_children,$new_parent);
$GLOBALS['phpgw']->contenthistory->updateTimeStamp('infolog_'.$info['info_type'], $info_id, 'delete', time()); $GLOBALS['egw']->contenthistory->updateTimeStamp('infolog_'.$info['info_type'], $info_id, 'delete', time());
return True;
} }
/** /**
@ -316,10 +362,10 @@
} }
} }
$status_only = $values['info_id'] && $values['info_responsible'] == $this->user && $status_only = $values['info_id'] && $values['info_responsible'] == $this->user &&
!$this->check_access($values['info_id'],PHPGW_ACL_EDIT); // responsible has implicit right to change status !$this->check_access($values['info_id'],EGW_ACL_EDIT); // responsible has implicit right to change status
if ($values['info_id'] && !$this->check_access($values['info_id'],PHPGW_ACL_EDIT) && !$status_only || if ($values['info_id'] && !$this->check_access($values['info_id'],EGW_ACL_EDIT) && !$status_only ||
!$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],PHPGW_ACL_ADD)) !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],EGW_ACL_ADD))
{ {
if ($this->xmlrpc) if ($this->xmlrpc)
{ {
@ -388,7 +434,7 @@
if($values['info_id']) if($values['info_id'])
{ {
// update // update
$GLOBALS['phpgw']->contenthistory->updateTimeStamp( $GLOBALS['egw']->contenthistory->updateTimeStamp(
'infolog_'.$values['info_type'], 'infolog_'.$values['info_type'],
$infoID, 'modify', time() $infoID, 'modify', time()
); );
@ -396,7 +442,7 @@
else else
{ {
// add // add
$GLOBALS['phpgw']->contenthistory->updateTimeStamp( $GLOBALS['egw']->contenthistory->updateTimeStamp(
'infolog_'.$values['info_type'], 'infolog_'.$values['info_type'],
$infoID, 'add', time() $infoID, 'add', time()
); );
@ -406,24 +452,29 @@
return $infoID; return $infoID;
} }
/**
* Query the number of children / subs
*
* @param int $info_id id
* @return int number of subs
*/
function anzSubs( $info_id ) function anzSubs( $info_id )
{ {
return $this->so->anzSubs( $info_id ); return $this->so->anzSubs( $info_id );
} }
/*! /**
@function search * searches InfoLog for a certain pattern in $query
@abstract searches InfoLog for a certain pattern in $query *
@syntax search( $query ) * @param $query[order] column-name to sort after
@param $query[order] column-name to sort after * @param $query[sort] sort-order DESC or ASC
@param $query[sort] sort-order DESC or ASC * @param $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or ''
@param $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or '' * @param $query[cat_id] category to use or 0 or unset
@param $query[cat_id] category to use or 0 or unset * @param $query[search] pattern to search, search is done in info_from, info_subject and info_des
@param $query[search] pattern to search, search is done in info_from, info_subject and info_des * @param $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used
@param $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used * @param &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries
@param &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries * @param $query[col_filter] array with column-name - data pairs, data == '' means no filter (!)
@param $query[col_filter] array with column-name - data pairs, data == '' means no filter (!) * @return array with id's as key of the matching log-entries
@returns array with id's as key of the matching log-entries
*/ */
function &search(&$query) function &search(&$query)
{ {
@ -454,11 +505,13 @@
return $ret; return $ret;
} }
/*! /**
@function link_title * get title for an infolog entry identified by $info
@syntax link_title( $id ) *
@author ralfbecker * Is called as hook to participate in the linking
@abstract get title for an infolog entry identified by $id *
* @param int/array $info int info_id or array with infolog entry
* @param string the title
*/ */
function link_title( $info ) function link_title( $info )
{ {
@ -474,11 +527,13 @@
$this->subject_from_des($info['info_descr']); $this->subject_from_des($info['info_descr']);
} }
/*! /**
@function link_query * query infolog for entries matching $pattern
@syntax link_query( $pattern ) *
@author ralfbecker * Is called as hook to participate in the linking
@abstract query infolog for entries matching $pattern *
* @param string $pattern pattern to search
* @return array with info_id - title pairs of the matching entries
*/ */
function link_query( $pattern ) function link_query( $pattern )
{ {
@ -499,15 +554,13 @@
return $content; return $content;
} }
/*! /**
@function cal_to_include * hook called be calendar to include events or todos in the cal-dayview
@syntax cal_to_include( $args ) *
@author ralfbecker * @param int $args[year], $args[month], $args[day] date of the events
@abstract hook called be calendar to include events or todos in the cal-dayview * @param int $args[owner] owner of the events
@param $args[year], $args[month], $args[day] date of the events * @param string $args[location] calendar_include_{events|todos}
@param $args[owner] owner of the events * @return array of events (array with keys starttime, endtime, title, view, icon, content)
@param $args[location] calendar_include_{events|todos}
@returns array of events (array with keys starttime, endtime, title, view, icon, content)
*/ */
function cal_to_include($args) function cal_to_include($args)
{ {
@ -517,11 +570,11 @@
{ {
return False; return False;
} }
if (!is_object($GLOBALS['phpgw']->html)) if (!is_object($GLOBALS['egw']->html))
{ {
$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html'); $GLOBALS['egw']->html =& CreateObject('phpgwapi.html');
} }
$GLOBALS['phpgw']->translation->add_app('infolog'); $GLOBALS['egw']->translation->add_app('infolog');
$do_events = $args['location'] == 'calendar_include_events'; $do_events = $args['location'] == 'calendar_include_events';
$to_include = array(); $to_include = array();
@ -543,7 +596,7 @@
{ {
continue; continue;
} }
$title = ($do_events?$GLOBALS['phpgw']->common->formattime(adodb_date('H',$info['info_startdate']),adodb_date('i',$info['info_startdate'])).' ':''). $title = ($do_events?$GLOBALS['egw']->common->formattime(adodb_date('H',$info['info_startdate']),adodb_date('i',$info['info_startdate'])).' ':'').
$info['info_subject']; $info['info_subject'];
$view = $this->link->view('infolog',$info['info_id']); $view = $this->link->view('infolog',$info['info_id']);
$content=array(); $content=array();
@ -552,10 +605,10 @@
$info['info_status'] => 'infolog' $info['info_status'] => 'infolog'
) as $name => $app) ) as $name => $app)
{ {
$content[] = $GLOBALS['phpgw']->html->image($app,$name,lang($name),'border="0" width="15" height="15"').' '; $content[] = $GLOBALS['egw']->html->image($app,$name,lang($name),'border="0" width="15" height="15"').' ';
} }
$content[] = $GLOBALS['phpgw']->html->a_href($title,$view); $content[] = $GLOBALS['egw']->html->a_href($title,$view);
$content = $GLOBALS['phpgw']->html->table(array(1 => $content)); $content = $GLOBALS['egw']->html->table(array(1 => $content));
$to_include[] = array( $to_include[] = array(
'starttime' => $info['info_startdate'], 'starttime' => $info['info_startdate'],
@ -575,14 +628,16 @@
return $to_include; return $to_include;
} }
/**
* 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.
*
* @param string $_type='xmlrpc' xmlrpc or soap
* @return array
*/
function list_methods($_type='xmlrpc') 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)) if (is_array($_type))
{ {
$_type = $_type['type'] ? $_type['type'] : $_type[0]; $_type = $_type['type'] ? $_type['type'] : $_type[0];
@ -634,6 +689,12 @@
} }
} }
/**
* Convert an InfoLog entry into its xmlrpc representation, eg. convert timestamps to datetime.iso8601
*
* @param array $data infolog entry
* @param array xmlrpc infolog entry
*/
function data2xmlrpc($data) function data2xmlrpc($data)
{ {
$data['rights'] = $this->so->grants[$data['info_owner']]; $data['rights'] = $this->so->grants[$data['info_owner']];
@ -662,6 +723,12 @@
return $data; return $data;
} }
/**
* Convert an InfoLog xmlrpc representation into the internal one, eg. convert datetime.iso8601 to timestamps
*
* @param array $data infolog entry
* @param array xmlrpc infolog entry
*/
function xmlrpc2data($data) function xmlrpc2data($data)
{ {
foreach($data as $name => $val) foreach($data as $name => $val)
@ -689,7 +756,12 @@
return $data; return $data;
} }
// return array with all infolog categories (for xmlrpc) /**
* return array with all infolog categories (for xmlrpc)
*
* @param boolean $complete true returns array with all data for each cat, else only the title is returned
* @return array with cat_id / title or data pairs (see above)
*/
function categories($complete = False) function categories($complete = False)
{ {
return $this->xmlrpc ? $GLOBALS['server']->categories($complete) : False; return $this->xmlrpc ? $GLOBALS['server']->categories($complete) : False;

View File

@ -12,25 +12,28 @@
/* $Id$ */ /* $Id$ */
include_once(PHPGW_INCLUDE_ROOT . '/infolog/inc/class.solink.inc.php'); include_once(EGW_INCLUDE_ROOT . '/infolog/inc/class.solink.inc.php');
$GLOBALS['phpgw_info']['flags']['included_classes']['bolink'] = True; /**
* generalized linking between entries of eGroupware apps - BO layer
/*! *
@class bolink * This class is the BO-layer of the links
@author ralfbecker *
@copyright GPL - GNU General Public License * Links have two ends each pointing to an entry, each entry is a double:
@abstract generalized linking between entries of eGroupware apps - BO layer * - app app-name or directory-name of an egw application, eg. 'infolog'
@discussion This class is the BO-layer of the links<br> * - id this is the id, eg. an integer or a tupple like '0:INBOX:1234'
Links have two ends each pointing to an entry, each entry is a double:<br> *
app app-name or directory-name of an egw application, eg. 'infolog'<br> * The BO-layer implementes 2 extra features on top of the so-layer:
id this is the id, eg. an integer or a tupple like '0:INBOX:1234'<br> * 1) It handles links to not already existing entries. This is used by the eTemplate link-widget, which allows to
The BO-layer implementes 2 extra features on top of the so-layer:<br> * setup links even for new / not already existing entries, before they get saved.
1) It handles links to not already existing entries. This is used by the eTemplate link-widget, which allows to * In that case you have to set the first id to 0 for the link-function and pass the array returned in that id
setup links even for new / not already existing entries, before they get saved. * (not the return-value) after saveing your new entry again to the link function.
In that case you have to set the first id to 0 for the link-function and pass the array returned in that id * 2) Attaching files: they are saved in the vfs and not the link-table (!).
(not the return-value) after saveing your new entry again to the link function.<br> *
2) Attaching files: they are saved in the vfs and not the link-table (!). * @package infolog
* @subpackage link
* @author RalfBecker-At-outdoor-training.de
* @copyright GPL - GNU General Public License
*/ */
class bolink extends solink class bolink extends solink
{ {
@ -86,11 +89,10 @@
var $valid_pathes = array(); var $valid_pathes = array();
var $send_file_ips = array(); var $send_file_ips = array();
/*! /**
@function bolink * @author ralfbecker
@syntax bolink( ) * constructor
@author ralfbecker *
@abstract constructor
*/ */
function bolink( ) function bolink( )
{ {
@ -101,10 +103,10 @@
'view' => True, 'view' => True,
'get_file' => True 'get_file' => True
); );
//$this->vfs = CreateObject('infolog.vfs'); //$this->vfs =& CreateObject('infolog.vfs');
$this->vfs = CreateObject('phpgwapi.vfs'); $this->vfs =& CreateObject('phpgwapi.vfs');
$config = CreateObject('phpgwapi.config'); $config =& CreateObject('phpgwapi.config');
$config->read_repository(); $config->read_repository();
if (is_array($config->config_data)) if (is_array($config->config_data))
{ {
@ -116,7 +118,7 @@
// other apps can participate in the linking by implementing a search_link hook, which // other apps can participate in the linking by implementing a search_link hook, which
// has to return an array in the format of an app_register entry // has to return an array in the format of an app_register entry
// //
$search_link_hooks = $GLOBALS['phpgw']->hooks->process('search_link'); $search_link_hooks = $GLOBALS['egw']->hooks->process('search_link');
if (is_array($search_link_hooks)) if (is_array($search_link_hooks))
{ {
foreach($search_link_hooks as $app => $data) foreach($search_link_hooks as $app => $data)
@ -129,28 +131,27 @@
} }
} }
/*! /**
@function link * @author ralfbecker
@syntax link( $app1,&$id1,$app2,$id2='',$remark='',$user=0 ) * creats a link between $app1,$id1 and $app2,$id2 - $id1 does NOT need to exist yet
@author ralfbecker *
@abstract creats a link between $app1,$id1 and $app2,$id2 - $id1 does NOT need to exist yet * @param $app1 app of $id1
@param $app1 app of $id1 * @param $id1 id of item to linkto or 0 if item not yet created or array with links
@param $id1 id of item to linkto or 0 if item not yet created or array with links * of not created item or $file-array if $app1 == $this->vfs_appname (see below).
of not created item or $file-array if $app1 == $this->vfs_appname (see below). * If $id==0 it will be set on return to an array with the links for the new item.
If $id==0 it will be set on return to an array with the links for the new item. * @param $app2 app of 2.linkend or array with links ($id2 not used)
@param $app2 app of 2.linkend or array with links ($id2 not used) * @param $id2 id of 2. item of $file-array if $app2 == $this->vfs_appname (see below)<br>
@param $id2 id of 2. item of $file-array if $app2 == $this->vfs_appname (see below)<br> * $file array with informations about the file in format of the etemplate file-type<br>
$file array with informations about the file in format of the etemplate file-type<br> * $file['name'] name of the file (no directory)<br>
$file['name'] name of the file (no directory)<br> * $file['type'] mine-type of the file<br>
$file['type'] mine-type of the file<br> * $file['tmp_name'] name of the uploaded file (incl. directory)<br>
$file['tmp_name'] name of the uploaded file (incl. directory)<br> * $file['path'] path of the file on the client computer<br>
$file['path'] path of the file on the client computer<br> * $file['ip'] of the client (path and ip in $file are only needed if u want a symlink (if possible))
$file['ip'] of the client (path and ip in $file are only needed if u want a symlink (if possible)) * @param $remark Remark to be saved with the link (defaults to '')
@param $remark Remark to be saved with the link (defaults to '') * @param $owner Owner of the link (defaults to user)
@param $owner Owner of the link (defaults to user) * Does NOT check if link already exists.<br>
@discussion Does NOT check if link already exists.<br> * File-attachments return a negative link-id !!!
File-attachments return a negative link-id !!! * @return False (for db or param-error) or on success link_id (Please not the return-value of $id1)
@result False (for db or param-error) or on success link_id (Please not the return-value of $id1)
*/ */
function link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0 ) function link( $app1,&$id1,$app2,$id2='',$remark='',$owner=0,$lastmod=0 )
{ {
@ -217,15 +218,14 @@
return solink::link($app1,$id1,$app2,$id2,$remark,$owner); return solink::link($app1,$id1,$app2,$id2,$remark,$owner);
} }
/*! /**
@function get_links * @author ralfbecker
@syntax get_links( $app,$id,$only_app='',$only_name='',$order='link_lastmod DESC' ) * returns array of links to $app,$id (reimplemented to deal with not yet created items)
@author ralfbecker *
@abstract returns array of links to $app,$id (reimplemented to deal with not yet created items) * @param $id id of entry in $app or array of links if entry not yet created
@param $id id of entry in $app or array of links if entry not yet created * @param $only_app if set return only links from $only_app (eg. only addressbook-entries) or NOT from if $only_app[0]=='!'
@param $only_app if set return only links from $only_app (eg. only addressbook-entries) or NOT from if $only_app[0]=='!' * @param $order defaults to newest links first
@param $order defaults to newest links first * @return array of links or empty array if no matching links found
@result array of links or empty array if no matching links found
*/ */
function get_links( $app,$id,$only_app='',$order='link_lastmod DESC' ) function get_links( $app,$id,$only_app='',$order='link_lastmod DESC' )
{ {
@ -269,15 +269,14 @@
return $ids; return $ids;
} }
/*! /**
@function get_link * @author ralfbecker
@syntax get_link( $app_link_id,$id='',$app2='',$id2='' ) * returns data of a link
@author ralfbecker *
@abstract returns data of a link * @param $app_link_id > 0 link_id of link or app-name of link
@param $app_link_id > 0 link_id of link or app-name of link * @param $id,$app2,$id2 other param of the link if not link_id given
@param $id,$app2,$id2 other param of the link if not link_id given * @return array with link-data or False
@result array with link-data or False * If $id is an array (links not yet created) only link_ids are allowed.
@discussion If $id is an array (links not yet created) only link_ids are allowed.
*/ */
function get_link($app_link_id,$id='',$app2='',$id2='') function get_link($app_link_id,$id='',$app2='',$id2='')
{ {
@ -304,16 +303,15 @@
return solink::get_link($app_link_id,$id,$app2,$id2); return solink::get_link($app_link_id,$id,$app2,$id2);
} }
/*! /**
@function unlink * @author ralfbecker
@syntax unlink( $link_id,$app='',$id='',$owner='',$app2='',$id2='' ) * Remove link with $link_id or all links matching given $app,$id
@author ralfbecker *
@abstract Remove link with $link_id or all links matching given $app,$id * @param $link_id link-id to remove if > 0
@param $link_id link-id to remove if > 0 * @param $app,$id,$owner,$app2,$id2 if $link_id <= 0: removes all links matching the non-empty params
@param $app,$id,$owner,$app2,$id2 if $link_id <= 0: removes all links matching the non-empty params * Note: if $link_id != '' and $id is an array: unlink removes links from that array only
@discussion Note: if $link_id != '' and $id is an array: unlink removes links from that array only * unlink has to be called with &$id to see the result (depricated) or unlink2 has to be used !!!
unlink has to be called with &$id to see the result (depricated) or unlink2 has to be used !!! * @return the number of links deleted
@result the number of links deleted
*/ */
function unlink($link_id,$app='',$id='',$owner='',$app2='',$id2='') function unlink($link_id,$app='',$id='',$owner='',$app2='',$id2='')
{ {
@ -355,12 +353,11 @@
return False; return False;
} }
/*! /**
@function app_list * @author ralfbecker
@syntax app_list( ) * get list/array of link-aware apps the user has rights to use
@author ralfbecker *
@abstract get list/array of link-aware apps the user has rights to use * @return array( $app => lang($app), ... )
@result array( $app => lang($app), ... )
*/ */
function app_list( ) function app_list( )
{ {
@ -368,20 +365,19 @@
$apps = array(); $apps = array();
while (list($app,$reg) = each($this->app_register)) while (list($app,$reg) = each($this->app_register))
{ {
if ($GLOBALS['phpgw_info']['user']['apps'][$app]) if ($GLOBALS['egw_info']['user']['apps'][$app])
{ {
$apps[$app] = $GLOBALS['phpgw_info']['apps'][$app]['title']; $apps[$app] = $GLOBALS['egw_info']['apps'][$app]['title'];
} }
} }
return $apps; return $apps;
} }
/*! /**
@function query * @author ralfbecker
@syntax query( $app,$pattern ) * Searches for a $pattern in the entries of $app
@author ralfbecker *
@abstract Searches for a $pattern in the entries of $app * @return an array of $id => $title pairs
@result an array of $id => $title pairs
*/ */
function query($app,$pattern) function query($app,$pattern)
{ {
@ -398,12 +394,11 @@
return strchr($method,'.') ? ExecMethod($method,$pattern) : $this->$method($pattern); return strchr($method,'.') ? ExecMethod($method,$pattern) : $this->$method($pattern);
} }
/*! /**
@function title * @author ralfbecker
@syntax title( $app,$id ) * returns the title (short description) of entry $id and $app
@author ralfbecker *
@abstract returns the title (short description) of entry $id and $app * @return the title or false if $id does not exist in $app
@result the title or false if $id does not exist in $app
*/ */
function title($app,$id,$link='') function title($app,$id,$link='')
{ {
@ -452,12 +447,11 @@
return $title; return $title;
} }
/*! /**
@function view * @author ralfbecker
@syntax view( $app,$id ) * view entry $id of $app
@author ralfbecker *
@abstract view entry $id of $app * @return array with name-value pairs for link to view-methode of $app to view $id
@result array with name-value pairs for link to view-methode of $app to view $id
*/ */
function view($app,$id,$link='') function view($app,$id,$link='')
{ {
@ -502,11 +496,11 @@
$id = get_var('id','GET'); $id = get_var('id','GET');
$filename = get_var('filename','GET'); $filename = get_var('filename','GET');
if (empty($app) || empty($id) || empty($filename) /* || !$this->bo->check_access($info_id,PHPGW_ACL_READ)*/) if (empty($app) || empty($id) || empty($filename) /* || !$this->bo->check_access($info_id,EGW_ACL_READ)*/)
{ {
$GLOBALS['phpgw']->redirect_link('/'); $GLOBALS['egw']->redirect_link('/');
} }
$browser = CreateObject('phpgwapi.browser'); $browser =& CreateObject('phpgwapi.browser');
$local = $this->attached_local($app,$id,$filename, $local = $this->attached_local($app,$id,$filename,
get_var('REMOTE_ADDR',Array('SERVER')),$browser->is_windows()); get_var('REMOTE_ADDR',Array('SERVER')),$browser->is_windows());
@ -521,15 +515,14 @@
$browser->content_header($filename,$info['type']); $browser->content_header($filename,$info['type']);
echo $this->read_attached($app,$id,$filename); echo $this->read_attached($app,$id,$filename);
} }
$GLOBALS['phpgw']->common->phpgw_exit(); $GLOBALS['egw']->common->egw_exit();
} }
/*! /**
@function vfs_path * path to the attached files of $app/$ip
@syntax vfs_path ( $app,$id,$file='' ) *
@abstract path to the attached files of $app/$ip * All link-files are based in the vfs-subdir 'infolog'. For other apps
@discussion All link-files are based in the vfs-subdir 'infolog'. For other apps * separate subdirs with name app are created.
@discussion separate subdirs with name app are created.
*/ */
function vfs_path($app,$id='',$file='',$relatives=False) function vfs_path($app,$id='',$file='',$relatives=False)
{ {
@ -546,19 +539,18 @@
) : $path; ) : $path;
} }
/*! /**
@function attach_file * Put a file to the corrosponding place in the VFS and set the attributes
@syntax attach_file ( $app,$id,$file,$comment='' ) *
@abstract Put a file to the corrosponding place in the VFS and set the attributes * @param $app/$id entry which should the file should be linked with
@param $app/$id entry which should the file should be linked with * @param $file array with informations about the file in format of the etemplate file-type
@param $file array with informations about the file in format of the etemplate file-type * $file['name'] name of the file (no directory)
$file['name'] name of the file (no directory) * $file['type'] mine-type of the file
$file['type'] mine-type of the file * $file['tmp_name'] name of the uploaded file (incl. directory)
$file['tmp_name'] name of the uploaded file (incl. directory) * $file['path'] path of the file on the client computer
$file['path'] path of the file on the client computer * $file['ip'] of the client (path and ip are only needed if u want a symlink (if possible))
$file['ip'] of the client (path and ip are only needed if u want a symlink (if possible)) * @param $comment
@param $comment * @return int negative id of phpgw_vfs table as negative link-id's are for vfs attachments
@return int negative id of phpgw_vfs table as negative link-id's are for vfs attachments
*/ */
function attach_file($app,$id,$file,$comment='') function attach_file($app,$id,$file,$comment='')
{ {
@ -636,13 +628,12 @@
return is_array($link) ? $link['link_id'] : False; return is_array($link) ? $link['link_id'] : False;
} }
/*! /**
@function delete_attached * @author ralfbecker
@syntax delete_attached( $app,$id,$filename ) * deletes an attached file
@author ralfbecker *
@abstract deletes an attached file * @param $app > 0: file_id of an attchemnt or $app/$id entry which linked to
@param $app > 0: file_id of an attchemnt or $app/$id entry which linked to * @param $filename
@param $filename
*/ */
function delete_attached($app,$id='',$fname = '') function delete_attached($app,$id='',$fname = '')
{ {
@ -680,14 +671,13 @@
return $Ok; return $Ok;
} }
/*! /**
@function info_attached * @author ralfbecker
@syntax info_attached( $app,$id,$filename ) * converts the infos vfs has about a file into a link
@author ralfbecker *
@abstract converts the infos vfs has about a file into a link * @param $app/$id entry which linked to
@param $app/$id entry which linked to * @param $filename
@param $filename * a 'kind' of link-array
@returns a 'kind' of link-array
*/ */
function info_attached($app,$id,$filename) function info_attached($app,$id,$filename)
{ {
@ -702,14 +692,13 @@
return $this->fileinfo2link($attachments[0]); return $this->fileinfo2link($attachments[0]);
} }
/*! /**
@function fileinfo2link * @author ralfbecker
@syntax fileinfo2link( $fileinfo ) * converts a fileinfo (row in the vfs-db-table) in a link
@author ralfbecker *
@abstract converts a fileinfo (row in the vfs-db-table) in a link * @param $fileinfo a row from the vfs-db-table (eg. returned by the vfs ls function)
@param $fileinfo a row from the vfs-db-table (eg. returned by the vfs ls function) * or a file_id of that table
or a file_id of that table * a 'kind' of link-array
@returns a 'kind' of link-array
*/ */
function fileinfo2link($fileinfo) function fileinfo2link($fileinfo)
{ {
@ -743,12 +732,11 @@
); );
} }
/*! /**
@function list_attached * @author ralfbecker
@syntax list_attached( $app,$id ) * lists all attachments to $app/$id
@author ralfbecker *
@abstract lists all attachments to $app/$id * a 'kind' of link-array
@returns a 'kind' of link-array
*/ */
function list_attached($app,$id) function list_attached($app,$id)
{ {
@ -768,26 +756,24 @@
return $attached; return $attached;
} }
/*! /**
@function is_win_path * @author ralfbecker
@syntax is_win_path( $path ) * checks if path starts with a '\\' or has a ':' in it
@author ralfbecker *
@abstract checks if path starts with a '\\' or has a ':' in it
*/ */
function is_win_path($path) function is_win_path($path)
{ {
return $path[0] == '\\' || strstr($path,':'); return $path[0] == '\\' || strstr($path,':');
} }
/*! /**
@function read_attached * @author ralfbecker
@syntax read_attached($app,$id,$filename) * reads the attached file and returns the content
@author ralfbecker *
@abstract reads the attached file and returns the content
*/ */
function read_attached($app,$id,$filename) function read_attached($app,$id,$filename)
{ {
if (empty($app) || !$id || empty($filename) /*|| !$this->check_access($info_id,PHPGW_ACL_READ)*/) if (empty($app) || !$id || empty($filename) /*|| !$this->check_access($info_id,EGW_ACL_READ)*/)
{ {
return False; return False;
} }
@ -797,18 +783,18 @@
return $data; return $data;
} }
/*! /**
@function attached_local * @author ralfbecker
@syntax attached_local($app,$id,$filename,$ip,$win_user) * Checks if filename should be local availible and if so returns
@author ralfbecker *
@abstract Checks if filename should be local availible and if so returns * 'file:/path' for HTTP-redirect else return False
@abstract 'file:/path' for HTTP-redirect else return False *
*/ */
function attached_local($app,$id,$filename,$ip,$win_user) function attached_local($app,$id,$filename,$ip,$win_user)
{ {
//echo "<p>attached_local(app=$app, id='$id', filename='$filename', ip='$ip', win_user='$win_user', count(send_file_ips)=".count($this->send_file_ips).")</p>\n"; //echo "<p>attached_local(app=$app, id='$id', filename='$filename', ip='$ip', win_user='$win_user', count(send_file_ips)=".count($this->send_file_ips).")</p>\n";
if (!$id || !$filename || /* !$this->check_access($info_id,PHPGW_ACL_READ) || */ if (!$id || !$filename || /* !$this->check_access($info_id,EGW_ACL_READ) || */
!count($this->send_file_ips)) !count($this->send_file_ips))
{ {
return False; return False;
@ -836,22 +822,20 @@
return False; return False;
} }
/*! /**
@function decode_htmlspecialchars * @author ralfbecker
@syntax decode_htmlspecialchars( $str ) * reverse function of htmlspecialchars()
@author ralfbecker *
@abstract reverse function of htmlspecialchars()
*/ */
function decode_htmlspecialchars($str) function decode_htmlspecialchars($str)
{ {
return str_replace(array('&amp;','&quot;','&lt;','&gt;'),array('&','"','<','>'),$str); return str_replace(array('&amp;','&quot;','&lt;','&gt;'),array('&','"','<','>'),$str);
} }
/*! /**
@function calendar_title * @author ralfbecker
@syntax calendar_title( $id ) * get title for an event, should be moved to bocalendar.link_title
@author ralfbecker *
@abstract get title for an event, should be moved to bocalendar.link_title
*/ */
function calendar_title( $event ) function calendar_title( $event )
{ {
@ -867,20 +851,19 @@
{ {
return False; return False;
} }
$format = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] . ' '. $format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'] . ' '.
($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12' ? 'h:i a' : 'H:i'); ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12' ? 'h:i a' : 'H:i');
$name = $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset,$format); $name = $GLOBALS['egw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset,$format);
$name .= ': ' . $this->decode_htmlspecialchars($event['title']); // cal returns entities $name .= ': ' . $this->decode_htmlspecialchars($event['title']); // cal returns entities
return $name; return $name;
} }
/*! /**
@function calendar_query * @author ralfbecker
@syntax calendar_query( $pattern ) * query calendar for an event $matching pattern, should be moved to bocalendar.link_query
@author ralfbecker *
@abstract query calendar for an event $matching pattern, should be moved to bocalendar.link_query
*/ */
function calendar_query($pattern) function calendar_query($pattern)
{ {
@ -895,7 +878,7 @@
foreach($event_ids as $id) foreach($event_ids as $id)
{ {
// only include it in the list, if we have permissions to read it // only include it in the list, if we have permissions to read it
if ($this->bocal->check_perms(PHPGW_ACL_READ,$id)) if ($this->bocal->check_perms(EGW_ACL_READ,$id))
{ {
$content[$id] = $this->calendar_title( $id ); $content[$id] = $this->calendar_title( $id );
} }
@ -904,11 +887,10 @@
return $content; return $content;
} }
/*! /**
@function addressbook_title * @author ralfbecker
@syntax addressbook_title( $id ) * get title for an address, should be moved to boaddressbook.link_title
@author ralfbecker *
@abstract get title for an address, should be moved to boaddressbook.link_title
*/ */
function addressbook_title( $addr ) function addressbook_title( $addr )
{ {
@ -943,11 +925,10 @@
return stripslashes($name); // addressbook returns quotes with slashes return stripslashes($name); // addressbook returns quotes with slashes
} }
/*! /**
@function addressbook_query * @author ralfbecker
@syntax addressbook_query( $pattern ) * query addressbook for $pattern, should be moved to boaddressbook.link_query
@author ralfbecker *
@abstract query addressbook for $pattern, should be moved to boaddressbook.link_query
*/ */
function addressbook_query( $pattern ) function addressbook_query( $pattern )
{ {
@ -964,17 +945,16 @@
return $content; return $content;
} }
/*! /**
@function projects_title * @author ralfbecker
@syntax projects_title( $id ) * get title for a project, should be moved to boprojects.link_title
@author ralfbecker *
@abstract get title for a project, should be moved to boprojects.link_title
*/ */
function projects_title( $proj ) function projects_title( $proj )
{ {
if (!is_object($this->boprojects)) if (!is_object($this->boprojects))
{ {
if (!file_exists(PHPGW_SERVER_ROOT.'/projects')) // check if projects installed if (!file_exists(EGW_SERVER_ROOT.'/projects')) // check if projects installed
return ''; return '';
$this->boprojects = createobject('projects.boprojects'); $this->boprojects = createobject('projects.boprojects');
} }
@ -985,17 +965,16 @@
return is_array($proj) ? $proj['title'] : False; return is_array($proj) ? $proj['title'] : False;
} }
/*! /**
@function projects_query * @author ralfbecker
@syntax projects_query( $pattern ) * query for projects matching $pattern, should be moved to boprojects.link_query
@author ralfbecker *
@abstract query for projects matching $pattern, should be moved to boprojects.link_query
*/ */
function projects_query( $pattern ) function projects_query( $pattern )
{ {
if (!is_object($this->boprojects)) if (!is_object($this->boprojects))
{ {
if (!file_exists(PHPGW_SERVER_ROOT.'/projects')) // check if projects installed if (!file_exists(EGW_SERVER_ROOT.'/projects')) // check if projects installed
return array(); return array();
$this->boprojects = createobject('projects.boprojects'); $this->boprojects = createobject('projects.boprojects');
} }

View File

@ -12,11 +12,14 @@
/* $Id$ */ /* $Id$ */
/*! /**
@class customfields_widget * generates a template based on an array with definitions
@author ralfbecker *
@abstract generates a template based on an array with definitions * This widget has neither a render nor a post_process function as it only generates a template
@discussion This widget has neither a render nor a post_process function as it only generates a template *
* @package infolog
* @author RalfBecker-At-outdoor-training.de
* @copyright GPL - GNU General Public License
*/ */
class customfields_widget class customfields_widget
{ {
@ -36,7 +39,7 @@
$cell['type'] = 'label'; $cell['type'] = 'label';
return True; return True;
} }
$tpl = new etemplate; $tpl =& new etemplate;
$tpl->init('*** generated custom fields for InfoLog','','',0,'',0,0); // make an empty template $tpl->init('*** generated custom fields for InfoLog','','',0,'',0,0); // make an empty template
$typ = $value['###typ###']; $typ = $value['###typ###'];

View File

@ -13,13 +13,17 @@
/* $Id$ */ /* $Id$ */
/*! include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.solink.inc.php');
@class soinfolog
@abstract storage object / db-layer for InfoLog /**
@author Ralf Becker * storage object / db-layer for InfoLog
@copyright GPL - GNU General Public License *
@note all values passed to this class are run either through intval or addslashes to prevent query-insertion * all values passed to this class are run either through intval or addslashes to prevent query-insertion
and for pgSql 7.3 compatibility * and for pgSql 7.3 compatibility
*
* @package infolog
* @author RalfBecker-At-outdoor-training.de
* @copyright GPL - GNU General Public License
*/ */
class soinfolog // DB-Layer class soinfolog // DB-Layer
{ {
@ -30,31 +34,29 @@
var $info_table = 'phpgw_infolog'; var $info_table = 'phpgw_infolog';
var $extra_table = 'phpgw_infolog_extra'; var $extra_table = 'phpgw_infolog_extra';
/*! /**
@function soinfolog * constructor
@abstract constructor
*/ */
function soinfolog( $info_id = 0) function soinfolog( $info_id = 0)
{ {
$this->db = clone($GLOBALS['phpgw']->db); $this->db = clone($GLOBALS['egw']->db);
$this->db->set_app('infolog'); $this->db->set_app('infolog');
$this->grants = $GLOBALS['phpgw']->acl->get_grants('infolog'); $this->grants = $GLOBALS['egw']->acl->get_grants('infolog');
$this->user = $GLOBALS['phpgw_info']['user']['account_id']; $this->user = $GLOBALS['egw_info']['user']['account_id'];
$this->links = CreateObject('infolog.solink'); $this->links =& new solink();
$this->tz_offset = $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']; $this->tz_offset = $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'];
$this->read( $info_id ); $this->read( $info_id );
} }
/*! /**
@function check_access * checks if user has the $required_rights to access $info_id (private access is handled too)
@abstract checks if user has the $required_rights to access $info_id (private access is handled too) *
@syntax check_access( $info_id,$required_rights ) * @param $info_id Id of InfoLog entry
@param $info_id Id of InfoLog entry * @param $required_rights EGW_ACL_xyz anded together
@param $required_rights PHPGW_ACL_xyz anded together * @return boolean True if access is granted else False
@returns True if access is granted else False
*/ */
function check_access( $info_id,$required_rights ) function check_access( $info_id,$required_rights )
{ {
@ -79,20 +81,20 @@
// ACL only on public entrys || $owner granted _PRIVATE // ACL only on public entrys || $owner granted _PRIVATE
(!!($this->grants[$owner] & $required_rights) || (!!($this->grants[$owner] & $required_rights) ||
// implicite read-rights for responsible user !!! // implicite read-rights for responsible user !!!
$info['info_responsible'] == $this->user && $required_rights == PHPGW_ACL_READ) && $info['info_responsible'] == $this->user && $required_rights == EGW_ACL_READ) &&
($info['info_access'] == 'public' || ($info['info_access'] == 'public' ||
!!($this->grants[$owner] & PHPGW_ACL_PRIVATE)); !!($this->grants[$owner] & EGW_ACL_PRIVATE));
//echo "<p>check_access(info_id=$info_id (owner=$owner, user=$user),required_rights=$required_rights): access".($access_ok?"Ok":"Denied")."</p>\n"; //echo "<p>check_access(info_id=$info_id (owner=$owner, user=$user),required_rights=$required_rights): access".($access_ok?"Ok":"Denied")."</p>\n";
return $access_ok; return $access_ok;
} }
/*! /**
@function aclFilter * generate sql to be AND'ed into a query to ensure ACL is respected (incl. _PRIVATE)
@abstract generate sql to be AND'ed into a query to ensure ACL is respected (incl. _PRIVATE) *
@param $filter: none|all - list all entrys user have rights to see<br> * @param $filter: none|all - list all entrys user have rights to see<br>
private|own - list only his personal entrys (incl. those he is responsible for !!!) * private|own - list only his personal entrys (incl. those he is responsible for !!!)
@returns the necesary sql * @return string the necesary sql
*/ */
function aclFilter($filter = False) function aclFilter($filter = False)
{ {
@ -109,11 +111,11 @@
foreach($this->grants as $user => $grant) foreach($this->grants as $user => $grant)
{ {
// echo "<p>grants: user=$user, grant=$grant</p>"; // echo "<p>grants: user=$user, grant=$grant</p>";
if ($grant & (PHPGW_ACL_READ|PHPGW_ACL_EDIT)) if ($grant & (EGW_ACL_READ|EGW_ACL_EDIT))
{ {
$public_user_list[] = $user; $public_user_list[] = $user;
} }
if ($grant & PHPGW_ACL_PRIVATE) if ($grant & EGW_ACL_PRIVATE)
{ {
$private_user_list[] = $user; $private_user_list[] = $user;
} }
@ -157,12 +159,11 @@
return $this->acl_filter[$filter.$user] = $filtermethod; // cache the filter return $this->acl_filter[$filter.$user] = $filtermethod; // cache the filter
} }
/*! /**
@function statusFilter * generate sql to filter based on the status of the log-entry
@abstract generate sql to filter based on the status of the log-entry *
@syntax statusFilter($filter = '') * @param $filter done = done or billed, open = not ()done or billed), offer = offer
@param $filter done = done or billed, open = not ()done or billed), offer = offer * @return string the necesary sql
@returns the necesary sql
*/ */
function statusFilter($filter = '') function statusFilter($filter = '')
{ {
@ -178,15 +179,14 @@
return ''; return '';
} }
/*! /**
@function dateFilter * generate sql to filter based on the start- and enddate of the log-entry
@abstract generate sql to filter based on the start- and enddate of the log-entry *
@syntax dateFilter($filter = '') * @param $filter upcoming = startdate is in the future<br>
@param $filter upcoming = startdate is in the future<br> * today startdate < tomorrow<br>
today startdate < tomorrow<br> * overdue enddate < tomorrow<br>
overdue enddate < tomorrow<br> * limitYYYY/MM/DD not older or open
limitYYYY/MM/DD not older or open * @return string the necesary sql
@returns the necesary sql
*/ */
function dateFilter($filter = '') function dateFilter($filter = '')
{ {
@ -223,10 +223,10 @@
return ''; return '';
} }
/*! /**
@function init * initialise the internal $this->data to be empty
@abstract initialise the internal $this->data to be empty *
@discussion only non-empty values got initialised * only non-empty values got initialised
*/ */
function init() function init()
{ {
@ -236,12 +236,12 @@
); );
} }
/*! /**
@function db2data * copy data after a query into $data
@abstract copy data after a query into $data *
@syntax db2data(&$data) * copy only non-numeric keys
@param $data array to copy the data *
@description copy only non-numeric keys * @param $data array to copy the data
*/ */
function db2data(&$data) function db2data(&$data)
{ {
@ -255,13 +255,13 @@
} }
} }
/*! /**
@function read * read InfoLog entry $info_id
@abstract read InfoLog entry $info_id *
@syntax read( $info_id ) * some cacheing is done to prevent multiple reads of the same entry
@param $info_id id of log-entry *
@description some cacheing is done to prevent multiple reads of the same entry * @param $info_id id of log-entry
@returns the entry as array * @return array/boolean the entry as array or False on error (eg. entry not found)
*/ */
function read($info_id) // did _not_ ensure ACL function read($info_id) // did _not_ ensure ACL
{ {
@ -287,13 +287,12 @@
return $this->data; return $this->data;
} }
/*! /**
@function delete * delete InfoLog entry $info_id AND the links to it
@abstract delete InfoLog entry $info_id AND the links to it *
@syntax delete( $info_id ) * @param int $info_id id of log-entry
@param int $info_id id of log-entry * @param bool $delete_children delete the children, if not set there parent-id to $new_parent
@param bool $delete_children delete the children, if not set there parent-id to $new_parent * @param int $new_parent new parent-id to set for subs
@param int new_parent new parent-id to set for subs
*/ */
function delete($info_id,$delete_children=True,$new_parent=0) // did _not_ ensure ACL function delete($info_id,$delete_children=True,$new_parent=0) // did _not_ ensure ACL
{ {
@ -327,12 +326,11 @@
$this->db->update($this->info_table,array('info_id_parent'=>$new_parent),array('info_id_parent'=>$info_id),__LINE__,__FILE__); $this->db->update($this->info_table,array('info_id_parent'=>$new_parent),array('info_id_parent'=>$info_id),__LINE__,__FILE__);
} }
/*! /**
@function change_delete_owner * changes or deletes entries with a spezified owner (for hook_delete_account)
@abstract changes or deletes entries with a spezified owner (for hook_delete_account) *
@syntax change_delete_owner( $owner,$new_owner=0 ) * @param $owner old owner
@param $owner old owner * @param $new_owner new owner or 0 if entries should be deleted
@param $new_owner new owner or 0 if entries should be deleted
*/ */
function change_delete_owner($owner,$new_owner=0) // new_owner=0 means delete function change_delete_owner($owner,$new_owner=0) // new_owner=0 means delete
{ {
@ -352,12 +350,11 @@
$this->db->update($this->info_table,array('info_responsible'=>$new_owner),array('info_responsible'=>$owner),__LINE__,__FILE__); $this->db->update($this->info_table,array('info_responsible'=>$new_owner),array('info_responsible'=>$owner),__LINE__,__FILE__);
} }
/*! /**
@function write * writes the given $values to InfoLog, a new entry gets created if info_id is not set or 0
@abstract writes the given $values to InfoLog, a new entry gets created if info_id is not set or 0 *
@syntax write( $values ) * @param array $values with the data of the log-entry
@param $values array with the data of the log-entry * @return int the info_id
@return the info_id
*/ */
function write($values) // did _not_ ensure ACL function write($values) // did _not_ ensure ACL
{ {
@ -406,12 +403,11 @@
return $this->data['info_id']; return $this->data['info_id'];
} }
/*! /**
@function anzSubs * count the sub-entries of $info_id
@abstract count the sub-entries of $info_id *
@syntax anzSubs( $info_id ) * @param $info_id id of log-entry
@param $info_id id of log-entry * @return int the number of sub-entries
@returns the number of sub-entries
*/ */
function anzSubs( $info_id ) function anzSubs( $info_id )
{ {
@ -429,20 +425,19 @@
return $this->db->f(0); return $this->db->f(0);
} }
/*! /**
@function search * searches InfoLog for a certain pattern in $query
@abstract searches InfoLog for a certain pattern in $query *
@syntax search( $query ) * @param $query[order] column-name to sort after
@param $query[order] column-name to sort after * @param $query[sort] sort-order DESC or ASC
@param $query[sort] sort-order DESC or ASC * @param $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or ''
@param $query[filter] string with combination of acl-, date- and status-filters, eg. 'own-open-today' or '' * @param $query[cat_id] category to use or 0 or unset
@param $query[cat_id] category to use or 0 or unset * @param $query[search] pattern to search, search is done in info_from, info_subject and info_des
@param $query[search] pattern to search, search is done in info_from, info_subject and info_des * @param $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used
@param $query[action] / $query[action_id] if only entries linked to a specified app/entry show be used * @param &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries
@param &$query[start], &$query[total] nextmatch-parameters will be used and set if query returns less entries * @param $query[col_filter] array with column-name - data pairs, data == '' means no filter (!)
@param $query[col_filter] array with column-name - data pairs, data == '' means no filter (!) * @param $query[subs] boolean return subs or not, if unset the user preference is used
@param $query[subs] boolean return subs or not, if unset the user preference is used * @return array with id's as key of the matching log-entries
@returns array with id's as key of the matching log-entries
*/ */
function search(&$query) function search(&$query)
{ {
@ -503,11 +498,11 @@
if ((int)$query['cat_id']) if ((int)$query['cat_id'])
{ {
//$filtermethod .= ' AND info_cat='.intval($query['cat_id']).' '; //$filtermethod .= ' AND info_cat='.intval($query['cat_id']).' ';
if (!is_object($GLOBALS['phpgw']->categories)) if (!is_object($GLOBALS['egw']->categories))
{ {
$GLOBALS['phpgw']->categories = CreateObject('phpgwapi.categories'); $GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories');
} }
$cats = $GLOBALS['phpgw']->categories->return_all_children((int)$query['cat_id']); $cats = $GLOBALS['egw']->categories->return_all_children((int)$query['cat_id']);
$filtermethod .= ' AND info_cat'.(count($cats)>1? ' IN ('.implode(',',$cats).') ' : '='.(int)$query['cat_id']); $filtermethod .= ' AND info_cat'.(count($cats)>1? ' IN ('.implode(',',$cats).') ' : '='.(int)$query['cat_id']);
} }
$join = ''; $join = '';
@ -531,7 +526,7 @@
} }
$pid = 'AND info_id_parent='.($action == 'sp' ? $query['action_id'] : 0); $pid = 'AND info_id_parent='.($action == 'sp' ? $query['action_id'] : 0);
if (!$GLOBALS['phpgw_info']['user']['preferences']['infolog']['listNoSubs'] && if (!$GLOBALS['egw_info']['user']['preferences']['infolog']['listNoSubs'] &&
$action != 'sp' || isset($query['subs']) && $query['subs']) $action != 'sp' || isset($query['subs']) && $query['subs'])
{ {
$pid = ''; $pid = '';

View File

@ -12,18 +12,18 @@
/* $Id$ */ /* $Id$ */
$GLOBALS['phpgw_info']['flags']['included_classes']['solink'] = True; $GLOBALS['egw_info']['flags']['included_classes']['solink'] = True;
/*! /**
@class solink * @author ralfbecker
@author ralfbecker * @copyright GPL - GNU General Public License
@copyright GPL - GNU General Public License * generalized linking between entries of eGroupware apps - DB layer
@abstract generalized linking between entries of eGroupware apps - DB layer *
@discussion This class is to access the links in the DB<br> * This class is to access the links in the DB<br>
Links have to ends each pointing two an entry, each entry is a double:<br> * * Links have to ends each pointing two an entry, each entry is a double:<br>
app app-name or directory-name of an egw application, eg. 'infolog'<br> * * app app-name or directory-name of an egw application, eg. 'infolog'<br>
id this is the id, eg. an integer or a tupple like '0:INBOX:1234' * * id this is the id, eg. an integer or a tupple like '0:INBOX:1234'
@note All vars passed to this class are run either through addslashes or intval * All vars passed to this class are run either through addslashes or intval
to prevent query insertion and to get pgSql 7.3 compatibility. * * to prevent query insertion and to get pgSql 7.3 compatibility.
*/ */
class solink // DB-Layer class solink // DB-Layer
{ {
@ -40,28 +40,26 @@
var $link_table = 'phpgw_links'; var $link_table = 'phpgw_links';
var $debug; var $debug;
/*! /**
@function solink * @author ralfbecker
@syntax solink( ) * constructor
@author ralfbecker *
@abstract constructor
*/ */
function solink( ) function solink( )
{ {
$this->db = clone($GLOBALS['phpgw']->db); $this->db = clone($GLOBALS['egw']->db);
$this->db->set_app('infolog'); $this->db->set_app('infolog');
$this->user = $GLOBALS['phpgw_info']['user']['account_id']; $this->user = $GLOBALS['egw_info']['user']['account_id'];
} }
/*! /**
@function link * @author ralfbecker
@syntax link( $app1,$id1,$app2,$id2,$remark='',$user=0 ) * creats a link between $app1,$id1 and $app2,$id2
@author ralfbecker *
@abstract creats a link between $app1,$id1 and $app2,$id2 * @param $remark Remark to be saved with the link (defaults to '')
@param $remark Remark to be saved with the link (defaults to '') * @param $owner Owner of the link (defaults to user)
@param $owner Owner of the link (defaults to user) * Does NOT check if link already exists
@discussion Does NOT check if link already exists * @return False (for db or param-error) or link_id for success
@result False (for db or param-error) or link_id for success
*/ */
function link( $app1,$id1,$app2,$id2,$remark='',$owner=0,$lastmod=0 ) function link( $app1,$id1,$app2,$id2,$remark='',$owner=0,$lastmod=0 )
{ {
@ -93,14 +91,13 @@
),False,__LINE__,__FILE__) ? $this->db->get_last_insert_id($this->link_table,'link_id') : false; ),False,__LINE__,__FILE__) ? $this->db->get_last_insert_id($this->link_table,'link_id') : false;
} }
/*! /**
@function get_links * @author ralfbecker
@syntax get_links( $app,$id,$only_app='',$only_name='',$order='link_lastmod DESC' ) * returns array of links to $app,$id
@author ralfbecker *
@abstract returns array of links to $app,$id * @param $only_app if set return only links from $only_app (eg. only addressbook-entries) or NOT from if $only_app[0]=='!'
@param $only_app if set return only links from $only_app (eg. only addressbook-entries) or NOT from if $only_app[0]=='!' * @param $order defaults to newest links first
@param $order defaults to newest links first * @return array of links (only_app: ids) or empty array if no matching links found
@result array of links (only_app: ids) or empty array if no matching links found
*/ */
function get_links( $app,$id,$only_app='',$order='link_lastmod DESC' ) function get_links( $app,$id,$only_app='',$order='link_lastmod DESC' )
{ {
@ -144,7 +141,7 @@
); );
} }
if ($only_app && $not_only == ($link['app'] == $only_app) || if ($only_app && $not_only == ($link['app'] == $only_app) ||
!$GLOBALS['phpgw_info']['user']['apps'][$link['app']]) !$GLOBALS['egw_info']['user']['apps'][$link['app']])
{ {
continue; continue;
} }
@ -158,14 +155,13 @@
return $links; return $links;
} }
/*! /**
@function get_link * @author ralfbecker
@syntax get_link( $app_link_id,$id='',$app2='',$id2='' ) * returns data of a link
@author ralfbecker *
@abstract returns data of a link * @param $app_link_id > 0 link_id of link or app-name of link
@param $app_link_id > 0 link_id of link or app-name of link * @param $id,$app2,$id2 other param of the link if not link_id given
@param $id,$app2,$id2 other param of the link if not link_id given * @return array with link-data or False
@result array with link-data or False
*/ */
function get_link($app_link_id,$id='',$app2='',$id2='') function get_link($app_link_id,$id='',$app2='',$id2='')
{ {
@ -213,14 +209,13 @@
return False; return False;
} }
/*! /**
@function unlink * @author ralfbecker
@syntax unlink( $link_id,$app='',$id='',$owner='',$app2='',$id2='' ) * Remove link with $link_id or all links matching given params
@author ralfbecker *
@abstract Remove link with $link_id or all links matching given params * @param $link_id link-id to remove if > 0
@param $link_id link-id to remove if > 0 * @param $app,$id,$owner,$app2,$id2 if $link_id <= 0: removes all links matching the non-empty params
@param $app,$id,$owner,$app2,$id2 if $link_id <= 0: removes all links matching the non-empty params * @return the number of links deleted
@result the number of links deleted
*/ */
function unlink($link_id,$app='',$id='',$owner='',$app2='',$id2='') function unlink($link_id,$app='',$id='',$owner='',$app2='',$id2='')
{ {
@ -275,14 +270,13 @@
return $this->db->affected_rows(); return $this->db->affected_rows();
} }
/*! /**
@function chown * @author ralfbecker
@syntax chown( $owner,$new_owner ) * Changes ownership of all links from $owner to $new_owner
@author ralfbecker *
@abstract Changes ownership of all links from $owner to $new_owner * This is needed when a user/account gets deleted
@discussion This is needed when a user/account gets deleted * Does NOT change the modification-time
@discussion Does NOT change the modification-time * @return the number of links changed
@result the number of links changed
*/ */
function chown($owner,$new_owner) function chown($owner,$new_owner)
{ {

View File

@ -21,24 +21,23 @@
function uicustomfields( ) function uicustomfields( )
{ {
$this->bo = CreateObject('infolog.boinfolog'); $this->bo =& CreateObject('infolog.boinfolog');
$this->tmpl = CreateObject('etemplate.etemplate'); $this->tmpl =& CreateObject('etemplate.etemplate');
$this->types = &$this->bo->enums['type']; $this->types = &$this->bo->enums['type'];
$this->status = &$this->bo->status; $this->status = &$this->bo->status;
$this->config = &$this->bo->config; $this->config = &$this->bo->config;
$this->fields = &$this->bo->customfields; $this->fields = &$this->bo->customfields;
} }
/*! /**
@function edit * @author ralfbecker
@syntax edit( $content=0 ) * Edit/Create an InfoLog Custom fields, typ and status
@author ralfbecker *
@abstract Edit/Create an InfoLog Custom fields, typ and status * @param $content Content from the eTemplate Exec
@param $content Content from the eTemplate Exec
*/ */
function edit($content = 0) function edit($content = 0)
{ {
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Custom fields, typ and status'); $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Custom fields, typ and status');
if (is_array($content)) if (is_array($content))
{ {
//echo '<pre style="text-align: left;">'; print_r($content); echo "</pre>\n"; //echo '<pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
@ -65,7 +64,7 @@
break; break;
} }
case 'cancel': case 'cancel':
$GLOBALS['phpgw']->redirect_link('/admin/'); $GLOBALS['egw']->redirect_link('/admin/');
exit; exit;
} }
} }

View File

@ -13,7 +13,16 @@
/* $Id$ */ /* $Id$ */
class uiinfolog // UI - User Interface - HTML include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.boinfolog.inc.php');
/**
* This class is the UI-layer (user interface) of InfoLog
*
* @package infolog
* @author RalfBecker-At-outdoor-training.de
* @copyright GPL - GNU General Public License
*/
class uiinfolog
{ {
var $public_functions = array var $public_functions = array
( (
@ -28,7 +37,7 @@
function uiinfolog( ) function uiinfolog( )
{ {
$this->bo = CreateObject('infolog.boinfolog'); $this->bo =& new boinfolog();
$this->icons = array( $this->icons = array(
'type' => array( 'type' => array(
@ -75,10 +84,10 @@
); );
$this->link = &$this->bo->link; $this->link = &$this->bo->link;
$this->tmpl = CreateObject('etemplate.etemplate'); $this->tmpl =& CreateObject('etemplate.etemplate');
$this->html = &$this->tmpl->html; $this->html = &$this->tmpl->html;
$this->user = $GLOBALS['phpgw_info']['user']['account_id']; $this->user = $GLOBALS['egw_info']['user']['account_id'];
} }
function get_info($info,&$readonlys,$action='',$action_id='') function get_info($info,&$readonlys,$action='',$action_id='')
@ -97,14 +106,14 @@
$info['info_anz_subs'] = $this->bo->anzSubs($id); $info['info_anz_subs'] = $this->bo->anzSubs($id);
$this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id $this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id
$readonlys["edit[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_EDIT); $readonlys["edit[$id]"] = !$this->bo->check_access($id,EGW_ACL_EDIT);
$readonlys["edit_status[$id]"] = !($this->bo->check_access($id,PHPGW_ACL_EDIT) || $info['info_responsible'] == $this->user); $readonlys["edit_status[$id]"] = !($this->bo->check_access($id,EGW_ACL_EDIT) || $info['info_responsible'] == $this->user);
$readonlys["delete[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_DELETE); $readonlys["delete[$id]"] = !$this->bo->check_access($id,EGW_ACL_DELETE);
$readonlys["sp[$id]"] = !$this->bo->check_access($id,PHPGW_ACL_ADD); $readonlys["sp[$id]"] = !$this->bo->check_access($id,EGW_ACL_ADD);
$readonlys["view[$id]"] = $info['info_anz_subs'] < 1; $readonlys["view[$id]"] = $info['info_anz_subs'] < 1;
$readonlys['view[0]'] = True; // no parent $readonlys['view[0]'] = True; // no parent
$show_links = $GLOBALS['phpgw_info']['user']['preferences']['infolog']['show_links']; $show_links = $GLOBALS['egw_info']['user']['preferences']['infolog']['show_links'];
if ($show_links != 'none' && ($links = $this->link->get_links('infolog',$info['info_id']))) if ($show_links != 'none' && ($links = $this->link->get_links('infolog',$info['info_id'])))
{ {
@ -128,7 +137,7 @@
{ {
$for = @$values['session_for'] ? $values['session_for'] : @$this->called_by; $for = @$values['session_for'] ? $values['session_for'] : @$this->called_by;
//echo "<p>$for: uiinfolog::save_sessiondata(".print_r($values,True).") called_by='$this->called_by'</p>\n"; //echo "<p>$for: uiinfolog::save_sessiondata(".print_r($values,True).") called_by='$this->called_by'</p>\n";
$GLOBALS['phpgw']->session->appsession($for.'session_data','infolog',array( $GLOBALS['egw']->session->appsession($for.'session_data','infolog',array(
'search' => $values['search'], 'search' => $values['search'],
'start' => $values['start'], 'start' => $values['start'],
'filter' => $values['filter'], 'filter' => $values['filter'],
@ -142,7 +151,7 @@
function read_sessiondata() function read_sessiondata()
{ {
$values = $GLOBALS['phpgw']->session->appsession(@$this->called_by.'session_data','infolog'); $values = $GLOBALS['egw']->session->appsession(@$this->called_by.'session_data','infolog');
if (!@$values['session_for'] && $this->called_by) if (!@$values['session_for'] && $this->called_by)
{ {
$values['session_for'] = $this->called_by; $values['session_for'] = $this->called_by;
@ -275,7 +284,7 @@
{ {
if ($typ != 'defaults') $all_stati += $stati; if ($typ != 'defaults') $all_stati += $stati;
} }
$GLOBALS['phpgw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologIndex'); $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologIndex');
return $this->tmpl->exec('infolog.uiinfolog.index',$values,array( return $this->tmpl->exec('infolog.uiinfolog.index',$values,array(
'info_type' => $this->bo->enums['type'], 'info_type' => $this->bo->enums['type'],
@ -290,7 +299,7 @@
if (is_array($values) || $info_id <= 0) if (is_array($values) || $info_id <= 0)
{ {
if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,PHPGW_ACL_DELETE)) if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,EGW_ACL_DELETE))
{ {
$this->bo->delete($info_id,$values['remove_subs'],$values['info_id_parent']); $this->bo->delete($info_id,$values['remove_subs'],$values['info_id_parent']);
} }
@ -307,24 +316,22 @@
$persist['referer'] = $referer; $persist['referer'] = $referer;
$persist['info_id_parent'] = $values['main'][1]['info_id_parent']; $persist['info_id_parent'] = $values['main'][1]['info_id_parent'];
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete'); $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete');
$GLOBALS['phpgw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologDelete'); $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologDelete');
$this->tmpl->exec('infolog.uiinfolog.delete',$values,'',$readonlys,$persist); $this->tmpl->exec('infolog.uiinfolog.delete',$values,'',$readonlys,$persist);
} }
/*! /**
@function edit * Edit/Create an InfoLog Entry
@syntax edit( $content=0,$action='',$action_id=0,$type='',$referer='' ) *
@author ralfbecker * @param array $content=null Content from the eTemplate Exec call or info_id on inital call
@abstract Edit/Create an InfoLog Entry * @param string $action='' Name of an app of 'sp' for a infolog-sub
@param $content Content from the eTemplate Exec call or info_id on inital call * @param int $action_id=0 Id of app-entry to which a link is created
@param $action Name of an app of 'sp' for a infolog-sub * @param string $type='' Type of log-entry: note,todo,task
@param $action_id Id of app-entry to which a link is created * @param string $referer='' array with param/get-vars of the refering page
@param $type Type of log-entry: note,todo,task
@param $referer array with param/get-vars of the refering page
*/ */
function edit($content = 0,$action = '',$action_id=0,$type='',$referer='') function edit($content = null,$action = '',$action_id=0,$type='',$referer='')
{ {
if (is_array($content)) if (is_array($content))
{ {
@ -342,7 +349,7 @@
{ {
if ($content['save'] && $info_id) if ($content['save'] && $info_id)
{ {
if (!($edit_acl = $this->bo->check_access($info_id,PHPGW_ACL_EDIT))) if (!($edit_acl = $this->bo->check_access($info_id,EGW_ACL_EDIT)))
{ {
$old = $this->bo->read($info_id); $old = $this->bo->read($info_id);
$status_only = $old['info_responsible'] == $this->user; $status_only = $old['info_responsible'] == $this->user;
@ -402,7 +409,7 @@
$info_id = $content ? $content : get_var('info_id', array('POST','GET')); $info_id = $content ? $content : get_var('info_id', array('POST','GET'));
$type = $type ? $type : get_var('type', array('POST','GET')); $type = $type ? $type : get_var('type', array('POST','GET'));
$referer = $referer !== '' ? $referer : $referer = $referer !== '' ? $referer :
ereg_replace('^.*'.$GLOBALS['phpgw_info']['server']['webserver_url'],'', ereg_replace('^.*'.$GLOBALS['egw_info']['server']['webserver_url'],'',
get_var('HTTP_REFERER',Array('SERVER'))); get_var('HTTP_REFERER',Array('SERVER')));
//echo "<p>uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n"; //echo "<p>uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
@ -416,7 +423,7 @@
if (!$info_id && $action_id && $action == 'sp') // new SubProject if (!$info_id && $action_id && $action == 'sp') // new SubProject
{ {
if (!$this->bo->check_access($action_id,PHPGW_ACL_ADD)) if (!$this->bo->check_access($action_id,EGW_ACL_ADD))
{ {
return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id); return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id);
} }
@ -448,7 +455,7 @@
} }
else else
{ {
if ($info_id && !$this->bo->check_access($info_id,PHPGW_ACL_EDIT)) if ($info_id && !$this->bo->check_access($info_id,EGW_ACL_EDIT))
{ {
if ($content['info_responsible'] == $this->user) if ($content['info_responsible'] == $this->user)
{ {
@ -519,9 +526,9 @@
{ {
$content['blur_title'] = $this->link->title($action,$action_id); $content['blur_title'] = $this->link->title($action,$action_id);
} }
$readonlys['delete'] = !$info_id || !$this->bo->check_access($info_id,PHPGW_ACL_DELETE); $readonlys['delete'] = !$info_id || !$this->bo->check_access($info_id,EGW_ACL_DELETE);
$GLOBALS['phpgw_info']['flags']['app_header'] = lang($this->messages[$info_id ? 'edit' : ($action == 'sp' ? 'add_sub' : 'add')]); $GLOBALS['egw_info']['flags']['app_header'] = lang($this->messages[$info_id ? 'edit' : ($action == 'sp' ? 'add_sub' : 'add')]);
$this->tmpl->read('infolog.edit'); $this->tmpl->read('infolog.edit');
if ($this->bo->has_customfields($content['info_type'])) if ($this->bo->has_customfields($content['info_type']))
@ -533,9 +540,9 @@
{ {
$this->tmpl->set_cell_attribute('description|links|delegation|customfields','name','description|links|delegation'); $this->tmpl->set_cell_attribute('description|links|delegation|customfields','name','description|links|delegation');
} }
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '. $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.
($content['status_only'] ? lang('Edit Status') : lang('Edit')); ($content['status_only'] ? lang('Edit Status') : lang('Edit'));
$GLOBALS['phpgw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd')); $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd'));
//echo "<p>uiinfolog.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content); //echo "<p>uiinfolog.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content);
$this->tmpl->exec('infolog.uiinfolog.edit',$content,array( $this->tmpl->exec('infolog.uiinfolog.edit',$content,array(
@ -565,7 +572,7 @@
{ {
$icon = $this->icons[$cat][$id]; $icon = $this->icons[$cat][$id];
} }
if ($icon && !is_readable($GLOBALS['phpgw']->common->get_image_dir() . '/' . $icon)) if ($icon && !is_readable($GLOBALS['egw']->common->get_image_dir() . '/' . $icon))
{ {
$icon = False; $icon = False;
} }
@ -583,7 +590,7 @@
{ {
if(get_var('cancel',Array('POST'))) if(get_var('cancel',Array('POST')))
{ {
$GLOBALS['phpgw']->redirect_link('/admin/index.php'); $GLOBALS['egw']->redirect_link('/admin/index.php');
} }
if(get_var('save',Array('POST'))) if(get_var('save',Array('POST')))
@ -608,15 +615,15 @@
$this->bo->config->save_repository(True); $this->bo->config->save_repository(True);
} }
$GLOBALS['phpgw_info']['flags']['css'] = $this->html->theme2css(); $GLOBALS['egw_info']['flags']['css'] = $this->html->theme2css();
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Configuration'); $GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Configuration');
$GLOBALS['phpgw']->common->phpgw_header(); $GLOBALS['egw']->common->egw_header();
$GLOBALS['phpgw']->template->set_file(array('info_admin_t' => 'admin.tpl')); $GLOBALS['egw']->template->set_file(array('info_admin_t' => 'admin.tpl'));
$GLOBALS['phpgw']->template->set_block('info_admin_t', 'admin_line'); $GLOBALS['egw']->template->set_block('info_admin_t', 'admin_line');
$GLOBALS['phpgw']->template->set_block('info_admin_t', 'info_admin'); $GLOBALS['egw']->template->set_block('info_admin_t', 'info_admin');
$GLOBALS['phpgw']->template->set_var(Array( $GLOBALS['egw']->template->set_var(Array(
'text' => lang('<b>file-attachments via symlinks</b> instead of uploads and retrieval via file:/path for direct lan-clients'), 'text' => lang('<b>file-attachments via symlinks</b> instead of uploads and retrieval via file:/path for direct lan-clients'),
'action_url' => $this->html->link('/index.php',$this->menuaction('admin')), 'action_url' => $this->html->link('/index.php',$this->menuaction('admin')),
'save_button' => $this->html->submit_button('save','Save'), 'save_button' => $this->html->submit_button('save','Save'),
@ -633,32 +640,32 @@
$i = 0; @reset($this->bo->link_pathes); $i = 0; @reset($this->bo->link_pathes);
do { do {
list($valid,$trans) = @each($this->bo->link_pathes); list($valid,$trans) = @each($this->bo->link_pathes);
$GLOBALS['phpgw']->template->set_var(array( $GLOBALS['egw']->template->set_var(array(
'tr_color' => $i & 1 ? 'row_off' : 'row_on', 'tr_color' => $i & 1 ? 'row_off' : 'row_on',
'num' => $i+1, 'num' => $i+1,
'val_valid' => $this->html->input("valid[$i]",$valid), 'val_valid' => $this->html->input("valid[$i]",$valid),
'val_trans' => $this->html->input("trans[$i]",$trans), 'val_trans' => $this->html->input("trans[$i]",$trans),
'val_ip' => $this->html->input("ip[$i]",$this->bo->send_file_ips[$valid]) 'val_ip' => $this->html->input("ip[$i]",$this->bo->send_file_ips[$valid])
)); ));
$GLOBALS['phpgw']->template->parse('admin_lines','admin_line',True); $GLOBALS['egw']->template->parse('admin_lines','admin_line',True);
++$i; ++$i;
} while ($valid); } while ($valid);
if (!$this->tmpl->xslt) if (!$this->tmpl->xslt)
{ {
echo parse_navbar(); echo parse_navbar();
$GLOBALS['phpgw']->template->pfp('phpgw_body','info_admin'); $GLOBALS['egw']->template->pfp('phpgw_body','info_admin');
} }
else else
{ {
$GLOBALS['phpgw']->template->fp('phpgw_body','info_admin'); $GLOBALS['egw']->template->fp('phpgw_body','info_admin');
} }
} }
/*! /**
@function writeLangFile * writes langfile with all templates and messages registered here
@abstract writes langfile with all templates and messages registered here *
@discussion called via [write Langfile] in the etemplate-editor or as http://domain/egroupware/index.php?menuaction=infolog.uiinfolog.writeLangFile * called via [write Langfile] in the etemplate-editor or as http://domain/egroupware/index.php?menuaction=infolog.uiinfolog.writeLangFile
*/ */
function writeLangFile() function writeLangFile()
{ {
@ -672,23 +679,22 @@
return $this->tmpl->writeLangFile('infolog','en',$extra); return $this->tmpl->writeLangFile('infolog','en',$extra);
} }
/*! /**
@function hook_view * shows infolog in other applications
@abstract shows infolog in other applications *
@syntax hook_view($args) * @param $args['location'] location des hooks: {addressbook|projects|calendar}_view|infolog
@param $args['location'] location des hooks: {addressbook|projects|calendar}_view|infolog * @param $args['view'] menuaction to view, if location == 'infolog'
@param $args['view'] menuaction to view, if location == 'infolog' * @param $args['app'] app-name, if location == 'infolog'
@param $args['app'] app-name, if location == 'infolog' * @param $args['view_id'] name of the id-var for location == 'infolog'
@param $args['view_id'] name of the id-var for location == 'infolog' * @param $args[$args['view_id']] id of the entry
@param $args[$args['view_id']] id of the entry * this function can be called for any app, which should include infolog: \
@note this function can be called for any app, which should include infolog: \ * $GLOBALS['egw']->hooks->process(array( \
$GLOBALS['phpgw']->hooks->process(array( \ * * 'location' => 'infolog', \
'location' => 'infolog', \ * * 'app' => <your app>, \
'app' => <your app>, \ * * 'view_id' => <id name>, \
'view_id' => <id name>, \ * * <id name> => <id value>, \
<id name> => <id value>, \ * * 'view' => <menuaction to view an entry in your app> \
'view' => <menuaction to view an entry in your app> \ * ));
));
*/ */
function hook_view($args) function hook_view($args)
{ {
@ -724,17 +730,17 @@
} }
$this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks $this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks
$save_app = $GLOBALS['phpgw_info']['flags']['currentapp']; $save_app = $GLOBALS['egw_info']['flags']['currentapp'];
$GLOBALS['phpgw_info']['flags']['currentapp'] = 'infolog'; $GLOBALS['egw_info']['flags']['currentapp'] = 'infolog';
$GLOBALS['phpgw']->translation->add_app('infolog'); $GLOBALS['egw']->translation->add_app('infolog');
$GLOBALS['phpgw_info']['etemplate']['hooked'] = True; $GLOBALS['egw_info']['etemplate']['hooked'] = True;
$this->index(0,$app,$args[$view_id],array( $this->index(0,$app,$args[$view_id],array(
'menuaction' => $view, 'menuaction' => $view,
$view_id => $args[$view_id] $view_id => $args[$view_id]
),True); ),True);
$GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app; $GLOBALS['egw_info']['flags']['currentapp'] = $save_app;
unset($GLOBALS['phpgw_info']['etemplate']['hooked']); unset($GLOBALS['egw_info']['etemplate']['hooked']);
} }
} }

View File

@ -11,10 +11,10 @@
/* $Id$ */ /* $Id$ */
// Delete all records for a user // Delete all records for a user
$info = CreateObject('infolog.soinfolog'); $info =& CreateObject('infolog.soinfolog');
$info->change_delete_owner(intval($GLOBALS['HTTP_POST_VARS']['account_id']), $info->change_delete_owner(intval($_POST['account_id']),
intval($GLOBALS['HTTP_POST_VARS']['new_owner'])); intval($_POST['new_owner']));
unset($info); unset($info);
?> ?>

View File

@ -10,18 +10,18 @@
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
$showevents = intval($GLOBALS['phpgw_info']['user']['preferences']['infolog']['homeShowEvents']); $showevents = intval($GLOBALS['egw_info']['user']['preferences']['infolog']['homeShowEvents']);
if($showevents > 0) if($showevents > 0)
{ {
$save_app = $GLOBALS['phpgw_info']['flags']['currentapp']; $save_app = $GLOBALS['egw_info']['flags']['currentapp'];
$GLOBALS['phpgw_info']['flags']['currentapp'] = 'infolog'; $GLOBALS['egw_info']['flags']['currentapp'] = 'infolog';
$GLOBALS['phpgw']->translation->add_app('infolog'); $GLOBALS['egw']->translation->add_app('infolog');
$app_id = $GLOBALS['phpgw']->applications->name2id('infolog'); $app_id = $GLOBALS['egw']->applications->name2id('infolog');
$GLOBALS['portal_order'][] = $app_id; $GLOBALS['portal_order'][] = $app_id;
$infolog = CreateObject('infolog.uiinfolog'); $infolog =& CreateObject('infolog.uiinfolog');
switch($showevents) switch($showevents)
{ {
case 1: case 1:
@ -37,14 +37,14 @@
if(!$xslt) // .14/6 if(!$xslt) // .14/6
{ {
$portalbox = CreateObject('phpgwapi.listbox',array( $portalbox =& CreateObject('phpgwapi.listbox',array(
'title' => $title, 'title' => $title,
'primary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], 'primary' => $GLOBALS['egw_info']['theme']['navbar_bg'],
'secondary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], 'secondary' => $GLOBALS['egw_info']['theme']['navbar_bg'],
'tertiary' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], 'tertiary' => $GLOBALS['egw_info']['theme']['navbar_bg'],
'width' => '100%', 'width' => '100%',
'outerborderwidth' => '0', 'outerborderwidth' => '0',
'header_background_image' => $GLOBALS['phpgw']->common->image('phpgwapi/templates/default','bg_filler') 'header_background_image' => $GLOBALS['egw']->common->image('phpgwapi/templates/default','bg_filler')
)); ));
foreach(array( foreach(array(
'up' => Array('url' => '/set_box.php', 'app' => $app_id), 'up' => Array('url' => '/set_box.php', 'app' => $app_id),
@ -63,14 +63,14 @@
} }
else // HEAD / XSLT else // HEAD / XSLT
{ {
$GLOBALS['phpgw']->portalbox->set_params(array( $GLOBALS['egw']->portalbox->set_params(array(
'app_id' => $app_id, 'app_id' => $app_id,
'title' => $title 'title' => $title
)); ));
$GLOBALS['phpgw']->portalbox->draw($html); $GLOBALS['egw']->portalbox->draw($html);
} }
unset($html); unset($html);
$GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app; $GLOBALS['egw_info']['flags']['currentapp'] = $save_app;
} }
unset($showevents); unset($showevents);
?> ?>

View File

@ -24,7 +24,7 @@
create_input_box('Max number of entries to display on the main screen','mainscreen_maxshow', create_input_box('Max number of entries to display on the main screen','mainscreen_maxshow',
'Only up to this number of entries are displayed on the main screen.','10',3); 'Only up to this number of entries are displayed on the main screen.','10',3);
$ui = CreateObject('infolog.uiinfolog'); // need some labels from $ui =& CreateObject('infolog.uiinfolog'); // need some labels from
foreach($ui->filters as $key => $label) foreach($ui->filters as $key => $label)
{ {
$filters[$key] = lang($label); $filters[$key] = lang($label);

View File

@ -13,16 +13,16 @@
/* $Id$ */ /* $Id$ */
$GLOBALS['phpgw_info']['flags'] = array( $GLOBALS['egw_info']['flags'] = array(
'currentapp' => 'infolog', 'currentapp' => 'infolog',
'noheader' => True, 'noheader' => True,
'nonavbar' => True 'nonavbar' => True
); );
include('../header.inc.php'); include('../header.inc.php');
$GLOBALS['phpgw']->redirect_link('/index.php',array( $GLOBALS['egw']->redirect_link('/index.php',array(
'menuaction' => 'infolog.uiinfolog.index', 'menuaction' => 'infolog.uiinfolog.index',
'filter' => $GLOBALS['phpgw_info']['user']['preferences']['infolog']['defaultFilter'] 'filter' => $GLOBALS['egw_info']['user']['preferences']['infolog']['defaultFilter']
)); ));
$GLOBALS['phpgw']->common->phpgw_exit(); $GLOBALS['egw']->common->egw_exit();
?> ?>