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
/**
* class.dvEditor.php
* @package gulliver.system
*
*
* @package gulliver.system
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* 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,
* 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.
*
*
* 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/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
//XmlForm_Field_DVEditor
/**
/**
* XmlForm_Field_HTML class definition
* It is useful to see dynaforms how are built
*
* @package gulliver.system
* @author
* @author
*
* @copyright (C) 2002 by Colosa Development Team.
*
*/
class XmlForm_Field_HTML extends XmlForm_Field
{
var $toolbarSet = 'smallToolBar';
var $width = '100%';
var $height = '200' ;
var $defaultValue ='<br/>';
/**
* render function is drawing the dynaform
* @author
*
* @access public
* @param string $value
* @param string $owner
* @return string
*
*/
function render( $value , $owner=NULL ) {
$value = ($value=='')?'<br/>':$value;
$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
* @param string $element
* @return string
*
*/
function attachEvents($element) {
$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;
}
public $toolbarSet = 'smallToolBar';
public $width = '100%';
public $height = '200';
public $defaultValue = '<br/>';
/**
* render function is drawing the dynaform
*
* @author
*
*
* @access public
* @param string $value
* @param string $owner
* @return string
*
*/
public function render ($value, $owner = null)
{
$value = ($value == '') ? '<br/>' : $value;
$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
* @param string $element
* @return string
*
*/
public function attachEvents ($element)
{
$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
/**
* class.error.php
* @package gulliver.system
*
*
* @package gulliver.system
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* 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,
* 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.
*
*
* 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/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
/**
*
* @package gulliver.system
*/
*
*/
require_once 'PEAR.php';
/**
* G_Error implements a class for reporting portable database error
* 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
{
/**
* G_Error constructor
*
* @param mixed $code error code, or string with error message
* @param int $mode what "error mode" to operate in
* @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
*/
function G_Error($code = G_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null) {
if (is_int($code)) {
$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);
/**
* G_Error constructor
*
* @param mixed $code error code, or string with error message
* @param int $mode what "error mode" to operate in
* @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
*/
public function G_Error ($code = G_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
{
if (is_int( $code )) {
$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
* @author
* @access public
* @param string $code
* @return string
*
*/
function errorMessage ( $code ) {
static $gErrorMessages;
if ( $code < 0 && $code > -100 ) {
return DB::errorMessage ( $code );
/**
* this function returns the kind of Error
*
* @author
*
* @access public
* @param string $code
* @return string
*
*/
public function 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
/**
* HttpProxyController
*
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
* @package gulliver.system
* @access public
*/
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);
parent::__construct( $message, 1 );
}
public function __toString() {
public function __toString ()
{
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}
}

View File

@@ -1,11 +1,13 @@
<?php
/**
* class.xmlMenu.php
* @package gulliver.system
*
* @package gulliver.system
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* 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,
* 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.
*
*
* 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/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*
*/
/**
/**
*
* @package gulliver.system
*/
class xmlMenu extends form
{
var $type = 'xmlmenu';
}
class xmlMenu extends form
{
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
*
* @param string $xmlNode
* @param string $lang default value 'en'
* @param string $home default value ''
* @param string $owner
* @param string $xmlNode
* @param string $lang default value 'en'
* @param string $home default value ''
* @param string $owner
*
* @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);
$this->home = $home;
parent::XmlForm_Field( $xmlNode, $lang, $home, $owner );
$this->home = $home;
}
/**
* render
*
* @param string $value
* @param string $value
*
* @return object $out
*/
function render( $value )
{
$this->xmlMenu = new xmlMenu( $this->xmlfile , $this->home );
$this->xmlMenu->setValues($value);
$this->type = 'xmlmenuDyn';
$template = PATH_CORE . 'templates/' . $this->type . '.html';
$out = $this->xmlMenu->render( $template , $scriptCode ) ;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( $this->xmlMenu->scriptURL );
$oHeadPublisher->addScriptCode( $scriptCode );
return $out;
*/
public function render ($value)
{
$this->xmlMenu = new xmlMenu( $this->xmlfile, $this->home );
$this->xmlMenu->setValues( $value );
$this->type = 'xmlmenuDyn';
$template = PATH_CORE . 'templates/' . $this->type . '.html';
$out = $this->xmlMenu->render( $template, $scriptCode );
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( $this->xmlMenu->scriptURL );
$oHeadPublisher->addScriptCode( $scriptCode );
return $out;
}
/**
* renderGrid
*
* @param string $value
* @param string $value
*
* @return none
*/
function renderGrid ($value)
*/
public function renderGrid ($value)
{
return $this->render($value);
return $this->render( $value );
}
}
}