Improvement constant PARTNER_FLAG

- Browser library
- HearBeat
- tab plugins
This commit is contained in:
Marco Antonio Nina
2013-03-18 15:13:14 -04:00
parent 517726c938
commit d6918697aa
6 changed files with 32 additions and 19 deletions

View File

@@ -195,7 +195,7 @@ class Installer
@mkdir($path_site . "reports/", 0777, true); @mkdir($path_site . "reports/", 0777, true);
@mkdir($path_site . "xmlForms", 0777, true); @mkdir($path_site . "xmlForms", 0777, true);
$db_text = "<?php\n" . "// Processmaker configuration\n" . "define ('DB_ADAPTER', 'mysql' );\n" . "define ('DB_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_NAME', '" . $wf . "' );\n" . "define ('DB_USER', '" . (($this->cc_status == 1) ? $wf : $this->options['database']['username']) . "' );\n" . "define ('DB_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_RBAC_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_RBAC_NAME', '" . $rb . "' );\n" . "define ('DB_RBAC_USER', '" . (($this->cc_status == 1) ? $rb : $this->options['database']['username']) . "' );\n" . "define ('DB_RBAC_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_REPORT_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_REPORT_NAME', '" . $rp . "' );\n" . "define ('DB_REPORT_USER', '" . (($this->cc_status == 1) ? $rp : $this->options['database']['username']) . "' );\n" . "define ('DB_REPORT_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "?>"; $db_text = "<?php\n" . "// Processmaker configuration\n" . "define ('DB_ADAPTER', 'mysql' );\n" . "define ('DB_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_NAME', '" . $wf . "' );\n" . "define ('DB_USER', '" . (($this->cc_status == 1) ? $wf : $this->options['database']['username']) . "' );\n" . "define ('DB_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_RBAC_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_RBAC_NAME', '" . $rb . "' );\n" . "define ('DB_RBAC_USER', '" . (($this->cc_status == 1) ? $rb : $this->options['database']['username']) . "' );\n" . "define ('DB_RBAC_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('DB_REPORT_HOST', '" . $this->options['database']['hostname'] . ":" . $myPort . "' );\n" . "define ('DB_REPORT_NAME', '" . $rp . "' );\n" . "define ('DB_REPORT_USER', '" . (($this->cc_status == 1) ? $rp : $this->options['database']['username']) . "' );\n" . "define ('DB_REPORT_PASS', '" . (($this->cc_status == 1) ? $this->options['password'] : $this->options['database']['password']) . "' );\n" . "define ('PARTNER_FLAG', true );\n"."?>";
$fp = @fopen($db_file, "w"); $fp = @fopen($db_file, "w");
$this->log("Create: " . $db_file . " => " . ((!$fp) ? $fp : "OK") . "\n", $fp === false); $this->log("Create: " . $db_file . " => " . ((!$fp) ? $fp : "OK") . "\n", $fp === false);
$ff = @fputs($fp, $db_text, strlen($db_text)); $ff = @fputs($fp, $db_text, strlen($db_text));

View File

@@ -680,6 +680,7 @@ class Installer extends Controller
$dbText .= sprintf( " define ('DB_REPORT_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_REPORT_HOST', '%s' );\n", $db_host );
$dbText .= sprintf( " define ('DB_REPORT_NAME', '%s' );\n", $rp ); $dbText .= sprintf( " define ('DB_REPORT_NAME', '%s' );\n", $rp );
$dbText .= sprintf( " define ('DB_REPORT_USER', '%s' );\n", $rp ); $dbText .= sprintf( " define ('DB_REPORT_USER', '%s' );\n", $rp );
$dbText .= sprintf( " define ('DB_REPORT_PASS', '%s' );\n", $rpPass );
$dbText .= " define ('PARTNER_FLAG', true );\n"; $dbText .= " define ('PARTNER_FLAG', true );\n";
$this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) )); $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) ));
@@ -944,6 +945,7 @@ class Installer extends Controller
$dbText .= sprintf( " define ('DB_REPORT_HOST', '%s' );\n", $db_host ); $dbText .= sprintf( " define ('DB_REPORT_HOST', '%s' );\n", $db_host );
$dbText .= sprintf( " define ('DB_REPORT_NAME', '%s' );\n", $rp ); $dbText .= sprintf( " define ('DB_REPORT_NAME', '%s' );\n", $rp );
$dbText .= sprintf( " define ('DB_REPORT_USER', '%s' );\n", $rp ); $dbText .= sprintf( " define ('DB_REPORT_USER', '%s' );\n", $rp );
$dbText .= sprintf( " define ('DB_REPORT_PASS', '%s' );\n", $rpPass );
$dbText .= " define ('PARTNER_FLAG', true );\n"; $dbText .= " define ('PARTNER_FLAG', true );\n";
$this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) )); $this->installLog( G::LoadTranslation('ID_CREATING', SYS_LANG, Array($db_file) ));

View File

@@ -62,8 +62,11 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1) {
$G_TMP_MENU->AddIdRawOption('DASHBOARD', '../dashboard/dashletsList', ucfirst(G::LoadTranslation('ID_DASHBOARD')), '', '', 'settings'); $G_TMP_MENU->AddIdRawOption('DASHBOARD', '../dashboard/dashletsList', ucfirst(G::LoadTranslation('ID_DASHBOARD')), '', '', 'settings');
} }
//tools options //tools options
if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1) { if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1 ) {
$G_TMP_MENU->AddIdRawOption('PLUGINS', 'pluginsMain', 'Plugins Manager', 'icon-plugins.png', '', 'plugins'); $valueShow = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : true;
if ($valueShow) {
$G_TMP_MENU->AddIdRawOption('PLUGINS', 'pluginsMain', 'Plugins Manager', 'icon-plugins.png', '', 'plugins');
}
} }
//users options //users options

View File

@@ -158,18 +158,22 @@ G::LoadClass('serverConfiguration');
//Bootstrap::LoadClass('serverConfiguration'); //Bootstrap::LoadClass('serverConfiguration');
//get the serverconf singleton, and check if we can send the heartbeat //get the serverconf singleton, and check if we can send the heartbeat
$oServerConf = & serverConf::getSingleton(); $oServerConf = & serverConf::getSingleton();
$valueShow = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : true;
if ($valueShow) {
$sflag = $oServerConf->getHeartbeatProperty('HB_OPTION', 'HEART_BEAT_CONF');
$sflag = (trim($sflag) != '') ? $sflag : '1';
$sflag = $oServerConf->getHeartbeatProperty('HB_OPTION', 'HEART_BEAT_CONF'); //get date of next beat
$sflag = (trim($sflag) != '') ? $sflag : '1'; $nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF');
//get date of next beat //if flag to send heartbeat is enabled, and it is time to send heartbeat, sent it using asynchronous beat.
$nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF'); if (($sflag == "1") && ((strtotime("now") > $nextBeatDate) || is_null($nextBeatDate))) {
$oHeadPublisher =& headPublisher::getSingleton();
//if flag to send heartbeat is enabled, and it is time to send heartbeat, sent it using asynchronous beat. //To do: we need to change to ExtJs
if (($sflag == "1") && ((strtotime("now") > $nextBeatDate) || is_null($nextBeatDate))) { $oHeadPublisher->addScriptCode('var flagHeartBeat = 1;');
$oHeadPublisher =& headPublisher::getSingleton(); } else {
//To do: we need to change to ExtJs $oHeadPublisher->addScriptCode('var flagHeartBeat = 0;');
$oHeadPublisher->addScriptCode('var flagHeartBeat = 1;'); }
} else { } else {
$oHeadPublisher->addScriptCode('var flagHeartBeat = 0;'); $oHeadPublisher->addScriptCode('var flagHeartBeat = 0;');
} }

View File

@@ -30,7 +30,8 @@ $conf = new Configurations();
$oHeadPublisher->addExtJsScript( 'processes/main', true ); //adding a javascript file .js $oHeadPublisher->addExtJsScript( 'processes/main', true ); //adding a javascript file .js
$oHeadPublisher->addContent( 'processes/main' ); //adding a html file .html. $oHeadPublisher->addContent( 'processes/main' ); //adding a html file .html.
$valueShow = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : true;
$oHeadPublisher->assign( 'PARTNER_FLAG', $valueShow );
$oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) ); $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber' ) );
G::RenderPage( 'publish', 'extJs' ); G::RenderPage( 'publish', 'extJs' );

View File

@@ -263,12 +263,15 @@ Ext.onReady(function(){
importProcessGlobal.processFileType = "pm"; importProcessGlobal.processFileType = "pm";
importProcess(); importProcess();
} }
},{
text: _('ID_BROWSE_LIBRARY'),
iconCls: 'button_menu_ext ss_sprite ss_world',
//icon: '/images/icon-pmwebservices.png',
handler: browseLibrary
}, },
PARTNER_FLAG ?
[{
text: _('ID_BROWSE_LIBRARY'),
iconCls: 'button_menu_ext ss_sprite ss_world',
//icon: '/images/icon-pmwebservices.png',
handler: browseLibrary
},
] : [],
{ {
xtype: 'tbfill' xtype: 'tbfill'
},{ },{