CODE STYLE gulliver/system/

files modified:    class.filterForm.php
                    class.publisher.php
                    class.xmlform.php
                    class.ymlDomain.php
This commit is contained in:
Ralph Asendeteufrer
2012-10-17 18:15:15 -04:00
parent fb28adbe7f
commit 05758ea812
4 changed files with 5570 additions and 5175 deletions

View File

@@ -1,6 +1,8 @@
<?php <?php
/** /**
* class.filterForm.php * class.filterForm.php
*
* @package gulliver.system * @package gulliver.system
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
@@ -25,27 +27,32 @@
*/ */
/** /**
*
* @package gulliver.system * @package gulliver.system
**/ *
*/
class filterForm extends form class filterForm extends form
{ {
var $cols = 3; public $cols = 3;
var $type = 'filterform'; public $type = 'filterform';
var $ajaxServer = '../gulliver/pagedTableAjax'; public $ajaxServer = '../gulliver/pagedTableAjax';
/** /**
* this function is putting the filters * this function is putting the filters
*
* @author * @author
* *
*
* @access public * @access public
* @param string $template * @param string $template
* @param string $scriptContent * @param string $scriptContent
* @return string * @return string
*/ */
function render( $template, &$scriptContent ) public function render ($template, &$scriptContent)
{ {
$this->cols = intVal( $this->cols ); $this->cols = intVal( $this->cols );
return parent::render( $template, $scriptContent ); return parent::render( $template, $scriptContent );
} }
} }

View File

@@ -1,6 +1,8 @@
<?php <?php
/** /**
* class.publisher.php * class.publisher.php
*
* @package gulliver.system * @package gulliver.system
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
@@ -27,6 +29,7 @@
/** /**
* Publisher class definition * Publisher class definition
* It is to publish all content in a page * It is to publish all content in a page
*
* @package gulliver.system * @package gulliver.system
* @author Fernando Ontiveros Lira <fernando@colosa.com> * @author Fernando Ontiveros Lira <fernando@colosa.com>
* @copyright (C) 2002 by Colosa Development Team. * @copyright (C) 2002 by Colosa Development Team.
@@ -34,21 +37,22 @@
*/ */
class Publisher class Publisher
{ {
var $Parts = NULL; public $Parts = null;
var $dbc = NULL; public $dbc = null;
var $scriptFile = ''; public $scriptFile = '';
var $publisherId = 'publisherContent'; public $publisherId = 'publisherContent';
var $localMode = ''; public $localMode = '';
var $publishType; public $publishType;
var $ROWS_PER_PAGE = null; public $ROWS_PER_PAGE = null;
/* PHP 4 doesn't provide destructor where to free $scriptFileHandler resource */ /* PHP 4 doesn't provide destructor where to free $scriptFileHandler resource */
//var $scriptFileHandler = FALSE; //var $scriptFileHandler = false;
/** /**
* Add content in $Parts array * Add content in $Parts array
*
* @author Fernando Ontiveros Lira <fernando@colosa.com> * @author Fernando Ontiveros Lira <fernando@colosa.com>
* *
* @param $strType * @param $strType
@@ -60,7 +64,7 @@ class Publisher
* @return void * @return void
* *
*/ */
function AddContent( $strType = "form", $strLayout = "form", $strName = "", $strContent = "", $arrData = NULL, $strTarget = "", $ajaxServer='', $mode='', $bAbsolutePath = false) public function AddContent ($strType = "form", $strLayout = "form", $strName = "", $strContent = "", $arrData = null, $strTarget = "", $ajaxServer = '', $mode = '', $bAbsolutePath = false)
{ {
if ($mode != '') { if ($mode != '') {
$this->localMode = $mode; $this->localMode = $mode;
@@ -69,15 +73,7 @@ class Publisher
if (is_array( $this->Parts )) { if (is_array( $this->Parts )) {
$pos = count( $this->Parts ); $pos = count( $this->Parts );
} }
$this->Parts[$pos] = array( $this->Parts[$pos] = array ('Type' => $strType,'Template' => $strLayout,'File' => $strName,'Content' => $strContent,'Data' => $arrData,'Target' => $strTarget,'ajaxServer' => $ajaxServer,'AbsolutePath' => $bAbsolutePath
'Type' => $strType,
'Template' => $strLayout,
'File' => $strName,
'Content' => $strContent,
'Data' => $arrData,
'Target' => $strTarget,
'ajaxServer' => $ajaxServer,
'AbsolutePath' => $bAbsolutePath
); );
//This is needed to prepare the "header content" //This is needed to prepare the "header content"
@@ -89,37 +85,36 @@ class Publisher
$this->Parts[$pos]['RenderedContent'] = '<DIV id="' . $this->publisherId . '[' . $pos . ']" style="' . ((is_string( $strContent )) ? $strContent : '') . '; margin:0px;" align="center">'; $this->Parts[$pos]['RenderedContent'] = '<DIV id="' . $this->publisherId . '[' . $pos . ']" style="' . ((is_string( $strContent )) ? $strContent : '') . '; margin:0px;" align="center">';
$this->Parts[$pos]['RenderedContent'] .= ob_get_contents(); $this->Parts[$pos]['RenderedContent'] .= ob_get_contents();
$this->Parts[$pos]['RenderedContent'] .= '</DIV>'; $this->Parts[$pos]['RenderedContent'] .= '</DIV>';
} } else {
else {
$this->Parts[$pos]['RenderedContent'] = ob_get_contents(); $this->Parts[$pos]['RenderedContent'] = ob_get_contents();
} }
ob_end_clean(); ob_end_clean();
} }
/** /**
* Function RenderContent * Function RenderContent
*
* @author David S. Callizaya S. <davidsantos@colosa.com> * @author David S. Callizaya S. <davidsantos@colosa.com>
* @access public * @access public
* @param eter string intPos * @param eter string intPos
* @param eter string showXMLFormName * @param eter string showXMLFormName
* @return string * @return string
*/ */
function RenderContent( $intPos = 0) public function RenderContent ($intPos = 0)
{ {
print $this->Parts[$intPos]['RenderedContent']; print $this->Parts[$intPos]['RenderedContent'];
} }
/** /**
* It Renders content according to Part['Type'] * It Renders content according to Part['Type']
*
* @author Fernando Ontiveros Lira <fernando@colosa.com> * @author Fernando Ontiveros Lira <fernando@colosa.com>
* *
* @param intPos = 0 * @param intPos = 0
* @return void * @return void
* *
*/ */
function RenderContent0( $intPos = 0, $showXMLFormName = false) public function RenderContent0 ($intPos = 0, $showXMLFormName = false)
{ {
global $G_FORM; global $G_FORM;
global $G_TABLE; global $G_TABLE;
@@ -133,44 +128,42 @@ class Publisher
$Part = $this->Parts[$intPos]; $Part = $this->Parts[$intPos];
$this->publishType = $Part['Type']; $this->publishType = $Part['Type'];
switch( $this->publishType ) switch ($this->publishType) {
{
case 'externalContent': case 'externalContent':
$G_CONTENT = new Content; $G_CONTENT = new Content();
if( $Part['Content'] != "" ) $G_CONTENT = G::LoadContent( $Part['Content'] ); if ($Part['Content'] != "") {
$G_CONTENT = G::LoadContent( $Part['Content'] );
}
G::LoadTemplateExternal( $Part['Template'] ); G::LoadTemplateExternal( $Part['Template'] );
break; break;
case 'image': case 'image':
$G_IMAGE_FILENAME = $Part['File']; $G_IMAGE_FILENAME = $Part['File'];
$G_IMAGE_PARTS = $Part['Data']; $G_IMAGE_PARTS = $Part['Data'];
break; break;
case 'appform': case 'appform':
global $APP_FORM; global $APP_FORM;
$G_FORM = $APP_FORM; $G_FORM = $APP_FORM;
break; break;
case 'xmlform': case 'xmlform':
case 'dynaform': case 'dynaform':
global $G_FORM; global $G_FORM;
if ($Part['AbsolutePath']) { if ($Part['AbsolutePath']) {
$sPath = $Part['AbsolutePath']; $sPath = $Part['AbsolutePath'];
} } else {
else { if ($this->publishType == 'xmlform') {
if ($this->publishType == 'xmlform')
$sPath = PATH_XMLFORM; $sPath = PATH_XMLFORM;
else } else {
$sPath = PATH_DYNAFORM; $sPath = PATH_DYNAFORM;
} }
}
//if the xmlform file doesn't exists, then try with the plugins folders //if the xmlform file doesn't exists, then try with the plugins folders
if (! is_file( $sPath . $Part['File'] . '.xml' )) { if (! is_file( $sPath . $Part['File'] . '.xml' )) {
$aux = explode( PATH_SEP, $Part['File'] ); $aux = explode( PATH_SEP, $Part['File'] );
//check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment
if(count($aux) > 2){//Subfolders if (count( $aux ) > 2) {
//Subfolders
$filename = array_pop( $aux ); $filename = array_pop( $aux );
$aux0 = implode( PATH_SEP, $aux ); $aux0 = implode( PATH_SEP, $aux );
$aux = array (); $aux = array ();
@@ -188,43 +181,40 @@ class Publisher
} }
} }
} }
if (!class_exists($Part['Template']) || $Part['Template']==='xmlform') if (! class_exists( $Part['Template'] ) || $Part['Template'] === 'xmlform') {
$G_FORM = new Form( $Part['File'], $sPath, SYS_LANG, false ); $G_FORM = new Form( $Part['File'], $sPath, SYS_LANG, false );
else } else {
eval( '$G_FORM = new ' . $Part['Template'] . ' ( $Part[\'File\'] , "' . $sPath . '");' ); eval( '$G_FORM = new ' . $Part['Template'] . ' ( $Part[\'File\'] , "' . $sPath . '");' );
}
if (($this->publishType == 'dynaform') && (($Part['Template'] == 'xmlform') || ($Part['Template'] == 'xmlform_preview')) ) if (($this->publishType == 'dynaform') && (($Part['Template'] == 'xmlform') || ($Part['Template'] == 'xmlform_preview'))) {
{
$dynaformShow = (isset( $G_FORM->printdynaform ) && ($G_FORM->printdynaform)) ? 'gulliver/dynaforms_OptionsPrint' : 'gulliver/dynaforms_Options'; $dynaformShow = (isset( $G_FORM->printdynaform ) && ($G_FORM->printdynaform)) ? 'gulliver/dynaforms_OptionsPrint' : 'gulliver/dynaforms_Options';
$G_FORM->fields=G::array_merges( $G_FORM->fields = G::array_merges( array ('__DYNAFORM_OPTIONS' => new XmlForm_Field_XmlMenu( new Xml_Node( '__DYNAFORM_OPTIONS', 'complete', '', array ('type' => 'xmlmenu','xmlfile' => $dynaformShow
array('__DYNAFORM_OPTIONS' => new XmlForm_Field_XmlMenu( ) ), SYS_LANG, PATH_XMLFORM, $G_FORM )
new Xml_Node( ), $G_FORM->fields );
'__DYNAFORM_OPTIONS',
'complete',
'',
array('type'=>'xmlmenu','xmlfile'=>$dynaformShow)
),SYS_LANG,PATH_XMLFORM,$G_FORM) ),
$G_FORM->fields);
} }
//Needed to make ajax calls //Needed to make ajax calls
//The action in the form tag. //The action in the form tag.
if ( defined ( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes' ) if (defined( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes') {
$G_FORM->action = urlencode( G::encrypt( $Part['Target'], URL_KEY ) ); $G_FORM->action = urlencode( G::encrypt( $Part['Target'], URL_KEY ) );
else } else {
$G_FORM->action = $Part['Target']; $G_FORM->action = $Part['Target'];
}
if (!(isset($Part['ajaxServer']) && ($Part['ajaxServer']!==''))) if (! (isset( $Part['ajaxServer'] ) && ($Part['ajaxServer'] !== ''))) {
if ($this->publishType == 'dynaform') if ($this->publishType == 'dynaform') {
$Part['ajaxServer'] = '../gulliver/defaultAjaxDynaform'; $Part['ajaxServer'] = '../gulliver/defaultAjaxDynaform';
else } else {
$Part['ajaxServer'] = '../gulliver/defaultAjax'; $Part['ajaxServer'] = '../gulliver/defaultAjax';
}
if ( defined ( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes' ) }
if (defined( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes') {
$G_FORM->ajaxServer = urlencode( G::encrypt( $Part['ajaxServer'], URL_KEY ) ); $G_FORM->ajaxServer = urlencode( G::encrypt( $Part['ajaxServer'], URL_KEY ) );
else } else {
$G_FORM->ajaxServer = $Part['ajaxServer']; $G_FORM->ajaxServer = $Part['ajaxServer'];
}
$G_FORM->setValues( $Part['Data'] ); $G_FORM->setValues( $Part['Data'] );
@@ -232,11 +222,9 @@ class Publisher
//Asegurese de que no entre cuando $Part['Template']=="grid" //Asegurese de que no entre cuando $Part['Template']=="grid"
//de hecho soo deberia usarse cuando $Part['Template']=="xmlform" //de hecho soo deberia usarse cuando $Part['Template']=="xmlform"
if ((($this->publishType == 'dynaform') && $Part['Template']=="xmlform") || ($Part['Template']=="xmlform")) if ((($this->publishType == 'dynaform') && $Part['Template'] == "xmlform") || ($Part['Template'] == "xmlform")) {
{ $G_FORM->values = G::array_merges( array ('__DYNAFORM_OPTIONS' => isset( $Part['Data']['__DYNAFORM_OPTIONS'] ) ? $Part['Data']['__DYNAFORM_OPTIONS'] : ''
$G_FORM->values=G::array_merges( ), $G_FORM->values );
array('__DYNAFORM_OPTIONS' => isset($Part['Data']['__DYNAFORM_OPTIONS'])? $Part['Data']['__DYNAFORM_OPTIONS']:''),
$G_FORM->values);
if (isset( $G_FORM->nextstepsave )) { if (isset( $G_FORM->nextstepsave )) {
switch ($G_FORM->nextstepsave) { switch ($G_FORM->nextstepsave) {
// this condition validates if the next step link is configured to Save and Go the next step or show a prompt // this condition validates if the next step link is configured to Save and Go the next step or show a prompt
@@ -251,11 +239,13 @@ class Publisher
} }
} }
} }
if (isset($_SESSION)) $_SESSION[$G_FORM->id]=$G_FORM->values; if (isset( $_SESSION )) {
$_SESSION[$G_FORM->id] = $G_FORM->values;
}
// by default load the core template // by default load the core template
if ($Part['Template'] == 'xmlform_preview') if ($Part['Template'] == 'xmlform_preview') {
$Part['Template'] = 'xmlform'; $Part['Template'] = 'xmlform';
}
$template = PATH_CORE . 'templates/' . $Part['Template'] . '.html'; $template = PATH_CORE . 'templates/' . $Part['Template'] . '.html';
@@ -264,28 +254,34 @@ class Publisher
// first, verify if the template exists on base skins path // first, verify if the template exists on base skins path
if (is_file( G::ExpandPath( "skinEngine" ) . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html' )) { if (is_file( G::ExpandPath( "skinEngine" ) . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html' )) {
$template = G::ExpandPath( "skinEngine" ) . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html'; $template = G::ExpandPath( "skinEngine" ) . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html';
}
// second, verify if the template exists on user skins path // second, verify if the template exists on user skins path
else if (is_file(PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html')) { } elseif (is_file( PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html' )) {
$template = PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html'; $template = PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html';
} }
} }
//end new feature //end new feature
if ($Part['Template'] == 'grid') print ('<form class="formDefault">');
if ($Part['Template'] == 'grid') {
print ('<form class="formDefault">') ;
}
$scriptCode = ''; $scriptCode = '';
if($this->localMode != '') { // @# las modification by erik in 09/06/2008 if ($this->localMode != '') {
// @# las modification by erik in 09/06/2008
$G_FORM->mode = $this->localMode; $G_FORM->mode = $this->localMode;
} }
print $G_FORM->render( $template, $scriptCode ); print $G_FORM->render( $template, $scriptCode );
if ($Part['Template'] == 'grid') print ('</form>'); if ($Part['Template'] == 'grid') {
print ('</form>') ;
}
$oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( $G_FORM->scriptURL ); $oHeadPublisher->addScriptFile( $G_FORM->scriptURL );
$oHeadPublisher->addScriptCode( $scriptCode ); $oHeadPublisher->addScriptCode( $scriptCode );
/** /**
* We've implemented the conditional show hide fields.. * We've implemented the conditional show hide fields..
*
* @author Erik A. Ortiz <erik@colosa.com> * @author Erik A. Ortiz <erik@colosa.com>
* @date Fri Feb 19, 2009 * @date Fri Feb 19, 2009
*/ */
@@ -296,7 +292,6 @@ class Publisher
#This dynaform has show/hide field conditions #This dynaform has show/hide field conditions
$ConditionalShowHideRoutines = $oFieldCondition->getConditionScript( $_SESSION['CURRENT_DYN_UID'] ); $ConditionalShowHideRoutines = $oFieldCondition->getConditionScript( $_SESSION['CURRENT_DYN_UID'] );
} }
} }
@@ -304,10 +299,8 @@ class Publisher
G::evalJScript( $ConditionalShowHideRoutines ); G::evalJScript( $ConditionalShowHideRoutines );
} }
break; break;
case 'pagedtable': case 'pagedtable':
global $G_FORM; global $G_FORM;
//if the xmlform file doesn't exists, then try with the plugins folders //if the xmlform file doesn't exists, then try with the plugins folders
$sPath = PATH_XMLFORM; $sPath = PATH_XMLFORM;
if (! is_file( $sPath . $Part['File'] )) { if (! is_file( $sPath . $Part['File'] )) {
@@ -321,13 +314,16 @@ class Publisher
} }
$G_FORM = new Form( $Part['File'], $sPath, SYS_LANG, true ); $G_FORM = new Form( $Part['File'], $sPath, SYS_LANG, true );
if ( defined ( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes' ) if (defined( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes') {
$G_FORM->ajaxServer = urlencode( G::encrypt( $Part['ajaxServer'], URL_KEY ) ); $G_FORM->ajaxServer = urlencode( G::encrypt( $Part['ajaxServer'], URL_KEY ) );
else } else {
$G_FORM->ajaxServer = $Part['ajaxServer']; $G_FORM->ajaxServer = $Part['ajaxServer'];
}
$G_FORM->setValues( $Part['Data'] ); $G_FORM->setValues( $Part['Data'] );
if (isset($_SESSION)) $_SESSION[$G_FORM->id]=$G_FORM->values; if (isset( $_SESSION )) {
$_SESSION[$G_FORM->id] = $G_FORM->values;
}
G::LoadSystem( 'pagedTable' ); G::LoadSystem( 'pagedTable' );
$oTable = new pagedTable(); $oTable = new pagedTable();
@@ -340,8 +336,9 @@ class Publisher
$oTable->setupFromXmlform( $G_FORM ); $oTable->setupFromXmlform( $G_FORM );
if (isset($Part['ajaxServer']) && ($Part['ajaxServer']!=='')) if (isset( $Part['ajaxServer'] ) && ($Part['ajaxServer'] !== '')) {
$oTable->ajaxServer = $Part['ajaxServer']; $oTable->ajaxServer = $Part['ajaxServer'];
}
/* Start Block: Load user configuration for the pagedTable */ /* Start Block: Load user configuration for the pagedTable */
G::LoadClass( 'configuration' ); G::LoadClass( 'configuration' );
$objUID = $Part['File']; $objUID = $Part['File'];
@@ -366,8 +363,7 @@ class Publisher
default: default:
$label = ($oTable->fields[$f]['Label'] != '') ? $oTable->fields[$f]['Label'] : $f; $label = ($oTable->fields[$f]['Label'] != '') ? $oTable->fields[$f]['Label'] : $f;
$label = str_replace( "\n", ' ', $label ); $label = str_replace( "\n", ' ', $label );
$pm->fields[$f] = new XmlForm_Field_popupOption(new Xml_Node($f, 'complete', '', array('label'=>$label,'type'=>'popupOption', $pm->fields[$f] = new XmlForm_Field_popupOption( new Xml_Node( $f, 'complete', '', array ('label' => $label,'type' => 'popupOption','launch' => $oTable->id . '.showHideField("' . $f . '")' ) ) );
'launch'=>$oTable->id.'.showHideField("'.$f.'")') ) );
$pm->values[$f] = ''; $pm->values[$f] = '';
} }
} }
@@ -385,15 +381,12 @@ class Publisher
print ('</script>') ; print ('</script>') ;
/* End Block */ /* End Block */
break; break;
case 'propeltable': case 'propeltable':
global $G_FORM; global $G_FORM;
//if the xmlform file doesn't exists, then try with the plugins folders //if the xmlform file doesn't exists, then try with the plugins folders
if ($Part['AbsolutePath']) { if ($Part['AbsolutePath']) {
$sPath = ''; $sPath = '';
} } else {
else {
$sPath = PATH_XMLFORM; $sPath = PATH_XMLFORM;
} }
if (! is_file( $sPath . $Part['File'] )) { if (! is_file( $sPath . $Part['File'] )) {
@@ -421,25 +414,30 @@ class Publisher
$G_FORM = new Form( $Part['File'], $sPath, SYS_LANG, true ); $G_FORM = new Form( $Part['File'], $sPath, SYS_LANG, true );
if ( defined ( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes' ) if (defined( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes') {
$G_FORM->ajaxServer = urlencode( G::encrypt( $Part['ajaxServer'], URL_KEY ) ); $G_FORM->ajaxServer = urlencode( G::encrypt( $Part['ajaxServer'], URL_KEY ) );
else } else {
$G_FORM->ajaxServer = $Part['ajaxServer']; $G_FORM->ajaxServer = $Part['ajaxServer'];
}
if (isset($_SESSION)) $_SESSION[$G_FORM->id] = $G_FORM->values; if (isset( $_SESSION )) {
$_SESSION[$G_FORM->id] = $G_FORM->values;
}
G::LoadClass( 'propelTable' ); G::LoadClass( 'propelTable' );
$oTable = new propelTable(); $oTable = new propelTable();
$oTable->template = $Part['Template']; $oTable->template = $Part['Template'];
$oTable->criteria = $Part['Content']; $oTable->criteria = $Part['Content'];
if ( isset($Part['ajaxServer'] ) && ( $Part['ajaxServer']!=='' )) if (isset( $Part['ajaxServer'] ) && ($Part['ajaxServer'] !== '')) {
$oTable->ajaxServer = $Part['ajaxServer']; $oTable->ajaxServer = $Part['ajaxServer'];
}
$G_FORM->xmlform->fileXml = $G_FORM->fileName; $G_FORM->xmlform->fileXml = $G_FORM->fileName;
$G_FORM->xmlform->home = $G_FORM->home; $G_FORM->xmlform->home = $G_FORM->home;
$G_FORM->xmlform->tree->attribute = $G_FORM->tree->attributes; $G_FORM->xmlform->tree->attribute = $G_FORM->tree->attributes;
if ( is_array($Part['Data'] )) if (is_array( $Part['Data'] )) {
$G_FORM->values = array_merge( $G_FORM->values, $Part['Data'] ); $G_FORM->values = array_merge( $G_FORM->values, $Part['Data'] );
}
$oTable->setupFromXmlform( $G_FORM ); $oTable->setupFromXmlform( $G_FORM );
/* Start Block: Load user configuration for the pagedTable */ /* Start Block: Load user configuration for the pagedTable */
@@ -459,22 +457,22 @@ class Publisher
/* End Block */ /* End Block */
//krumo ( $Part ); //krumo ( $Part );
if ($this->ROWS_PER_PAGE) { if ($this->ROWS_PER_PAGE) {
$oTable->rowsPerPage = $this->ROWS_PER_PAGE; $oTable->rowsPerPage = $this->ROWS_PER_PAGE;
} }
try { try {
if ( is_array ( $Part['Data'] )) if (is_array( $Part['Data'] )) {
$oTable->renderTable( '', $Part['Data'] ); $oTable->renderTable( '', $Part['Data'] );
else } else {
$oTable->renderTable(); $oTable->renderTable();
print($sc);
} }
catch ( Exception $e ) { print ($sc) ;
} catch (Exception $e) {
$aMessage['MESSAGE'] = $e->getMessage(); $aMessage['MESSAGE'] = $e->getMessage();
$this->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); $this->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
} }
break; break;
case 'panel-init': case 'panel-init':
global $mainPanelScript; global $mainPanelScript;
global $panelName; global $panelName;
@@ -484,52 +482,21 @@ class Publisher
$tabCount = 0; $tabCount = 0;
$panelName = $Part['Template']; $panelName = $Part['Template'];
$data = $Part['File']; $data = $Part['File'];
if (!is_array($data)) $data=array(); if (! is_array( $data )) {
$data = G::array_merges( array( $data = array ();
'title'=>'', }
'style'=>array(), $data = G::array_merges( array ('title' => '','style' => array (),'left' => 'getAbsoluteLeft(mycontent)','top' => 'getAbsoluteTop(mycontent)','width' => 700,'height' => 600,'drag' => true,'close' => true,'modal' => true,'roll' => false,'resize' => false,'tabWidth' => 120,'tabStep' => 3,'blinkToFront' => true,'tabSpace' => 10 ), $data );
'left'=>'getAbsoluteLeft(mycontent)', $mainPanelScript = 'var ' . $panelName . '={},' . $panelName . 'Tabs=[];' . 'leimnud.event.add(window,"load",function(){'
'top'=>'getAbsoluteTop(mycontent)', . $panelName . ' = new leimnud.module.panel();' . 'var mycontent=document.getElementById("' . $this->publisherId . '['
'width'=>700, . $intPos . ']");' . $panelName . '.options={' . 'size:{w:' . $data['width'] . ',h:' . $data['height'] . '},' . 'position:{x:'
'height'=>600, . $data['left'] . ',y:' . $data['top'] . '},' . 'title:"' . addcslashes( $data['title'], '\\"' ) . '",' . 'theme:"processmaker",'
'drag'=>true, . 'statusBar:true,' . 'headerBar:true,' . 'control:{' . ' close:' . ($data['close'] ? 'true' : 'false') . ',' . ' roll:'
'close'=>true, . ($data['roll'] ? 'true' : 'false') . ',' . ' drag:' . ($data['drag'] ? 'true' : 'false') . ',' . ' resize:'
'modal'=>true, . ($data['resize'] ? 'true' : 'false') . '},' . 'fx:{' . ' drag:' . ($data['drag'] ? 'true' : 'false') . ',' . ' modal:'
'roll'=>false, . ($data['modal'] ? 'true' : 'false') . ',' . ' blinkToFront:' . ($data['blinkToFront'] ? 'true' : 'false') . '}' . '};'
'resize'=>false, . $panelName . '.setStyle=' . $json->encode( $data['style'] ) . ';' . $panelName . '.tab={' . 'width:'
'tabWidth'=>120, . ($data['tabWidth'] + $data['tabSpace']) . ',' . 'optWidth:' . $data['tabWidth'] . ',' . 'step :' . $data['tabStep']
'tabStep'=>3, . ',' . 'options:[]' . '};';
'blinkToFront'=>true,
'tabSpace'=>10), $data );
$mainPanelScript = 'var '.$panelName.'={},'.$panelName.'Tabs=[];'.
'leimnud.event.add(window,"load",function(){'.$panelName.' = new leimnud.module.panel();'.
'var mycontent=document.getElementById("'.$this->publisherId.'['.$intPos.']");'.
$panelName.'.options={'.
'size:{w:'.$data['width'].',h:'.$data['height'].'},'.
'position:{x:'.$data['left'].',y:'.$data['top'].'},'.
'title:"'.addcslashes($data['title'],'\\"').'",'.
'theme:"processmaker",'.
'statusBar:true,'.
'headerBar:true,'.
'control:{'.
' close:'.($data['close']?'true':'false').','.
' roll:'.($data['roll']?'true':'false').','.
' drag:'.($data['drag']?'true':'false').','.
' resize:'.($data['resize']?'true':'false').
'},'.
'fx:{'.
' drag:'.($data['drag']?'true':'false').','.
' modal:'.($data['modal']?'true':'false').','.
' blinkToFront:'.($data['blinkToFront']?'true':'false').
'}'.
'};'.
$panelName.'.setStyle='.$json->encode($data['style']).';'.
$panelName.'.tab={'.
'width:'.($data['tabWidth']+$data['tabSpace']).','.
'optWidth:'.$data['tabWidth'].','.
'step :'.$data['tabStep'].','.
'options:[]'.
'};';
print (' ') ; print (' ') ;
break; break;
case 'panel-tab': case 'panel-tab':
@@ -538,28 +505,16 @@ class Publisher
global $panelName; global $panelName;
$onChange = $Part['Content']; $onChange = $Part['Content'];
$beforeChange = $Part['Data']; $beforeChange = $Part['Data'];
if(SYS_LANG=='es') if (SYS_LANG == 'es') {
$mainPanelScript = str_replace( "120", "150", $mainPanelScript ); $mainPanelScript = str_replace( "120", "150", $mainPanelScript );
else } else {
$mainPanelScript = str_replace( "150", "120", $mainPanelScript ); $mainPanelScript = str_replace( "150", "120", $mainPanelScript );
$mainPanelScript .= }
$panelName.'Tabs['.$tabCount.']='. $mainPanelScript .= $panelName . 'Tabs[' . $tabCount . ']=' . 'document.getElementById("' . $Part['File'] . '");' . $panelName . '.tab.options[' . $panelName . '.tab.options.length]=' . '{' . 'title :"' . addcslashes( $Part['Template'], '\\"' ) . '",' . 'noClear :true,' . 'content :function(){' . ($beforeChange != '' ? ('if (typeof(' . $beforeChange . ')!=="undefined") {' . $beforeChange . '();}') : '') . $panelName . 'Clear();' . $panelName . 'Tabs[' . $tabCount . '].style.display="";' .
'document.getElementById("'.$Part['File'].'");'.
$panelName.'.tab.options['.$panelName.'.tab.options.length]='.
'{'.
'title :"'.addcslashes($Part['Template'],'\\"').'",'.
'noClear :true,'.
'content :function(){'.
($beforeChange!='' ? ('if (typeof('.$beforeChange.')!=="undefined") {'.$beforeChange.'();}'): '').
$panelName.'Clear();'.
$panelName.'Tabs['.$tabCount.'].style.display="";'.
// 'this.addContent('.$panelName.'Tabs['.$tabCount.']);'. // 'this.addContent('.$panelName.'Tabs['.$tabCount.']);'.
// 'this.addContent(document.getElementById("'.$Part['File'].'"));'. // 'this.addContent(document.getElementById("'.$Part['File'].'"));'.
// $panelName.'Tabs['.$tabCount.']='.$panelName.'Tabs['.$tabCount.'].cloneNode( true );'. // $panelName.'Tabs['.$tabCount.']='.$panelName.'Tabs['.$tabCount.'].cloneNode( true );'.
($onChange!='' ? ('if (typeof('.$onChange.')!=="undefined") {'.$onChange.'();}'): ''). ($onChange != '' ? ('if (typeof(' . $onChange . ')!=="undefined") {' . $onChange . '();}') : '') . '}.extend(' . $panelName . '),' . 'selected:' . ($tabCount == 0 ? 'true' : 'false') . '};';
'}.extend('.$panelName.'),'.
'selected:'.($tabCount==0 ? 'true' : 'false').
'};';
$tabCount ++; $tabCount ++;
break; break;
@@ -568,25 +523,22 @@ class Publisher
global $panelName; global $panelName;
global $tabCount; global $tabCount;
$mainPanelScript .= $panelName . '.make();'; $mainPanelScript .= $panelName . '.make();';
$mainPanelScript .= 'for(var r=0;r<'.$tabCount.';r++)'. $mainPanelScript .= 'for(var r=0;r<' . $tabCount . ';r++)' . 'if (' . $panelName . 'Tabs[r])' . $panelName . '.addContent(' . $panelName . 'Tabs[r]);';
'if ('.$panelName.'Tabs[r])'.$panelName.
'.addContent('.$panelName.'Tabs[r]);';
$mainPanelScript .= '});'; $mainPanelScript .= '});';
$mainPanelScript .= 'function ' . $panelName . 'Clear(){'; $mainPanelScript .= 'function ' . $panelName . 'Clear(){';
$mainPanelScript .= 'for(var r=0;r<'.$tabCount.';r++)'. $mainPanelScript .= 'for(var r=0;r<' . $tabCount . ';r++)' . 'if (' . $panelName . 'Tabs[r])' . $panelName . 'Tabs[r].style.display="none";}';
'if ('.$panelName.'Tabs[r])'.$panelName.'Tabs[r].style.display="none";}';
$oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptCode( $mainPanelScript ); $oHeadPublisher->addScriptCode( $mainPanelScript );
break; break;
case 'blank'; case 'blank':
print (' ') ; print (' ') ;
break; break;
case 'varform': case 'varform':
global $G_FORM; global $G_FORM;
$G_FORM = new Form; $G_FORM = new Form();
G::LoadSystem( "varform" ); G::LoadSystem( "varform" );
$xml = new varForm; $xml = new varForm();
//$xml->parseFile ( ); //$xml->parseFile ( );
$xml->renderForm( $G_FORM, $Part['File'] ); $xml->renderForm( $G_FORM, $Part['File'] );
$G_FORM->Values = $Part['Data']; $G_FORM->Values = $Part['Data'];
@@ -599,10 +551,9 @@ class Publisher
break; break;
case 'menu': case 'menu':
$G_TMP_TARGET = $Part['Target']; $G_TMP_TARGET = $Part['Target'];
$G_OP_MENU = new Menu; $G_OP_MENU = new Menu();
$G_OP_MENU->Load( $Part['File'] ); $G_OP_MENU->Load( $Part['File'] );
break; break;
case 'smarty': //To do: Please check it 26/06/07 case 'smarty': //To do: Please check it 26/06/07
$template = new Smarty(); $template = new Smarty();
$template->compile_dir = PATH_SMARTY_C; $template->compile_dir = PATH_SMARTY_C;
@@ -614,11 +565,11 @@ class Publisher
// verify if there are templates folders registered, template and method folders are the same // verify if there are templates folders registered, template and method folders are the same
$folderTemplate = explode( '/', $Part['Template'] ); $folderTemplate = explode( '/', $Part['Template'] );
$oPluginRegistry = & PMPluginRegistry::getSingleton(); $oPluginRegistry = & PMPluginRegistry::getSingleton();
if ( $oPluginRegistry->isRegisteredFolder( $folderTemplate[0] ) ) if ($oPluginRegistry->isRegisteredFolder( $folderTemplate[0] )) {
$template->templateFile = PATH_PLUGINS . $Part['Template'] . '.html'; $template->templateFile = PATH_PLUGINS . $Part['Template'] . '.html';
else } else {
$template->templateFile = PATH_TPL . $Part['Template'] . '.html'; $template->templateFile = PATH_TPL . $Part['Template'] . '.html';
}
// last change to load the template, maybe absolute path was given // last change to load the template, maybe absolute path was given
if (! is_file( $template->templateFile )) { if (! is_file( $template->templateFile )) {
$template->templateFile = strpos( $Part['Template'], '.html' ) !== false ? $Part['Template'] : $Part['Template'] . '.html'; $template->templateFile = strpos( $Part['Template'], '.html' ) !== false ? $Part['Template'] : $Part['Template'] . '.html';
@@ -628,7 +579,6 @@ class Publisher
$template->assign( $dataArray ); $template->assign( $dataArray );
print $template->fetch( $template->templateFile ); print $template->fetch( $template->templateFile );
break; break;
case 'template': //To do: Please check it 26/06/07 case 'template': //To do: Please check it 26/06/07
if (gettype( $Part['Data'] ) == 'array') { if (gettype( $Part['Data'] ) == 'array') {
G::LoadSystem( 'template' ); //template phpBB G::LoadSystem( 'template' ); //template phpBB
@@ -636,19 +586,20 @@ class Publisher
$template->set_filenames( array ('body' => $Part['Template'] . '.html' ) ); $template->set_filenames( array ('body' => $Part['Template'] . '.html' ) );
$dataArray = $Part['Data']; $dataArray = $Part['Data'];
if (is_array( $dataArray )) { if (is_array( $dataArray )) {
foreach ( $dataArray as $key => $val ) foreach ($dataArray as $key => $val) {
if (is_array( $val )) { if (is_array( $val )) {
foreach ( $val as $key_val => $val_array ) foreach ($val as $key_val => $val_array) {
$template->assign_block_vars( $key, $val_array ); $template->assign_block_vars( $key, $val_array );
} }
else } else {
$template->assign_vars( array ($key => $val ) ); $template->assign_vars( array ($key => $val ) );
} }
}
}
$template->pparse( 'body' ); $template->pparse( 'body' );
} }
if (gettype( $Part['Data'] ) == 'object' && strtolower( get_class( $Part['Data'] ) ) == 'templatepower') { if (gettype( $Part['Data'] ) == 'object' && strtolower( get_class( $Part['Data'] ) ) == 'templatepower') {
$Part['Data']->printToScreen(); $Part['Data']->printToScreen();
} }
return; return;
break; break;
@@ -678,10 +629,10 @@ class Publisher
break; break;
} }
//krumo( $Part['Template'] ); //krumo( $Part['Template'] );
//check if this LoadTemplate is used, byOnti 12th Aug 2008 //check if this LoadTemplate is used, byOnti 12th Aug 2008
G::LoadTemplate( $Part['Template'] ); G::LoadTemplate( $Part['Template'] );
$G_TABLE = NULL; $G_TABLE = null;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
<?php <?php
/** /**
* class.ymlDomain.php * class.ymlDomain.php
*
* @package gulliver.system * @package gulliver.system
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
@@ -25,18 +26,22 @@
*/ */
/** /**
*
* @package gulliver.system * @package gulliver.system
*
*/ */
require_once (PATH_THIRDPARTY . 'lime/yaml.class.php'); require_once (PATH_THIRDPARTY . 'lime/yaml.class.php');
/** /**
* ymlDomain class * ymlDomain class
*
* @copyright (C) 2002 by Colosa Development Team. * @copyright (C) 2002 by Colosa Development Team.
* @package gulliver.system * @package gulliver.system
*/ */
class ymlDomain class ymlDomain
{ {
var $global; public $global;
/** /**
* function ymlDomain * function ymlDomain
@@ -44,7 +49,7 @@ class ymlDomain
* @access public * @access public
* @return void * @return void
*/ */
function ymlDomain() public function ymlDomain ()
{ {
$this->global = sfYAML::Load( PATH_FIXTURES . 'domain.yml' ); $this->global = sfYAML::Load( PATH_FIXTURES . 'domain.yml' );
} }
@@ -56,22 +61,23 @@ class ymlDomain
* @param string $domainName * @param string $domainName
* @return boolean * @return boolean
*/ */
function addDomain( $domainName ) public function addDomain ($domainName)
{ {
$keys = $this->name2keys( $domainName ); $keys = $this->name2keys( $domainName );
$currDomain = & $this->global; $currDomain = & $this->global;
$i = 0; $i = 0;
for ($i = 0; $i < count( $keys ); $i ++) { for ($i = 0; $i < count( $keys ); $i ++) {
if (is_array( $currDomain )) { if (is_array( $currDomain )) {
if (!isset($currDomain[$keys[$i]])) $currDomain[$keys[$i]] = array(); if (! isset( $currDomain[$keys[$i]] )) {
$currDomain[$keys[$i]] = array ();
}
$currDomain = & $currDomain[$keys[$i]]; $currDomain = & $currDomain[$keys[$i]];
} } else {
else{
trigger_error( "Operation not possible: Subdomain is not present $domainName", E_USER_ERROR ); trigger_error( "Operation not possible: Subdomain is not present $domainName", E_USER_ERROR );
return FALSE; return false;
} }
} }
return TRUE; return true;
} }
/** /**
@@ -82,7 +88,7 @@ class ymlDomain
* @param string $value * @param string $value
* @return boolean * @return boolean
*/ */
function addDomainValue( $domainName , $value ) public function addDomainValue ($domainName, $value)
{ {
$keys = $this->name2keys( $domainName ); $keys = $this->name2keys( $domainName );
$currDomain = & $this->global; $currDomain = & $this->global;
@@ -90,14 +96,13 @@ class ymlDomain
for ($i = 0; $i < count( $keys ); $i ++) { for ($i = 0; $i < count( $keys ); $i ++) {
if (is_array( $currDomain )) { if (is_array( $currDomain )) {
$currDomain = & $currDomain[$keys[$i]]; $currDomain = & $currDomain[$keys[$i]];
} } else {
else{
trigger_error( "Operation not possible: Subdomain is not present $domainName", E_USER_ERROR ); trigger_error( "Operation not possible: Subdomain is not present $domainName", E_USER_ERROR );
return FALSE; return false;
} }
} }
$currDomain[] = $value; $currDomain[] = $value;
return TRUE; return true;
} }
/** /**
@@ -107,7 +112,7 @@ class ymlDomain
* @param string $domainName * @param string $domainName
* @return boolean * @return boolean
*/ */
function exists( $domainName ) public function exists ($domainName)
{ {
$keys = $this->name2keys( $domainName ); $keys = $this->name2keys( $domainName );
$currDomain = & $this->global; $currDomain = & $this->global;
@@ -115,12 +120,11 @@ class ymlDomain
for ($i = 0; $i < count( $keys ); $i ++) { for ($i = 0; $i < count( $keys ); $i ++) {
if (is_array( $currDomain ) && isset( $currDomain[$keys[$i]] )) { if (is_array( $currDomain ) && isset( $currDomain[$keys[$i]] )) {
$currDomain = & $currDomain[$keys[$i]]; $currDomain = & $currDomain[$keys[$i]];
} } else {
else{ return false;
return FALSE;
} }
} }
return TRUE; return true;
} }
/** /**
@@ -130,7 +134,7 @@ class ymlDomain
* @param string $resource * @param string $resource
* @return array * @return array
*/ */
function get($resource) public function get ($resource)
{ {
if (is_array( $result = $this->load( $resource ) )) { if (is_array( $result = $this->load( $resource ) )) {
//Get one value per each $item //Get one value per each $item
@@ -147,8 +151,7 @@ class ymlDomain
} }
} }
return $result; return $result;
} } else {
else{
return array (''); return array ('');
} }
} }
@@ -160,21 +163,19 @@ class ymlDomain
* @param string $resource * @param string $resource
* @return array * @return array
*/ */
function name2keys( $resource ) public function name2keys ($resource)
{ {
if (strpos( $resource, '.' )!==FALSE){ if (strpos( $resource, '.' ) !== false) {
$revKeys = explode( '.', $resource ); $revKeys = explode( '.', $resource );
$keys = array (); $keys = array ();
for ($i = count( $revKeys ) - 1; $i >= 0; $i --) { for ($i = count( $revKeys ) - 1; $i >= 0; $i --) {
$keys[] = $revKeys[$i]; $keys[] = $revKeys[$i];
} }
} } elseif (strpos( $resource, '/' ) !== false) {
elseif (strpos( $resource, '/' )!==FALSE){
$rootKeys = explode( '/', $resource ); $rootKeys = explode( '/', $resource );
unset( $rootKeys[0] ); unset( $rootKeys[0] );
$keys = array_values( $rootKeys ); $keys = array_values( $rootKeys );
} } else {
else{
$keys = array ($resource ); $keys = array ($resource );
} }
return $keys; return $keys;
@@ -187,25 +188,23 @@ class ymlDomain
* @param string $resource * @param string $resource
* @return array * @return array
*/ */
function load($resource) public function load ($resource)
{ {
$keys = $this->name2keys( $resource ); $keys = $this->name2keys( $resource );
//Find in global variable //Find in global variable
if (count( $this->getNode( $keys[0], $this->global ) ) > 0) { if (count( $this->getNode( $keys[0], $this->global ) ) > 0) {
return $this->find( $keys, $this->global ); return $this->find( $keys, $this->global );
} } else {
else{
if (file_exists( PATH_FIXTURES . $keys[0] . '.yml' )) { if (file_exists( PATH_FIXTURES . $keys[0] . '.yml' )) {
$local = sfYAML::Load( PATH_FIXTURES . $keys[0] . '.yml' ); $local = sfYAML::Load( PATH_FIXTURES . $keys[0] . '.yml' );
unset( $keys[0] ); unset( $keys[0] );
$keys = array_values( $keys ); $keys = array_values( $keys );
return $this->find( $keys, $local ); return $this->find( $keys, $local );
} } else {
else{ return null;
return NULL;
} }
} }
return NULL; return null;
} }
/** /**
@@ -216,12 +215,11 @@ class ymlDomain
* @param string $where * @param string $where
* @return array * @return array
*/ */
function find( $nodesKey , $where ) public function find ($nodesKey, $where)
{ {
if (count( $nodesKey ) == 1) { if (count( $nodesKey ) == 1) {
return $this->getNode( $nodesKey[0], $where ); return $this->getNode( $nodesKey[0], $where );
} } elseif (count( $nodesKey ) > 1) {
elseif (count($nodesKey)>1){
$routes = $this->getNode( $nodesKey[0], $where ); $routes = $this->getNode( $nodesKey[0], $where );
$result = array (); $result = array ();
unset( $nodesKey[0] ); unset( $nodesKey[0] );
@@ -230,14 +228,12 @@ class ymlDomain
if (is_array( $route )) { if (is_array( $route )) {
$subResult = $this->find( $nodesKey, $route ); $subResult = $this->find( $nodesKey, $route );
$this->arrayAppend( $result, $subResult ); $this->arrayAppend( $result, $subResult );
} } else {
else{
$result[] = $route; $result[] = $route;
} }
} }
return $result; return $result;
} } else {
else{
return array (); return array ();
} }
} }
@@ -250,15 +246,13 @@ class ymlDomain
* @param string $from * @param string $from
* @return array * @return array
*/ */
function getNode( $nodeKey , $from ) public function getNode ($nodeKey, $from)
{ {
if ($nodeKey === '*') { if ($nodeKey === '*') {
return array_values( $from ); return array_values( $from );
} } elseif (array_key_exists( $nodeKey, $from )) {
elseif (array_key_exists( $nodeKey, $from )){
return array ($from[$nodeKey] ); return array ($from[$nodeKey] );
} } else {
else{
return array (); return array ();
} }
} }
@@ -270,15 +264,14 @@ class ymlDomain
* @param array $array * @param array $array
* @return array * @return array
*/ */
function plainArray( $array ) public function plainArray ($array)
{ {
$result = array (); $result = array ();
foreach ($array as $item) { foreach ($array as $item) {
if (is_array( $item )) { if (is_array( $item )) {
$appResult = $this->plainArray( $item ); $appResult = $this->plainArray( $item );
$this->arrayAppend( $result, $appResult ); $this->arrayAppend( $result, $appResult );
} } else {
else{
$result[] = $item; $result[] = $item;
} }
} }
@@ -293,8 +286,11 @@ class ymlDomain
* @param string $appendFrom * @param string $appendFrom
* @return void * @return void
*/ */
function arrayAppend( &$to , $appendFrom ) public function arrayAppend (&$to, $appendFrom)
{ {
foreach($appendFrom as $appendItem) $to[]=$appendItem; foreach ($appendFrom as $appendItem) {
$to[] = $appendItem;
} }
} }
}