diff --git a/gulliver/bin/tasks/templates/db_insert.sql b/gulliver/bin/tasks/templates/db_insert.sql index 892cfebc0..77c3a6a87 100755 --- a/gulliver/bin/tasks/templates/db_insert.sql +++ b/gulliver/bin/tasks/templates/db_insert.sql @@ -7,7 +7,7 @@ CREATE TABLE `LANGUAGE` ( `LAN_ENABLED` char(1) NOT NULL default '1', `LAN_CALENDAR` varchar(30) NOT NULL default 'GREGORIAN', PRIMARY KEY (`LAN_ID`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Dumping data for table `LANGUAGE` diff --git a/gulliver/bin/tasks/templates/pluginSchema.xml.tpl b/gulliver/bin/tasks/templates/pluginSchema.xml.tpl index aae41bf43..c74de4c3a 100755 --- a/gulliver/bin/tasks/templates/pluginSchema.xml.tpl +++ b/gulliver/bin/tasks/templates/pluginSchema.xml.tpl @@ -4,7 +4,7 @@ - + diff --git a/gulliver/bin/tasks/templates/schema.xml.tpl b/gulliver/bin/tasks/templates/schema.xml.tpl index f3670ae36..11a41e59e 100755 --- a/gulliver/bin/tasks/templates/schema.xml.tpl +++ b/gulliver/bin/tasks/templates/schema.xml.tpl @@ -4,7 +4,7 @@
- + @@ -88,7 +88,7 @@
- + @@ -189,7 +189,7 @@
- + @@ -268,7 +268,7 @@
- + diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index fe35fa8e8..1466842fa 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -225,6 +225,8 @@ class Bootstrap self::registerClass("cronFile", PATH_CLASSES . "class.plugin.php"); self::registerClass("pluginDetail", PATH_CLASSES . "class.pluginRegistry.php"); self::registerClass("PMPluginRegistry", PATH_CLASSES . "class.pluginRegistry.php"); + self::registerClass("featuresDetail", PATH_CLASSES . "class.licensedFeatures.php"); + self::registerClass("PMLicensedFeatures", PATH_CLASSES . "class.licensedFeatures.php"); self::registerClass("PMDashlet", PATH_CLASSES . "class.pmDashlet.php"); self::registerClass("pmGauge", PATH_CLASSES . "class.pmGauge.php"); self::registerClass("pmPhing", PATH_CLASSES . "class.pmPhing.php"); diff --git a/gulliver/system/class.database_mysql.php b/gulliver/system/class.database_mysql.php index 739c926ce..44bf43ec6 100755 --- a/gulliver/system/class.database_mysql.php +++ b/gulliver/system/class.database_mysql.php @@ -682,7 +682,7 @@ class database extends database_base `OP_OBJ_UID` varchar(32) NOT NULL, `OP_ACTION` varchar(10) NOT NULL default 'VIEW', KEY `PRO_UID` (`PRO_UID`,`TAS_UID`,`USR_UID`,`OP_TASK_SOURCE`,`OP_OBJ_UID`) - )ENGINE=MyISAM DEFAULT CHARSET=latin1;"; + )ENGINE=InnoDB DEFAULT CHARSET=latin1;"; return $sql; } diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 75f707ec5..c423a3caf 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -5271,6 +5271,22 @@ class G $oLogger->write($message); } + /** + */ + public function auditLog($actionToLog, $valueToLog = "") + { + $oServerConf = & serverConf::getSingleton(); + $sflagAudit = $oServerConf->getAuditLogProperty( 'AL_OPTION', SYS_SYS ); + $ipClient = G::getIpAddress(); + + if ($sflagAudit) { + $workspace = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined'; + $username = isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '' ? $_SESSION['USER_LOGGED'] : 'Unknow User'; + $fullname = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : '-'; + G::log("|". $workspace ."|". $ipClient ."|". $username . "|" . $fullname ."|" . $actionToLog . "|" . $valueToLog, PATH_DATA, "audit.log"); + } + } + /** * Changes all keys in an array and sub-arrays * @@ -5347,8 +5363,8 @@ class G if((preg_match('/^\*\.?[a-z]{2,8}$/', $val)) || ($val == '*.*')){ $allowedDocTypes = substr($val, 2); if(($dtype[count($dtype) -1]) == $allowedDocTypes || $allowedDocTypes == '*'){ - $res->status = true; - return $res; + $res->status = true; + return $res; break; } else { $flag = 1; @@ -5376,7 +5392,7 @@ class G break; case 'xls': if($docType[1] == 'vnd.ms-excel' || ($dtype[count($dtype) - 1] == 'xls' && $docType[1] == 'plain')){ - $res->status = true; + $res->status = true; return $res; } else { $flag = 1; @@ -5384,7 +5400,7 @@ class G break; case 'doc': if($docType[1] == 'msword' || ($dtype[count($dtype) - 1] == 'doc' && $docType[1] == 'html')){ - $res->status = true; + $res->status = true; return $res; } else { $flag = 1; @@ -5476,7 +5492,7 @@ class G if ($docType[1] != $allowedDocTypes){ $flag = 1; } else { - $res->status = true; + $res->status = true; return $res; } break; diff --git a/gulliver/thirdparty/pear/SOAP/Interop/interop_database.sql b/gulliver/thirdparty/pear/SOAP/Interop/interop_database.sql index 1c8f0cf09..bb2f5119b 100755 --- a/gulliver/thirdparty/pear/SOAP/Interop/interop_database.sql +++ b/gulliver/thirdparty/pear/SOAP/Interop/interop_database.sql @@ -21,7 +21,7 @@ CREATE TABLE clientinfo ( name char(100) NOT NULL default '', version char(20) NOT NULL default '', resultsURL char(255) NOT NULL default '' -) TYPE=MyISAM; +) TYPE=InnoDB; # -------------------------------------------------------- # @@ -41,7 +41,7 @@ CREATE TABLE results ( error text, wire text NOT NULL, PRIMARY KEY (id) -) TYPE=MyISAM; +) TYPE=InnoDB; # -------------------------------------------------------- # @@ -56,7 +56,7 @@ CREATE TABLE serverinfo ( endpointURL char(255) NOT NULL default '', wsdlURL char(255) NOT NULL default '', PRIMARY KEY (id) -) TYPE=MyISAM; +) TYPE=InnoDB; # -------------------------------------------------------- # @@ -70,7 +70,7 @@ CREATE TABLE services ( wsdlURL char(255) NOT NULL default '', websiteURL char(255) NOT NULL default '', PRIMARY KEY (id) -) TYPE=MyISAM; +) TYPE=InnoDB; diff --git a/gulliver/thirdparty/propel-generator/templates/sql/base/mysql/table.tpl b/gulliver/thirdparty/propel-generator/templates/sql/base/mysql/table.tpl index 34ecb24cf..d52bc5e1a 100755 --- a/gulliver/thirdparty/propel-generator/templates/sql/base/mysql/table.tpl +++ b/gulliver/thirdparty/propel-generator/templates/sql/base/mysql/table.tpl @@ -37,7 +37,7 @@ CREATE TABLE getName() . "`" ?> if(isset($vendorSpecific['Type'])) $mysqlTableType = $vendorSpecific['Type']; else - $mysqlTableType = 'MyISAM'; + $mysqlTableType = 'InnoDB'; } ?> diff --git a/rbac/engine/classes/model/AuthenticationSource.php b/rbac/engine/classes/model/AuthenticationSource.php index 43d0c99de..09bd10b12 100755 --- a/rbac/engine/classes/model/AuthenticationSource.php +++ b/rbac/engine/classes/model/AuthenticationSource.php @@ -69,6 +69,7 @@ class AuthenticationSource extends BaseAuthenticationSource { $oConnection->begin(); $iResult = $oAuthenticationSource->save(); $oConnection->commit(); + G::auditLog("CreateAuthSource", $aData['AUTH_SOURCE_NAME']); return $aData['AUTH_SOURCE_UID']; } else { @@ -97,6 +98,7 @@ class AuthenticationSource extends BaseAuthenticationSource { $oConnection->begin(); $iResult = $oAuthenticationSource->save(); $oConnection->commit(); + G::auditLog("UpdateAuthSource", $aData['AUTH_SOURCE_NAME']." (".$aData['AUTH_SOURCE_UID'].") "); return $iResult; } else { @@ -126,10 +128,14 @@ class AuthenticationSource extends BaseAuthenticationSource { $oConnection = Propel::getConnection(AuthenticationSourcePeer::DATABASE_NAME); try { $oAuthenticationSource = AuthenticationSourcePeer::retrieveByPK($sUID); + $authenticationSource = $this->load($sUID); + if (!is_null($oAuthenticationSource)) { $oConnection->begin(); $iResult = $oAuthenticationSource->delete(); $oConnection->commit(); + + G::auditLog("DeleteAuthSource", $authenticationSource['AUTH_SOURCE_NAME']." (".$sUID.") "); return $iResult; } else { diff --git a/rbac/engine/classes/model/Roles.php b/rbac/engine/classes/model/Roles.php index 480179dbc..d0a30f36e 100755 --- a/rbac/engine/classes/model/Roles.php +++ b/rbac/engine/classes/model/Roles.php @@ -236,9 +236,8 @@ class Roles extends BaseRoles { if ($obj->validate()) { $result = $obj->save(); $con->commit(); - $obj->setRolName($rol_name); - + G::auditLog("CreateRole", $rol_name); } else { $e = new Exception("Failed Validation in class " . get_class($this) . "."); $e->aValidationFailures = $this->getValidationFailures(); @@ -263,8 +262,8 @@ class Roles extends BaseRoles { if ($this->validate()) { $result = $this->save(); $con->commit(); - $this->setRolName($rol_name); + G::auditLog("UpdateRole", $rol_name." (".$fields['ROL_UID'].") "); return $result; } else { $con->rollback(); @@ -281,10 +280,11 @@ class Roles extends BaseRoles { try { $con->begin(); $this->setRolUid($ROL_UID); + $rol_name = $this->load($ROL_UID); Content::removeContent('ROL_NAME', '', $this->getRolUid()); $result = $this->delete(); - $con->commit(); + G::auditLog("DeleteRole", $rol_name['ROL_NAME']." (".$ROL_UID.") "); return $result; } catch( exception $e ) { $con->rollback(); @@ -514,6 +514,10 @@ class Roles extends BaseRoles { $oUsersRoles->setRolUid($aData['ROL_UID']); $oUsersRoles->save(); + $rol = $this->load($aData['ROL_UID']); + $oUsersRbac = new RbacUsers(); + $user = $oUsersRbac->load($aData['USR_UID']); + G::auditLog("AssignUsersToRole", "Assign user ".$user['USR_USERNAME']." (".$aData['USR_UID'].") to Role ".$rol['ROL_NAME']." (".$aData['ROL_UID'].") "); } function deleteUserRole($ROL_UID, $USR_UID) { @@ -524,6 +528,11 @@ class Roles extends BaseRoles { $crit->add(UsersRolesPeer::ROL_UID, $ROL_UID); } UsersRolesPeer::doDelete($crit); + $rol = $this->load($ROL_UID); + $oUsersRbac = new RbacUsers(); + $user = $oUsersRbac->load($USR_UID); + + G::auditLog("DeleteUsersToRole", "Delete user ".$user['USR_USERNAME']." (".$USR_UID.") to Role ".$rol['ROL_NAME']." (".$ROL_UID.") "); } function getRolePermissions($ROL_UID, $filter='', $status=null) { @@ -619,7 +628,10 @@ class Roles extends BaseRoles { if (isset($sData['PER_NAME'])) { $o->setPermissionName($sData['PER_NAME']); } + $permission = $o->getPermissionName($sData['PER_UID']); + $role = $this->load($sData['ROL_UID']); $o->save(); + G::auditLog("AddPermissionToRole", "Add Permission ".$permission." (".$sData['PER_UID'].") to Role ".$role['ROL_NAME']." (".$sData['ROL_UID'].") "); } function deletePermissionRole($ROL_UID, $PER_UID) { @@ -627,6 +639,13 @@ class Roles extends BaseRoles { $crit->add(RolesPermissionsPeer::ROL_UID, $ROL_UID); $crit->add(RolesPermissionsPeer::PER_UID, $PER_UID); RolesPermissionsPeer::doDelete($crit); + + $o = new RolesPermissions(); + $o->setPerUid($PER_UID); + $permission = $o->getPermissionName($PER_UID); + $role = $this->load($ROL_UID); + + G::auditLog("DeletePermissionToRole", "Delete Permission ".$permission." (".$PER_UID.") to Role ".$role['ROL_NAME']." (".$ROL_UID.") "); } function numUsersWithRole($ROL_UID) { diff --git a/rbac/engine/config/schema.xml b/rbac/engine/config/schema.xml index a113f0e1f..2b82770e3 100755 --- a/rbac/engine/config/schema.xml +++ b/rbac/engine/config/schema.xml @@ -4,7 +4,7 @@
- + @@ -32,7 +32,7 @@
- + @@ -61,7 +61,7 @@
- + @@ -85,7 +85,7 @@
- + @@ -112,7 +112,7 @@
- + @@ -148,7 +148,7 @@
- + @@ -172,7 +172,7 @@
- + diff --git a/rbac/engine/data/mysql/schema.sql b/rbac/engine/data/mysql/schema.sql index 4c4a9cdbc..40de34f8c 100755 --- a/rbac/engine/data/mysql/schema.sql +++ b/rbac/engine/data/mysql/schema.sql @@ -19,7 +19,7 @@ CREATE TABLE `RBAC_PERMISSIONS` `PER_STATUS` INTEGER default 1 NOT NULL, `PER_SYSTEM` VARCHAR(32) default '00000000000000000000000000000002' NOT NULL, PRIMARY KEY (`PER_UID`) -)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='Permissions'; +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Permissions'; #----------------------------------------------------------------------------- #-- ROLES #----------------------------------------------------------------------------- @@ -37,7 +37,7 @@ CREATE TABLE `RBAC_ROLES` `ROL_UPDATE_DATE` DATETIME, `ROL_STATUS` INTEGER default 1 NOT NULL, PRIMARY KEY (`ROL_UID`) -)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='Roles'; +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Roles'; #----------------------------------------------------------------------------- #-- ROLES_PERMISSIONS #----------------------------------------------------------------------------- @@ -50,7 +50,7 @@ CREATE TABLE `RBAC_ROLES_PERMISSIONS` `ROL_UID` VARCHAR(32) default '' NOT NULL, `PER_UID` VARCHAR(32) default '' NOT NULL, PRIMARY KEY (`ROL_UID`,`PER_UID`) -)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='Permissions of the roles'; +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Permissions of the roles'; #----------------------------------------------------------------------------- #-- SYSTEMS #----------------------------------------------------------------------------- @@ -66,7 +66,7 @@ CREATE TABLE `RBAC_SYSTEMS` `SYS_UPDATE_DATE` DATETIME, `SYS_STATUS` INTEGER default 0 NOT NULL, PRIMARY KEY (`SYS_UID`) -)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='Systems'; +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Systems'; #----------------------------------------------------------------------------- #-- USERS #----------------------------------------------------------------------------- @@ -91,7 +91,7 @@ CREATE TABLE `RBAC_USERS` `USR_AUTH_USER_DN` VARCHAR(255) default '' NOT NULL, `USR_AUTH_SUPERVISOR_DN` VARCHAR(255) default '' NOT NULL, PRIMARY KEY (`USR_UID`) -)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='Users'; +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Users'; #----------------------------------------------------------------------------- #-- USERS_ROLES #----------------------------------------------------------------------------- @@ -104,7 +104,7 @@ CREATE TABLE `RBAC_USERS_ROLES` `USR_UID` VARCHAR(32) default '' NOT NULL, `ROL_UID` VARCHAR(32) default '' NOT NULL, PRIMARY KEY (`USR_UID`,`ROL_UID`) -)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='Roles of the users'; +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Roles of the users'; #----------------------------------------------------------------------------- #-- AUTHENTICATION_SOURCE #----------------------------------------------------------------------------- @@ -129,6 +129,6 @@ CREATE TABLE `RBAC_AUTHENTICATION_SOURCE` `AUTH_SOURCE_OBJECT_CLASSES` VARCHAR(255) default '' NOT NULL, `AUTH_SOURCE_DATA` MEDIUMTEXT, PRIMARY KEY (`AUTH_SOURCE_UID`) -)ENGINE=MyISAM DEFAULT CHARSET='utf8'; +)ENGINE=InnoDB DEFAULT CHARSET='utf8'; # This restores the fkey checks, after having unset them earlier SET FOREIGN_KEY_CHECKS = 1; diff --git a/workflow/engine/classes/class.groups.php b/workflow/engine/classes/class.groups.php index ccf9b0333..7c73bb19a 100755 --- a/workflow/engine/classes/class.groups.php +++ b/workflow/engine/classes/class.groups.php @@ -115,6 +115,14 @@ class Groups $oGrp->setGrpUid($GrpUid); $oGrp->setUsrUid($UsrUid); $oGrp->Save(); + + $oGrpwf = new Groupwf(); + $grpName = $oGrpwf->loadByGroupUid($GrpUid); + + $oUsr = new Users(); + $usrName = $oUsr->load($UsrUid); + + G::auditLog("AssignUsersToGroup", "Assign user ". $usrName['USR_USERNAME'] ." (".$UsrUid.") to group ".$grpName['CON_VALUE']." (".$GrpUid.") "); } } catch (exception $oError) { throw ($oError); diff --git a/workflow/engine/classes/class.licensedFeatures.php b/workflow/engine/classes/class.licensedFeatures.php new file mode 100644 index 000000000..50ccb71e6 --- /dev/null +++ b/workflow/engine/classes/class.licensedFeatures.php @@ -0,0 +1,89 @@ +featureName = $featureName; + $this->description = $description; + } +} + + +class PMLicensedFeatures +{ + private $featuresDetails = array (); + private $features = array (); + + private static $instancefeature = null; + + /** + * This function is the constructor of the PMLicensedFeatures class + * param + * + * @return void + */ + public function __construct () + { + $criteria = new Criteria(); + $criteria->addAscendingOrderByColumn(AddonsManagerPeer::ADDON_ID); + $criteria->add(AddonsManagerPeer::ADDON_TYPE, 'feature', Criteria::EQUAL); + $addons = AddonsManagerPeer::doSelect($criteria); + foreach ($addons as $addon) { + $this->features[] = $addon->getAddonId(); + $detail = new featuresDetail($addon->getAddonNick(), $addon->getAddonDescription()); + $this->featuresDetails[$addon->getAddonId()] = $detail; + } + } + + /** + * This function is instancing to this class + * param + * + * @return object + */ + public static function getSingleton () + { + if (self::$instancefeature == null) { + self::$instancefeature = new PMLicensedFeatures(); + } + return self::$instancefeature; + } + + public function verifyfeature ($featureName) + { + $licenseManager = &pmLicenseManager::getSingleton(); + $_SESSION['__sw__'] = true; + $padl = new padl(); + + $enable = in_array($padl->_decrypt($featureName), $licenseManager->features); + + $this->featuresDetails[$padl->_decrypt($featureName)]->enabled = $enable; + return $enable; + } + + public static function loadSingleton($file) + { + self::$instancefeature = unserialize(file_get_contents($file)); + + if (! is_object(self::$instancefeature) || get_class(self::$instancefeature) != "PMLicensedFeatures") { + throw new Exception("Can't load main PMLicensedFeatures object."); + } + + return self::$instancefeature; + } +} + diff --git a/workflow/engine/classes/class.pmLicenseManager.php b/workflow/engine/classes/class.pmLicenseManager.php index 8c2386a44..ace704336 100644 --- a/workflow/engine/classes/class.pmLicenseManager.php +++ b/workflow/engine/classes/class.pmLicenseManager.php @@ -53,6 +53,9 @@ class pmLicenseManager ); $this->result = $results['RESULT']; + $this->features = array(); + $this->licensedfeatures = array(); + $this->licensedfeaturesList = array(); if (in_array($this->result, $validStatus)) { $this->serial="3ptta7Xko2prrptrZnSd356aqmPXvMrayNPFj6CLdaR1pWtrW6qPw9jV0OHjxrDGu8LVxtmSm9nP5kR23HRpdZWccpeui+bKkK°DoqCt2Kqgpq6Vg37s"; $info['FIRST_NAME'] = $results['DATA']['FIRST_NAME']; @@ -64,7 +67,9 @@ class pmLicenseManager $this->plan = isset($results ['DATA']['PLAN'])?$results ['DATA']['PLAN']:""; $this->id = $results ['ID']; $this->expireIn = $this->getExpireIn (); - $this->features = $this->result!='TMINUS'?isset($results ['DATA']['CUSTOMER_PLUGIN'])?$results ['DATA']['CUSTOMER_PLUGIN']:$this->getActiveFeatures():array(); + $this->features = $this->result!='TMINUS'?isset($results ['DATA']['CUSTOMER_PLUGIN'])? $results ['DATA']['CUSTOMER_PLUGIN'] : $this->getActiveFeatures() : array(); + $this->licensedfeatures = $this->result!='TMINUS'?isset($results ['DATA']['CUSTOMER_LICENSED_FEATURES'])? $results ['DATA']['CUSTOMER_LICENSED_FEATURES'] : array() : array(); + $this->licensedfeaturesList = isset($results ['DATA']['LICENSED_FEATURES_LIST'])? $results ['DATA']['LICENSED_FEATURES_LIST'] : null; $this->status = $this->getCurrentLicenseStatus (); if (isset ( $results ['LIC'] )) { @@ -352,7 +357,9 @@ class pmLicenseManager public function installLicense($path, $redirect = true) { $application = new license_application ( $path, false, true, false, true, true ); + $results = $application->validate ( false, false, "", "", "80", true ); + //if the result is ok then it is saved into DB $res = $results ['RESULT']; if (( $res != 'OK') && ($res != 'EXPIRED' ) && ($res != 'TMINUS') ) { @@ -496,6 +503,9 @@ class pmLicenseManager public function getActiveFeatures() { + if (file_exists ( PATH_PLUGINS . 'enterprise/data/default' )) { + return array(); + } return unserialize(G::decrypt($this->serial, file_get_contents(PATH_PLUGINS . 'enterprise/data/default'))); } } diff --git a/workflow/engine/classes/class.serverConfiguration.php b/workflow/engine/classes/class.serverConfiguration.php index 79fd692e8..d70d57123 100755 --- a/workflow/engine/classes/class.serverConfiguration.php +++ b/workflow/engine/classes/class.serverConfiguration.php @@ -39,6 +39,7 @@ class serverConf private $_aProperties = array(); private $_aHeartbeatConfig = array(); private $_aWSapces = array(); + private $_auditLogConfig = array(); private $aWSinfo = array(); private $pluginsA = array(); private $errors = array(); @@ -465,6 +466,52 @@ class serverConf } } + /** + * With this is possible to save a property that will be saved in the properties + * array of this class. + * + * @param string $propertyName + * @param string $propertyValue + * @param string $workspace + */ + public function setAuditLogProperty($propertyName, $propertyValue, $workspace) + { + $this->_auditLogConfig[$workspace][$propertyName] = $propertyValue; + $this->saveSingleton(); + } + + /** + * To unset a defined property. + * If it doesn't exist then it does nothing. + * + * @param string $propertyName + * @param string $workspace + * @return void + */ + public function unsetAuditLogProperty($propertyName, $workspace) + { + if (isset($this->_auditLogConfig[$workspace][$propertyName])) { + unset($this->_auditLogConfig[$workspace][$propertyName]); + } + $this->saveSingleton(); + } + + /** + * Returns the value of a defined property. + * If it doesn't exist then returns null + * + * @param string $propertyName + * @return string/null + */ + public function getAuditLogProperty($propertyName, $workspace) + { + if (isset($this->_auditLogConfig[$workspace][$propertyName])) { + return $this->_auditLogConfig[$workspace][$propertyName]; + } else { + return null; + } + } + public function isRtl($lang = SYS_LANG) { $lang = substr($lang, 0, 2); diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index a52b9ee03..b1323e394 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -1506,6 +1506,13 @@ class workspaceTools $versionOld = ( isset($version[0])) ? $version[0] : ''; CLI::logging(CLI::info("$versionOld < $versionPresent") . "\n"); + $start = microtime(true); + CLI::logging("> Verify enterprise old...\n"); + $this->verifyEnterprise($workSpace); + $stop = microtime(true); + $final = $stop - $start; + CLI::logging("<*> Verify took $final seconds.\n"); + if ( $versionOld < $versionPresent || strpos($versionPresent, "Branch")) { $start = microtime(true); CLI::logging("> Updating database...\n"); diff --git a/workflow/engine/classes/model/AdditionalTables.php b/workflow/engine/classes/model/AdditionalTables.php index 07ce84404..d35abcfca 100755 --- a/workflow/engine/classes/model/AdditionalTables.php +++ b/workflow/engine/classes/model/AdditionalTables.php @@ -200,6 +200,8 @@ class AdditionalTables extends BaseAdditionalTables 'APP_UID' => '', 'SHD_DATE' => date('Y-m-d H:i:s'))); */ + + G::auditLog("CreatePMTable", $aData['ADD_TAB_NAME']); return $aData['ADD_TAB_UID']; } else { $sMessage = ''; @@ -226,6 +228,7 @@ class AdditionalTables extends BaseAdditionalTables $oConnection->begin(); $iResult = $oAdditionalTables->save(); $oConnection->commit(); + G::auditLog("UpdatePMTable", $aData['ADD_TAB_NAME']." (".$aData['ADD_TAB_UID'].") "); } else { $sMessage = ''; $aValidationFailures = $oAdditionalTables->getValidationFailures(); diff --git a/workflow/engine/classes/model/AddonsStore.php b/workflow/engine/classes/model/AddonsStore.php index 30e861fec..132b26a9b 100644 --- a/workflow/engine/classes/model/AddonsStore.php +++ b/workflow/engine/classes/model/AddonsStore.php @@ -64,7 +64,115 @@ class AddonsStore extends BaseAddonsStore return false; } - public static function addonList() + public static function addonList($type = 'plugin') + { + $result = array(); + + AddonsStore::checkLicenseStore(); + + $licenseManager = &pmLicenseManager::getSingleton(); //Getting the licenseManager + + $result["store_errors"] = array(); + list($stores, $errors) = AddonsStore::updateAll(false, $type); + + foreach ($errors as $store_id => $store_error) { + $result["store_errors"][] = array("id" => $store_id, "msg" => $store_error); + } + + $result["addons"] = array(); + $result["errors"] = array(); + + $criteria = new Criteria(); + $criteria->addAscendingOrderByColumn(AddonsManagerPeer::ADDON_TYPE); + $criteria->addAscendingOrderByColumn(AddonsManagerPeer::ADDON_ID); + $criteria->add(AddonsManagerPeer::ADDON_TYPE, $type, Criteria::EQUAL); + $addons = AddonsManagerPeer::doSelect($criteria); + + foreach ($addons as $addon) { + + $status = $addon->getAddonStatus(); + $version = $addon->getAddonVersion(); + $enabled = null; + + if (!$addon->checkState()) { + $result["errors"][] = array("addonId" => $addon->getAddonId(), "storeId" => $addon->getStoreId()); + } + + $sw = 1; + $addonInLicense = in_array($addon->getAddonId(), $licenseManager->features); + + if ($sw == 1 && $addon->getAddonId() != "enterprise" && !$addonInLicense) { + $sw = 0; + } + + if ($type == 'plugin') { + if ($sw == 1 && $addon->isInstalled()) { + if ($addon->isEnabled()) { + $status = "installed"; + } else { + $status = "disabled"; + } + + $version = $addon->getInstalledVersion(); + + if (version_compare($version . "", $addon->getAddonVersion() . "", "<")) { + $status = "upgrade"; + } + + $enabled = $addon->isEnabled(); + $sw = 0; + } + } else { + $status = "available"; + $enabled = false; + if (!$addonInLicense && in_array($addon->getAddonName(), $licenseManager->licensedfeatures) == 1) { + $status = "installed"; + $enabled = true; + } + } + + if ($sw == 1 && $addonInLicense) { + $status = "ready"; + $sw = 0; + } + + $state = $addon->getAddonState(); + $log = null; + + if ($state != null) { + $status = $state; + $log = $addon->getInstallLog(); + } + if ($addon->getAddonId() == "enterprise" && $status== 'ready') { + $status = 'installed'; + } + if ($status == 'minus-circle' ) { + $status = "available"; + } + + $result["addons"][$addon->getAddonId()] = array( + "id" => $addon->getAddonId(), + "store" => $addon->getStoreId(), + "name" => $addon->getAddonName(), + "nick" => $addon->getAddonNick(), + "version" => $version, + "enabled" => $enabled, + "latest_version" => $addon->getAddonVersion(), + "type" => $addon->getAddonType(), + "release_type" => $addon->getAddonReleaseType(), + "url" => $addon->getAddonDownloadUrl(), + "publisher" => $addon->getAddonPublisher(), + "description" => $addon->getAddonDescription(), + "status" => $status, + "log" => $log, + "progress" => round($addon->getAddonDownloadProgress()) + ); + } + + return $result; + } + + public static function addonFeatureList() { $result = array(); @@ -135,6 +243,9 @@ class AddonsStore extends BaseAddonsStore if ($addon->getAddonId() == "enterprise" && $status== 'ready') { $status = 'installed'; } + if ($status == 'minus-circle' ) { + $status = "available"; + } $result["addons"][$addon->getAddonId()] = array( "id" => $addon->getAddonId(), @@ -175,14 +286,14 @@ class AddonsStore extends BaseAddonsStore * * @return array containing a 'stores' array and a 'errors' array */ - public static function updateAll($force = false) + public static function updateAll($force = false, $type = 'plugin') { $stores = array(); $errors = array(); foreach (self::listStores() as $store) { try { - $stores[$store->getStoreId()] = $store->update($force); + $stores[$store->getStoreId()] = $store->update($force, $type); } catch (Exception $e) { $errors[$store->getStoreId()] = $e->getMessage(); } @@ -196,11 +307,12 @@ class AddonsStore extends BaseAddonsStore * * @return int number of addons removed */ - public function clear() + public function clear($type = 'plugin') { /* Remove old items from this store */ $criteria = new Criteria(AddonsManagerPeer::DATABASE_NAME); $criteria->add(AddonsManagerPeer::STORE_ID, $this->getStoreId(), Criteria::EQUAL); + $criteria->add(AddonsManagerPeer::ADDON_TYPE, $type, Criteria::EQUAL); return AddonsManagerPeer::doDelete($criteria); } @@ -210,7 +322,7 @@ class AddonsStore extends BaseAddonsStore * * @return bool true if updated, false otherwise */ - public function update($force = false) + public function update($force = false, $type = 'plugin') { require_once PATH_CORE . 'classes' . PATH_SEP . 'class.pmLicenseManager.php'; @@ -221,12 +333,13 @@ class AddonsStore extends BaseAddonsStore //If we have any addon that is installing or updating, don't update store $criteria = new Criteria(AddonsManagerPeer::DATABASE_NAME); $criteria->add(AddonsManagerPeer::ADDON_STATE, '', Criteria::NOT_EQUAL); + $criteria->add(AddonsManagerPeer::ADDON_TYPE, $type); if (AddonsManagerPeer::doCount($criteria) > 0) { return false; } - $this->clear(); + $this->clear($type); //Fill with local information @@ -241,74 +354,98 @@ class AddonsStore extends BaseAddonsStore $pmLicenseManagerO = &pmLicenseManager::getSingleton(); $localPlugins = array(); - foreach ($aPluginsPP as $aPlugin) { - $sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-')); + if ($type == 'plugin') { + foreach ($aPluginsPP as $aPlugin) { + $sClassName = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-')); - if (file_exists(PATH_PLUGINS . $sClassName . '.php')) { - require_once PATH_PLUGINS . $sClassName . '.php'; + if (file_exists(PATH_PLUGINS . $sClassName . '.php')) { + require_once PATH_PLUGINS . $sClassName . '.php'; - $oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php'); + $oDetails = $oPluginRegistry->getPluginDetails($sClassName . '.php'); - if ($oDetails) { - $sStatus = $oDetails->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED'); + if ($oDetails) { + $sStatus = $oDetails->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED'); - if (isset($oDetails->aWorkspaces)) { - if (!in_array(SYS_SYS, $oDetails->aWorkspaces)) { + if (isset($oDetails->aWorkspaces)) { + if (!in_array(SYS_SYS, $oDetails->aWorkspaces)) { + continue; + } + } + + if ($sClassName == "pmLicenseManager" || $sClassName == "pmTrial") { continue; } + + $sEdit = (($oDetails->sSetupPage != '') && ($oDetails->enabled)? G::LoadTranslation('ID_SETUP') : ' '); + $aPlugin = array(); + $aPluginId = $sClassName; + $aPluginTitle = $oDetails->sFriendlyName; + $aPluginDescription = $oDetails->sDescription; + $aPluginVersion = $oDetails->iVersion; + + if (@in_array($sClassName, $pmLicenseManagerO->features)) { + $aPluginStatus = $sStatus; + $aPluginLinkStatus = 'pluginsChange?id=' . $sClassName . '.php&status=' . $oDetails->enabled; + $aPluginEdit = $sEdit; + $aPluginLinkEdit = 'pluginsSetup?id=' . $sClassName . '.php'; + $aPluginStatusA = $sStatus == "Enabled" ? "installed" : 'disabled'; + $enabledStatus = true; + } else { + $aPluginStatus = ""; + $aPluginLinkStatus = ''; + $aPluginEdit = ''; + $aPluginLinkEdit = ''; + $aPluginStatusA = 'minus-circle'; + $enabledStatus = false; + } + + $addon = new AddonsManager(); + //G::pr($addon); + $addon->setAddonId($aPluginId); + $addon->setStoreId($this->getStoreId()); + //Don't trust external data + $addon->setAddonName($aPluginId); + $addon->setAddonDescription($aPluginDescription); + $addon->setAddonNick($aPluginTitle); + $addon->setAddonVersion(""); + $addon->setAddonStatus($aPluginStatusA); + $addon->setAddonType("plugin"); + $addon->setAddonPublisher("Colosa"); + $addon->setAddonDownloadUrl(""); + $addon->setAddonDownloadMd5(""); + $addon->setAddonReleaseDate(null); + $addon->setAddonReleaseType('localRegistry'); + $addon->setAddonReleaseNotes(""); + $addon->setAddonState(""); + + $addon->save(); + + $localPlugins[$aPluginId] = $addon; } - - if ($sClassName == "pmLicenseManager" || $sClassName == "pmTrial") { - continue; - } - - $sEdit = (($oDetails->sSetupPage != '') && ($oDetails->enabled)? G::LoadTranslation('ID_SETUP') : ' '); - $aPlugin = array(); - $aPluginId = $sClassName; - $aPluginTitle = $oDetails->sFriendlyName; - $aPluginDescription = $oDetails->sDescription; - $aPluginVersion = $oDetails->iVersion; - - if (@in_array($sClassName, $pmLicenseManagerO->features)) { - $aPluginStatus = $sStatus; - $aPluginLinkStatus = 'pluginsChange?id=' . $sClassName . '.php&status=' . $oDetails->enabled; - $aPluginEdit = $sEdit; - $aPluginLinkEdit = 'pluginsSetup?id=' . $sClassName . '.php'; - $aPluginStatusA = $sStatus == "Enabled" ? "installed" : 'disabled'; - $enabledStatus = true; - } else { - $aPluginStatus = ""; - $aPluginLinkStatus = ''; - $aPluginEdit = ''; - $aPluginLinkEdit = ''; - $aPluginStatusA = 'minus-circle'; - $enabledStatus = false; - } - - $addon = new AddonsManager(); - //G::pr($addon); - $addon->setAddonId($aPluginId); - $addon->setStoreId($this->getStoreId()); - //Don't trust external data - $addon->setAddonName($aPluginId); - $addon->setAddonDescription($aPluginDescription); - $addon->setAddonNick($aPluginTitle); - $addon->setAddonVersion(""); - $addon->setAddonStatus($aPluginStatusA); - $addon->setAddonType("plugin"); - $addon->setAddonPublisher("Colosa"); - $addon->setAddonDownloadUrl(""); - $addon->setAddonDownloadMd5(""); - $addon->setAddonReleaseDate(null); - $addon->setAddonReleaseType('localRegistry'); - $addon->setAddonReleaseNotes(""); - $addon->setAddonState(""); - - $addon->save(); - - $localPlugins[$aPluginId] = $addon; } } + } else { + $list = unserialize($pmLicenseManagerO->licensedfeaturesList); + foreach ($list['addons'] as $key => $feature) { + $addon = new AddonsManager(); + $addon->setAddonId($feature['name']); + $addon->setStoreId($feature['guid']); + $addon->setAddonName($feature['name']); + $addon->setAddonDescription($feature['description']); + $addon->setAddonNick($feature['nick']); + $addon->setAddonVersion(""); + $addon->setAddonStatus($feature['status']); + $addon->setAddonType("features"); + $addon->setAddonPublisher("Colosa"); + $addon->setAddonDownloadUrl(""); + $addon->setAddonDownloadMd5(""); + $addon->setAddonReleaseDate(null); + $addon->setAddonReleaseType('localRegistry'); + $addon->setAddonReleaseNotes(""); + $addon->setAddonState(""); + + $addon->save(); + } } $this->setStoreLastUpdated(time()); @@ -359,6 +496,7 @@ class AddonsStore extends BaseAddonsStore $context = stream_context_create($option); //This may block for a while, always use AJAX to call this method + $url = $url . '&type=' . strtoupper($type); $data = file_get_contents($url, false, $context); if ($data === false) { @@ -388,7 +526,7 @@ class AddonsStore extends BaseAddonsStore throw (new Exception("Addons not found on store data")); } - $this->clear(); + $this->clear($type); try { //Add each item to this stores addons @@ -451,7 +589,7 @@ class AddonsStore extends BaseAddonsStore $this->save(); } catch (Exception $e) { //If we had issues, don't keep only a part of the items - $this->clear(); + $this->clear($type); throw $e; } diff --git a/workflow/engine/classes/model/CalendarDefinition.php b/workflow/engine/classes/model/CalendarDefinition.php index 37d3e29bf..31856b9c6 100755 --- a/workflow/engine/classes/model/CalendarDefinition.php +++ b/workflow/engine/classes/model/CalendarDefinition.php @@ -253,7 +253,11 @@ class CalendarDefinition extends BaseCalendarDefinition if (! (is_object( $tr ) && get_class( $tr ) == 'CalendarDefinition')) { $tr = new CalendarDefinition(); $tr->setCalendarCreateDate( 'now' ); + G::auditLog("CreateCalendar", $aData['CALENDAR_NAME']); + } else { + G::auditLog("UpdateCalendar", $aData['CALENDAR_NAME']." (".$CalendarUid.") "); } + $tr->setCalendarUid( $CalendarUid ); $tr->setCalendarName( $CalendarName ); $tr->setCalendarUpdateDate( 'now' ); @@ -315,6 +319,8 @@ class CalendarDefinition extends BaseCalendarDefinition if ($tr->validate()) { // we save it, since we get no validation errors, or do whatever else you like. $res = $tr->save(); + $deletedCalendar = $tr->getCalendarName(); + G::auditLog("DeleteCalendar", $deletedCalendar." (".$CalendarUid.") "); } else { // Something went wrong. We can now get the validationFailures and handle them. $msg = ''; diff --git a/workflow/engine/classes/model/Content.php b/workflow/engine/classes/model/Content.php index 2a5255e70..cec41fcb8 100755 --- a/workflow/engine/classes/model/Content.php +++ b/workflow/engine/classes/model/Content.php @@ -342,7 +342,7 @@ class Content extends BaseContent `CON_LANG` VARCHAR(10) default '' NOT NULL, `CON_VALUE` MEDIUMTEXT NOT NULL, CONSTRAINT CONTENT_BACKUP_PK PRIMARY KEY (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG) - )Engine=MyISAM DEFAULT CHARSET='utf8' COMMENT='Table for add content';" ); + )Engine=InnoDB DEFAULT CHARSET='utf8' COMMENT='Table for add content';" ); $oStatement->executeQuery(); $sql = " SELECT DISTINCT CON_LANG diff --git a/workflow/engine/classes/model/DashletInstance.php b/workflow/engine/classes/model/DashletInstance.php index b4c504e25..585e18794 100644 --- a/workflow/engine/classes/model/DashletInstance.php +++ b/workflow/engine/classes/model/DashletInstance.php @@ -57,8 +57,10 @@ class DashletInstance extends BaseDashletInstance $data['DAS_INS_UID'] = G::generateUniqueID(); $data['DAS_INS_CREATE_DATE'] = date('Y-m-d H:i:s'); $dashletInstance = new DashletInstance(); + $msg = 'CreateDashletInstance'; } else { $dashletInstance = DashletInstancePeer::retrieveByPK($data['DAS_INS_UID']); + $msg = 'UpdateDashletInstance'; } $data['DAS_INS_UPDATE_DATE'] = date('Y-m-d H:i:s'); $dashletInstance->fromArray($data, BasePeer::TYPE_FIELDNAME); @@ -66,6 +68,10 @@ class DashletInstance extends BaseDashletInstance $connection->begin(); $result = $dashletInstance->save(); $connection->commit(); + + $dashletData = $this->load($data['DAS_INS_UID']); + G::auditLog($msg, $dashletData['DAS_INS_TITLE']." (".$dashletData['DAS_INS_UID'].") "); + return $data['DAS_INS_UID']; } else { $message = ''; @@ -88,8 +94,11 @@ class DashletInstance extends BaseDashletInstance $dashletInstance = DashletInstancePeer::retrieveByPK($dasInsUid); if (!is_null($dashletInstance)) { $connection->begin(); + $dashletData = $this->load($dasInsUid); $result = $dashletInstance->delete(); $connection->commit(); + + G::auditLog("DeleteDashletInstance", $dashletData['DAS_INS_TITLE']." (".$dasInsUid.") "); return $result; } else { throw new Exception('Error trying to delete: The row "' . $dasInsUid. '" does not exist.'); diff --git a/workflow/engine/classes/model/Department.php b/workflow/engine/classes/model/Department.php index 49ae0e04a..66512eb81 100755 --- a/workflow/engine/classes/model/Department.php +++ b/workflow/engine/classes/model/Department.php @@ -61,6 +61,12 @@ class Department extends BaseDepartment $this->setDepUid( G::generateUniqueID() ); } + if (isset( $aData['DEP_PARENT'] ) && ($aData['DEP_PARENT'] =='')) { + $msgLog = 'Departament'; + } else { + $msgLog = 'SubDepartament'; + } + if (isset( $aData['DEP_PARENT'] )) { $this->setDepParent( $aData['DEP_PARENT'] ); } else { @@ -108,6 +114,9 @@ class Department extends BaseDepartment $res = $this->save(); $con->commit(); + + G::auditLog("Create ".$msgLog, $aData['DEP_TITLE']); + return $this->getDepUid(); } else { $msg = ''; @@ -277,8 +286,11 @@ class Department extends BaseDepartment $oPro = DepartmentPeer::retrieveByPK( $ProUid ); if (! is_null( $oPro )) { + $dptoTitle = $this->Load($oPro->getDepUid()); Content::removeContent( 'DEPO_TITLE', '', $oPro->getDepUid() ); Content::removeContent( 'DEPO_DESCRIPTION', '', $oPro->getDepUid() ); + + G::auditLog("DeleteDepartament", $dptoTitle['DEPO_TITLE']." (".$oPro->getDepUid().") "); return $oPro->delete(); } else { throw (new Exception( "The row '$ProUid' in table Group doesn't exist!" )); @@ -320,10 +332,11 @@ class Department extends BaseDepartment } public function updateDepartmentManager ($depId) - { + { $managerId = ''; $depParent = ''; $oDept = DepartmentPeer::retrieveByPk( $depId ); + if (is_object( $oDept ) && get_class( $oDept ) == 'Department') { $managerId = $oDept->getDepManager(); $depParent = $oDept->getDepParent(); @@ -353,7 +366,12 @@ class Department extends BaseDepartment } $oUser->save(); } - + + if ($managerId) { + $user = $oUser->loadDetailed ($managerId); + $dptoTitle = $oDept->Load($depId); + G::auditLog("AssignManagerToDepartament", "Assign Manager ".$user['USR_USERNAME']." (".$managerId.") to ".$dptoTitle['DEPO_TITLE']." (".$depId.") "); + } // get children departments to update the reportsTo of these children $childrenCriteria = new Criteria( 'workflow' ); $childrenCriteria->add( DepartmentPeer::DEP_PARENT, $depId ); @@ -378,9 +396,13 @@ class Department extends BaseDepartment try { //update the field in user table $oUser = UsersPeer::retrieveByPk( $userId ); + $user = $oUser->loadDetailed ($userId); + $dptoTitle = $this->Load($depId); + if (is_object( $oUser ) && get_class( $oUser ) == 'Users') { $oUser->setDepUid( $depId ); $oUser->save(); + G::auditLog("AssignUsersToDepartament", "Assign user ".$user['USR_USERNAME']." (".$userId.") to departament ".$dptoTitle['DEPO_TITLE']." (".$depId.") "); } //if the user is a manager update Department Table @@ -549,11 +571,16 @@ class Department extends BaseDepartment ); try { $oUser = UsersPeer::retrieveByPk( $UsrUid ); + $user = $oUser->loadDetailed ($UsrUid); + $dptoTitle = $this->Load($DepUid); + if (is_object( $oUser ) && get_class( $oUser ) == 'Users') { //$oDepto = new Users(); $oUser->setDepUid( '' ); $oUser->setUsrReportsTo( '' ); $oUser->save(); + + G::auditLog("RemoveUsersFromDepartament", "Remove user ".$user['USR_USERNAME']."( ".$UsrUid.") from departament ".$dptoTitle['DEPO_TITLE']." (".$DepUid.") "); } } catch (exception $oError) { throw ($oError); diff --git a/workflow/engine/classes/model/GroupUser.php b/workflow/engine/classes/model/GroupUser.php index d4124cb37..226d2da4f 100755 --- a/workflow/engine/classes/model/GroupUser.php +++ b/workflow/engine/classes/model/GroupUser.php @@ -91,6 +91,15 @@ class GroupUser extends BaseGroupUser $oConnection->begin(); $iResult = $oGroupUser->delete(); $oConnection->commit(); + + $oGrpwf = new Groupwf(); + $grpName = $oGrpwf->loadByGroupUid($sGrpUid); + + $oUsr = new Users(); + $usrName = $oUsr->load($sUserUid); + + G::auditLog("AssignUsersToGroup", "Remove user ". $usrName['USR_USERNAME'] ." (".$sUserUid.") from group ".$grpName['CON_VALUE']." (".$sGrpUid.") "); + return $iResult; } else { throw (new Exception( 'This row doesn\'t exist!' )); diff --git a/workflow/engine/classes/model/Groupwf.php b/workflow/engine/classes/model/Groupwf.php index 605345679..f99a70127 100755 --- a/workflow/engine/classes/model/Groupwf.php +++ b/workflow/engine/classes/model/Groupwf.php @@ -272,6 +272,26 @@ class Groupwf extends BaseGroupwf return $c; } + public function loadByGroupUid ($UidGroup) + { + $c = new Criteria( 'workflow' ); + $del = DBAdapter::getStringDelimiter(); + + $c->clearSelectColumns(); + $c->addSelectColumn( ContentPeer::CON_VALUE ); + + $c->add( ContentPeer::CON_CATEGORY, 'GRP_TITLE' ); + $c->add( ContentPeer::CON_ID, $UidGroup ); + $c->add( ContentPeer::CON_LANG, SYS_LANG ); + + $dataset = ContentPeer::doSelectRS( $c ); + $dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $dataset->next(); + $row = $dataset->getRow(); + + return $row; + } + public function getAll ($start = null, $limit = null, $search = null) { $totalCount = 0; diff --git a/workflow/engine/classes/model/Language.php b/workflow/engine/classes/model/Language.php index 6384a8b1b..b9904aa30 100755 --- a/workflow/engine/classes/model/Language.php +++ b/workflow/engine/classes/model/Language.php @@ -301,6 +301,8 @@ class Language extends BaseLanguage $results->headers = $POHeaders; $results->errMsg = $errorMsg; + G::auditLog("UploadLanguage", $languageID); + return $results; } catch (Exception $oError) { throw ($oError); @@ -549,6 +551,7 @@ class Language extends BaseLanguage } } //end foreach } + G::auditLog("ExportLanguage", $_GET['LOCALE']); G::streamFile( $sPOFile, true ); } public function updateLanguagePlugin ($plugin, $idLanguage) diff --git a/workflow/engine/classes/model/ProcessCategory.php b/workflow/engine/classes/model/ProcessCategory.php index b0de98507..2d51d25f6 100755 --- a/workflow/engine/classes/model/ProcessCategory.php +++ b/workflow/engine/classes/model/ProcessCategory.php @@ -55,6 +55,22 @@ class ProcessCategory extends BaseProcessCategory return $aRow; } + public function loadByCategoryId($sCategoryUid) + { + $c = new Criteria('workflow'); + $del = DBAdapter::getStringDelimiter(); + + $c->clearSelectColumns(); + $c->addSelectColumn( ProcessCategoryPeer::CATEGORY_NAME); + + $c->add(ProcessCategoryPeer::CATEGORY_UID, $sCategoryUid); + $dataset = ProcessCategoryPeer::doSelectRS($c); + $dataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC ); + $dataset->next(); + $aRow = $dataset->getRow(); + return $aRow['CATEGORY_NAME']; + } + public function exists ($catUid) { $oProCat = ProcessCategoryPeer::retrieveByPk( $catUid ); diff --git a/workflow/engine/classes/model/Translation.php b/workflow/engine/classes/model/Translation.php index 01e608303..82bc45a41 100755 --- a/workflow/engine/classes/model/Translation.php +++ b/workflow/engine/classes/model/Translation.php @@ -454,6 +454,7 @@ class Translation extends BaseTranslation if (file_exists( PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po' )) { G::rm_dir( PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po' ); } + G::auditLog("DeleteLanguage", $locale); } } diff --git a/workflow/engine/controllers/adminProxy.php b/workflow/engine/controllers/adminProxy.php index 5afd4ee74..68c2adaf8 100644 --- a/workflow/engine/controllers/adminProxy.php +++ b/workflow/engine/controllers/adminProxy.php @@ -121,6 +121,12 @@ class adminProxy extends HttpProxyController $this->restart = $restart; $this->url = "/sys" . SYS_SYS . "/" . (($sysConf["default_lang"] != "")? $sysConf["default_lang"] : ((defined("SYS_LANG") && SYS_LANG != "")? SYS_LANG : "en")) . "/" . $sysConf["default_skin"] . $urlPart; $this->message = 'Saved Successfully'; + + if($httpData->proxy_host != '' || $httpData->proxy_port != '' || $httpData->proxy_user != '') { + $msg = " Host -> ".$httpData->proxy_host." Port -> ".$httpData->proxy_port." User -> ".$httpData->proxy_user; + } + + G::auditLog("UploadSystemSettings", "Time Zone -> ".$httpData->time_zone." Memory Limit -> ".$httpData->memory_limit." Cookie lifetime -> ".$httpData->max_life_time." Default Skin -> ".$httpData->default_skin." Default Language -> ". $httpData->default_lang. $msg); } public function uxUserUpdate($httpData) @@ -732,6 +738,7 @@ class adminProxy extends HttpProxyController ); $this->success='true'; $this->msg='Saved'; + G::auditLog("UpdateEmailSettings", "EnableEmailNotifications->".$aFields['MESS_ENABLED']." EmailEngine->".$aFields['MESS_ENGINE']." Server->".$aFields['MESS_SERVER']." Port->".$aFields['MESS_PORT']." RequireAuthentication->".$aFields['MESS_RAUTH']." FromMail->".$aFields['MESS_ACCOUNT']." FromName->".$aFields['MESS_FROM_NAME']." Use Secure Connection->".$aFields['SMTPSecure']); } else { $oConfiguration->create( array( @@ -745,6 +752,7 @@ class adminProxy extends HttpProxyController ); $this->success='true'; $this->msg='Saved'; + G::auditLog("CreateEmailSettings", "EnableEmailNotifications->".$aFields['MESS_ENABLED']." EmailEngine->".$aFields['MESS_ENGINE']." Server->".$aFields['MESS_SERVER']." Port->".$aFields['MESS_PORT']." RequireAuthentication->".$aFields['MESS_RAUTH']." FromMail->".$aFields['MESS_ACCOUNT']." FromName->".$aFields['MESS_FROM_NAME']." Use Secure Connection->".$aFields['SMTPSecure']); } } catch (Exception $e) { $this->success= false; @@ -1048,6 +1056,7 @@ class adminProxy extends HttpProxyController try { list($imageWidth, $imageHeight, $imageType) = @getimagesize($dir . '/' . 'tmp' . $fileName); G::resizeImage($dir . '/tmp' . $fileName, $imageWidth, 49, $dir . '/' . $fileName); + G::auditLog("UploadLogo", $fileName); } catch (Exception $e) { $error = $e->getMessage(); } @@ -1064,8 +1073,7 @@ class adminProxy extends HttpProxyController } } elseif ($_FILES['img']['type'] != '') { $failed = "1"; - } - + } echo '{success: true, failed: ' . $failed . ', uploaded: ' . $uploaded . ', type: "' . $_FILES['img']['type'] . '"}'; exit(); } @@ -1130,6 +1138,7 @@ class adminProxy extends HttpProxyController if (file_exists($dir . '/tmp' . $imgname)) { unlink ($dir . '/tmp' . $imgname); } + G::auditLog("DeleteLogo", $imgname); } else { echo '{success: false}'; exit(); @@ -1182,6 +1191,8 @@ class adminProxy extends HttpProxyController $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '', ''); G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels'); + G::auditLog("ReplaceLogo", $snameLogo); + break; case 'restoreLogo': $snameLogo = $_GET['NAMELOGO']; @@ -1194,8 +1205,8 @@ class adminProxy extends HttpProxyController $oConf->aConfig = $aConf; $oConf->saveConfig('USER_LOGO_REPLACEMENT', '', '', ''); - G::SendTemporalMessage('ID_REPLACED_LOGO', 'tmp-info', 'labels'); + G::auditLog("RestoreLogo", "Restore Original Logo"); break; } } catch (Exception $oException) { diff --git a/workflow/engine/controllers/main.php b/workflow/engine/controllers/main.php index 295e11bd1..ebb7151c9 100644 --- a/workflow/engine/controllers/main.php +++ b/workflow/engine/controllers/main.php @@ -44,11 +44,12 @@ class Main extends Controller // license notification $expireInLabel = ''; - if (class_exists( 'pmLicenseManager' )) { - $pmLicenseManager = &pmLicenseManager::getSingleton(); - $expireIn = $pmLicenseManager->getExpireIn(); - $expireInLabel = $pmLicenseManager->getExpireInLabel(); - } + + require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php"); + $pmLicenseManager = &pmLicenseManager::getSingleton(); + $expireIn = $pmLicenseManager->getExpireIn(); + $expireInLabel = $pmLicenseManager->getExpireInLabel(); + $this->setVar( 'licenseNotification', $expireInLabel ); // setting variables on javascript env. diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index 7ba429ffd..979bb16e1 100755 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -410,6 +410,7 @@ class pmTablesProxy extends HttpProxyController if ($errors == '') { $result->success = true; $result->message = $count.G::LoadTranslation( 'ID_TABLES_REMOVED_SUCCESSFULLY' ); + G::auditLog("DeletePMTable", $table['ADD_TAB_NAME']." (".$table['ADD_TAB_UID'].") "); } else { $result->success = false; $result->message = $count. G::LoadTranslation( 'ID_TABLES_REMOVED_WITH_ERRORS' ) .$errors; @@ -508,7 +509,7 @@ class pmTablesProxy extends HttpProxyController if ($obj->validate()) { $obj->save(); $toSave = true; - + G::auditLog("AddDataInPMTable", $table['ADD_TAB_NAME']." (".$table['ADD_TAB_UID'].") "); $primaryKeysValues = array (); foreach ($primaryKeys as $primaryKey) { $method = 'get' . AdditionalTables::getPHPName( $primaryKey['FLD_NAME'] ); @@ -580,6 +581,10 @@ class pmTablesProxy extends HttpProxyController $result = $this->_dataUpdate( $row, $primaryKeys ); } + if ($result) { + G::auditLog("UpdateDataInPMTable", $table['ADD_TAB_NAME']." (".$table['ADD_TAB_UID'].") "); + } + $this->success = $result; $this->message = $result ? G::loadTranslation( 'ID_UPDATED_SUCCESSFULLY' ) : G::loadTranslation( 'ID_UPDATE_FAILED' ); } @@ -604,6 +609,8 @@ class pmTablesProxy extends HttpProxyController require_once $sPath . $this->className . '.php'; + G::auditLog("DeleteDataInPMTable", $table['ADD_TAB_NAME']." (".$table['ADD_TAB_UID'].") "); + $this->success = $this->_dataDestroy( $httpData->rows ); $this->message = $this->success ? G::loadTranslation( 'ID_DELETED_SUCCESSFULLY' ) : G::loadTranslation( 'ID_DELETE_FAILED' ); } @@ -678,6 +685,7 @@ class pmTablesProxy extends HttpProxyController $this->success = true; $this->message = G::loadTranslation( 'ID_FILE_IMPORTED_SUCCESSFULLY', array ($filename ) ); + G::auditLog("ImportTable", $filename); } } else { $sMessage = G::LoadTranslation( 'ID_UPLOAD_VALID_CSV_FILE' ); @@ -919,6 +927,7 @@ class pmTablesProxy extends HttpProxyController // is a report table, try populate it $additionalTable->populateReportTable( $table['ADD_TAB_NAME'], pmTable::resolveDbSource( $table['DBS_UID'] ), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'], $table['ADD_TAB_UID'] ); } + G::auditLog("ImportTable", $table['ADD_TAB_NAME']." (".$table['ADD_TAB_UID'].") "); break; case '@DATA': $fstName = intval( fread( $fp, 9 ) ); @@ -1104,6 +1113,7 @@ class pmTablesProxy extends HttpProxyController $bytesSaved += fwrite( $fp, $fsData ); //writing the size of xml file $bytesSaved += fwrite( $fp, $SDATA ); //writing the xmlfile } + G::auditLog("ExportTable", $table->ADD_TAB_NAME." (".$table->ADD_TAB_UID.") "); } fclose( $fp ); diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index a44a36510..b044eec61 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2119,7 +2119,7 @@ CREATE TABLE `ADDONS_STORE` `STORE_TYPE` VARCHAR(255) NOT NULL, `STORE_LAST_UPDATED` DATETIME, PRIMARY KEY (`STORE_ID`) -)ENGINE=MyISAM ; +)ENGINE=InnoDB ; #----------------------------------------------------------------------------- #-- ADDONS_MANAGER @@ -2147,7 +2147,7 @@ CREATE TABLE `ADDONS_MANAGER` `ADDON_DOWNLOAD_PROGRESS` FLOAT, `ADDON_DOWNLOAD_MD5` VARCHAR(32), PRIMARY KEY (`ADDON_ID`,`STORE_ID`) -)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='Addons manager'; +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Addons manager'; #----------------------------------------------------------------------------- @@ -2167,4 +2167,4 @@ CREATE TABLE IF NOT EXISTS `LICENSE_MANAGER` ( `LICENSE_WORKSPACE` varchar(32) NOT NULL DEFAULT '0', `LICENSE_TYPE` varchar(32) NOT NULL DEFAULT '0', PRIMARY KEY (`LICENSE_UID`) -)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='Licenses Manager'; +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Licenses Manager'; diff --git a/workflow/engine/menus/setup.php b/workflow/engine/menus/setup.php index c107afcbf..13821b0e0 100755 --- a/workflow/engine/menus/setup.php +++ b/workflow/engine/menus/setup.php @@ -26,6 +26,9 @@ global $G_TMP_MENU; global $RBAC; $partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false; +$oServerConf = & serverConf::getSingleton(); +$sAudit = $oServerConf->getAuditLogProperty( 'AL_OPTION', SYS_SYS ); + if ($RBAC->userCanAccess('PM_SETUP') == 1 ) { //settings options // $G_TMP_MENU->AddIdRawOption('LOGO', 'uplogo', G::LoadTranslation('ID_LOGO'), 'icon-pmlogo.png', '', 'settings'); @@ -95,12 +98,16 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1) { $G_TMP_MENU->AddIdRawOption('LOG_CASE_SCHEDULER', '../cases/cases_Scheduler_Log', G::LoadTranslation('ID_CASE_SCHEDULER'), "icon-logs-list.png",'', 'logs'); $G_TMP_MENU->AddIdRawOption("CRON", "../setup/cron", G::LoadTranslation("ID_CRON_ACTIONS"), null, null, "logs"); $G_TMP_MENU->AddIdRawOption('EMAILS', '../mails/emailList', ucfirst (strtolower ( G::LoadTranslation('ID_EMAILS'))), '', '', 'logs'); + if (isset($sAudit) && $sAudit != false) { + $G_TMP_MENU->AddIdRawOption('AUDIT_LOG', '../setup/auditLog', ucfirst (strtolower ( G::LoadTranslation('ID_AUDITLOG_DISPLAY'))), '', '', 'logs'); + } } if ($RBAC->userCanAccess("PM_SETUP") == 1) { $G_TMP_MENU->AddIdRawOption("PM_REQUIREMENTS", "../setup/systemInfo", G::LoadTranslation("ID_PROCESSMAKER_REQUIREMENTS_CHECK"), "", "", "settings"); $G_TMP_MENU->AddIdRawOption("PHP_INFO", "../setup/systemInfo?option=php", G::LoadTranslation("ID_PHP_INFO"), "", "", "settings"); //$G_TMP_MENU->AddIdRawOption("PHP_MAINTENANCE", "../admin/maintenance", 'Maintenance', "", "", "settings"); + $G_TMP_MENU->AddIdRawOption("AUDIT_LOG", "auditLogConfig", G::LoadTranslation("ID_AUDITLOG_DISPLAY"), "", "", "settings"); } require_once 'classes/class.pmLicenseManager.php'; diff --git a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php index 94055d1dc..4e01a467f 100755 --- a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php @@ -22,6 +22,11 @@ * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ +$arrayToTranslation = array( + "TRIGGER" => G::LoadTranslation("ID_TRIGGER_DB"), + "DERIVATION" => G::LoadTranslation("ID_DERIVATION_DB") +); + $actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null; if ($actionAjax == 'messageHistoryGridList_JXP') { @@ -110,6 +115,8 @@ if ($actionAjax == 'messageHistoryGridList_JXP') { $r->data = $aProcesses; $r->totalCount = $totalCount; + $r->data[0]["APP_MSG_TYPE"] = (array_key_exists($r->data[0]["APP_MSG_TYPE"], $arrayToTranslation))? $arrayToTranslation[$r->data[0]["APP_MSG_TYPE"]] : $r->data[0]["APP_MSG_TYPE"]; + echo G::json_encode( $r ); } if ($actionAjax == 'showHistoryMessage') { diff --git a/workflow/engine/methods/cases/cases_Ajax.php b/workflow/engine/methods/cases/cases_Ajax.php index 20a25b77e..d97fdc197 100755 --- a/workflow/engine/methods/cases/cases_Ajax.php +++ b/workflow/engine/methods/cases/cases_Ajax.php @@ -533,6 +533,12 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) { G::LoadClass( "BasePeer" ); global $G_PUBLISH; + $arrayToTranslation = array( + "INPUT" => G::LoadTranslation("ID_INPUT_DB"), + "OUTPUT" => G::LoadTranslation("ID_OUTPUT_DB"), + "ATTACHED" => G::LoadTranslation("ID_ATTACHED_DB") + ); + $oCase = new Cases(); $aProcesses = Array (); $G_PUBLISH = new Publisher(); @@ -551,6 +557,7 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) { for ($j = 0; $j < $rs->getRecordCount(); $j ++) { $result = $rs->getRow(); + $result["TYPE"] = (array_key_exists($result["TYPE"], $arrayToTranslation))? $arrayToTranslation[$result["TYPE"]] : $result["TYPE"]; $aProcesses[] = $result; $rs->next(); $totalCount ++; diff --git a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php index 54e42c063..29d6180c9 100755 --- a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php +++ b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php @@ -49,6 +49,149 @@ $aData['APP_STATUS'] = $Fields['APP_STATUS']; $oCase->updateCase( $_SESSION['APPLICATION'], $aData ); G::SendTemporalMessage( 'ID_SAVED_SUCCESSFULLY', 'info' ); +//Save files +if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) { + $arrayField = array (); + $arrayFileName = array (); + $arrayFileTmpName = array (); + $arrayFileError = array (); + $i = 0; + + foreach ($_FILES["form"]["name"] as $fieldIndex => $fieldValue) { + if (is_array( $fieldValue )) { + foreach ($fieldValue as $index => $value) { + if (is_array( $value )) { + foreach ($value as $grdFieldIndex => $grdFieldValue) { + $arrayField[$i]["grdName"] = $fieldIndex; + $arrayField[$i]["grdFieldName"] = $grdFieldIndex; + $arrayField[$i]["index"] = $index; + + $arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex][$index][$grdFieldIndex]; + $arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex][$index][$grdFieldIndex]; + $arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex][$index][$grdFieldIndex]; + $i = $i + 1; + } + } + } + } else { + $arrayField[$i] = $fieldIndex; + + $arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex]; + $arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex]; + $arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex]; + $i = $i + 1; + } + } + if (count( $arrayField ) > 0) { + for ($i = 0; $i <= count( $arrayField ) - 1; $i ++) { + if ($arrayFileError[$i] == 0) { + $indocUid = null; + $fieldName = null; + $fileSizeByField = 0; + + if (is_array( $arrayField[$i] )) { + if (isset( $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]] ) && ! empty( $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]] )) { + $indocUid = $_POST["INPUTS"][$arrayField[$i]["grdName"]][$arrayField[$i]["grdFieldName"]]; + } + + $fieldName = $arrayField[$i]["grdName"] . "_" . $arrayField[$i]["index"] . "_" . $arrayField[$i]["grdFieldName"]; + + if (isset($_FILES["form"]["size"][$arrayField[$i]["grdName"]][$arrayField[$i]["index"]][$arrayField[$i]["grdFieldName"]])) { + $fileSizeByField = $_FILES["form"]["size"][$arrayField[$i]["grdName"]][$arrayField[$i]["index"]][$arrayField[$i]["grdFieldName"]]; + } + } else { + if (isset( $_POST["INPUTS"][$arrayField[$i]] ) && ! empty( $_POST["INPUTS"][$arrayField[$i]] )) { + $indocUid = $_POST["INPUTS"][$arrayField[$i]]; + } + + $fieldName = $arrayField[$i]; + + if (isset($_FILES["form"]["size"][$fieldName])) { + $fileSizeByField = $_FILES["form"]["size"][$fieldName]; + } + } + + if ($indocUid != null) { + //require_once ("classes/model/AppFolder.php"); + //require_once ("classes/model/InputDocument.php"); + + $oInputDocument = new InputDocument(); + $aID = $oInputDocument->load( $indocUid ); + + //Get the Custom Folder ID (create if necessary) + $oFolder = new AppFolder(); + + //***Validating the file allowed extensions*** + $res = G::verifyInputDocExtension($aID['INP_DOC_TYPE_FILE'], $arrayFileName[$i], $arrayFileTmpName[$i]); + if($res->status == 0){ + $message = $res->message; + G::SendMessageText( $message, "ERROR" ); + $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + die(); + } + + //--- Validate Filesize of $_FILE + $inpDocMaxFilesize = $aID["INP_DOC_MAX_FILESIZE"]; + $inpDocMaxFilesizeUnit = $aID["INP_DOC_MAX_FILESIZE_UNIT"]; + + $inpDocMaxFilesize = $inpDocMaxFilesize * (($inpDocMaxFilesizeUnit == "MB")? 1024 *1024 : 1024); //Bytes + + if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) { + if ($fileSizeByField > $inpDocMaxFilesize) { + G::SendMessageText(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR"); + $arrayAux1 = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]); + G::header("location: /sys" . SYS_SYS . $arrayAux1[1]); + exit(0); + } + } + + $aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => $indocUid,"APP_DOC_TYPE" => "INPUT","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"FOLDER_UID" => $oFolder->createFromPath( $aID["INP_DOC_DESTINATION_PATH"] ),"APP_DOC_TAGS" => $oFolder->parseTags( $aID["INP_DOC_TAGS"] ),"APP_DOC_FIELDNAME" => $fieldName); + } else { + $aFields = array ("APP_UID" => $_SESSION["APPLICATION"],"DEL_INDEX" => $_SESSION["INDEX"],"USR_UID" => $_SESSION["USER_LOGGED"],"DOC_UID" => - 1,"APP_DOC_TYPE" => "ATTACHED","APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => "","APP_DOC_TITLE" => "","APP_DOC_FILENAME" => $arrayFileName[$i],"APP_DOC_FIELDNAME" => $fieldName); + } + + $oAppDocument = new AppDocument(); + $oAppDocument->create( $aFields ); + + $iDocVersion = $oAppDocument->getDocVersion(); + $sAppDocUid = $oAppDocument->getAppDocUid(); + $aInfo = pathinfo( $oAppDocument->getAppDocFilename() ); + $sExtension = ((isset( $aInfo["extension"] )) ? $aInfo["extension"] : ""); + $pathUID = G::getPathFromUID($_SESSION["APPLICATION"]); + $sPathName = PATH_DOCUMENT . $pathUID . PATH_SEP; + $sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension; + G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName ); + + //Plugin Hook PM_UPLOAD_DOCUMENT for upload document + $oPluginRegistry = &PMPluginRegistry::getSingleton(); + + if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( "uploadDocumentData" )) { + $triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT ); + $documentData = new uploadDocumentData( $_SESSION["APPLICATION"], $_SESSION["USER_LOGGED"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion ); + $uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData ); + + if ($uploadReturn) { + $aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace; + + if (! isset( $aFields["APP_DOC_UID"] )) { + $aFields["APP_DOC_UID"] = $sAppDocUid; + } + + if (! isset( $aFields["DOC_VERSION"] )) { + $aFields["DOC_VERSION"] = $iDocVersion; + } + + $oAppDocument->update( $aFields ); + + unlink( $sPathName . $sFileName ); + } + } + } + } + } +} + //go to the next step $aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] ); $_SESSION['STEP_POSITION'] = $aNextStep['POSITION']; diff --git a/workflow/engine/methods/cases/cases_Scheduler_Save.php b/workflow/engine/methods/cases/cases_Scheduler_Save.php index a6b36e3f4..9a296b527 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_Save.php +++ b/workflow/engine/methods/cases/cases_Scheduler_Save.php @@ -49,7 +49,7 @@ try { $aData['SCH_UID'] = G::generateUniqueID(); $aData['SCH_NAME'] = $_POST['form']['SCH_NAME']; $aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME']; - $aData['SCH_DEL_USER_PASS'] = md5( $_POST['form']['SCH_USER_PASSWORD'] ); + $aData['SCH_DEL_USER_PASS'] = Bootstrap::hashPassword($_POST['form']['SCH_USER_PASSWORD']); $aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID']; $aData['PRO_UID'] = $_POST['form']['PRO_UID']; $aData['TAS_UID'] = $_POST['form']['TAS_UID']; diff --git a/workflow/engine/methods/cases/cases_Scheduler_Update.php b/workflow/engine/methods/cases/cases_Scheduler_Update.php index 995eaaefb..122ef8c22 100755 --- a/workflow/engine/methods/cases/cases_Scheduler_Update.php +++ b/workflow/engine/methods/cases/cases_Scheduler_Update.php @@ -54,7 +54,7 @@ try { $aData['SCH_DEL_USER_NAME'] = $_POST['form']['SCH_USER_NAME']; if ($_POST['form']['SCH_USER_PASSWORD'] != 'DefaultPM') { - $aData['SCH_DEL_USER_PASS'] = md5( $_POST['form']['SCH_USER_PASSWORD'] ); + $aData['SCH_DEL_USER_PASS'] = Bootstrap::hashPassword($_POST['form']['SCH_USER_PASSWORD']); } $aData['SCH_DEL_USER_UID'] = $_POST['form']['SCH_USER_UID']; diff --git a/workflow/engine/methods/cases/proxyPMTablesFieldList.php b/workflow/engine/methods/cases/proxyPMTablesFieldList.php index d8d996725..a5ea64795 100644 --- a/workflow/engine/methods/cases/proxyPMTablesFieldList.php +++ b/workflow/engine/methods/cases/proxyPMTablesFieldList.php @@ -631,6 +631,27 @@ function fieldSave() $conf->saveObject($result, "casesList", $action, "", "", ""); + $msgLog = ''; + + if($action == 'todo') { + $list = 'Inbox'; + } elseif ($action == 'sent') { + $list = 'Participated'; + } else { + $list = ucwords($action); + } + + for ($i=4; $iupdate( $editDepartment ); $oDept->updateDepartmentManager( $dep_uid ); + + if ($dep_parent == '') { + G::auditLog("UpdateDepartament", $dep_name." (".$dep_uid.") "); + } else { + G::auditLog("UpdateSubDepartament", $dep_name." (".$dep_uid.") "); + } + echo '{success: true}'; } catch (exception $e) { echo '{success: false}'; diff --git a/workflow/engine/methods/enterprise/addonsStoreAction.php b/workflow/engine/methods/enterprise/addonsStoreAction.php index ec0b59622..2c4120e13 100644 --- a/workflow/engine/methods/enterprise/addonsStoreAction.php +++ b/workflow/engine/methods/enterprise/addonsStoreAction.php @@ -177,6 +177,13 @@ try { } $result["success"] = $addon->setEnabled(($action == "enable")); + + if ($action == "enable") { + G::auditLog("EnablePlugin", $_REQUEST['addon']); + } else { + G::auditLog("DisablePlugin", $_REQUEST['addon']); + } + break; case "install": $status = 1; @@ -340,7 +347,9 @@ try { exit(0); break; case "addonslist": - $result = AddonsStore::addonList(); + $type = (isset($_REQUEST['type'])) ? $_REQUEST['type']: 'plugin'; + $result = AddonsStore::addonList($type); + break; break; default: throw (new Exception("Action \"$action\" is not valid")); diff --git a/workflow/engine/methods/enterprise/enterprise.php b/workflow/engine/methods/enterprise/enterprise.php index d8a122412..2ae816c76 100644 --- a/workflow/engine/methods/enterprise/enterprise.php +++ b/workflow/engine/methods/enterprise/enterprise.php @@ -21,8 +21,8 @@ class enterprisePlugin extends PMPlugin $VERSION = System::getVersion(); $res = parent::PMPlugin($sNamespace, $sFilename); - $this->sFriendlyName = "ProcessMaker Enterprise Edition"; - $this->sDescription = "ProcessMaker Enterprise Edition $VERSION"; + $this->sFriendlyName = "ProcessMaker Enterprise Core Edition"; + $this->sDescription = "ProcessMaker Enterprise Core Edition $VERSION"; $this->sPluginFolder = "enterprise"; $this->sSetupPage = "../enterprise/addonsStore.php"; $this->iVersion = $VERSION; diff --git a/workflow/engine/methods/enterprise/processMakerAjax.php b/workflow/engine/methods/enterprise/processMakerAjax.php index 877adde34..46a2d6e99 100644 --- a/workflow/engine/methods/enterprise/processMakerAjax.php +++ b/workflow/engine/methods/enterprise/processMakerAjax.php @@ -270,6 +270,7 @@ switch ($option) { if ($result["status"] == "OK") { $response["status"] = $result["status"]; //OK $response["message"] = $result["message"]; + G::auditLog("InstallPlugin", $file); } else { throw (new Exception($result["message"])); } diff --git a/workflow/engine/methods/groups/groups_Ajax.php b/workflow/engine/methods/groups/groups_Ajax.php index 76f350204..18ea84d25 100644 --- a/workflow/engine/methods/groups/groups_Ajax.php +++ b/workflow/engine/methods/groups/groups_Ajax.php @@ -149,7 +149,10 @@ switch ($_POST['action']) { unset( $newGroup['GRP_UID'] ); $group = new Groupwf(); $group->create( $newGroup ); + G::auditLog("CreateGroup", $newGroup['GRP_TITLE']); + echo '{success: true}'; + break; case 'saveEditGroup': G::LoadClass( 'groups' ); @@ -158,6 +161,7 @@ switch ($_POST['action']) { $editGroup['GRP_TITLE'] = trim( $_POST['name'] ); $group = new Groupwf(); $group->update( $editGroup ); + G::auditLog("UpdateGroup", $editGroup['GRP_TITLE']." (".$_POST['grp_uid'].") "); echo '{success: true}'; break; case 'deleteGroup': @@ -167,6 +171,7 @@ switch ($_POST['action']) { return; } $group->remove( urldecode( $_POST['GRP_UID'] ) ); + G::auditLog("DeleteGroup", $_POST['GRP_NAME']." (".$_POST['GRP_UID'].") "); require_once 'classes/model/TaskUser.php'; $oProcess = new TaskUser(); $oCriteria = new Criteria( 'workflow' ); diff --git a/workflow/engine/methods/processCategory/processCategory_Ajax.php b/workflow/engine/methods/processCategory/processCategory_Ajax.php index 37a678507..20df5a3df 100755 --- a/workflow/engine/methods/processCategory/processCategory_Ajax.php +++ b/workflow/engine/methods/processCategory/processCategory_Ajax.php @@ -104,6 +104,7 @@ if (isset( $_REQUEST['action'] )) { $pcat->setCategoryUid( G::GenerateUniqueID() ); $pcat->setCategoryName( $catName ); $pcat->save(); + G::auditLog("CreateCategory", $catName); echo '{success: true}'; } catch (Exception $ex) { echo '{success: false, error: ' . $ex->getMessage() . '}'; @@ -134,6 +135,7 @@ if (isset( $_REQUEST['action'] )) { $pcat->setCategoryUid( $catUID ); $pcat->setCategoryName( $catName ); $pcat->save(); + g::auditLog("UpdateCategory", $catName." (".$catUID.") "); echo '{success: true}'; } catch (Exception $ex) { echo '{success: false, error: ' . $ex->getMessage() . '}'; @@ -153,7 +155,9 @@ if (isset( $_REQUEST['action'] )) { $catUID = $_REQUEST['cat_uid']; $cat = new ProcessCategory(); $cat->setCategoryUid( $catUID ); + $catName = $cat->loadByCategoryId( $catUID ); $cat->delete(); + G::auditLog("DeleteCategory", $catName." (".$catUID.") "); echo '{success: true}'; } catch (Exception $ex) { echo '{success: false, error: ' . $ex->getMessage() . '}'; diff --git a/workflow/engine/methods/setup/appCacheViewAjax.php b/workflow/engine/methods/setup/appCacheViewAjax.php index 23efa9ce0..1cc649c1b 100755 --- a/workflow/engine/methods/setup/appCacheViewAjax.php +++ b/workflow/engine/methods/setup/appCacheViewAjax.php @@ -260,7 +260,7 @@ switch ($request) { $result = new StdClass(); $result->success = true; $result->msg = G::LoadTranslation('ID_TITLE_COMPLETED'); - + G::auditLog("BuildCache"); echo G::json_encode( $result ); } catch (Exception $e) { diff --git a/workflow/engine/methods/setup/auditLog.php b/workflow/engine/methods/setup/auditLog.php new file mode 100644 index 000000000..2f35243f8 --- /dev/null +++ b/workflow/engine/methods/setup/auditLog.php @@ -0,0 +1,18 @@ +userCanAccess("PM_SETUP") != 1) { + G::SendTemporalMessage("ID_USER_HAVENT_RIGHTS_PAGE", "error", "labels"); + exit(0); +} + +$c = new Configurations(); +$configPage = $c->getConfiguration( "auditLogList", "pageSize", null, $_SESSION["USER_LOGGED"] ); + +$config = array (); +$config["pageSize"] = (isset( $configPage["pageSize"] )) ? $configPage["pageSize"] : 20; + +$oHeadPublisher = &headPublisher::getSingleton(); +$oHeadPublisher->addExtJsScript( "setup/auditLog", true ); +$oHeadPublisher->assign( "CONFIG", $config ); +G::RenderPage( "publish", "extJs" ); diff --git a/workflow/engine/methods/setup/auditLogAjax.php b/workflow/engine/methods/setup/auditLogAjax.php new file mode 100644 index 000000000..f61abccde --- /dev/null +++ b/workflow/engine/methods/setup/auditLogAjax.php @@ -0,0 +1,141 @@ + 1) { + $date = (isset( $arrayAux[0] )) ? trim( $arrayAux[0] ) : ""; + $workspace = (isset( $arrayAux[1] )) ? trim( $arrayAux[1] ) : ""; + $ip = (isset( $arrayAux[2] )) ? trim( $arrayAux[2] ) : ""; + $user = (isset( $arrayAux[4] )) ? trim( $arrayAux[4] ) : ""; + $action = (isset( $arrayAux[5] )) ? trim( $arrayAux[5] ) : ""; + $description = (isset( $arrayAux[6] )) ? trim( $arrayAux[6] ) : ""; + } + + $mktDate = (! empty( $date )) ? mktimeDate( $date ) : 0; + + //Filter + $sw = 1; + if ($workspace != $filter["workspace"]) { + $sw = 0; + } + + if ($filter["dateFrom"] && $mktDate > 0) { + if (! (mktimeDate( $filter["dateFrom"] ) <= $mktDate)) { + $sw = 0; + } + } + + if ($filter["dateTo"] && $mktDate > 0) { + if (! ($mktDate <= mktimeDate( $filter["dateTo"] . " 23:59:59" ))) { + $sw = 0; + } + } + + if ($filter["description"]) { + $sw = 0; + $string = $filter["description"]; + + if ( (stristr($date, $string) !== false) || (stristr($ip, $string) !== false) || (stristr($user, $string) !== false) || (stristr($action, $string) !== false) || (stristr($description, $string) !== false) ) { + $sw = 1; + } + } + + $arrayData = array (); + + if ($sw == 1) { + $arrayData = array ("DATE" => $date, "USER" => $user, "IP" =>$ip, "ACTION" => $action, "DESCRIPTION" => $description); + } + + return $arrayData; +} + +function getAuditLogData ($filter, $r, $i) +{ + $arrayData = array (); + $strAux = null; + $count = 0; + + $file = PATH_DATA . "log" . PATH_SEP . "audit.log"; + + if (file_exists($file)) { + $arrayFileData = file($file); + + for ($k = 0; $k < count($arrayFileData); $k++) { + + $strAux = $arrayFileData[$k]; + + if ($strAux) { + $arrayAux = auditLogArraySet($strAux, $filter); + + if (count($arrayAux) > 0) { + $count = $count + 1; + + if ($count > $i && count($arrayData) < $r) { + $arrayData[] = $arrayAux; + } + } + } + } + } + return array($count, $arrayData); +} + +$option = (isset( $_REQUEST["option"] )) ? $_REQUEST["option"] : null; + +$response = array (); + +switch ($option) { + case "LST": + $pageSize = $_REQUEST["pageSize"]; + $workspace = SYS_SYS; + $description = $_REQUEST["description"]; + $dateFrom = $_REQUEST["dateFrom"]; + $dateTo = $_REQUEST["dateTo"]; + + $arrayFilter = array ("workspace" => $workspace,"description" => $description,"dateFrom" => str_replace( "T00:00:00", null, $dateFrom ),"dateTo" => str_replace( "T00:00:00", null, $dateTo ) + ); + + $limit = isset( $_REQUEST["limit"] ) ? $_REQUEST["limit"] : $pageSize; + $start = isset( $_REQUEST["start"] ) ? $_REQUEST["start"] : 0; + + list ($count, $data) = getAuditLogData( $arrayFilter, $limit, $start ); + $response = array ("success" => true,"resultTotal" => $count,"resultRoot" => $data + ); + break; + case "EMPTY": + $status = 1; + + try { + $file = PATH_DATA . "log" . PATH_SEP . "cron.log"; + + if (file_exists( $file )) { + unlink( $file ); + } + + $response["status"] = "OK"; + } catch (Exception $e) { + $response["message"] = $e->getMessage(); + $status = 0; + } + + if ($status == 0) { + $response["status"] = "ERROR"; + } + break; +} + +echo G::json_encode( $response ); \ No newline at end of file diff --git a/workflow/engine/methods/setup/auditLogConfig.php b/workflow/engine/methods/setup/auditLogConfig.php new file mode 100644 index 000000000..829d5c778 --- /dev/null +++ b/workflow/engine/methods/setup/auditLogConfig.php @@ -0,0 +1,16 @@ +requirePermissions( 'PM_SETUP' ); + +$oHeadPublisher = & headPublisher::getSingleton(); +G::LoadClass( 'serverConfiguration' ); + +$oServerConf = & serverConf::getSingleton(); + +$sflag = $oServerConf->getAuditLogProperty( 'AL_OPTION', SYS_SYS ); +$auditLogChecked = $sflag == 1 ? true : false; + +$oHeadPublisher->addExtJsScript( 'setup/auditLogConfig', true ); //adding a javascript file .js +$oHeadPublisher->assign( 'auditLogChecked', $auditLogChecked ); +G::RenderPage( 'publish', 'extJs' ); \ No newline at end of file diff --git a/workflow/engine/methods/setup/auditLogConfigAjax.php b/workflow/engine/methods/setup/auditLogConfigAjax.php new file mode 100644 index 000000000..c5cf3decd --- /dev/null +++ b/workflow/engine/methods/setup/auditLogConfigAjax.php @@ -0,0 +1,33 @@ +unsetAuditLogProperty( 'AL_TYPE', SYS_SYS ); + if (isset( $_POST['acceptAL'] )) { + $oServerConf->setAuditLogProperty( 'AL_OPTION', 1, SYS_SYS ); + $oServerConf->unsetAuditLogProperty( 'AL_NEXT_DATE', SYS_SYS ); + $response->enable = true; + G::auditLog("Enable AuditLog"); + } else { + $oServerConf->setAuditLogProperty( 'AL_OPTION', 0, SYS_SYS ); + $oServerConf->unsetAuditLogProperty( 'AL_NEXT_DATE', SYS_SYS ); + $oServerConf->setAuditLogProperty( 'AL_TYPE', 'endaudit', SYS_SYS ); + $response->enable = false; + G::auditLog("Disable AuditLog"); + } + $response->success = true; + + } catch (Exception $e) { + $response->success = false; + $response->msg = $e->getMessage(); + } + echo G::json_encode( $response ); + break; +} + diff --git a/workflow/engine/methods/setup/clearCompiledAjax.php b/workflow/engine/methods/setup/clearCompiledAjax.php index f4e47bafe..d665b64d8 100644 --- a/workflow/engine/methods/setup/clearCompiledAjax.php +++ b/workflow/engine/methods/setup/clearCompiledAjax.php @@ -3,22 +3,28 @@ try { $response = new stdClass; if (isset( $_POST['javascriptCache'] ) || isset( $_POST['metadataCache'] ) || isset( $_POST['htmlCache'] )) { + $msgLog = ''; if (isset( $_POST['javascriptCache'] )) { G::rm_dir( PATH_C . 'ExtJs' ); $response->javascript = true; + $msgLog .= 'Javascript cache '; } if (isset( $_POST['metadataCache'] )) { G::rm_dir( PATH_C . 'xmlform' ); $response->xmlform = true; + $msgLog .= 'Forms Metadata cache '; } if (isset( $_POST['htmlCache'] )) { G::rm_dir( PATH_C . 'smarty' ); $response->smarty = true; + $msgLog .= 'Forms Html Templates cache '; } $response->success = true; + + G::auditLog("ClearCache", $msgLog); } else { $response->success = false; } diff --git a/workflow/engine/methods/setup/cronAjax.php b/workflow/engine/methods/setup/cronAjax.php index ea67d253d..7f443a981 100644 --- a/workflow/engine/methods/setup/cronAjax.php +++ b/workflow/engine/methods/setup/cronAjax.php @@ -144,6 +144,7 @@ switch ($option) { } $response["status"] = "OK"; + G::auditLog("Cron", "ClearCron"); } catch (Exception $e) { $response["message"] = $e->getMessage(); $status = 0; diff --git a/workflow/engine/methods/setup/environmentSettingsAjax.php b/workflow/engine/methods/setup/environmentSettingsAjax.php index 7666e75a8..6ee5a6017 100755 --- a/workflow/engine/methods/setup/environmentSettingsAjax.php +++ b/workflow/engine/methods/setup/environmentSettingsAjax.php @@ -46,6 +46,8 @@ switch ($request) { $conf->aConfig = $config; $conf->saveConfig( "ENVIRONMENT_SETTINGS", "" ); + G::auditLog("UpdateEnvironmentSettings", "UserNameDisplayFormat -> ".$_POST["userFormat"]." GlobalDateFormat -> ".$_POST["dateFormat"]." HideProcessInformation -> ".$_POST["hideProcessInf"]." DateFormat -> ".$_POST["casesListDateFormat"]." NumberOfRowsPerPage -> ".$_POST["casesListRowNumber"]." RefreshTimeSeconds -> ".$_POST["txtCasesRefreshTime"]); + $response = new stdclass(); $response->success = true; $response->msg = G::LoadTranslation( "ID_SAVED_SUCCESSFULLY" ); diff --git a/workflow/engine/methods/setup/loginSettingsAjax.php b/workflow/engine/methods/setup/loginSettingsAjax.php index 61eba676b..67aa16a79 100755 --- a/workflow/engine/methods/setup/loginSettingsAjax.php +++ b/workflow/engine/methods/setup/loginSettingsAjax.php @@ -30,10 +30,13 @@ switch ($request) { $conf->saveConfig( 'ENVIRONMENT_SETTINGS', '' ); + $lang = isset( $_REQUEST['lang'] ) ? $_REQUEST['lang'] : 'en'; //remove from memcache when this value is updated/created $memcache->delete( 'flagForgotPassword' ); $response->success = true; + G::auditLog("UpdateLoginSettings", "DefaultLanguage->".$lang." EnableForgotPassword->".$_REQUEST['forgotPasswd']); + echo G::json_encode( $response ); break; diff --git a/workflow/engine/methods/setup/processHeartBeatAjax.php b/workflow/engine/methods/setup/processHeartBeatAjax.php index d743c42ae..7241e656b 100644 --- a/workflow/engine/methods/setup/processHeartBeatAjax.php +++ b/workflow/engine/methods/setup/processHeartBeatAjax.php @@ -12,11 +12,13 @@ switch ($_GET['action']) { $oServerConf->setHeartbeatProperty( 'HB_OPTION', 1, 'HEART_BEAT_CONF' ); $oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' ); $response->enable = true; + G::auditLog("EnableHeartBeat"); } else { $oServerConf->setHeartbeatProperty( 'HB_OPTION', 0, 'HEART_BEAT_CONF' ); $oServerConf->unsetHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' ); $oServerConf->setHeartbeatProperty( 'HB_BEAT_TYPE', 'endbeat', 'HEART_BEAT_CONF' ); $response->enable = false; + G::auditLog("DisableHeartBeat"); } $response->success = true; diff --git a/workflow/engine/methods/setup/setupSchemas/app_cache_view.sql b/workflow/engine/methods/setup/setupSchemas/app_cache_view.sql index 7416765bc..74cf64bbb 100755 --- a/workflow/engine/methods/setup/setupSchemas/app_cache_view.sql +++ b/workflow/engine/methods/setup/setupSchemas/app_cache_view.sql @@ -34,4 +34,4 @@ CREATE TABLE `APP_CACHE_VIEW` PRIMARY KEY (`APP_UID`,`DEL_INDEX`), KEY `indexAppNumber`(`APP_NUMBER`), KEY `indexAppUser`(`USR_UID`, `APP_STATUS`) -)ENGINE=MyISAM DEFAULT CHARSET='utf8' COMMENT='Application cache view'; +)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Application cache view'; diff --git a/workflow/engine/methods/setup/skin_Ajax.php b/workflow/engine/methods/setup/skin_Ajax.php index e00bc76be..8c92e924e 100755 --- a/workflow/engine/methods/setup/skin_Ajax.php +++ b/workflow/engine/methods/setup/skin_Ajax.php @@ -170,6 +170,7 @@ function newSkin ($baseSkin = 'classic') file_put_contents( $configFileFinal, $xmlConfiguration ); $response['success'] = true; $response['message'] = G::LoadTranslation( 'ID_SKIN_SUCCESS_CREATE' ); + G::auditLog("CreateSkin", $skinName); print_r( G::json_encode( $response ) ); } catch (Exception $e) { $response['success'] = false; @@ -285,6 +286,7 @@ function importSkin () $response['success'] = true; $response['message'] = G::LoadTranslation( 'ID_SKIN_SUCCESSFUL_IMPORTED' ); + G::auditLog("ImportSkin", $skinName); print_r( G::json_encode( $response ) ); } catch (Exception $e) { $response['success'] = false; @@ -329,7 +331,7 @@ function exportSkin ($skinToExport = "") $response['success'] = true; $response['message'] = $skinTar; - + G::auditLog("ExportSkin", $skinName); print_r( G::json_encode( $response ) ); } catch (Exception $e) { $response['success'] = false; @@ -355,6 +357,7 @@ function deleteSkin () G::rm_dir( PATH_CUSTOM_SKINS . $folderId ); $response['success'] = true; $response['message'] = "$folderId deleted"; + G::auditLog("DeleteSkin", $folderId); } catch (Exception $e) { $response['success'] = false; $response['error'] = $response['message'] = $e->getMessage(); diff --git a/workflow/engine/methods/users/usersAjax.php b/workflow/engine/methods/users/usersAjax.php index 1f7220c82..3a950ed56 100755 --- a/workflow/engine/methods/users/usersAjax.php +++ b/workflow/engine/methods/users/usersAjax.php @@ -187,6 +187,7 @@ switch ($_POST['action']) { require_once 'classes/model/Users.php'; $oUser = new Users(); $oUser->create($aData); + G::auditLog("CreateUser", $aData['USR_USERNAME']); if ($_FILES['USR_PHOTO']['error'] != 1) { //print (PATH_IMAGES_ENVIRONMENT_USERS); @@ -363,6 +364,7 @@ switch ($_POST['action']) { require_once 'classes/model/Users.php'; $oUser = new Users(); $oUser->update($aData); + G::auditLog("UpdateUser", $aData['USR_USERNAME']." (".$aData['USR_UID'].") "); if ($_FILES['USR_PHOTO']['error'] != 1) { if ($_FILES['USR_PHOTO']['tmp_name'] != '') { $aAux = explode('.', $_FILES['USR_PHOTO']['name']); diff --git a/workflow/engine/methods/users/users_Ajax.php b/workflow/engine/methods/users/users_Ajax.php index 85beae03c..f2263111f 100644 --- a/workflow/engine/methods/users/users_Ajax.php +++ b/workflow/engine/methods/users/users_Ajax.php @@ -201,6 +201,7 @@ try { $oUser = new Users(); $aFields = $oUser->load($UID); $aFields['USR_STATUS'] = 'CLOSED'; + $userName = $aFields['USR_USERNAME']; $aFields['USR_USERNAME'] = ''; $oUser->update($aFields); @@ -216,8 +217,8 @@ try { $criteria->add(ProcessUserPeer::USR_UID, $UID, Criteria::EQUAL); $criteria->add(ProcessUserPeer::PU_TYPE, "SUPERVISOR", Criteria::EQUAL); - ProcessUserPeer::doDelete($criteria); + G::auditLog("DeleteUser", $userName." (".$UID.") "); break; case 'changeUserStatus': $response = new stdclass(); @@ -228,6 +229,9 @@ try { $userData = $userInstance->load($_REQUEST['USR_UID']); $userData['USR_STATUS'] = $_REQUEST['NEW_USR_STATUS']; $userInstance->update($userData); + + $msg = $_REQUEST['NEW_USR_STATUS'] == 'ACTIVE'? "Enable User" : "Disable User"; + G::auditLog($msg, $userData['USR_USERNAME']." (".$userData['USR_UID'].") "); $response->status = 'OK'; } else { $response->status = 'ERROR'; @@ -353,6 +357,7 @@ try { } $aData['USR_AUTH_USER_DN'] = $auth_dn; $RBAC->updateUser($aData); + g::auditLog("AssignAuthenticationSource", $aData['USR_USERNAME'].' ('.$aData['USR_UID'].') assign to '.$aData['USR_AUTH_TYPE']); echo '{success: true}'; break; case 'usersList': diff --git a/workflow/engine/skinEngine/skinEngine.php b/workflow/engine/skinEngine/skinEngine.php index 45334f0f9..af5f412a8 100755 --- a/workflow/engine/skinEngine/skinEngine.php +++ b/workflow/engine/skinEngine/skinEngine.php @@ -755,16 +755,16 @@ class SkinEngine $name = $conf->userNameFormat(isset($_SESSION['USR_USERNAME']) ? $_SESSION['USR_USERNAME']: '', isset($_SESSION['USR_FULLNAME']) ? htmlentities($_SESSION['USR_FULLNAME'] , ENT_QUOTES, 'UTF-8'): '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ''); $smarty->assign('user',$name); } - if(class_exists('pmLicenseManager')){ - $pmLicenseManagerO = &pmLicenseManager::getSingleton(); - $expireIn = $pmLicenseManagerO->getExpireIn(); - $expireInLabel = $pmLicenseManagerO->getExpireInLabel(); - //if($expireIn<=30){ - if($expireInLabel != ""){ - $smarty->assign('msgVer', '  '); + + if (defined('SYS_SYS')) { + require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php"); + $pmLicenseManagerO = &pmLicenseManager::getSingleton(); + $expireIn = $pmLicenseManagerO->getExpireIn(); + $expireInLabel = $pmLicenseManagerO->getExpireInLabel(); + if($expireInLabel != ""){ + $smarty->assign('msgVer', '  '); + } } - //} - } if (defined('SYS_SYS')) { $logout = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; diff --git a/workflow/engine/templates/departments/departmentList.js b/workflow/engine/templates/departments/departmentList.js index 825ac207c..2f2bcbc94 100755 --- a/workflow/engine/templates/departments/departmentList.js +++ b/workflow/engine/templates/departments/departmentList.js @@ -383,7 +383,7 @@ SaveEditDepartment = function(){ if (res_ok){ Ext.Ajax.request({ url: 'departments_Ajax', - params: {action: 'updateDepartment', uid: dep_uid, name: dep_name, status: dep_status, manager: dep_manager}, + params: {action: 'updateDepartment', uid: dep_uid, name: dep_name, status: dep_status, manager: dep_manager, parent: dep_parent}, success: function(r,o){ var xtree = Ext.getCmp('treePanel'); xtree.getLoader().load(xtree.root); diff --git a/workflow/engine/templates/enterprise/addonsStore.js b/workflow/engine/templates/enterprise/addonsStore.js index 33bda2d8e..f1c2906ff 100644 --- a/workflow/engine/templates/enterprise/addonsStore.js +++ b/workflow/engine/templates/enterprise/addonsStore.js @@ -499,6 +499,11 @@ Ext.onReady(function() { "force": true } }); + addonsFeaturesStore.load({ + params: { + "force": true + } + }); Ext.getCmp("refresh-btn").setDisabled(!Ext.getCmp("chkEeInternetConnection").checked); @@ -518,8 +523,9 @@ Ext.onReady(function() { url: "addonsStoreAction", method: "POST" }), - baseParams: {"action": "addonsList" - }, + baseParams: { + "action": "addonsList" + }, //url: "addonsStoreAction?action=addonsList", @@ -608,6 +614,79 @@ Ext.onReady(function() { } }); + + var addonsFeaturesStore = new Ext.data.JsonStore({ + proxy: new Ext.data.HttpProxy({ + url: "addonsStoreAction", + method: "POST" + }), + baseParams: { + "action": "addonsList", + "type" : "features" + }, + autoDestroy: true, + messageProperty: 'error', + storeId: 'addonsFeaturesStore', + root: 'addons', + idProperty: 'id', + sortInfo: { + field: 'nick', + direction: 'ASC' // or 'DESC' (case sensitive for local sorting) + }, + fields: ['id', 'name', 'store', 'nick', 'latest_version', 'version', 'status', + 'type', 'release_type', 'url', 'enabled', 'publisher', 'description', + 'log', 'progress'], + listeners: { + 'beforeload': function(store, options) { + Ext.ComponentMgr.get('loading-features-indicator').setValue(''); + return true; + }, + "exception": function(e, type, action, options, response, arg) { + Ext.ComponentMgr.get('loading-features-indicator').setValue(' '); + }, + "load": function(store, records, options) { + Ext.ComponentMgr.get('loading-features-indicator').setValue(""); + progressWindow.hide(); + store.filterBy(function (record, id) { + if (record.get('type') == 'core') { + coreRecord = record.copy(); + status = record.get('status'); + if (status == "download-start" || status == "download" || status == "install" || status == "install-finish") { + upgradeStatus(record.get('id'), record.get('store'), record); + } + return false; + } + return true; + }); + + if (addonsFeatureGrid.disabled) { + addonsFeatureGrid.enable(); + } + + errors = store.reader.jsonData.errors; + for (var i = 0, n = errors.length; i"; + } + + if (store_errors.length > 0) { + Ext.ComponentMgr.get('loading-features-indicator').setValue(' '); + //storeError(error_msg); + reloadTask.cancel(); + } else { + Ext.ComponentMgr.get('loading-features-indicator').setValue(' '); + } + } + } + }); + var upgradeStore = new Ext.data.Store({ recordType: addonsStore.recordType }); @@ -930,8 +1009,8 @@ Ext.onReady(function() { var pnlSetup = new Ext.FormPanel({ frame: true, title: _('ID_SETUP_WEBSERVICES'), - height: 188, - bodyStyle: "padding: 5px 5px 5px 5px;", + height: 178, + //bodyStyle: "padding: 5px 5px 5px 5px;", disabled: !licensed, items: [ @@ -966,7 +1045,7 @@ Ext.onReady(function() { }); var pnlSystem = new Ext.Container({ - autoEl: "div", + //autoEl: "div", //width: 550, anchor: "right 50%", //items: [pnlUpgrade, pnlSetup] @@ -976,62 +1055,62 @@ Ext.onReady(function() { var licensePanel = new Ext.FormPanel( { frame: true, title: _('ID_YOUR_LICENSE'), - labelWidth: 150, + labelWidth: 130, labelAlign: "right", //width : '50%', anchor: "right 50%", - bodyStyle: "padding: 5px 5px 5px 5px;", + //bodyStyle: "padding: 5px 5px 5px 5px;", defaultType: "displayfield", autoHeight: true, items: [ - { - id: "license_name", - fieldLabel: _('ID_CURRENT_LICENSE'), - value: license_name - }, - { - id: "license_server", - fieldLabel: _('ID_LICENSE_SERVER'), - value: license_server - }, - { - id: "license_message", - fieldLabel:_('ID_STATUS'), - hidden: licensed, - hideLabel: licensed, - value: ""+license_message+" ("+license_start_date+"/"+license_end_date+")
"+license_user - }, - - { - id: "license_user", - fieldLabel: _('ID_ISSUED_TO'), - value: license_user, - hidden: !licensed, - hideLabel: !licensed - }, - - { - id: "license_expires", - fieldLabel: _('ID_EXPIRES'), - value: license_expires+'/'+license_span+" ("+license_start_date+" / "+license_end_date+")", - hidden: !licensed, - hideLabel: !licensed - } - ], - buttons : [ - { - text: _('ID_IMPORT_LICENSE'), - disable: false, - handler: function() { - addLicenseWindow.show(); - } - }, - { - text : _('ID_RENEW'), - hidden: true, - disabled : true - } + { + id: "license_name", + fieldLabel: _('ID_CURRENT_LICENSE'), + value: license_name + }, + { + id: "license_server", + fieldLabel: _('ID_LICENSE_SERVER'), + value: license_server + }, + { + id: "license_message", + fieldLabel:_('ID_STATUS'), + hidden: licensed, + hideLabel: licensed, + value: ""+license_message+" ("+license_start_date+"/"+license_end_date+")
"+license_user + }, + + { + id: "license_user", + fieldLabel: _('ID_ISSUED_TO'), + value: license_user, + hidden: !licensed, + hideLabel: !licensed + }, + + { + id: "license_expires", + fieldLabel: _('ID_EXPIRES'), + value: license_expires+'/'+license_span+" ("+license_start_date+" / "+license_end_date+")", + hidden: !licensed, + hideLabel: !licensed + } + ], + buttons : [ + { + text: _('ID_IMPORT_LICENSE'), + disable: false, + handler: function() { + addLicenseWindow.show(); + } + }, + { + text : _('ID_RENEW'), + hidden: true, + disabled : true + } ] }); @@ -1178,257 +1257,426 @@ Ext.onReady(function() { items: [btnEnable, btnDisable, btnAdmin] }); - var addonsGrid = new Ext.grid.GridPanel({ - store: addonsStore, - colspan: 2, - flex: 1, - padding: 5, - disabled: !licensed, - columns: [ - expander, - { - id : 'icon-column', - header : '', - width : 30, - //sortable : true, - menuDisabled: true, - hideable : false, - dataIndex: 'status', - renderer : function (val, metadata, record, rowIndex, colIndex, store) { - return ""; - } - }, - { - id :'nick-column', - header : _('ID_NAME'), - //width : 160, - //sortable : true, - menuDisabled: true, - dataIndex: 'nick', - renderer: function (val, metadata, record, rowIndex, colIndex, store) { - if (record.get('release_type') == 'beta') { - return val + " (Beta)"; - } else if (record.get('release_type') == 'localRegistry') { - return val + " (Local)"; - } else { - return val; - } - } - }, - { - id : 'publisher-column', - header : _('ID_PUBLISHER'), - //sortable : true, - menuDisabled: true, - dataIndex: 'publisher' - }, - { - id : 'version-column', - header : _('ID_VERSION'), - //width : 160, - //sortable : true, - menuDisabled: true, - dataIndex: 'version' - }, - { - id : 'latest-version-column', - header : _('ID_LATEST_VERSION'), - //width : 160, - //sortable : true, - menuDisabled: true, - dataIndex: 'latest_version' - }, - { - id : 'enabled-column', - header : _('ID_ENABLED'), - width : 60, - //sortable : true, - menuDisabled: true, - dataIndex: 'enabled', - renderer: function (val) { - if (val === true) { - return ""; - } else if (val === false) { - return ""; - } - return ''; - } - }, - { - id : "status", - header : "", - width : 120, - //sortable : true, - menuDisabled: true, - hideable : false, - dataIndex: "status", - renderer: function (val) { - var str = ""; - var text = ""; - - switch (val) { - case "available": text = _('ID_BUY_NOW'); break; - case "installed": text = _('ID_INSTALLED'); break; - case "ready": text = _('ID_INSTALL_NOW'); break; - case "upgrade": text = _('ID_UPGRADE_NOW'); break; - case "download": text = _('ID_CANCEL'); break; - case "install": text = _('ID_INSTALLING'); break; - case "cancel": text = _('ID_CANCELLING'); break; - case "disabled": text = _('ID_DISABLED'); break; - case "download-start": text = ""; break; - default: text = val; break; - } - - switch (val) { - case "available": - case "ready": - case "upgrade": - case "download": - case "install": - case "cancel": - case "download-start": - str = "
" + text + "
"; - break; - - case "installed": - case "disabled": - str = "
" + text + "
"; - break; - - default: - str = "
" + text + "
"; - break; - } - - return (str); - } - } - ], - tbar:[/*{ - text:'Install', - tooltip:'Install this addon', - //iconCls:'add', - handler: function(b, e) { - record = addonsGrid.getSelectionModel().getSelected(); - console.log(record.get('name') + ' ' + record.get('store')); - installAddon(record.get('name'), record.get('store')); - } - }, - btnUninstall, - '-',*/ - btnEnable, - btnDisable, - btnAdmin, - '-', - { - id: "import-btn", - text: _('ID_INSTALL_FROM_FILE'), - tooltip: _('ID_INSTALL_FROM_FILE_PLUGIN_TIP'), - iconCls:"button_menu_ext ss_sprite ss_application_add", - - //ref: "../removeButton", - disabled: false, - handler: function () { - var sw = 1; - var msg = ""; - if (sw == 1 && PATH_PLUGINS_WRITABLE == 0) { - sw = 0; - msg = PATH_PLUGINS_WRITABLE_MESSAGE; - } - if (sw == 1) { - addPluginWindow.show(); - } else { - Ext.MessageBox.alert(_('ID_WARNING'), msg); - } - } - }, - '-', - { - id: 'refresh-btn', - text:_('ID_REFRESH_LABEL'), - iconCls:'button_menu_ext ss_sprite ss_database_refresh', - tooltip: _('ID_REFRESH_LABEL_PLUGIN_TIP'), - disabled: (INTERNET_CONNECTION == 1)? false : true, - handler: function (b, e) { - reloadTask.cancel(); - addonsStore.load({ - params: { - "force": true - } - }); - } - }, - '->', - { - xtype:"displayfield", - id:'loading-indicator' - } - ], - plugins: expander, - collapsible: false, - animCollapse: false, - stripeRows: true, - autoExpandColumn: 'nick-column', - title: _('ID_ENTERPRISE_PLUGINS'), - sm: new Ext.grid.RowSelectionModel({ - singleSelect:true, - listeners: { - selectionchange: function (sel) { - if (sel.getCount() == 0 || sel.getSelected().get("name") == "enterprise") { - //btnUninstall.setDisabled(true); - btnEnable.setDisabled(true); - btnDisable.setDisabled(true); - btnAdmin.setDisabled(true); - } else { - record = sel.getSelected(); - - //btnUninstall.setDisabled(!(record.get("status") == "installed" || record.get("status") == "upgrade" || record.get("status") == "disabled")); - btnEnable.setDisabled(!(record.get("enabled") === false)); - btnDisable.setDisabled(!(record.get("enabled") === true)); - btnAdmin.setDisabled(!(record.get("enabled") === true)); - } - } - } - }), - //config options for stateful behavior - stateful: true, - stateId: "grid", - listeners: { - "cellclick": function (grid, rowIndex, columnIndex, e) { - var record = grid.getStore().getAt(rowIndex); - var fieldName = grid.getColumnModel().getDataIndex(columnIndex); - //var data = record.get(fieldName); - - if (fieldName != "status") { - return; - } - - switch (record.get("status")) { - case "upgrade": - case "ready": - if (INTERNET_CONNECTION == 1) { - installAddon(record.get("id"), record.get("store")); - } else { - Ext.MessageBox.alert(_('ID_INFORMATION'), _('ID_NO_INTERNET_CONECTION')); + var addonsGrid = new Ext.grid.GridPanel({ + store: addonsStore, + colspan: 2, + flex: 1, + padding: 5, + //anchor : '100%', + //height: 300, + autoHeight : true, + disabled: !licensed, + columns: [ + expander, + { + id : 'icon-column', + header : '', + width : 30, + //sortable : true, + menuDisabled: true, + hideable : false, + dataIndex: 'status', + renderer : function (val, metadata, record, rowIndex, colIndex, store) { + return ""; } - break; - case "download": - Ext.Ajax.request({ - url: "addonsStoreAction", - params: { - "action": "cancel", - "addon": record.get("id"), - "store": record.get("store") + }, + { + id :'nick-column', + header : _('ID_NAME'), + width : 160, + //sortable : true, + menuDisabled: true, + dataIndex: 'nick', + renderer: function (val, metadata, record, rowIndex, colIndex, store) { + if (record.get('release_type') == 'beta') { + return val + " (Beta)"; + } else if (record.get('release_type') == 'localRegistry') { + return val + " (Local)"; + } else { + return val; + } + } + }, + { + id : 'publisher-column', + header : _('ID_PUBLISHER'), + //sortable : true, + menuDisabled: true, + dataIndex: 'publisher' + }, + { + id : 'version-column', + header : _('ID_VERSION'), + //width : 160, + //sortable : true, + menuDisabled: true, + dataIndex: 'version' + }, + { + id : 'latest-version-column', + header : _('ID_LATEST_VERSION'), + //width : 160, + //sortable : true, + menuDisabled: true, + dataIndex: 'latest_version' + }, + { + id : 'enabled-column', + header : _('ID_ENABLED'), + width : 60, + //sortable : true, + menuDisabled: true, + dataIndex: 'enabled', + renderer: function (val) { + if (val === true) { + return ""; + } else if (val === false) { + return ""; } - }); - break; - case "available": - addonAvailable(record.get("id")); - break; + return ''; + } + }, + { + id : "status", + header : "", + width : 120, + //sortable : true, + menuDisabled: true, + hideable : false, + dataIndex: "status", + renderer: function (val) { + var str = ""; + var text = ""; + + switch (val) { + case "available": text = _('ID_BUY_NOW'); break; + case "installed": text = _('ID_INSTALLED'); break; + case "ready": text = _('ID_INSTALL_NOW'); break; + case "upgrade": text = _('ID_UPGRADE_NOW'); break; + case "download": text = _('ID_CANCEL'); break; + case "install": text = _('ID_INSTALLING'); break; + case "cancel": text = _('ID_CANCELLING'); break; + case "disabled": text = _('ID_DISABLED'); break; + case "download-start": text = ""; break; + default: text = val; break; + } + + switch (val) { + case "available": + case "ready": + case "upgrade": + case "download": + case "install": + case "cancel": + case "download-start": + str = "
" + text + "
"; + break; + + case "installed": + case "disabled": + str = "
" + text + "
"; + break; + + default: + str = "
" + text + "
"; + break; + } + + return (str); + } + } + ], + tbar:[ + /*{ + text:'Install', + tooltip:'Install this addon', + //iconCls:'add', + handler: function(b, e) { + record = addonsGrid.getSelectionModel().getSelected(); + console.log(record.get('name') + ' ' + record.get('store')); + installAddon(record.get('name'), record.get('store')); + } + }, + btnUninstall, + '-',*/ + btnEnable, + btnDisable, + btnAdmin, + '-', + { + id: "import-btn", + text: _('ID_INSTALL_FROM_FILE'), + tooltip: _('ID_INSTALL_FROM_FILE_PLUGIN_TIP'), + iconCls:"button_menu_ext ss_sprite ss_application_add", + + //ref: "../removeButton", + disabled: false, + handler: function () { + var sw = 1; + var msg = ""; + if (sw == 1 && PATH_PLUGINS_WRITABLE == 0) { + sw = 0; + msg = PATH_PLUGINS_WRITABLE_MESSAGE; + } + if (sw == 1) { + addPluginWindow.show(); + } else { + Ext.MessageBox.alert(_('ID_WARNING'), msg); + } + } + }, + '-', + { + id: 'refresh-btn', + text:_('ID_REFRESH_LABEL'), + iconCls:'button_menu_ext ss_sprite ss_database_refresh', + tooltip: _('ID_REFRESH_LABEL_PLUGIN_TIP'), + disabled: (INTERNET_CONNECTION == 1)? false : true, + handler: function (b, e) { + reloadTask.cancel(); + addonsStore.load({ + params: { + "force": true + } + }); + } + }, + '->', + { + xtype:"displayfield", + id:'loading-indicator' + } + ], + plugins: expander, + collapsible: false, + animCollapse: false, + stripeRows: true, + autoExpandColumn: 'nick-column', + //title: _('ID_ENTERPRISE_PLUGINS'), + sm: new Ext.grid.RowSelectionModel({ + singleSelect:true, + listeners: { + selectionchange: function (sel) { + if (sel.getCount() == 0 || sel.getSelected().get("name") == "enterprise") { + //btnUninstall.setDisabled(true); + btnEnable.setDisabled(true); + btnDisable.setDisabled(true); + btnAdmin.setDisabled(true); + } else { + record = sel.getSelected(); + //btnUninstall.setDisabled(!(record.get("status") == "installed" || record.get("status") == "upgrade" || record.get("status") == "disabled")); + btnEnable.setDisabled(!(record.get("enabled") === false)); + btnDisable.setDisabled(!(record.get("enabled") === true)); + btnAdmin.setDisabled(!(record.get("enabled") === true)); + } + } + } + }), + //config options for stateful behavior + stateful: true, + stateId: "grid", + listeners: { + "cellclick": function (grid, rowIndex, columnIndex, e) { + var record = grid.getStore().getAt(rowIndex); + var fieldName = grid.getColumnModel().getDataIndex(columnIndex); + //var data = record.get(fieldName); + + if (fieldName != "status") { + return; + } + + switch (record.get("status")) { + case "upgrade": + case "ready": + if (INTERNET_CONNECTION == 1) { + installAddon(record.get("id"), record.get("store")); + } else { + Ext.MessageBox.alert(_('ID_INFORMATION'), _('ID_NO_INTERNET_CONECTION')); + } + break; + case "download": + Ext.Ajax.request({ + url: "addonsStoreAction", + params: { + "action": "cancel", + "addon": record.get("id"), + "store": record.get("store") + } + }); + break; + case "available": + addonAvailable(record.get("id")); + break; + } + } } - } - } - }); + }); + + // create the Grid Features + var addonsFeatureGrid = new Ext.grid.GridPanel({ + store: addonsFeaturesStore, + colspan: 2, + flex: 1, + padding: 5, + columns: [ + { + id : 'icon-column-feature', + header : '', + width : 30, + hideable : false, + dataIndex: 'status', + renderer : function (val, metadata, record, rowIndex, colIndex, store) { + return ""; + } + }, + { + id :'nick-column-feature', + header : _('ID_NAME'), + width : 300, + sortable : true, + dataIndex: 'nick', + renderer: function (val, metadata, record, rowIndex, colIndex, store) { + if (record.get('release_type') == 'beta') { + return val + " (Beta)"; + } else if (record.get('release_type') == 'localRegistry') { + return val + " (Local)"; + } else { + return val; + } + } + }, + { + id :'description-column-feature', + header : _('ID_DESCRIPTION'), + width : 400, + dataIndex: 'description' + }, + { + id : 'enabled-column-feature', + header : _('ID_ENABLED'), + width : 60, + dataIndex: 'enabled', + renderer: function (val) { + if (val === true) { + return ""; + } else if (val === false) { + return ""; + } + return ''; + } + }, + { + id : "status-feature", + header : _('ID_STATUS'), + width : 120, + sortable : false, + hideable : false, + dataIndex: "status", + renderer: function (val) { + var str = ""; + var text = ""; + + switch (val) { + case "available": text = _('ID_BUY_NOW'); break; + case "installed": text = _('ID_INSTALLED'); break; + case "ready": text = _('ID_INSTALL_NOW'); break; + case "upgrade": text = _('ID_UPGRADE_NOW'); break; + case "download": text = _('ID_CANCEL'); break; + case "install": text = _('ID_INSTALLING'); break; + case "cancel": text = _('ID_CANCELLING'); break; + case "disabled": text = _('ID_DISABLED'); break; + case "download-start": text = ""; break; + default: text = val; break; + } + + switch (val) { + case "available": + case "ready": + case "upgrade": + case "download": + case "install": + case "cancel": + case "download-start": + str = "
" + text + "
"; + break; + + case "installed": + case "disabled": + str = "
" + text + "
"; + break; + + default: + str = "
" + text + "
"; + break; + } + + return (str); + } + } + ], + stripeRows: true, + autoHeight : true, + stateId: "grid", + tbar: + [ + { + id: 'refresh-btn', + text:_('ID_REFRESH_LABEL'), + iconCls:'button_menu_ext ss_sprite ss_database_refresh', + tooltip: _('ID_REFRESH_LABEL_PLUGIN_TIP'), + disabled: (INTERNET_CONNECTION == 1)? false : true, + handler: function (b, e) { + reloadTask.cancel(); + addonsFeaturesStore.load({ + params: { + "force": true + } + }); + } + }, + '->', + { + xtype:"displayfield", + id:'loading-features-indicator' + } + ], + listeners: { + "cellclick": function (grid, rowIndex, columnIndex, e) { + var record = grid.getStore().getAt(rowIndex); + var fieldName = grid.getColumnModel().getDataIndex(columnIndex); + + if (fieldName != "status") { + return; + } + + switch (record.get("status")) { + case "upgrade": + case "ready": + if (INTERNET_CONNECTION == 1) { + installAddon(record.get("id"), record.get("store")); + } else { + Ext.MessageBox.alert(_('ID_INFORMATION'), _('ID_NO_INTERNET_CONECTION')); + } + break; + case "download": + Ext.Ajax.request({ + url: "addonsStoreAction", + params: { + "action": "cancel", + "addon": record.get("id"), + "store": record.get("store") + } + }); + break; + case "available": + addonAvailable(record.get("id")); + break; + } + } + } + }); + + var topBox = new Ext.Panel({ id:'main-panel-hbox', @@ -1444,28 +1692,47 @@ Ext.onReady(function() { defaults: { frame:true, flex: 1, - height: 210 + height: 182 }, items:[licensePanel, pnlSystem] }); - var fullBox = new Ext.Panel({ - id:'main-panel-vbox', - baseCls:'x-plain', - anchor: "right 100%", - layout:'vbox', - //padding: 10, - //defaultMargins: "5", - layoutConfig: { - align : 'stretch', - pack : 'start' - }, + var tabEnterprise = new Ext.TabPanel({ + activeTab: 0, + //width:600, + anchor: '100%', + height: 370, + plain:true, + defaults:{autoScroll: true}, + items:[{ + title: _('ID_ENTERPRISE_PLUGINS'), + items : addonsGrid + },{ + title: _('ID_ENTERPRISE_FIXTURES'), + items : addonsFeatureGrid + } + ] + }); - defaults: { - frame:true - }, - items:[topBox, addonsGrid] - }); + + var fullBox = new Ext.Panel({ + id:'main-panel-vbox', + baseCls:'x-plain', + anchor: "right 100%", + layout:'vbox', + //padding: 10, + //defaultMargins: "5", + layoutConfig: { + align : 'stretch', + pack : 'start' + }, + + defaults: { + frame:true + }, + //items:[topBox, addonsGrid] + items:[topBox, tabEnterprise] + }); /////// addonsGrid.on("rowcontextmenu", @@ -1477,6 +1744,16 @@ Ext.onReady(function() { ); addonsGrid.addListener("rowcontextmenu", onMessageMnuContext, this); + + addonsFeatureGrid.on("rowcontextmenu", + function (grid, rowIndex, evt) { + var sm = grid.getSelectionModel(); + sm.selectRow(rowIndex, sm.isSelected(rowIndex)); + }, + this + ); + + addonsFeatureGrid.addListener("rowcontextmenu", onMessageMnuContext, this); /////// var viewport = new Ext.Viewport({ @@ -1490,6 +1767,7 @@ Ext.onReady(function() { if (licensed) { addonsStore.load(); + addonsFeaturesStore.load(); } }); diff --git a/workflow/engine/templates/groups/groupsList.js b/workflow/engine/templates/groups/groupsList.js index 0ce028370..aa7b53db9 100755 --- a/workflow/engine/templates/groups/groupsList.js +++ b/workflow/engine/templates/groups/groupsList.js @@ -516,7 +516,8 @@ DeleteButtonAction = function() { url: "groups_Ajax", params: { action: "deleteGroup", - GRP_UID: rowSelected.data.GRP_UID + GRP_UID: rowSelected.data.GRP_UID, + GRP_NAME: rowSelected.data.CON_VALUE }, success: function(r,o) { diff --git a/workflow/engine/templates/setup/auditLog.js b/workflow/engine/templates/setup/auditLog.js new file mode 100644 index 000000000..e50fcf930 --- /dev/null +++ b/workflow/engine/templates/setup/auditLog.js @@ -0,0 +1,251 @@ +Ext.namespace("audit"); + +audit.application = { + init: function () + { + var loadMaskAudit = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING_GRID")}); + + auditLogAjax = function (option) + { + var p; + switch (option) { + case "EMPTY": + p = { + "option": option + }; + break; + } + + Ext.Ajax.request({ + url: "auditLogAjax", + method: "POST", + params: p, + + success: function (response, opts) + { + var dataResponse = eval("(" + response.responseText + ")"); //json + + switch (option) { + case "EMPTY": + if (dataResponse.status && dataResponse.status == "OK") { + pagingAudit.moveFirst(); + } + break; + } + } + }); + } + + logView = function () + { + var record = grdpnlMain.getSelectionModel().getSelected(); + + if (typeof record != "undefined") { + var strData = "" + _("ID_DATE_LABEL") + "
" + record.get("DATE") + "
"; + strData = strData + "" + _("ID_USER") + "
" + record.get("WORKSPACE") + "
"; + strData = strData + "" + _("ID_IP") + "
" + record.get("IP") + "
"; + strData = strData + "" + _("ID_ACTION") + "
" + record.get("ACTION") + "
"; + strData = strData + "" + _("ID_DESCRIPTION") + "
" + record.get("DESCRIPTION") + "
"; + + var formItems = Ext.getCmp("frmLogView").form.items; + formItems.items[0].setValue(strData); + } + } + + var pageSize = parseInt(CONFIG.pageSize); + + var storeAudit = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: "auditLogAjax", + method: "POST" + }), + + reader: new Ext.data.JsonReader({ + root: "resultRoot", + totalProperty: "resultTotal", + fields: [ + {name: "DATE"}, + {name: "USER"}, + {name: "IP"}, + {name: "ACTION"}, + {name: "DESCRIPTION"} + ] + }), + + listeners: { + beforeload: function (store) + { + loadMaskAudit.show(); + + this.baseParams = { + "option": "LST", + "pageSize": pageSize, + "description": Ext.getCmp("fldDescription").getValue(), + "dateFrom": Ext.getCmp("dateFrom").getValue(), + "dateTo": Ext.getCmp("dateTo").getValue() + }; + }, + load: function (store, record, opt) + { + loadMaskAudit.hide(); + } + } + }); + + var storePageSize = new Ext.data.SimpleStore({ + fields: ["size"], + data: [["20"], ["30"], ["40"], ["50"], ["100"]], + autoLoad: true + }); + + var dateFrom = new Ext.form.DateField({ + id: "dateFrom", + format: "Y-m-d", + editable: false, + width: 90, + value: "" + }); + + var dateTo = new Ext.form.DateField({ + id: "dateTo", + format: "Y-m-d", + editable: false, + width: 90, + value: "" + }); + + var fldDescription = new Ext.form.TextField({ + id: "fldDescription", + valueField: "id", + displayField: "value", + emptyText: _('ID_ENTER_SEARCH_TERM'), + value: "", + triggerAction: "all", + mode: "local", + editable: false, + width: 150 + }); + + var cboPageSize = new Ext.form.ComboBox({ + id: "cboPageSize", + + mode: "local", + triggerAction: "all", + store: storePageSize, + valueField: "size", + displayField: "size", + width: 50, + editable: false, + listeners: { + select: function (combo, record, index) + { + pageSize = parseInt(record.data["size"]); + pagingAudit.pageSize = pageSize; + pagingAudit.moveFirst(); + } + } + }); + + var pagingAudit = new Ext.PagingToolbar({ + id: "pagingAudit", + pageSize: pageSize, + store: storeAudit, + displayInfo: true, + displayMsg: _("ID_CRON_GRID_PAGE_DISPLAYING_MESSAGE"), + emptyMsg: _("ID_NO_RECORDS_FOUND"), + items: ["-", _("ID_PAGE_SIZE") + " ", cboPageSize] + }); + + var cmodel = new Ext.grid.ColumnModel({ + defaults: { + width: 50, + sortable: true + }, + columns: [ + {id: "ID", dataIndex: "DATE", hidden: true, hideable: false}, + {header: _("ID_DATE_LABEL"), dataIndex: "DATE", width: 15}, + {header: _("ID_USER"), dataIndex: "USER", width: 15}, + {header: _("ID_IP"), dataIndex: "IP", width: 10}, + {header: _("ID_ACTION"), dataIndex: "ACTION", width: 15}, + {header: _("ID_DESCRIPTION"), dataIndex: "DESCRIPTION"} + ] + }); + + var smodel = new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function (sm) + { + }, + rowdeselect: function (sm) + { + } + } + }); + + var grdpnlMain = new Ext.grid.GridPanel({ + id: "grdpnlMain", + + store: storeAudit, + colModel: cmodel, + selModel: smodel, + + columnLines: true, + viewConfig: {forceFit: true}, + enableColumnResize: true, + enableHdMenu: false, + tbar: [ + "->", + {xtype: "tbtext", text: _("ID_DESCRIPTION") + " "}, + fldDescription, + "-", + {xtype: "tbtext", text: _("ID_FROM") + " "}, + dateFrom, + {xtype: "tbtext", text: _("ID_TO") + " "}, + dateTo, + { + xtype: "button", + text: _("ID_RESET_FILTERS"), + + handler: function () + { + Ext.getCmp("dateFrom").reset(), + Ext.getCmp("dateTo").reset(), + Ext.getCmp("fldDescription").reset() + } + }, + "-", + { + xtype: "button", + text: _("ID_SEARCH"), + + handler: function () + { + pagingAudit.moveFirst(); + } + } + ], + bbar: pagingAudit, + border: false, + title: _("ID_AUDIT_LOG_ACTIONS"), + listeners: { + rowdblclick: function () + { + logView(); + } + } + }); + + storeAudit.load(); + + cboPageSize.setValue(pageSize); + + var viewport = new Ext.Viewport({ + layout: "fit", + autoScroll: false, + items: [grdpnlMain] + }); + } +} + +Ext.onReady(audit.application.init, audit.application); \ No newline at end of file diff --git a/workflow/engine/templates/setup/auditLogConfig.js b/workflow/engine/templates/setup/auditLogConfig.js new file mode 100644 index 000000000..297617faf --- /dev/null +++ b/workflow/engine/templates/setup/auditLogConfig.js @@ -0,0 +1,86 @@ +Ext.onReady(function() { + auditLogFields = new Ext.form.FieldSet({ + + title : _('ID_AUDITLOG_DISPLAY'), + items : [ + { + xtype : 'checkbox', + checked : auditLogChecked, + name : 'acceptAL', + fieldLabel : _('ID_TERMS_USE'), + hideLabel : true, + id : 'ch_ii', + style : 'margin-top:15px', + boxLabel : '' + _('ID_ENABLE_AUDIT_LOG') + '', + listeners : { + check : function(){ + Ext.getCmp('btn_save').enable(); + } + } + }, + { + xtype : 'box', + autoEl : { tag : 'div', + html : '
' + _('ID_AUDIT_LOG_DETAILS_1') + + '
' + _('ID_AUDIT_LOG_DETAILS_2') + }, + style : 'margin-left:20px' + } + ], + buttons : [{ + id : 'btn_save', + text : _('ID_SAVE'), + disabled: true, + handler : saveOption + }] + }); + + + var frm = new Ext.FormPanel( { + title : ' ', + id : 'frmAuditLog', + labelWidth : 150, + width : 600, + labelAlign : 'right', + autoScroll : true, + bodyStyle : 'padding:2px', + waitMsgTarget : true, + frame : true, + + defaults: { + allowBlank : false, + msgTarget : 'side', + align : 'center' + }, + items : [ auditLogFields ] + + }); + //render to process-panel + frm.render(document.body); +}); + +function saveOption() +{ + Ext.getCmp('btn_save').disable(); + Ext.getCmp('frmAuditLog').getForm().submit( { + url : 'auditLogConfigAjax?action=saveOption', + waitMsg : _('ID_SAVING_PROCESS'), + waitTitle : " ", + timeout : 36000, + success : function(obj, resp) { + //nothing to do + response = Ext.decode(resp.response.responseText); + if (response.enable) { + parent.PMExt.notify(_('ID_AUDITLOG_DISPLAY'), _('ID_AUDIT_LOG_ENABLED')); + } + else { + parent.PMExt.notify(_('ID_AUDITLOG_DISPLAY'), _('ID_AUDIT_LOG_DISABLED')); + } + }, + failure : function(obj, resp) { + Ext.Msg.alert( _('ID_ERROR'), resp.result.msg); + } + }); +} + + diff --git a/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.xml b/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.xml index 8c4782a52..21bc9a536 100755 --- a/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.xml +++ b/workflow/engine/xmlform/cases/cases_AttachInputDocumentGeneral.xml @@ -10,7 +10,7 @@ - Max size accepted + Max. file size