phpgw->egw

This commit is contained in:
Miles Lott 2005-11-25 00:20:34 +00:00
parent 98bb88f545
commit bcb682ed9d
3 changed files with 125 additions and 127 deletions

View File

@ -4,7 +4,7 @@
* Written by Ralf Becker <RalfBecker@outdoor-training.de> *
* Class for creating select boxes for addresse, projects, array items, ... *
* Copyright (C) 2000, 2001 Dan Kuykendall *
* -------------------------------------------------------------------------*
* ------------------------------------------------------------------------ *
* This library is part of the eGroupWare API *
* http://www.egroupware.org/api *
* ------------------------------------------------------------------------ *
@ -23,10 +23,10 @@
/* $Id$ */
if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
if(!isset($GLOBALS['egw_info']['flags']['included_classes']['sbox']))
{
include(PHPGW_API_INC . '/class.sbox.inc.php');
$GLOBALS['phpgw_info']['flags']['included_classes']['sbox'] = True;
include(EGW_API_INC . '/class.sbox.inc.php');
$GLOBALS['egw_info']['flags']['included_classes']['sbox'] = True;
}
class sbox2 extends sbox
@ -46,7 +46,7 @@
* {$name} content of $id if != 0, or lang('use Button to search for').$lang_name
* {$name.'_nojs} searchfield + button if we have no JavaScript, else empty
*
* To use call $template->set_var(getIdSearch( ... ));
* To use call $template->set_var(getIdSearch(...));
* the template should look like {doSearchFkt} <tr><td>{XXX_title}</td><td>{XXX}</td><td>{XXX_nojs}</td></tr> (XXX is content of $name)
* In the submitted page the vars $query_XXX and $id_XXX are set according to what is selected, see getAddress as Example
*/
@ -100,9 +100,9 @@
{
$ret[$name] = '<select name="id_'.$name.'">'."\n";
}
while (list( $id,$text ) = each( $content ))
while (list($id,$text) = each($content))
{
$ret[$name] .= "<option value=\"$id\">" . $GLOBALS['phpgw']->strip_html($text) . "\n";
$ret[$name] .= "<option value=\"$id\">" . $GLOBALS['egw']->strip_html($text) . "\n";
}
$ret[$name] .= '<option value="0">'.lang('none')."\n";
$ret[$name] .= '</select>';
@ -129,7 +129,7 @@
return $ret;
}
function event2name( $event )
function event2name($event)
{
if (!is_object($this->bocal))
{
@ -143,11 +143,11 @@
{
return 'not an event !!!';
}
$name = $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset);
$name .= ' -- ' . $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['end']) - $this->bocal->datetime->tz_offset);
$name = $GLOBALS['egw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset);
$name .= ' -- ' . $GLOBALS['egw']->common->show_date($this->bocal->maketime($event['end']) - $this->bocal->datetime->tz_offset);
$name .= ': ' . $event['title'];
return $GLOBALS['phpgw']->strip_html($name);
return $GLOBALS['egw']->strip_html($name);
}
/*
@ -158,16 +158,16 @@
* $multipe present a multiple selectable box instead of one selector-button
* On Submit $id_XXX contains the selected event (if != 0)
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
* Returns array with vars to set for the template, set with: $template->set_var( getEvent( ... )); (see getId( ))
* Returns array with vars to set for the template, set with: $template->set_var(getEvent(...)); (see getId())
*
* Note As query's for an event are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
*/
function getEvent( $name,$id_name,$query_name,$title='',$multiple=False)
function getEvent($name,$id_name,$query_name,$title='',$multiple=False)
{
// echo "<p>getEvent('$name',$id_name,'$query_name','$title')</p>";
// fallback if calendar is not installed or not enabled for user
if (!file_exists(PHPGW_SERVER_ROOT.'/calendar') || !$GLOBALS['phpgw_info']['user']['apps']['calendar']['enabled'])
if (!file_exists(EGW_SERVER_ROOT.'/calendar') || !$GLOBALS['egw_info']['user']['apps']['calendar']['enabled'])
{
return array(
$name => "<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">\n",
@ -184,18 +184,18 @@
if ($query_name)
{
$event_ids = $this->bocal->search_keywords($query_name);
$content = array( );
while ($event_ids && list( $key,$id ) = each( $event_ids ))
$content = array();
while ($event_ids && list($key,$id) = each($event_ids))
{
$content[$id] = $this->event2name( $id );
$content[$id] = $this->event2name($id);
}
}
else
{
$event = $this->bocal->read_entry( $id_name );
$event = $this->bocal->read_entry($id_name);
if ($event && is_array($event))
{
$content = $this->event2name( $event );
$content = $this->event2name($event);
}
}
}
@ -206,7 +206,7 @@
return $this->getId($name,$title,lang('Pattern for Search in Calendar'),$id_name,$content,lang('use Button to search for Calendarevent'),$multiple);
}
function addr2name( $addr )
function addr2name($addr)
{
$name = $addr['n_family'];
if ($addr['n_given'])
@ -224,7 +224,7 @@
{
$name = $addr['org_name'].': '.$name;
}
return $GLOBALS['phpgw']->strip_html($name);
return $GLOBALS['egw']->strip_html($name);
}
/*
@ -235,11 +235,11 @@
* $multipe present a multiple selectable box instead of one selector-button
* On Submit $id_XXX contains the selected address (if != 0)
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
* Returns array with vars to set for the template, set with: $template->set_var( getAddress( ... )); (see getId( ))
* Returns array with vars to set for the template, set with: $template->set_var(getAddress(...)); (see getId())
*
* Note As query's for an address are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
*/
function getAddress( $name,$id_name,$query_name,$title='',$multiple=False)
function getAddress($name,$id_name,$query_name,$title='',$multiple=False)
{
// echo "<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
if ($id_name || $query_name)
@ -248,19 +248,19 @@
if ($query_name)
{
$addrs = $contacts->read( 0,0,'',$query_name,'','DESC','org_name,n_family,n_given' );
$content = array( );
while ($addrs && list( $key,$addr ) = each( $addrs ))
$addrs = $contacts->read(0,0,'',$query_name,'','DESC','org_name,n_family,n_given');
$content = array();
while ($addrs && list($key,$addr) = each($addrs))
{
$content[$addr['id']] = $this->addr2name( $addr );
$content[$addr['id']] = $this->addr2name($addr);
}
}
else
{
list( $addr ) = $contacts->read_single_entry( $id_name );
list($addr) = $contacts->read_single_entry($id_name);
if (count($addr))
{
$content = $this->addr2name( $addr );
$content = $this->addr2name($addr);
}
}
}
@ -305,7 +305,7 @@
return $name.' <'.$addr['email'.$home].'>';
}
function getEmail( $name,$id_name,$query_name,$title='')
function getEmail($name,$id_name,$query_name,$title='')
{
// echo "<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
if ($id_name || $query_name)
@ -314,23 +314,23 @@
if ($query_name)
{
$addrs = $contacts->read( 0,0,'',$query_name,'','DESC','org_name,n_family,n_given' );
$content = array( );
while ($addrs && list( $key,$addr ) = each( $addrs ))
$addrs = $contacts->read(0,0,'',$query_name,'','DESC','org_name,n_family,n_given');
$content = array();
while($addrs && list($key,$addr) = each($addrs))
{
if ($addr['email'])
{
$content[$addr['id']] = $this->addr2email( $addr );
$content[$addr['id']] = $this->addr2email($addr);
}
if ($addr['email_home'])
{
$content[$addr['id'].'h'] = $this->addr2email( $addr,'_home' );
$content[$addr['id'].'h'] = $this->addr2email($addr,'_home');
}
}
}
else
{
$content = $this->addr2email( $id_name );
$content = $this->addr2email($id_name);
}
}
if (!$title)
@ -348,16 +348,16 @@
* $query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
* On Submit $id_XXX contains the selected address (if != 0)
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
* Returns array with vars to set for the template, set with: $template->set_var( getProject( ... )); (see getId( ))
* Returns array with vars to set for the template, set with: $template->set_var(getProject(...)); (see getId())
*
* Note As query's for an address are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
*/
function getProject( $name,$id_name,$query_name,$title='' )
function getProject($name,$id_name,$query_name,$title='')
{
// echo "<p>getProject('$name',$id_name,'$query_name','$title')</p>";
// fallback if projects is not installed or not enabled for user
if (!file_exists(PHPGW_SERVER_ROOT.'/projects') || !$GLOBALS['phpgw_info']['user']['apps']['projects']['enabled'])
if (!file_exists(EGW_SERVER_ROOT.'/projects') || !$GLOBALS['egw_info']['user']['apps']['projects']['enabled'])
{
return array(
$name => "<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">\n",
@ -374,16 +374,16 @@
}
if ($query_name)
{
$projs = $projects->list_projects( 0,0,$query_name,'','','','',0,'mains','' );
$projs = $projects->list_projects(0,0,$query_name,'','','','',0,'mains','');
$content = array();
while ($projs && list( $key,$proj ) = each( $projs ))
while ($projs && list($key,$proj) = each($projs))
{
$content[$proj['project_id']] = $proj['title'];
}
}
else
{
if ($proj = $projects->read_single_project( $id_name ))
if ($proj = $projects->read_single_project($id_name))
{
$content = $proj['title'];
// $customer_id = $proj['customer'];
@ -402,7 +402,7 @@
* Function: Allows to show and select one item from an array
* Parameters: $name string with name of the submitted var which holds the key of the selected item form array
* $key key(s) of already selected item(s) from $arr, eg. '1' or '1,2' or array with keys
* $arr array with items to select, eg. $arr = array ( 'y' => 'yes','n' => 'no','m' => 'maybe');
* $arr array with items to select, eg. $arr = array ('y' => 'yes','n' => 'no','m' => 'maybe');
* $no_lang if !$no_lang send items through lang()
* $options additional options (e.g. 'multiple')
* On submit $XXX is the key of the selected item (XXX is the content of $name)
@ -500,7 +500,7 @@
if (!is_array($account_data))
{
$accounts = createobject('phpgwapi.accounts',$id);
$accounts->db = $GLOBALS['phpgw']->db;
$accounts->db = $GLOBALS['egw']->db;
$accounts->read_repository();
$account_data = $accounts->data;
}
@ -523,7 +523,7 @@
*/
function getAccount($name,$id,$longnames=-1,$type='accounts',$multiple=0,$options='')
{
$accs = $GLOBALS['phpgw']->accounts->get_list($type);
$accs = $GLOBALS['egw']->accounts->get_list($type);
if ($multiple < 0)
{
@ -532,7 +532,7 @@
while ($a = current($accs))
{
$aarr[$a['account_id']] = $longnames == -1 ?
$GLOBALS['phpgw']->common->display_fullname($a['account_lid'],$a['account_firstname'],$a['account_lastname']) :
$GLOBALS['egw']->common->display_fullname($a['account_lid'],$a['account_firstname'],$a['account_lastname']) :
$this->accountInfo($a['account_id'],$a,$longnames,$type=='both');
next($accs);
@ -556,7 +556,7 @@
$month = date('m',$date);
$year = date('Y',$date);
}
return $GLOBALS['phpgw']->common->dateformatorder(
return $GLOBALS['egw']->common->dateformatorder(
$this->getYears($n_year,$year),
$this->getMonthText($n_month,$month),
$this->getDays($n_day,$day)

View File

@ -3,9 +3,9 @@
* eGroupWare API - Validator *
* This file written by Dave Hall <skwashd@phpgroupware.org> *
* Copyright (C) 2003 Free Software Foundation *
* -------------------------------------------------------------------------*
* ------------------------------------------------------------------------ *
* This library is part of the eGroupWare API *
* http://www.egroupware.org/api *
* http://www.egroupware.org/api *
* ------------------------------------------------------------------------ *
* This program is Free Software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
@ -21,116 +21,116 @@
{
var $error;
function clear_error ()
function clear_error()
{
$this->nonfree_call();
}
/* check if string contains any whitespace */
function has_space ($text)
function has_space($text)
{
return ereg("( |\n|\t|\r)+", $text);
}
function chconvert ($fragment)
function chconvert($fragment)
{
$this->nonfree_call();
}
function get_perms ($fileName)
function get_perms($fileName)
{
$this->nonfree_call();
}
function is_sane ($filename)
function is_sane($filename)
{
$this->nonfree_call();
}
/* strips all whitespace from a string */
function strip_space ($text)
function strip_space($text)
{
return ereg_replace("( |\n|\t|\r)+", '', $text);
}
function is_allnumbers ($text)
function is_allnumbers($text)
{
$this->nonfree_call();
}
function strip_numbers ($text)
function strip_numbers($text)
{
$this->nonfree_call();
}
function is_allletters ($text)
function is_allletters($text)
{
$this->nonfree_call();
}
function strip_letters ($text)
function strip_letters($text)
{
$this->nonfree_call();
}
function has_html ($text='')
function has_html($text='')
{
return ($text != $this->strip_html($text));
}
function strip_html ($text='')
function strip_html($text='')
{
return strip_tags($text);
}
function has_metas ($text='')
function has_metas($text='')
{
return ($text != $this->strip_metas($text));
}
function strip_metas ($text = "")
function strip_metas($text = "")
{
$metas = array('$','^','*','(',')','+','[',']','.','?');
return str_replace($metas, '', stripslashes($text));
}
function custom_strip ($Chars, $text = "")
function custom_strip($Chars, $text = "")
{
$this->nonfree_call();
}
function array_echo ($array, $name='Array')
function array_echo($array, $name='Array')
{
echo '<pre>';
print_r($array);
echo '<pre>';
}
function is_email ($address='')
function is_email($address='')
{
list($user, $domain) = explode('@', $address);
if(!($user && $domain))
{
return false;
}
if(!$this->has_space($user) && $this->is_host($domain))
{
return true;
}
}
function is_url ($url='')
function is_url($url='')
{
//echo "Checking $url<br>";
$uris = array(
'ftp' => True,
'https' => True,
'http' => True,
);
'http' => True
);
$url_elements = parse_url($url);
//echo '<pre>';
//print_r($url_elements);
//echo '</pre>';
@ -144,7 +144,7 @@
if(@$uris[$url_elements['scheme']])
{
//echo ' is valid<br>host ' . $url_elements['host'];
if( eregi("[a-z]", $url_elements['host']) )
if(eregi("[a-z]", $url_elements['host']))
{
//echo ' is name<br>';
return $this->is_hostname($url_elements['host']);
@ -160,11 +160,10 @@
//echo ' is invalid<br>';
return $false;
}
}
//the url may be valid, but this method can't test all types
function url_responds ($url='')
function url_responds($url='')
{
if(!$this->is_url($url))
{
@ -183,12 +182,12 @@
}
}
function is_phone ($Phone='')
function is_phone($Phone='')
{
$this->nonfree_call();
}
function is_hostname ($hostname='')
function is_hostname($hostname='')
{
//echo "Checking $hostname<br>";
$segs = explode('.', $hostname);
@ -199,7 +198,7 @@
//echo "Checking $seg<br>";
if(eregi("[a-z0-9\-]{0,62}",$seg))
{
$return = True;
$return = True;
}
if(!$return)
@ -212,12 +211,12 @@
return False;
}
function is_bigfour ($tld)
function is_bigfour($tld)
{
$this->nonfree_call();
}
function is_host ($hostname='', $type='ANY')
function is_host($hostname='', $type='ANY')
{
if($this->is_hostname($hostname))
{
@ -227,10 +226,9 @@
{
return false;
}
}
function is_ipaddress ($ip='')
function is_ipaddress($ip='')
{
if(strlen($ip) <= 15)
{
@ -241,7 +239,7 @@
}
foreach($segs as $seg)
{
if( ($seg < 0) || ($seg >= 255) )
if(($seg < 0) || ($seg >= 255))
{
return false;
}
@ -254,7 +252,7 @@
}
}
function ip_resolves ($ip='')
function ip_resolves($ip='')
{
if($this->is_ipaddress($ip))
{
@ -266,26 +264,26 @@
}
}
function browser_gen ()
function browser_gen()
{
$this->nonfree_call();
}
function is_state ($State = "")
function is_state($State = "")
{
$this->nonfree_call();
}
function is_zip ($zipcode = "")
function is_zip($zipcode = "")
{
$this->nonfree_call();
}
function is_country ($countrycode='')
function is_country($countrycode='')
{
$this->nonfree_call();
}
function nonfree_call()
{
echo 'class.validator.inc.php used to contain code that was not Free ';
@ -296,11 +294,11 @@
echo '<a href="http://sourceforge.net/projects/egroupwaregroup">';
echo 'our project page at sourceforge.net</a>. Please copy and paste ';
echo 'the following information into the bug report:<br>';
echo '<b>Summary<b>: ' . $GLOBALS['phpgw_info']['flags']['currentapp'];
echo '<b>Summary<b>: ' . $GLOBALS['egw_info']['flags']['currentapp'];
echo 'calls class.validator.inc.php';
echo 'Information:<br> The call was found when calling: ' . $_SERVER['QUERY_STRING'];
echo '<br><br>This application will now halt!<br><br>';
echo '<a href="'. $GLOBALS['phpgw']->link('/home.php') .'">Return to Home Screen</a>';
echo '<a href="'. $GLOBALS['egw']->link('/home.php') .'">Return to Home Screen</a>';
exit;
}
}

View File

@ -1,51 +1,51 @@
<?php
/**************************************************************************\
* eGroupWare - API htmlarea translations (according to lang in user prefs) *
* http://www.eGroupWare.org *
* Modified by Ralf Becker <RalfBecker@outdoor-training.de> *
* This file is derived from htmlareas's lang/en.js file *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/**************************************************************************\
* eGroupWare - API htmlarea translations (according to lang in user prefs) *
* http://www.eGroupWare.org *
* Modified by Ralf Becker <RalfBecker@outdoor-training.de> *
* This file is derived from htmlareas's lang/en.js file *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
/* $Id$ */
$GLOBALS['phpgw_info']['flags'] = Array(
'currentapp' => 'home', // can't be phpgwapi, nor htmlarea (no own directory)
'noheader' => True,
'nonavbar' => True,
'noappheader' => True,
'noappfooter' => True,
'nofooter' => True,
'nocachecontrol' => True // allow cacheing
);
$GLOBALS['egw_info']['flags'] = Array(
'currentapp' => 'home', // can't be phpgwapi, nor htmlarea (no own directory)
'noheader' => True,
'nonavbar' => True,
'noappheader' => True,
'noappfooter' => True,
'nofooter' => True,
'nocachecontrol' => True // allow cacheing
);
include('../../header.inc.php');
header('Content-type: text/javascript; charset='.$GLOBALS['phpgw']->translation->charset());
$GLOBALS['phpgw']->translation->add_app('htmlarea');
include('../../header.inc.php');
header('Content-type: text/javascript; charset='.$GLOBALS['egw']->translation->charset());
$GLOBALS['egw']->translation->add_app('htmlarea');
// I18N constants
// I18N constants
// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
// Author: Mihai Bazon, <mishoo@infoiasi.ro>
// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
// Author: Mihai Bazon, <mishoo@infoiasi.ro>
// FOR TRANSLATORS:
//
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
// (at least a valid email address)
//
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
// (if this is not possible, please include a comment
// that states what encoding is necessary.)
// FOR TRANSLATORS:
//
// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
// (at least a valid email address)
//
// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
// (if this is not possible, please include a comment
// that states what encoding is necessary.)
?>
HTMLArea.I18N = {
// the following should be the filename without .js extension
// it will be used for automatically load plugin language.
lang: "<?php echo $GLOBALS['phpgw_info']['user']['preferences']['common']['lang']; ?>",
lang: "<?php echo $GLOBALS['egw_info']['user']['preferences']['common']['lang']; ?>",
tooltips: {
bold: "<?php echo lang('Bold'); ?>",