CODE STYLE /gulliver/system/

files modified:   class.dvEditor.php
                  class.error.php
                  class.pagedTable.php
                  class.phpSqlParser.php
                  class.pmException.php
                  class.xmlMenu.php
This commit is contained in:
Ralph Asendeteufrer
2012-10-17 14:28:05 -04:00
parent 6e190143c8
commit a226a645d1
6 changed files with 2568 additions and 3043 deletions

View File

@@ -1,11 +1,13 @@
<?php <?php
/** /**
* class.dvEditor.php * class.dvEditor.php
* @package gulliver.system *
* * @package gulliver.system
*
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -13,65 +15,74 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
//XmlForm_Field_DVEditor //XmlForm_Field_DVEditor
/** /**
* XmlForm_Field_HTML class definition * XmlForm_Field_HTML class definition
* It is useful to see dynaforms how are built * It is useful to see dynaforms how are built
*
* @package gulliver.system * @package gulliver.system
* @author * @author
*
* @copyright (C) 2002 by Colosa Development Team. * @copyright (C) 2002 by Colosa Development Team.
* *
*/ */
class XmlForm_Field_HTML extends XmlForm_Field class XmlForm_Field_HTML extends XmlForm_Field
{ {
var $toolbarSet = 'smallToolBar'; public $toolbarSet = 'smallToolBar';
var $width = '100%'; public $width = '100%';
var $height = '200' ; public $height = '200';
var $defaultValue ='<br/>'; public $defaultValue = '<br/>';
/** /**
* render function is drawing the dynaform * render function is drawing the dynaform
* @author *
* * @author
* @access public *
* @param string $value *
* @param string $owner * @access public
* @return string * @param string $value
* * @param string $owner
*/ * @return string
function render( $value , $owner=NULL ) { *
$value = ($value=='')?'<br/>':$value; */
$html = "<div style='width:" . $this->width . ";'>" ; public function render ($value, $owner = null)
$html .= "<input id='form[" . $this->name . "]' name='form[" . $this->name . "]' type='hidden' value=' " . htmlentities($value,ENT_QUOTES,'UTF-8') . "' />"; {
$html .= "</div>"; $value = ($value == '') ? '<br/>' : $value;
return $html; $html = "<div style='width:" . $this->width . ";'>";
} $html .= "<input id='form[" . $this->name . "]' name='form[" . $this->name . "]' type='hidden' value=' " . htmlentities( $value, ENT_QUOTES, 'UTF-8' ) . "' />";
$html .= "</div>";
/** return $html;
* attachEvents function is putting its events }
* @author
* /**
* @access public * attachEvents function is putting its events
* @param string $element *
* @return string * @author
* *
*/ *
function attachEvents($element) { * @access public
* @param string $element
$html='window._editor'.$this->name.'=new DVEditor(getField("'.$this->name.'").parentNode,getField("'.$this->name.'").value,element,"' . $this->height . '","'.$this->mode.'");'; * @return string
if($this->mode=="edit") *
$html.='window._editor'.$this->name.'.loadToolBar("/js/dveditor/core/toolbars/'.$this->toolbarSet.'.html");'; */
$html.='window._editor'.$this->name.'.syncHidden("window._editor'.$this->name.'");'; public function attachEvents ($element)
return $html; {
} $html = 'window._editor' . $this->name . '=new DVEditor(getField("' . $this->name . '").parentNode,getField("' . $this->name . '").value,element,"' . $this->height . '","' . $this->mode . '");';
if ($this->mode == "edit") {
$html .= 'window._editor' . $this->name . '.loadToolBar("/js/dveditor/core/toolbars/' . $this->toolbarSet . '.html");';
}
$html .= 'window._editor' . $this->name . '.syncHidden("window._editor' . $this->name . '");';
return $html;
}
} }

View File

@@ -1,11 +1,12 @@
<?php <?php
/** /**
* class.error.php * class.error.php
* @package gulliver.system *
* * @package gulliver.system
*
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -13,100 +14,105 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
/** /**
*
* @package gulliver.system * @package gulliver.system
*/ *
*/
require_once 'PEAR.php'; require_once 'PEAR.php';
/** /**
* G_Error implements a class for reporting portable database error * G_Error implements a class for reporting portable database error
* messages * messages
*/
define( 'G_ERROR', - 100 );
define( 'DB_ERROR_FEATURE_NOT_AVAILABLE', - 101 );
define( 'DB_ERROR_OBJECT_NOT_DEFINED', - 102 );
define( 'G_ERROR_WARNING_MESSAGE', - 103 );
define( 'G_ERROR_DBCONNECTION', - 104 );
define( 'G_ERROR_SYSTEM_UID', - 105 );
define( 'G_ERROR_SYSTEM_CODE', - 106 );
define( 'G_ERROR_ROLE_UID', - 107 );
define( 'G_ERROR_ROLE_CODE', - 108 );
define( 'G_ERROR_PERMISSION_UID', - 109 );
define( 'G_ERROR_PERMISSION_CODE', - 110 );
define( 'G_ERROR_USER_UID', - 111 );
define( 'G_ERROR_USER_USERNAME', - 112 );
define( 'G_ERROR_USERNAME_EMPTY', - 113 );
define( 'G_ERROR_PASSWORD_EMPTY', - 114 );
define( 'G_ERROR_PASSWORD_INCORRECT', - 115 );
define( 'G_ERROR_USER_INACTIVE', - 116 );
define( 'G_ERROR_DUE_DATE', - 117 );
define( 'G_ERROR_ALREADY_ASSIGNED', - 118 );
/**
*
* @package gulliver.system
* *
*/ */
define('G_ERROR', -100);
define('DB_ERROR_FEATURE_NOT_AVAILABLE', -101);
define('DB_ERROR_OBJECT_NOT_DEFINED', -102);
define('G_ERROR_WARNING_MESSAGE', -103);
define('G_ERROR_DBCONNECTION', -104);
define('G_ERROR_SYSTEM_UID', -105);
define('G_ERROR_SYSTEM_CODE', -106);
define('G_ERROR_ROLE_UID', -107);
define('G_ERROR_ROLE_CODE', -108);
define('G_ERROR_PERMISSION_UID', -109);
define('G_ERROR_PERMISSION_CODE', -110);
define('G_ERROR_USER_UID', -111);
define('G_ERROR_USER_USERNAME', -112);
define('G_ERROR_USERNAME_EMPTY', -113);
define('G_ERROR_PASSWORD_EMPTY', -114);
define('G_ERROR_PASSWORD_INCORRECT', -115);
define('G_ERROR_USER_INACTIVE', -116);
define('G_ERROR_DUE_DATE', -117);
define('G_ERROR_ALREADY_ASSIGNED', -118);
/**
* @package gulliver.system
*/
class G_Error extends PEAR_Error class G_Error extends PEAR_Error
{ {
/**
* G_Error constructor /**
* * G_Error constructor
* @param mixed $code error code, or string with error message *
* @param int $mode what "error mode" to operate in * @param mixed $code error code, or string with error message
* @param int $level what error level to use for $mode &PEAR_ERROR_TRIGGER * @param int $mode what "error mode" to operate in
* @param mixed $debuginfo additional debug info, such as the last query * @param int $level what error level to use for $mode &PEAR_ERROR_TRIGGER
* * @param mixed $debuginfo additional debug info, such as the last query
* @see PEAR_Error *
*/ * @see PEAR_Error
function G_Error($code = G_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null) { */
if (is_int($code)) { public function G_Error ($code = G_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
$this->PEAR_Error('G Error: ' . G_Error::errorMessage($code), $code, $mode, $level, $debuginfo); {
} else { if (is_int( $code )) {
$this->PEAR_Error("G Error: $code", DB_ERROR, $mode, $level, $debuginfo); $this->PEAR_Error( 'G Error: ' . G_Error::errorMessage( $code ), $code, $mode, $level, $debuginfo );
} else {
$this->PEAR_Error( "G Error: $code", DB_ERROR, $mode, $level, $debuginfo );
}
} }
}
/** /**
* this function returns the kind of Error * this function returns the kind of Error
* @author *
* @access public * @author
* @param string $code *
* @return string * @access public
* * @param string $code
*/ * @return string
function errorMessage ( $code ) { *
static $gErrorMessages; */
if ( $code < 0 && $code > -100 ) { public function errorMessage ($code)
return DB::errorMessage ( $code ); {
static $gErrorMessages;
if ($code < 0 && $code > - 100) {
return DB::errorMessage( $code );
} else {
if (! isset( $gErrorMessages )) {
$gErrorMessages = array (G_ERROR => 'unknown error',DB_ERROR_FEATURE_NOT_AVAILABLE => 'this function or feature is not available for this database engine',DB_ERROR_OBJECT_NOT_DEFINED => 'Object or variable not defined',G_ERROR_WARNING_MESSAGE => 'Warning message'
);
}
/*
if (DB::isError($code)) {
$code = $code->getCode();
}
*/
return isset( $gErrorMessages[$code] ) ? $gErrorMessages[$code] : (isset( $errorMessages ) ? $errorMessages['G_ERROR'] : '');
}
} }
else {
if (!isset($gErrorMessages)) {
$gErrorMessages = array(
G_ERROR => 'unknown error',
DB_ERROR_FEATURE_NOT_AVAILABLE => 'this function or feature is not available for this database engine',
DB_ERROR_OBJECT_NOT_DEFINED => 'Object or variable not defined',
G_ERROR_WARNING_MESSAGE => 'Warning message',
);
}
/*
if (DB::isError($code)) {
$code = $code->getCode();
}
*/
return isset($gErrorMessages[$code]) ? $gErrorMessages[$code] : (isset($errorMessages) ? $errorMessages['G_ERROR'] : '');
}
}
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +1,24 @@
<?php <?php
/** /**
* HttpProxyController * HttpProxyController
*
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com> * @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
* @package gulliver.system * @package gulliver.system
* @access public * @access public
*/ */
class PMException extends Exception class PMException extends Exception
{ {
public function __construct($message, $code = 0, $previous = null) {
public function __construct ($message, $code = 0, $previous = null)
{
//parent::__construct($message, 1, $previous); //parent::__construct($message, 1, $previous);
parent::__construct($message, 1); parent::__construct( $message, 1 );
} }
public function __toString() { public function __toString ()
{
return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
} }
} }

View File

@@ -1,11 +1,13 @@
<?php <?php
/** /**
* class.xmlMenu.php * class.xmlMenu.php
* @package gulliver.system *
* @package gulliver.system
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc. * Copyright (C) 2004 - 2011 Colosa Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
@@ -13,87 +15,88 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
/** /**
*
* @package gulliver.system * @package gulliver.system
*/ */
class xmlMenu extends form class xmlMenu extends form
{ {
var $type = 'xmlmenu'; public $type = 'xmlmenu';
} }
/**
* XmlForm_Field_XmlMenu
*
* extends XmlForm_Field
*
* @package gulliver.system
*
*/
class XmlForm_Field_XmlMenu extends XmlForm_Field
{
public $xmlfile = '';
public $type = 'xmlmenuDyn';
public $xmlMenu;
public $home = '';
public $withoutLabel = true;
/**
* XmlForm_Field_XmlMenu
*
* extends XmlForm_Field
* @package gulliver.system
*
*/
class XmlForm_Field_XmlMenu extends XmlForm_Field
{
var $xmlfile = '';
var $type = 'xmlmenuDyn';
var $xmlMenu;
var $home ='';
var $withoutLabel = true;
/** /**
* XmlForm_Field_XmlMenu * XmlForm_Field_XmlMenu
* *
* @param string $xmlNode * @param string $xmlNode
* @param string $lang default value 'en' * @param string $lang default value 'en'
* @param string $home default value '' * @param string $home default value ''
* @param string $owner * @param string $owner
* *
* @return none * @return none
*/ */
function XmlForm_Field_XmlMenu($xmlNode, $lang = 'en', $home = '', $owner) public function XmlForm_Field_XmlMenu ($xmlNode, $lang = 'en', $home = '', $owner = null)
{ {
parent::XmlForm_Field($xmlNode, $lang, $home, $owner); parent::XmlForm_Field( $xmlNode, $lang, $home, $owner );
$this->home = $home; $this->home = $home;
} }
/** /**
* render * render
* *
* @param string $value * @param string $value
* *
* @return object $out * @return object $out
*/ */
function render( $value ) public function render ($value)
{ {
$this->xmlMenu = new xmlMenu( $this->xmlfile , $this->home ); $this->xmlMenu = new xmlMenu( $this->xmlfile, $this->home );
$this->xmlMenu->setValues($value); $this->xmlMenu->setValues( $value );
$this->type = 'xmlmenuDyn'; $this->type = 'xmlmenuDyn';
$template = PATH_CORE . 'templates/' . $this->type . '.html'; $template = PATH_CORE . 'templates/' . $this->type . '.html';
$out = $this->xmlMenu->render( $template , $scriptCode ) ; $out = $this->xmlMenu->render( $template, $scriptCode );
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( $this->xmlMenu->scriptURL ); $oHeadPublisher->addScriptFile( $this->xmlMenu->scriptURL );
$oHeadPublisher->addScriptCode( $scriptCode ); $oHeadPublisher->addScriptCode( $scriptCode );
return $out; return $out;
} }
/** /**
* renderGrid * renderGrid
* *
* @param string $value * @param string $value
* *
* @return none * @return none
*/ */
function renderGrid ($value) public function renderGrid ($value)
{ {
return $this->render($value); return $this->render( $value );
} }
}
}