Merge remote branch 'upstream/master' into BUG-8933

This commit is contained in:
Brayan Osmar Pereyra Suxo
2012-06-05 17:52:15 -04:00
39 changed files with 6364 additions and 5557 deletions

View File

@@ -2867,6 +2867,30 @@ var validateForm = function(sRequiredFields) {
return false; return false;
} }
else { else {
var arrayForm = document.getElementsByTagName("form");
for (var i = 0; i <= arrayForm.length - 1; i++) {
var frm = arrayForm[i];
for (var i = 0; i <= frm.elements.length - 1; i++) {
var elem = frm.elements[i];
if (elem.type == "checkbox" && elem.disabled && elem.checked) {
var id = elem.id + "_";
if (!document.getElementById(id)) {
var input = document.createElement("input");
input.type = "hidden";
input.id = id;
input.name = elem.name;
input.value = elem.value;
frm.appendChild(input);
}
}
}
}
return true; return true;
} }
}; };

View File

@@ -7,7 +7,19 @@ var G_Grid = function(oForm, sGridName){
this.oGrid = document.getElementById(this.sGridName); this.oGrid = document.getElementById(this.sGridName);
this.onaddrow = function(iRow){}; this.onaddrow = function(iRow){};
this.ondeleterow = function(){}; this.ondeleterow = function(){};
this.executeEvent = function (element,event) {
if ( document.createEventObject ) {
// IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
} else {
// firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
}
};
this.aFields = []; this.aFields = [];
this.aElements = []; this.aElements = [];
this.aFunctions = []; this.aFunctions = [];
@@ -868,6 +880,7 @@ var G_Grid = function(oForm, sGridName){
this.evaluateFormula = function(oEvent, oDOM, oField) { this.evaluateFormula = function(oEvent, oDOM, oField) {
oDOM = (oDOM ? oDOM : oEvent.target || window.event.srcElement); oDOM = (oDOM ? oDOM : oEvent.target || window.event.srcElement);
var aAux, sAux, i, oAux; var aAux, sAux, i, oAux;
var domId = oDOM.id;
var oContinue = true; var oContinue = true;
aAux = oDOM.name.split(']['); aAux = oDOM.name.split('][');
sAux = oField.sFormula.replace(/\+|\-|\*|\/|\(|\)|\[|\]|\{|\}|\%|\$/g, ' '); sAux = oField.sFormula.replace(/\+|\-|\*|\/|\(|\)|\[|\]|\{|\}|\%|\$/g, ' ');
@@ -889,6 +902,7 @@ var G_Grid = function(oForm, sGridName){
} }
} }
eval("if (!document.getElementById('" + aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + "]')) { oContinue = false; }"); eval("if (!document.getElementById('" + aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + "]')) { oContinue = false; }");
if (oContinue) { if (oContinue) {
//we're selecting the mask to put in the field with the formula //we're selecting the mask to put in the field with the formula
for (i = 0; i < this.aFields.length; i++) { for (i = 0; i < this.aFields.length; i++) {
@@ -898,24 +912,52 @@ var G_Grid = function(oForm, sGridName){
} }
if(maskformula!=''){ if(maskformula!=''){
maskDecimal=maskformula.split(";"); maskDecimal=maskformula.split(";");
if(maskDecimal.length > 1) { if(maskDecimal.length > 1) {
maskDecimal=maskDecimal[1].split("."); maskDecimal=maskDecimal[1].split(".");
} else { } else {
maskDecimal=maskformula.split("."); maskDecimal=maskformula.split(".");
} }
maskToPut=maskDecimal[1].length;
}else{ if(typeof maskDecimal[1] != 'undefined') {
maskToPut=0; maskToPut=maskDecimal[1].length;
} else {
maskToPut=0;
}
} else {
maskToPut=0;
} }
var symbol = document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']').value.replace(/[0-9.\s]/g,'');
var bkp = document.getElementById(aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + ']').value; // clean the field and load mask execute event keypress
eval("document.getElementById('" + aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + "]').value = (" + sAux + ').toFixed('+maskToPut+');'); document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']').value = '';
this.executeEvent(document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']'), 'keypress');
// execute formula and set decimal
eval("document.getElementById('" + aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + "]').value = (" + sAux + ').toFixed('+maskToPut+');');
// trim value
document.getElementById(aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + ']').value = document.getElementById(aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + ']').value.replace(/^\s*|\s*$/g,"");
// set '' to field if response is NaN
if (document.getElementById(aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + ']').value =='NaN') if (document.getElementById(aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + ']').value =='NaN')
document.getElementById(aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + ']').value = ''; document.getElementById(aAux[0] + '][' + aAux[1] + '][' + oField.sFieldName + ']').value = '';
document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']').value = symbol+' '+document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']').value; // save var symbol the response
var symbol = document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']').value.replace(/[0-9.\s]/g,'');
this.executeEvent(document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']'), 'keypress');
// replace symbol - for ''
document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']').value = document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']').value.replace('-','');
// set var symbol
document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']').value = symbol+''+document.getElementById(aAux[0]+']['+ aAux[1] + '][' + oField.sFieldName + ']').value;
// return focus the field typed
if (typeof document.getElementById(domId) != 'undefined') {
document.getElementById(domId).focus();
}
if (this.aFunctions.length > 0) { if (this.aFunctions.length > 0) {
for (i = 0; i < this.aFunctions.length; i++) { for (i = 0; i < this.aFunctions.length; i++) {
oAux = document.getElementById('form[' + this.sGridName + '][' + aAux[1] + '][' + this.aFunctions[i].sFieldName + ']'); oAux = document.getElementById('form[' + this.sGridName + '][' + aAux[1] + '][' + this.aFunctions[i].sFieldName + ']');

View File

@@ -147,37 +147,18 @@ class LDAP
$sKeyword .= '*'; $sKeyword .= '*';
} }
} }
$sFilter = '(&'; $sFilter = '(&(|(objectClass=*))';
if (count($aAuthSource['AUTH_SOURCE_OBJECT_CLASSES']) > 0) {
$sFilter .= '(|'; if ( isset( $aAuthSource['AUTH_SOURCE_DATA']['LDAP_TYPE']) && $aAuthSource['AUTH_SOURCE_DATA']['LDAP_TYPE'] == 'ad' ) {
$aObjects = explode("\n", $aAuthSource['AUTH_SOURCE_OBJECT_CLASSES']); $sFilter = "(&(|(objectClass=*))(|(samaccountname=$sKeyword)(userprincipalname=$sKeyword))(objectCategory=person))";
foreach ($aObjects as $sObject) {
$sFilter .= '(objectClass=' . trim($sObject) . ')';
}
$sFilter .= ')';
} }
if (count($aAuthSource['AUTH_SOURCE_ATTRIBUTES']) > 0) { else
$sFilter .= '(|'; $sFilter = "(&(|(objectClass=*))(|(uid=$sKeyword)(cn=$sKeyword)))";
$aAttributes = explode("\n", $aAuthSource['AUTH_SOURCE_ATTRIBUTES']);
foreach ($aAttributes as $sObject) {
$sObject = trim($sObject);
if ($sObject != '') {
$sFilter .= '(' . trim($sObject) . '=' . $sKeyword . ')';
}
}
$sFilter .= ')';
}
// note added by gustavo cruz gustavo-at-colosa.com
// code added in order to add the data of the aditional filter field
// the nature of the filter and the correct use will be explained in a
// future blog post
$sFilter .= isset($aAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_ADDITIONAL_FILTER'])
? $aAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_ADDITIONAL_FILTER'] :'' ;
$sFilter .= ')';
// G::pr($sFilter); //G::pr($sFilter);
$aUsers = array(); $aUsers = array();
$oSearch = @ldap_search($oLink, $aAuthSource['AUTH_SOURCE_BASE_DN'], $sFilter); $oSearch = @ldap_search($oLink, $aAuthSource['AUTH_SOURCE_BASE_DN'], $sFilter, array('dn','uid','samaccountname', 'cn','givenname','sn','mail','userprincipalname','objectcategory', 'manager'));
if ($oError = @ldap_errno($oLink)) { if ($oError = @ldap_errno($oLink)) {
return $aUsers; return $aUsers;
} }

View File

@@ -52,6 +52,7 @@ if (!defined('PATH_HOME')) {
G::LoadSystem('dvEditor'); G::LoadSystem('dvEditor');
G::LoadSystem('table'); G::LoadSystem('table');
G::LoadSystem('pagedTable'); G::LoadSystem('pagedTable');
G::LoadClass ( 'system' );
require_once ( "propel/Propel.php" ); require_once ( "propel/Propel.php" );
require_once ( "creole/Creole.php" ); require_once ( "creole/Creole.php" );
} }
@@ -155,7 +156,6 @@ if (!defined('SYS_SYS')) {
Propel::init(PATH_CORE . 'config/_databases_.php'); Propel::init(PATH_CORE . 'config/_databases_.php');
//Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection'); //Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
eprintln("Processing workspace: " . $sObject, 'green'); eprintln("Processing workspace: " . $sObject, 'green');
try{ try{
processWorkspace(); processWorkspace();

View File

@@ -3,57 +3,68 @@
* cron_single.php * cron_single.php
* @package workflow-engine-bin * @package workflow-engine-bin
*/ */
ini_set ( 'display_errors', 1 );
error_reporting ( E_ALL );
ini_set ( 'memory_limit', '256M' ); // set enough memory for the script
if (! defined ( 'SYS_LANG' )) { // check script parameters
define ( 'SYS_LANG', 'en' ); // php reindex_solr.php workspacename [reindexall|reindexmissing]
// var_dump($argv);
if (count ($argv) != 3) {
print "Invalid command line arguments: \n syntax: php reindex_solr.php [workspace_name] [reindexall|reindexmissing] \n" . " Where reindexall : reindex all the database \n" . " reindexmissing: reindex only the missing records stored in database.\n";
die ();
}
$workspaceName = $argv [1];
$ScriptAction = $argv [2];
ini_set ('display_errors', 1);
error_reporting (E_ALL);
ini_set ('memory_limit', '256M'); // set enough memory for the script
if (! defined ('SYS_LANG')) {
define ('SYS_LANG', 'en');
} }
if (! defined ( 'PATH_HOME' )) { if (! defined ('PATH_HOME')) {
if (! defined ( 'PATH_SEP' )) { if (! defined ('PATH_SEP')) {
define ( 'PATH_SEP', (substr ( PHP_OS, 0, 3 ) == 'WIN') ? '\\' : '/' ); define ('PATH_SEP', (substr (PHP_OS, 0, 3) == 'WIN') ? '\\' : '/');
} }
$docuroot = explode ( PATH_SEP, str_replace ( 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'services', '', dirname ( __FILE__ ) ) ); $docuroot = explode (PATH_SEP, str_replace ('engine' . PATH_SEP . 'methods' . PATH_SEP . 'services', '', dirname (__FILE__)));
array_pop ( $docuroot ); array_pop ($docuroot);
array_pop ( $docuroot ); array_pop ($docuroot);
$pathhome = implode ( PATH_SEP, $docuroot ) . PATH_SEP; $pathhome = implode (PATH_SEP, $docuroot) . PATH_SEP;
// try to find automatically the trunk directory where are placed the RBAC and // try to find automatically the trunk directory where are placed the RBAC and
// Gulliver directories // Gulliver directories
// in a normal installation you don't need to change it. // in a normal installation you don't need to change it.
array_pop ( $docuroot ); array_pop ($docuroot);
$pathTrunk = implode ( PATH_SEP, $docuroot ) . PATH_SEP; $pathTrunk = implode (PATH_SEP, $docuroot) . PATH_SEP;
array_pop ( $docuroot ); array_pop ($docuroot);
$pathOutTrunk = implode ( PATH_SEP, $docuroot ) . PATH_SEP; $pathOutTrunk = implode (PATH_SEP, $docuroot) . PATH_SEP;
// to do: check previous algorith for Windows $pathTrunk = "c:/home/"; // to do: check previous algorith for Windows $pathTrunk = "c:/home/";
define ( 'PATH_HOME', $pathhome ); define ('PATH_HOME', $pathhome);
define ( 'PATH_TRUNK', $pathTrunk ); define ('PATH_TRUNK', $pathTrunk);
define ( 'PATH_OUTTRUNK', $pathOutTrunk ); define ('PATH_OUTTRUNK', $pathOutTrunk);
require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
G::LoadThirdParty ( 'pear/json', 'class.json' ); G::LoadThirdParty ('pear/json', 'class.json');
G::LoadThirdParty ( 'smarty/libs', 'Smarty.class' ); G::LoadThirdParty ('smarty/libs', 'Smarty.class');
G::LoadSystem ( 'error' ); G::LoadSystem ('error');
G::LoadSystem ( 'dbconnection' ); G::LoadSystem ('dbconnection');
G::LoadSystem ( 'dbsession' ); G::LoadSystem ('dbsession');
G::LoadSystem ( 'dbrecordset' ); G::LoadSystem ('dbrecordset');
G::LoadSystem ( 'dbtable' ); G::LoadSystem ('dbtable');
G::LoadSystem ( 'rbac' ); G::LoadSystem ('rbac');
G::LoadSystem ( 'publisher' ); G::LoadSystem ('publisher');
G::LoadSystem ( 'templatePower' ); G::LoadSystem ('templatePower');
G::LoadSystem ( 'xmlDocument' ); G::LoadSystem ('xmlDocument');
G::LoadSystem ( 'xmlform' ); G::LoadSystem ('xmlform');
G::LoadSystem ( 'xmlformExtension' ); G::LoadSystem ('xmlformExtension');
G::LoadSystem ( 'form' ); G::LoadSystem ('form');
G::LoadSystem ( 'menu' ); G::LoadSystem ('menu');
G::LoadSystem ( "xmlMenu" ); G::LoadSystem ("xmlMenu");
G::LoadSystem ( 'dvEditor' ); G::LoadSystem ('dvEditor');
G::LoadSystem ( 'table' ); G::LoadSystem ('table');
G::LoadSystem ( 'pagedTable' ); G::LoadSystem ('pagedTable');
G::LoadClass ( 'system' ); G::LoadClass ('system');
require_once ("propel/Propel.php"); require_once ("propel/Propel.php");
require_once ("creole/Creole.php"); require_once ("creole/Creole.php");
} }
@@ -83,32 +94,32 @@ print "PATH_DB: " . PATH_DB . "\n";
print "PATH_CORE: " . PATH_CORE . "\n"; print "PATH_CORE: " . PATH_CORE . "\n";
// define the site name (instance name) // define the site name (instance name)
if (! defined ( 'SYS_SYS' )) { if (! defined ('SYS_SYS')) {
$sObject = $argv [1]; $sObject = $workspaceName;
$sNow = ''; // $argv[2]; $sNow = ''; // $argv[2];
$sFilter = ''; $sFilter = '';
for($i = 3; $i < count ( $argv ); $i ++) { for ($i = 3; $i < count ($argv); $i++) {
$sFilter .= ' ' . $argv [$i]; $sFilter .= ' ' . $argv [$i];
} }
$oDirectory = dir ( PATH_DB ); $oDirectory = dir (PATH_DB);
if (is_dir ( PATH_DB . $sObject )) { if (is_dir (PATH_DB . $sObject)) {
saveLog ( 'main', 'action', "checking folder " . PATH_DB . $sObject ); saveLog ('main', 'action', "checking folder " . PATH_DB . $sObject);
if (file_exists ( PATH_DB . $sObject . PATH_SEP . 'db.php' )) { if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) {
define ( 'SYS_SYS', $sObject ); define ('SYS_SYS', $sObject);
// **************************************** // ****************************************
// read initialize file // read initialize file
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
$config = System::getSystemConfiguration ('', '', SYS_SYS); $config = System::getSystemConfiguration ('', '', SYS_SYS);
define ( 'MEMCACHED_ENABLED', $config ['memcached'] ); define ('MEMCACHED_ENABLED', $config ['memcached']);
define ( 'MEMCACHED_SERVER', $config ['memcached_server'] ); define ('MEMCACHED_SERVER', $config ['memcached_server']);
define ( 'TIME_ZONE', $config ['time_zone'] ); define ('TIME_ZONE', $config ['time_zone']);
date_default_timezone_set ( TIME_ZONE ); date_default_timezone_set (TIME_ZONE);
print "TIME_ZONE: " . TIME_ZONE . "\n"; print "TIME_ZONE: " . TIME_ZONE . "\n";
print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n"; print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n";
print "MEMCACHED_SERVER: " . MEMCACHED_SERVER . "\n"; print "MEMCACHED_SERVER: " . MEMCACHED_SERVER . "\n";
@@ -118,39 +129,39 @@ if (! defined ( 'SYS_SYS' )) {
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
// ***************** PM Paths DATA ************************** // ***************** PM Paths DATA **************************
define ( 'PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/' ); define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
define ( 'PATH_DOCUMENT', PATH_DATA_SITE . 'files/' ); define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
define ( 'PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/' ); define ('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/');
define ( 'PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/' ); define ('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/');
define ( 'PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/' ); define ('PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/');
define ( 'PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/' ); define ('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/');
define ( 'PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP ); define ('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP);
define ( 'PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP ); define ('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
// server info file // server info file
if (is_file ( PATH_DATA_SITE . PATH_SEP . '.server_info' )) { if (is_file (PATH_DATA_SITE . PATH_SEP . '.server_info')) {
$SERVER_INFO = file_get_contents ( PATH_DATA_SITE . PATH_SEP . '.server_info' ); $SERVER_INFO = file_get_contents (PATH_DATA_SITE . PATH_SEP . '.server_info');
$SERVER_INFO = unserialize ( $SERVER_INFO ); $SERVER_INFO = unserialize ($SERVER_INFO);
// print_r($SERVER_INFO); // print_r($SERVER_INFO);
define ( 'SERVER_NAME', $SERVER_INFO ['SERVER_NAME'] ); define ('SERVER_NAME', $SERVER_INFO ['SERVER_NAME']);
define ( 'SERVER_PORT', $SERVER_INFO ['SERVER_PORT'] ); define ('SERVER_PORT', $SERVER_INFO ['SERVER_PORT']);
} }
else { else {
eprintln ( "WARNING! No server info found!", 'red' ); eprintln ("WARNING! No server info found!", 'red');
} }
// read db configuration // read db configuration
$sContent = file_get_contents ( PATH_DB . $sObject . PATH_SEP . 'db.php' ); $sContent = file_get_contents (PATH_DB . $sObject . PATH_SEP . 'db.php');
$sContent = str_replace ( '<?php', '', $sContent ); $sContent = str_replace ('<?php', '', $sContent);
$sContent = str_replace ( '<?', '', $sContent ); $sContent = str_replace ('<?', '', $sContent);
$sContent = str_replace ( '?>', '', $sContent ); $sContent = str_replace ('?>', '', $sContent);
$sContent = str_replace ( 'define', '', $sContent ); $sContent = str_replace ('define', '', $sContent);
$sContent = str_replace ( "('", "$", $sContent ); $sContent = str_replace ("('", "$", $sContent);
$sContent = str_replace ( "',", '=', $sContent ); $sContent = str_replace ("',", '=', $sContent);
$sContent = str_replace ( ");", ';', $sContent ); $sContent = str_replace (");", ';', $sContent);
eval ( $sContent ); eval ($sContent);
$dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME; $dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME;
$dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/' . $DB_RBAC_NAME; $dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/' . $DB_RBAC_NAME;
$dsnRp = $DB_ADAPTER . '://' . $DB_REPORT_USER . ':' . $DB_REPORT_PASS . '@' . $DB_REPORT_HOST . '/' . $DB_REPORT_NAME; $dsnRp = $DB_ADAPTER . '://' . $DB_REPORT_USER . ':' . $DB_REPORT_PASS . '@' . $DB_REPORT_HOST . '/' . $DB_REPORT_NAME;
@@ -176,22 +187,22 @@ if (! defined ( 'SYS_SYS' )) {
// $pro['datasources']['dbarray']['connection'] = // $pro['datasources']['dbarray']['connection'] =
// 'dbarray://user:pass@localhost/pm_os'; // 'dbarray://user:pass@localhost/pm_os';
// $pro['datasources']['dbarray']['adapter'] = 'dbarray'; // $pro['datasources']['dbarray']['adapter'] = 'dbarray';
$oFile = fopen ( PATH_CORE . 'config/_databases_.php', 'w' ); $oFile = fopen (PATH_CORE . 'config/_databases_.php', 'w');
fwrite ( $oFile, '<?php global $pro;return $pro; ?>' ); fwrite ($oFile, '<?php global $pro;return $pro; ?>');
fclose ( $oFile ); fclose ($oFile);
Propel::init ( PATH_CORE . 'config/_databases_.php' ); Propel::init (PATH_CORE . 'config/_databases_.php');
// Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection'); // Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
eprintln ( "Processing workspace: " . $sObject, 'green' ); eprintln ("Processing workspace: " . $sObject, 'green');
try { try {
processWorkspace (); processWorkspace ();
} }
catch ( Exception $e ) { catch (Exception $e) {
echo $e->getMessage (); echo $e->getMessage ();
eprintln ( "Probelm in workspace: " . $sObject . ' it was omitted.', 'red' ); eprintln ("Probelm in workspace: " . $sObject . ' it was omitted.', 'red');
} }
eprintln (); eprintln ();
unlink ( PATH_CORE . 'config/_databases_.php' ); unlink (PATH_CORE . 'config/_databases_.php');
} }
} }
@@ -204,63 +215,78 @@ else {
// @file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' => // @file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' =>
// '0', 'sLastExecution' => date('Y-m-d H:i:s')))); // '0', 'sLastExecution' => date('Y-m-d H:i:s'))));
function processWorkspace() { function processWorkspace()
{
global $sLastExecution; global $sLastExecution;
global $ScriptAction;
try { try {
if (($solrConf = System::solrEnv (SYS_SYS)) !== false) { if (($solrConf = System::solrEnv (SYS_SYS)) !== false) {
G::LoadClass ( 'AppSolr' ); G::LoadClass ('AppSolr');
$oAppSolr = new AppSolr ( $solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance'] ); print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
$oAppSolr->reindexAllApplications (); print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
print "solr_host: " . $solrConf ['solr_host'] . "\n";
print "solr_instance: " . $solrConf ['solr_instance'] . "\n";
$oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']);
if ($ScriptAction == "reindexall") {
$oAppSolr->reindexAllApplications ();
}
if ($ScriptAction == "reindexmissing") {
$oAppSolr->synchronizePendingApplications ();
}
} }
else { else {
print "Incomplete Solr configuration."; print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini";
} }
} }
catch ( Exception $oError ) { catch (Exception $oError) {
saveLog ( "main", "error", "Error processing workspace : " . $oError->getMessage () . "\n" ); saveLog ("main", "error", "Error processing workspace : " . $oError->getMessage () . "\n");
} }
} }
function saveLog($sSource, $sType, $sDescription) { function saveLog($sSource, $sType, $sDescription)
{
try { try {
global $isDebug; global $isDebug;
if ($isDebug) if ($isDebug)
print date ( 'H:i:s' ) . " ($sSource) $sType $sDescription <br>\n"; print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n";
@fwrite ( $oFile, date ( 'Y-m-d H:i:s' ) . '(' . $sSource . ') ' . $sDescription . "\n" ); @fwrite ($oFile, date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
G::verifyPath ( PATH_DATA . 'log' . PATH_SEP, true ); G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true);
if ($sType == 'action') { if ($sType == 'action') {
$oFile = @fopen ( PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+' ); $oFile = @fopen (PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
} }
else { else {
$oFile = @fopen ( PATH_DATA . 'log' . PATH_SEP . 'cronError.log', 'a+' ); $oFile = @fopen (PATH_DATA . 'log' . PATH_SEP . 'cronError.log', 'a+');
} }
@fwrite ( $oFile, date ( 'Y-m-d H:i:s' ) . '(' . $sSource . ') ' . $sDescription . "\n" ); @fwrite ($oFile, date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
@fclose ( $oFile ); @fclose ($oFile);
} }
catch ( Exception $oError ) { catch (Exception $oError) {
// CONTINUE // CONTINUE
} }
} }
function setExecutionMessage($m) { function setExecutionMessage($m)
$len = strlen ( $m ); {
$len = strlen ($m);
$linesize = 60; $linesize = 60;
$rOffset = $linesize - $len; $rOffset = $linesize - $len;
eprint ( "* $m" ); eprint ("* $m");
for($i = 0; $i < $rOffset; $i ++) for ($i = 0; $i < $rOffset; $i++)
eprint ( '.' ); eprint ('.');
} }
function setExecutionResultMessage($m, $t = '') { function setExecutionResultMessage($m, $t = '')
{
$c = 'green'; $c = 'green';
if ($t == 'error') if ($t == 'error')
$c = 'red'; $c = 'red';
if ($t == 'info') if ($t == 'info')
$c = 'yellow'; $c = 'yellow';
eprintln ( "[$m]", $c ); eprintln ("[$m]", $c);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -73,7 +73,7 @@ class Cases {
//get Solr initialization variables //get Solr initialization variables
if(($solrConf = System::solrEnv()) !== false){ if(($solrConf = System::solrEnv()) !== false){
G::LoadClass('AppSolr'); G::LoadClass('AppSolr');
$appSolr = new AppSolr($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']); $this->appSolr = new AppSolr($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']);
} }
} }
@@ -843,7 +843,6 @@ class Cases {
*/ */
function updateCase($sAppUid, $Fields = array()) { function updateCase($sAppUid, $Fields = array()) {
try { try {
$aApplicationFields = $Fields['APP_DATA']; $aApplicationFields = $Fields['APP_DATA'];
$Fields['APP_UID'] = $sAppUid; $Fields['APP_UID'] = $sAppUid;
@@ -929,7 +928,9 @@ class Cases {
} }
//Update Solr Index //Update Solr Index
if($this->appSolr != null) if($this->appSolr != null)
{
$this->appSolr->updateApplicationSearchIndex($sAppUid); $this->appSolr->updateApplicationSearchIndex($sAppUid);
}
return $Fields; return $Fields;
} }

View File

@@ -1,364 +1,441 @@
<?php <?php
/**
//$indexFields = array(); *
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2012 Colosa Inc.23
Class BpmnEngine_Services_SearchIndex *
{ * This program is free software: you can redistribute it and/or modify
private $solrIsEnabled = false; * it under the terms of the GNU Affero General Public License as
private $solrHost = ""; * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
function __construct($solrIsEnabled = false, $solrHost = ""){ *
//check if Zend Library is available * This program is distributed in the hope that it will be useful,
// if(class_exists("Zend_Registry")){ * but WITHOUT ANY WARRANTY; without even the implied warranty of
// $registry = Zend_Registry::getInstance(); * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// //check if configuration is enabled * GNU Affero General Public License for more details.
// $this->solrIsEnabled = $registry->isRegistered('solrEnabled') && $registry->get('solrEnabled') == 1; *
// $this->solrHost = $registry->isRegistered('solrHost')?$registry->get('solrHost'):""; * You should have received a copy of the GNU Affero General Public License
// } * along with this program. If not, see <http://www.gnu.org/licenses/>.
// else{ *
// //use the parameters to initialize class * For more information, contact Colosa Inc, 5304 Ventura Drive,
$this->solrIsEnabled = $solrIsEnabled; * Delray Beach, FL, 33484, USA, or email info@colosa.com.
$this->solrHost = $solrHost; *
// } */
}
/**
* Verify if the Solr service is available /**
* @gearman = false * Class used as interface to have access to the search index services
* @rest = false *
* @background = false * @author Herbert Saal Gutierrez
* *
* no input parameters @param[in] */
* @param[out] bool true if index service is enabled false in other case class BpmnEngine_Services_SearchIndex
*/ {
public function isEnabled() private $_solrIsEnabled = false;
{ private $_solrHost = "";
//require_once (ROOT_PATH . '/businessLogic/modules/SearchIndexAccess/Solr.php');
require_once ('class.solr.php'); function __construct($solrIsEnabled = false, $solrHost = "")
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->solrIsEnabled, $this->solrHost); {
return $solr->isEnabled(); // check if Zend Library is available
} // if(class_exists("Zend_Registry")){
// $registry = Zend_Registry::getInstance();
// //check if configuration is enabled
/** // $this->solrIsEnabled = $registry->isRegistered('solrEnabled') &&
* Get the list of facets in base to the specified query and filter // $registry->get('solrEnabled') == 1;
* @gearman = true // $this->solrHost =
* @rest = false // $registry->isRegistered('solrHost')?$registry->get('solrHost'):"";
* @background = false // }
* // else{
* @param[in] Entity_FacetRequest facetRequestEntity Facet request entity // //use the parameters to initialize class
* @param[out] array FacetGroup $this->_solrIsEnabled = $solrIsEnabled;
*/ $this->_solrHost = $solrHost;
function getFacetsList($facetRequestEntity) // }
{ }
require_once ('class.solr.php'); /**
//require_once (ROOT_PATH . '/businessLogic/modules/SearchIndexAccess/Solr.php'); * Verify if the Solr service is available
require_once ('entities/FacetGroup.php'); * @gearman = false
require_once ('entities/FacetItem.php'); * @rest = false
require_once ('entities/SelectedFacetGroupItem.php'); * @background = false
require_once ('entities/FacetResult.php'); *
* no input parameters @param[in]
/******************************************************************/ *
//get array of selected facet groups * @param
$facetRequestEntity->selectedFacetsString = str_replace(',,', ',', $facetRequestEntity->selectedFacetsString); * [out] bool true if index service is enabled false in other case
//remove descriptions of selected facet groups */
public function isEnabled()
$aGroups = explode(',', $facetRequestEntity->selectedFacetsString); {
// require_once (ROOT_PATH .
$aGroups = array_filter($aGroups);//remove empty items // '/businessLogic/modules/SearchIndexAccess/Solr.php');
require_once ('class.solr.php');
$aSelectedFacetGroups = array(); $solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
foreach($aGroups as $i => $value) return $solr->isEnabled ();
{ }
$gi = explode(':::', $value);
$gr = explode('::', $gi[0]); /**
$it = explode('::', $gi[1]); * Get the list of facets in base to the specified query and filter
* @gearman = true
//create string for remove condition * @rest = false
$count = 0; * @background = false
$removeCondition = str_replace($value . ',', '', $facetRequestEntity->selectedFacetsString, $count); *
if($count == 0) * @param
{ * [in] Entity_FacetRequest facetRequestEntity Facet request entity
$removeCondition = str_replace($value, '', $facetRequestEntity->selectedFacetsString, $count); * @param
} * [out] array FacetGroup
$selectedFacetGroupData= array( */
'selectedFacetGroupName' => $gr[0], public function getFacetsList($facetRequestEntity)
'selectedFacetGroupPrintName' => $gr[1], {
'selectedFacetItemName' => $it[0], require_once ('class.solr.php');
'selectedFacetItemPrintName' => $it[1], // require_once (ROOT_PATH .
'selectedFacetRemoveCondition' => $removeCondition // '/businessLogic/modules/SearchIndexAccess/Solr.php');
); require_once ('entities/FacetGroup.php');
require_once ('entities/FacetItem.php');
$aSelectedFacetGroups[] = Entity_SelectedFacetGroupItem::CreateForRequest($selectedFacetGroupData); require_once ('entities/SelectedFacetGroupItem.php');
} require_once ('entities/FacetResult.php');
/******************************************************************/ /**
//convert request to index request * ***************************************************************
//create filters */
$filters = array(); // get array of selected facet groups
if (!empty($aSelectedFacetGroups)) { $facetRequestEntity->selectedFacetsString = str_replace (',,', ',', $facetRequestEntity->selectedFacetsString);
//exclude facetFields and facetDates included in filter from the next list of facets // remove descriptions of selected facet groups
foreach ($aSelectedFacetGroups as $value) {
$facetRequestEntity->facetFields = array_diff($facetRequestEntity->facetFields, array($value->selectedFacetGroupName)); $aGroups = explode (',', $facetRequestEntity->selectedFacetsString);
$facetRequestEntity->facetDates = array_diff($facetRequestEntity->facetDates, array($value->selectedFacetGroupName));
} $aGroups = array_filter ($aGroups); // remove empty items
//$facetFields = array_diff($facetFields, $facetInterfaceRequestEntity->selectedFacetGroups); $aSelectedFacetGroups = array ();
//$facetDates = array_diff($facetDates, $facetInterfaceRequestEntity->selectedFacetGroups); foreach ($aGroups as $i => $value) {
foreach ($aSelectedFacetGroups as $group) { $gi = explode (':::', $value);
$filters[] = $group->selectedFacetGroupName . ':' . urlencode($group->selectedFacetItemName); $gr = explode ('::', $gi [0]);
} $it = explode ('::', $gi [1]);
}
$facetRequestEntity->filters = $filters; // create string for remove condition
$count = 0;
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->solrIsEnabled, $this->solrHost); $removeCondition = str_replace ($value . ',', '', $facetRequestEntity->selectedFacetsString, $count);
if ($count == 0) {
//create list of facets $removeCondition = str_replace ($value, '', $facetRequestEntity->selectedFacetsString, $count);
$facetsList = $solr->getFacetsList($facetRequestEntity); }
$selectedFacetGroupData = array (
$numFound = $facetsList['response']['numFound']; 'selectedFacetGroupName' => $gr [0],
'selectedFacetGroupPrintName' => $gr [1],
$facetCounts = $facetsList['facet_counts']; 'selectedFacetItemName' => $it [0],
'selectedFacetItemPrintName' => $it [1],
$facetGroups = array(); 'selectedFacetRemoveCondition' => $removeCondition
//convert facet fields result to objects );
/************************************************************************/
//include facet field results $aSelectedFacetGroups [] = Entity_SelectedFacetGroupItem::createForRequest ($selectedFacetGroupData);
$facetFieldsResult = $facetsList['facet_counts']['facet_fields']; }
if(!empty($facetFieldsResult))
{ /**
foreach($facetFieldsResult as $facetGroup => $facetvalues) * ***************************************************************
{ */
if(count($facetvalues) > 0) //if the group have facets included // convert request to index request
{ // create filters
$data = array('facetGroupName' => $facetGroup); $filters = array ();
$data['facetGroupPrintName'] = $facetGroup; if (! empty ($aSelectedFacetGroups)) {
$data['facetGroupType'] = 'field'; // exclude facetFields and facetDates included in filter from the next
$facetItems = array(); // list of facets
for($i = 0; $i < count($facetvalues) ; $i+=2) foreach ($aSelectedFacetGroups as $value) {
{ $facetRequestEntity->facetFields = array_diff ($facetRequestEntity->facetFields, array (
$dataItem = array(); $value->selectedFacetGroupName
$dataItem['facetName'] = $facetvalues[$i]; ));
$dataItem['facetPrintName'] = $facetvalues[$i]; $facetRequestEntity->facetDates = array_diff ($facetRequestEntity->facetDates, array (
$dataItem['facetCount'] = $facetvalues[$i+1]; $value->selectedFacetGroupName
$dataItem['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty($facetRequestEntity->selectedFacetsString)?'':',') . $data['facetGroupName'] . '::' . $data['facetGroupPrintName'] .':::' . $dataItem['facetName'] . '::' . $dataItem['facetPrintName']; ));
$newFacetItem = Entity_FacetItem::CreateForInsert($dataItem); }
$facetItems[] =$newFacetItem;
} // $facetFields = array_diff($facetFields,
$data['facetItems'] = $facetItems; // $facetInterfaceRequestEntity->selectedFacetGroups);
$newFacetGroup = Entity_FacetGroup::CreateForInsert($data); // $facetDates = array_diff($facetDates,
// $facetInterfaceRequestEntity->selectedFacetGroups);
$facetGroups[] = $newFacetGroup; foreach ($aSelectedFacetGroups as $group) {
} $filters [] = $group->selectedFacetGroupName . ':' . urlencode ($group->selectedFacetItemName);
} }
} }
/************************************************************************/ $facetRequestEntity->filters = $filters;
//include facet date ranges results
$facetDatesResult = $facetsList['facet_counts']['facet_dates']; $solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
if(!empty($facetDatesResult))
{ // create list of facets
foreach($facetDatesResult as $facetGroup => $facetvalues) $facetsList = $solr->getFacetsList ($facetRequestEntity);
{
if(count($facetvalues) > 3) //if the group have any facets included besides start, end and gap $numFound = $facetsList->response->numFound;
{
$data = array('facetGroupName' => $facetGroup); $facetCounts = $facetsList->facet_counts;
$data['facetGroupPrintName'] = $facetGroup;
$data['facetGroupType'] = 'daterange'; $facetGroups = array ();
$facetItems = array(); // convert facet fields result to objects
$facetvalueskeys = array_keys($facetvalues); /**
foreach ($facetvalueskeys as $i => $k) * *********************************************************************
{ */
if($k != 'gap' && $k != 'start' && $k != 'end') // include facet field results
{ $facetFieldsResult = $facetsList->facet_counts->facet_fields;
$dataItem = array(); if (! empty ($facetFieldsResult)) {
if($i < count($facetvalueskeys) - 4){ foreach ($facetFieldsResult as $facetGroup => $facetvalues) {
if (count ($facetvalues) > 0) // if the group have facets included
$dataItem['facetName'] = '['.$k.'%20TO%20'.$facetvalueskeys[$i+1].']'; {
$dataItem['facetPrintName'] = '['.$k.'%20TO%20'.$facetvalueskeys[$i+1].']'; $data = array (
} 'facetGroupName' => $facetGroup
else { );
//the last group $data ['facetGroupPrintName'] = $facetGroup;
$dataItem['facetName'] = '['.$k.'%20TO%20'.$facetvalues['end'].']'; $data ['facetGroupType'] = 'field';
$dataItem['facetPrintName'] = '['.$k.'%20TO%20'.$facetvalues['end'].']'; $facetItems = array ();
} for ($i = 0; $i < count ($facetvalues); $i += 2) {
$dataItem = array ();
$dataItem['facetCount'] = $facetvalues[$k]; $dataItem ['facetName'] = $facetvalues [$i];
$dataItem['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty($facetRequestEntity->selectedFacetsString)?'':',') . $data['facetGroupName'] . '::' . $data['facetGroupPrintName'] .':::' . $dataItem['facetName'] . '::' . $dataItem['facetPrintName']; $dataItem ['facetPrintName'] = $facetvalues [$i];
$newFacetItem = Entity_FacetItem::CreateForInsert($dataItem); $dataItem ['facetCount'] = $facetvalues [$i + 1];
$facetItems[] =$newFacetItem; $dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty ($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
} $newFacetItem = Entity_FacetItem::createForInsert ($dataItem);
} $facetItems [] = $newFacetItem;
}
$data['facetItems'] = $facetItems; $data ['facetItems'] = $facetItems;
$newFacetGroup = Entity_FacetGroup::CreateForInsert($data); $newFacetGroup = Entity_FacetGroup::createForInsert ($data);
$facetGroups[] = $newFacetGroup; $facetGroups [] = $newFacetGroup;
} }
} }
} }
//TODO:convert facet queries /**
//----- * *********************************************************************
/******************************************************************/ */
//Create a filter string used in the filter of results of a datatable // include facet date ranges results
$filterText = ''; //the list of selected filters used for filtering result, send in ajax $facetDatesResult = $facetsList->facet_counts->facet_dates;
foreach($aSelectedFacetGroups as $selectedFacetGroup) if (! empty ($facetDatesResult)) {
{ foreach ($facetDatesResult as $facetGroup => $facetvalues) {
$filterText .= $selectedFacetGroup->selectedFacetGroupName .':'. urlencode($selectedFacetGroup->selectedFacetItemName).','; if (count ((array)$facetvalues) > 3) // if the group have any facets included
} // besides start, end and gap
$filterText = substr_replace($filterText, '', -1); {
//$filterText = ($filterText == '')?'':'&filterText='.$filterText; $data = array (
'facetGroupName' => $facetGroup
/******************************************************************/ );
//Create result $data ['facetGroupPrintName'] = $facetGroup;
$dataFacetResult = array( $data ['facetGroupType'] = 'daterange';
'aFacetGroups' => $facetGroups, $facetItems = array ();
'aSelectedFacetGroups' => $aSelectedFacetGroups, $facetvalueskeys = array_keys ((array)$facetvalues);
'sFilterText' => $filterText foreach ($facetvalueskeys as $i => $k) {
); if ($k != 'gap' && $k != 'start' && $k != 'end') {
$facetResult = Entity_FacetResult::CreateForRequest($dataFacetResult); $dataItem = array ();
if ($i < count ($facetvalueskeys) - 4) {
return $facetResult;
} $dataItem ['facetName'] = '[' . $k . '%20TO%20' . $facetvalueskeys [$i + 1] . ']';
$dataItem ['facetPrintName'] = '[' . $k . '%20TO%20' . $facetvalueskeys [$i + 1] . ']';
function getNumberDocuments($workspace){ }
require_once ('class.solr.php'); else {
//require_once (ROOT_PATH . '/businessLogic/modules/SearchIndexAccess/Solr.php'); // the last group
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->solrIsEnabled, $this->solrHost); $dataItem ['facetName'] = '[' . $k . '%20TO%20' . $facetvalues->end . ']';
$dataItem ['facetPrintName'] = '[' . $k . '%20TO%20' . $facetvalues->end . ']';
//create list of facets }
$numberDocuments = $solr->getNumberDocuments($workspace);
$dataItem ['facetCount'] = $facetvalues->$k;
return $numberDocuments; $dataItem ['facetSelectCondition'] = $facetRequestEntity->selectedFacetsString . (empty ($facetRequestEntity->selectedFacetsString) ? '' : ',') . $data ['facetGroupName'] . '::' . $data ['facetGroupPrintName'] . ':::' . $dataItem ['facetName'] . '::' . $dataItem ['facetPrintName'];
} $newFacetItem = Entity_FacetItem::createForInsert ($dataItem);
$facetItems [] = $newFacetItem;
function updateIndexDocument($solrUpdateDocumentEntity){ }
G::LoadClass('solr'); }
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->solrIsEnabled, $this->solrHost); $data ['facetItems'] = $facetItems;
$newFacetGroup = Entity_FacetGroup::createForInsert ($data);
//create list of facets
$solr->updateDocument($solrUpdateDocumentEntity); $facetGroups [] = $newFacetGroup;
} }
}
function deleteDocumentFromIndex($workspace, $idQuery){ }
G::LoadClass('solr'); // TODO:convert facet queries
// -----
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->solrIsEnabled, $this->solrHost); /**
* ***************************************************************
//create list of facets */
$solr->deleteDocument($workspace, $idQuery); // Create a filter string used in the filter of results of a datatable
} $filterText = ''; // the list of selected filters used for filtering result,
// send in ajax
function commitIndexChanges($workspace){ foreach ($aSelectedFacetGroups as $selectedFacetGroup) {
G::LoadClass('solr'); $filterText .= $selectedFacetGroup->selectedFacetGroupName . ':' . urlencode ($selectedFacetGroup->selectedFacetItemName) . ',';
}
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->solrIsEnabled, $this->solrHost); $filterText = substr_replace ($filterText, '', - 1);
// $filterText = ($filterText == '')?'':'&filterText='.$filterText;
//commit
$solr->commitChanges($workspace); /**
} * ***************************************************************
*/
function getDataTablePaginatedList($solrRequestData){ // Create result
require_once ('class.solr.php'); $dataFacetResult = array (
//require_once (ROOT_PATH . '/businessLogic/modules/SearchIndexAccess/Solr.php'); 'aFacetGroups' => $facetGroups,
require_once ('entities/SolrRequestData.php'); 'aSelectedFacetGroups' => $aSelectedFacetGroups,
require_once ('entities/SolrQueryResult.php'); 'sFilterText' => $filterText
);
//print_r($solrRequestData); $facetResult = Entity_FacetResult::createForRequest ($dataFacetResult);
//prepare the list of sorted columns
//verify if the data of sorting is available return $facetResult;
if(isset($solrRequestData->sortCols[0])){ }
for($i=0; $i<$solrRequestData->numSortingCols; $i++){
//verify if column is sortable /**
if($solrRequestData->includeCols[$solrRequestData->sortCols[$i]] != '' && $solrRequestData->sortableCols[$i] == "true"){ * Get the total number of documents in search server
//change sorting column index to column names * @param string $workspace
$solrRequestData->sortCols[$i] = $solrRequestData->includeCols[$solrRequestData->sortCols[$i]]; * @return integer number of documents
//define the direction of the sorting columns *
$solrRequestData->sortDir[$i] = $solrRequestData->sortDir[$i]; */
} public function getNumberDocuments($workspace)
} {
} require_once ('class.solr.php');
//remove placeholder fields // require_once (ROOT_PATH .
//the placeholder doesn't affect the the solr's response // '/businessLogic/modules/SearchIndexAccess/Solr.php');
//$solrRequestData->includeCols = array_diff($solrRequestData->includeCols, array('')); $solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
//print_r($solrRequestData); // create list of facets
//execute query $numberDocuments = $solr->getNumberDocuments ($workspace);
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->solrIsEnabled, $this->solrHost);
$solrPaginatedResult = $solr->executeQuery($solrRequestData); return $numberDocuments;
}
//get total number of documents in index
$numTotalDocs = $solr->getNumberDocuments($solrRequestData->workspace); /**
* Update document Index
//create the Datatable response of the query * @param SolrUpdateDocumentEntity $solrUpdateDocumentEntity
$numFound = $solrPaginatedResult['response']['numFound']; */
public function updateIndexDocument($solrUpdateDocumentEntity)
$docs = $solrPaginatedResult['response']['docs']; {
//print_r($docs); G::LoadClass ('solr');
//insert list of names in docs result
$data = array( $solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
"sEcho" => '',//must be completed in response
"iTotalRecords" => intval($numTotalDocs), //we must get the total number of documents // create list of facets
"iTotalDisplayRecords" => $numFound, $solr->updateDocument ($solrUpdateDocumentEntity);
"aaData" => array() }
);
//copy result document or add placeholders to result /**
foreach ($docs as $i => $doc) { * Delete document from index
$data['aaData'][$i] = array(); * @param string $workspace
foreach($solrRequestData->includeCols as $columnName){ * @param string $idQuery
if($columnName == ''){ */
$data['aaData'][$i][] = ''; //placeholder public function deleteDocumentFromIndex($workspace, $idQuery)
}else{ {
if(isset($doc[$columnName])){ G::LoadClass ('solr');
$data['aaData'][$i][] = $doc[$columnName];
}else{ $solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
$data['aaData'][$i][] = '';
} // create list of facets
} $solr->deleteDocument ($workspace, $idQuery);
} }
}
/**
$solrQueryResponse = Entity_SolrQueryResult::CreateForRequest($data); * Commit index changes
// * @param string $workspace
*/
return $solrQueryResponse; public function commitIndexChanges($workspace)
} {
G::LoadClass ('solr');
function getIndexFields($workspace){
//global $indexFields; $solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
//cache
// if(!empty($indexFields)) // commit
// return $indexFields; $solr->commitChanges ($workspace);
}
require_once ('class.solr.php');
//require_once (ROOT_PATH . '/businessLogic/modules/SearchIndexAccess/Solr.php'); /**
$solr = new BpmnEngine_SearchIndexAccess_Solr($this->solrIsEnabled, $this->solrHost); * Call Solr server to return the list of paginated pages.
* @param FacetRequest $solrRequestData
* @return Entity_SolrQueryResult
//print "SearchIndex!!!!"; */
//create list of facets public function getDataTablePaginatedList($solrRequestData)
$solrFieldsData = $solr->getListIndexedStoredFields($workspace); {
require_once ('class.solr.php');
//copy list of arrays require_once ('entities/SolrRequestData.php');
$listFields = array(); require_once ('entities/SolrQueryResult.php');
foreach($solrFieldsData['fields'] as $key => $fieldData){
if(array_key_exists('dynamicBase', $fieldData)){ // prepare the list of sorted columns
//remove * // verify if the data of sorting is available
$originalFieldName = substr($key, 0, -strlen($fieldData['dynamicBase'])+1); if (isset ($solrRequestData->sortCols [0])) {
//$listFields[strtolower($originalFieldName)] = $key; for ($i = 0; $i < $solrRequestData->numSortingCols; $i ++) {
//Maintain case sensitive variable names // verify if column is sortable
$listFields[$originalFieldName] = $key; if ($solrRequestData->includeCols [$solrRequestData->sortCols [$i]] != '' && $solrRequestData->sortableCols [$i] == "true") {
}else{ // change sorting column index to column names
//$listFields[strtolower($key)] = $key; $solrRequestData->sortCols [$i] = $solrRequestData->includeCols [$solrRequestData->sortCols [$i]];
//Maintain case sensitive variable names // define the direction of the sorting columns
$listFields[$key] = $key; $solrRequestData->sortDir [$i] = $solrRequestData->sortDir [$i];
} }
} }
}
//print_r($listFields); // remove placeholder fields
//$indexFields = $listFields; // the placeholder doesn't affect the the solr's response
// $solrRequestData->includeCols = array_diff($solrRequestData->includeCols,
return $listFields; // array(''));
}
// execute query
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
$solrPaginatedResult = $solr->executeQuery ($solrRequestData);
// get total number of documents in index
$numTotalDocs = $solr->getNumberDocuments ($solrRequestData->workspace);
// create the Datatable response of the query
$numFound = $solrPaginatedResult->response->numFound;
$docs = $solrPaginatedResult->response->docs;
// print_r($docs);
// insert list of names in docs result
$data = array (
"sEcho" => '', // must be completed in response
"iTotalRecords" => intval ($numTotalDocs), // we must get the
// total number of
// documents
"iTotalDisplayRecords" => $numFound,
"aaData" => array ()
);
// copy result document or add placeholders to result
foreach ($docs as $i => $doc) {
$data ['aaData'] [$i] = array ();
foreach ($solrRequestData->includeCols as $columnName) {
if ($columnName == '') {
$data ['aaData'] [$i] [] = ''; // placeholder
}
else {
if (isset ($doc->$columnName)) {
$data ['aaData'] [$i] [] = $doc->$columnName;
}
else {
$data ['aaData'] [$i] [] = '';
}
}
}
}
$solrQueryResponse = Entity_SolrQueryResult::createForRequest ($data);
//
return $solrQueryResponse;
}
/**
* Return the list of stored fields in the index.
* @param string $workspace
* @return array of index fields
*/
public function getIndexFields($workspace)
{
require_once ('class.solr.php');
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
// print "SearchIndex!!!!";
// create list of facets
$solrFieldsData = $solr->getListIndexedStoredFields ($workspace);
// copy list of arrays
$listFields = array ();
foreach ($solrFieldsData->fields as $key => $fieldData) {
if (array_key_exists ('dynamicBase', $fieldData)) {
$originalFieldName = substr ($key, 0, - strlen ($fieldData->dynamicBase) + 1);
// $listFields[strtolower($originalFieldName)] = $key; //in case of case insentive strings
// Maintain case sensitive variable names
$listFields [$originalFieldName] = $key;
}
else {
// $listFields[strtolower($key)] = $key;
// Maintain case sensitive variable names
$listFields [$key] = $key;
}
}
return $listFields;
}
} }

View File

@@ -1,13 +1,44 @@
<?php <?php
class BpmnEngine_SearchIndexAccess_Solr { /**
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2012 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 5304 Ventura Drive,
* Delray Beach, FL, 33484, USA, or email info@colosa.com.
*
*/
/**
* Interface to the Solr Search server
* @author Herbert Saal Gutierrez
*
*/
class BpmnEngine_SearchIndexAccess_Solr
{
const SOLR_VERSION = '&version=2.2'; const SOLR_VERSION = '&version=2.2';
private $solrIsEnabled = false; private $_solrIsEnabled = false;
private $solrHost = ""; private $_solrHost = "";
function __construct($solrIsEnabled = false, $solrHost = "") { public function __construct($solrIsEnabled = false, $solrHost = "")
{
// use the parameters to initialize class // use the parameters to initialize class
$this->solrIsEnabled = $solrIsEnabled; $this->_solrIsEnabled = $solrIsEnabled;
$this->solrHost = $solrHost; $this->_solrHost = $solrHost;
} }
/** /**
@@ -15,13 +46,14 @@ class BpmnEngine_SearchIndexAccess_Solr {
* @gearman = false * @gearman = false
* @rest = false * @rest = false
* @background = false * @background = false
* *
* @return bool * @return bool
*/ */
function isEnabled() { public function isEnabled()
{
// verify solr server response // verify solr server response
return $this->solrIsEnabled; return $this->_solrIsEnabled;
} }
/** /**
@@ -29,79 +61,81 @@ class BpmnEngine_SearchIndexAccess_Solr {
* @gearman = false * @gearman = false
* @rest = false * @rest = false
* @background = false * @background = false
* *
* @param * @param
* workspace: workspace name * workspace: workspace name
* @return total * @return total
*/ */
function getNumberDocuments($workspace) { public function getNumberDocuments($workspace)
if (! $this->solrIsEnabled) {
if (! $this->_solrIsEnabled)
return; return;
// get configuration information in base to workspace parameter // get configuration information in base to workspace parameter
// get total number of documents in registry // get total number of documents in registry
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/"; $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace; $solrIntruct .= $workspace;
$solrIntruct .= "/select/?q=*:*"; $solrIntruct .= "/select/?q=*:*";
$solrIntruct .= self::SOLR_VERSION; $solrIntruct .= self::SOLR_VERSION;
$solrIntruct .= "&start=0&rows=0&echoParams=none&wt=json"; $solrIntruct .= "&start=0&rows=0&echoParams=none&wt=json";
$handlerTotal = curl_init ( $solrIntruct ); $handlerTotal = curl_init ($solrIntruct);
curl_setopt ( $handlerTotal, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($handlerTotal, CURLOPT_RETURNTRANSFER, true);
$responseTotal = curl_exec ( $handlerTotal ); $responseTotal = curl_exec ($handlerTotal);
curl_close ( $handlerTotal ); curl_close ($handlerTotal);
// verify the result of solr // verify the result of solr
$responseSolrTotal = json_decode ( $responseTotal, true ); $responseSolrTotal = G::json_decode ($responseTotal);
if ($responseSolrTotal['responseHeader']['status'] != 0) { if ($responseSolrTotal->responseHeader->status != 0) {
throw new Exception ( "Error returning the total number of documents in Solr." . $solrIntruct); throw new Exception ("Error returning the total number of documents in Solr." . $solrIntruct);
} }
$numTotalDocs = $responseSolrTotal ['response'] ['numFound']; $numTotalDocs = $responseSolrTotal->response->numFound;
return $numTotalDocs; return $numTotalDocs;
} }
/** /**
* Execute a query in base to Request data * Execute a query in base to Requested data
* @gearman = false * @gearman = false
* @rest = false * @rest = false
* @background = false * @background = false
* *
* @return solr response * @return solr response
*/ */
function executeQuery($solrRequestData) { public function executeQuery($solrRequestData)
if (! $this->solrIsEnabled) {
if (! $this->_solrIsEnabled)
return; return;
$solrIntruct = ''; $solrIntruct = '';
// get configuration information in base to workspace parameter // get configuration information in base to workspace parameter
$workspace = $solrRequestData->workspace; $workspace = $solrRequestData->workspace;
// format request // format request
$query = empty ( $solrRequestData->searchText ) ? '*:*' : $solrRequestData->searchText; $query = empty ($solrRequestData->searchText) ? '*:*' : $solrRequestData->searchText;
$query = rawurlencode ( $query ); $query = rawurlencode ($query);
$start = '&start=' . $solrRequestData->startAfter; $start = '&start=' . $solrRequestData->startAfter;
$rows = '&rows=' . $solrRequestData->pageSize; $rows = '&rows=' . $solrRequestData->pageSize;
$fieldList = ''; $fieldList = '';
$cols = $solrRequestData->includeCols; $cols = $solrRequestData->includeCols;
if (! empty ( $cols )) { if (! empty ($cols)) {
$fieldList = "&fl=" . implode ( ",", $cols ); $fieldList = "&fl=" . implode (",", $cols);
} }
$sort = ''; $sort = '';
if ($solrRequestData->numSortingCols > 0) { if ($solrRequestData->numSortingCols > 0) {
$sort = '&sort='; $sort = '&sort=';
for($i = 0; $i < $solrRequestData->numSortingCols; $i ++) { for ($i = 0; $i < $solrRequestData->numSortingCols; $i ++) {
$sort .= $solrRequestData->sortCols [$i] . "%20" . $solrRequestData->sortDir [$i] . ","; $sort .= $solrRequestData->sortCols [$i] . "%20" . $solrRequestData->sortDir [$i] . ",";
} }
$sort = substr_replace ( $sort, "", - 1 ); $sort = substr_replace ($sort, "", - 1);
} }
$resultFormat = empty ( $solrRequestData->resultFormat ) ? '' : '&wt=' . $solrRequestData->resultFormat; $resultFormat = empty ($solrRequestData->resultFormat) ? '' : '&wt=' . $solrRequestData->resultFormat;
$filters = ''; $filters = '';
$aFilters = explode ( ',', $solrRequestData->filterText ); $aFilters = explode (',', $solrRequestData->filterText);
foreach ( $aFilters as $value ) { foreach ($aFilters as $value) {
$filters .= '&fq=' . urlencode ( $value ); $filters .= '&fq=' . urlencode ($value);
} }
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/"; $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace; $solrIntruct .= $workspace;
$solrIntruct .= "/select/?q=$query"; $solrIntruct .= "/select/?q=$query";
$solrIntruct .= "&echoParams=none"; $solrIntruct .= "&echoParams=none";
@@ -112,18 +146,17 @@ class BpmnEngine_SearchIndexAccess_Solr {
$solrIntruct .= $sort; $solrIntruct .= $sort;
$solrIntruct .= $filters; $solrIntruct .= $filters;
$solrIntruct .= $resultFormat; $solrIntruct .= $resultFormat;
// send query // send query
// search the cases in base to datatable parameters // search the cases in base to datatable parameters
$handler = curl_init ( $solrIntruct ); $handler = curl_init ($solrIntruct);
curl_setopt ( $handler, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec ( $handler ); $response = curl_exec ($handler);
curl_close ( $handler ); curl_close ($handler);
// decode // decode
$responseSolr = json_decode ( $response, true ); $responseSolr = G::json_decode ($response);
if ($responseSolr['responseHeader']['status'] != 0) { if ($responseSolr->responseHeader->status != 0) {
throw new Exception ( "Error executing query to Solr." . $solrIntruct); throw new Exception ("Error executing query to Solr." . $solrIntruct);
} }
return $responseSolr; return $responseSolr;
@@ -134,31 +167,32 @@ class BpmnEngine_SearchIndexAccess_Solr {
* @gearman = false * @gearman = false
* @rest = false * @rest = false
* @background = false * @background = false
* *
* @return solr response * @return solr response
*/ */
function updateDocument($solrUpdateDocument) { public function updateDocument($solrUpdateDocument)
if (! $this->solrIsEnabled) {
if (! $this->_solrIsEnabled)
return; return;
$solrIntruct = ''; $solrIntruct = '';
// get configuration information in base to workspace parameter // get configuration information in base to workspace parameter
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/"; $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $solrUpdateDocument->workspace; $solrIntruct .= $solrUpdateDocument->workspace;
$solrIntruct .= "/update"; $solrIntruct .= "/update";
$handler = curl_init ( $solrIntruct );
curl_setopt ( $handler, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $handler, CURLOPT_HTTPHEADER, array (
'Content-type:application/xml'
) ); // -H
curl_setopt ( $handler, CURLOPT_BINARYTRANSFER, TRUE ); // --data-binary
curl_setopt ( $handler, CURLOPT_POSTFIELDS, $solrUpdateDocument->document ); // data
$response = curl_exec ( $handler );
curl_close ( $handler );
$swOk = strpos ( $response, '<int name="status">0</int>' ); $handler = curl_init ($solrIntruct);
curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($handler, CURLOPT_HTTPHEADER, array (
'Content-type:application/xml'
)); // -H
curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
curl_setopt ($handler, CURLOPT_POSTFIELDS, $solrUpdateDocument->document); // data
$response = curl_exec ($handler);
curl_close ($handler);
$swOk = strpos ($response, '<int name="status">0</int>');
if (! $swOk) { if (! $swOk) {
throw new Exception ( "Error updating document in Solr." . $solrIntruct); throw new Exception ("Error updating document in Solr." . $solrIntruct);
} }
} }
@@ -167,120 +201,132 @@ class BpmnEngine_SearchIndexAccess_Solr {
* @gearman = false * @gearman = false
* @rest = false * @rest = false
* @background = false * @background = false
* *
* @return solr response * @return solr response
*/ */
function commitChanges($workspace) { public function commitChanges($workspace)
if (! $this->solrIsEnabled) {
if (! $this->_solrIsEnabled)
return; return;
$solrIntruct = ''; $solrIntruct = '';
// get configuration information in base to workspace parameter // get configuration information in base to workspace parameter
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/"; $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace; $solrIntruct .= $workspace;
$solrIntruct .= "/update"; $solrIntruct .= "/update";
$handler = curl_init ( $solrIntruct ); $handler = curl_init ($solrIntruct);
curl_setopt ( $handler, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt ( $handler, CURLOPT_HTTPHEADER, array ( curl_setopt ($handler, CURLOPT_HTTPHEADER, array (
'Content-type:application/xml' 'Content-type:application/xml'
) ); // -H )); // -H
curl_setopt ( $handler, CURLOPT_BINARYTRANSFER, TRUE ); // --data-binary curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
curl_setopt ( $handler, CURLOPT_POSTFIELDS, "<commit/>" ); // data curl_setopt ($handler, CURLOPT_POSTFIELDS, "<commit/>"); // data
$response = curl_exec ( $handler ); $response = curl_exec ($handler);
curl_close ( $handler ); curl_close ($handler);
$swOk = strpos ( $response, '<int name="status">0</int>' ); $swOk = strpos ($response, '<int name="status">0</int>');
if (! $swOk) { if (! $swOk) {
throw new Exception ( "Error commiting changes in Solr." . $solrIntruct); throw new Exception ("Error commiting changes in Solr." . $solrIntruct);
} }
} }
/** /**
* Commit the changes since the last commit * Rollback the changes since the last commit
* @gearman = false * @gearman = false
* @rest = false * @rest = false
* @background = false * @background = false
* *
* @return solr response * @return solr response
*/ */
function rollbackChanges($workspace) { public function rollbackChanges($workspace)
if (! $this->solrIsEnabled) {
if (! $this->_solrIsEnabled)
return; return;
$solrIntruct = ''; $solrIntruct = '';
// get configuration information in base to workspace parameter // get configuration information in base to workspace parameter
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/"; $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace; $solrIntruct .= $workspace;
$solrIntruct .= "/update"; $solrIntruct .= "/update";
$handler = curl_init ( $solrIntruct ); $handler = curl_init ($solrIntruct);
curl_setopt ( $handler, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt ( $handler, CURLOPT_HTTPHEADER, array ( curl_setopt ($handler, CURLOPT_HTTPHEADER, array (
'Content-type:application/xml' 'Content-type:application/xml'
) ); // -H )); // -H
curl_setopt ( $handler, CURLOPT_BINARYTRANSFER, TRUE ); // --data-binary curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
curl_setopt ( $handler, CURLOPT_POSTFIELDS, "<rollback/>" ); // data curl_setopt ($handler, CURLOPT_POSTFIELDS, "<rollback/>"); // data
$response = curl_exec ( $handler ); $response = curl_exec ($handler);
curl_close ( $handler ); curl_close ($handler);
$swOk = strpos ( $response, '<int name="status">0</int>' ); $swOk = strpos ($response, '<int name="status">0</int>');
if (! $swOk) { if (! $swOk) {
throw new Exception ( "Error rolling back changes in Solr." . $solrIntruct); throw new Exception ("Error rolling back changes in Solr." . $solrIntruct);
} }
} }
/** /**
* Insert or Update document index * Optimize Solr index
* @gearman = false * @gearman = false
* @rest = false * @rest = false
* @background = false * @background = false
* *
* @return solr response * @return solr response
*/ */
function optimizeChanges($workspace) { public function optimizeChanges($workspace)
if (! $this->solrIsEnabled) {
if (! $this->_solrIsEnabled)
return; return;
$solrIntruct = ''; $solrIntruct = '';
// get configuration information in base to workspace parameter // get configuration information in base to workspace parameter
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/"; $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace; $solrIntruct .= $workspace;
$solrIntruct .= "/update"; $solrIntruct .= "/update";
$handler = curl_init ( $solrIntruct ); $handler = curl_init ($solrIntruct);
curl_setopt ( $handler, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt ( $handler, CURLOPT_HTTPHEADER, array ( curl_setopt ($handler, CURLOPT_HTTPHEADER, array (
'Content-type:application/xml' 'Content-type:application/xml'
) ); // -H )); // -H
curl_setopt ( $handler, CURLOPT_BINARYTRANSFER, TRUE ); // --data-binary curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
curl_setopt ( $handler, CURLOPT_POSTFIELDS, "<optimize/>" ); // data curl_setopt ($handler, CURLOPT_POSTFIELDS, "<optimize/>"); // data
$response = curl_exec ( $handler ); $response = curl_exec ($handler);
curl_close ( $handler ); curl_close ($handler);
$swOk = strpos ( $response, '<int name="status">0</int>' ); $swOk = strpos ($response, '<int name="status">0</int>');
if (! $swOk) { if (! $swOk) {
throw new Exception ( "Error optimizing changes in Solr." . $solrIntruct); throw new Exception ("Error optimizing changes in Solr." . $solrIntruct);
} }
} }
function getListIndexedStoredFields($workspace) { /**
if (! $this->solrIsEnabled) * Return the list of the stored fields in Solr
*
* @param string $workspace
* Solr instance name
* @throws Exception
* @return void mixed of field names
*/
public function getListIndexedStoredFields($workspace)
{
if (! $this->_solrIsEnabled)
return; return;
$solrIntruct = ''; $solrIntruct = '';
// get configuration information in base to workspace parameter // get configuration information in base to workspace parameter
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/"; $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace; $solrIntruct .= $workspace;
$solrIntruct .= "/admin/luke?numTerms=0&wt=json"; $solrIntruct .= "/admin/luke?numTerms=0&wt=json";
$handler = curl_init ( $solrIntruct ); $handler = curl_init ($solrIntruct);
curl_setopt ( $handler, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec ( $handler ); $response = curl_exec ($handler);
curl_close ( $handler ); curl_close ($handler);
// decode // decode
$responseSolr = json_decode ( $response, true ); $responseSolr = G::json_decode ($response);
if ($responseSolr['responseHeader']['status'] != 0) { if ($responseSolr->responseHeader->status != 0) {
throw new Exception ( "Error getting index fields in Solr." . $solrIntruct); throw new Exception ("Error getting index fields in Solr." . $solrIntruct);
} }
return $responseSolr; return $responseSolr;
} }
@@ -290,34 +336,35 @@ class BpmnEngine_SearchIndexAccess_Solr {
* @gearman = false * @gearman = false
* @rest = false * @rest = false
* @background = false * @background = false
* *
* @return solr response * @return solr response
*/ */
function deleteAllDocuments($workspace) { public function deleteAllDocuments($workspace)
if (! $this->solrIsEnabled) {
if (! $this->_solrIsEnabled)
return; return;
// $registry = Zend_Registry::getInstance(); // $registry = Zend_Registry::getInstance();
$solrIntruct = ''; $solrIntruct = '';
// get configuration information in base to workspace parameter // get configuration information in base to workspace parameter
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/"; $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace; $solrIntruct .= $workspace;
$solrIntruct .= "/update"; $solrIntruct .= "/update";
$handler = curl_init ( $solrIntruct ); $handler = curl_init ($solrIntruct);
curl_setopt ( $handler, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt ( $handler, CURLOPT_HTTPHEADER, array ( curl_setopt ($handler, CURLOPT_HTTPHEADER, array (
'Content-type:application/xml' 'Content-type:application/xml'
) ); // -H )); // -H
curl_setopt ( $handler, CURLOPT_BINARYTRANSFER, TRUE ); // --data-binary curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
curl_setopt ( $handler, CURLOPT_POSTFIELDS, "<delete><query>*:*</query></delete>" ); // data curl_setopt ($handler, CURLOPT_POSTFIELDS, "<delete><query>*:*</query></delete>"); // data
$response = curl_exec ( $handler ); $response = curl_exec ($handler);
curl_close ( $handler ); curl_close ($handler);
$swOk = strpos ( $response, '<int name="status">0</int>' ); $swOk = strpos ($response, '<int name="status">0</int>');
if (! $swOk) { if (! $swOk) {
throw new Exception ( "Error deleting all documents in Solr." . $solrIntruct); throw new Exception ("Error deleting all documents in Solr." . $solrIntruct);
} }
} }
@@ -326,45 +373,47 @@ class BpmnEngine_SearchIndexAccess_Solr {
* @gearman = false * @gearman = false
* @rest = false * @rest = false
* @background = false * @background = false
* *
* @return solr response * @return solr response
*/ */
function deleteDocument($workspace, $idQuery) { public function deleteDocument($workspace, $idQuery)
if (! $this->solrIsEnabled) {
if (! $this->_solrIsEnabled)
return; return;
// $registry = Zend_Registry::getInstance(); // $registry = Zend_Registry::getInstance();
$solrIntruct = ''; $solrIntruct = '';
// get configuration information in base to workspace parameter // get configuration information in base to workspace parameter
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/"; $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace; $solrIntruct .= $workspace;
$solrIntruct .= "/update"; $solrIntruct .= "/update";
$handler = curl_init ( $solrIntruct ); $handler = curl_init ($solrIntruct);
curl_setopt ( $handler, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true);
curl_setopt ( $handler, CURLOPT_HTTPHEADER, array ( curl_setopt ($handler, CURLOPT_HTTPHEADER, array (
'Content-type:application/xml' 'Content-type:application/xml'
) ); // -H )); // -H
curl_setopt ( $handler, CURLOPT_BINARYTRANSFER, TRUE ); // --data-binary curl_setopt ($handler, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary
curl_setopt ( $handler, CURLOPT_POSTFIELDS, "<delete><query>" . $idQuery . "</query></delete>" ); // data curl_setopt ($handler, CURLOPT_POSTFIELDS, "<delete><query>" . $idQuery . "</query></delete>"); // data
$response = curl_exec ( $handler ); $response = curl_exec ($handler);
curl_close ( $handler ); curl_close ($handler);
$swOk = strpos ( $response, '<int name="status">0</int>' ); $swOk = strpos ($response, '<int name="status">0</int>');
if (! $swOk) { if (! $swOk) {
throw new Exception ( "Error deleting document in Solr." . $solrIntruct); throw new Exception ("Error deleting document in Solr." . $solrIntruct);
} }
} }
/** /**
* Execute a query in base to Request data * Execute a query in base to Request data
* *
* @param Entity_FacetRequest $facetRequestEntity * @param Entity_FacetRequest $facetRequestEntity
* @return solr response: list of facets array * @return solr response: list of facets array
*/ */
function getFacetsList($facetRequest) { public function getFacetsList($facetRequest)
if (! $this->solrIsEnabled) {
if (! $this->_solrIsEnabled)
return; return;
$solrIntruct = ''; $solrIntruct = '';
@@ -372,22 +421,22 @@ class BpmnEngine_SearchIndexAccess_Solr {
$workspace = $facetRequest->workspace; $workspace = $facetRequest->workspace;
// format request // format request
$query = empty ( $facetRequest->searchText ) ? '*:*' : $facetRequest->searchText; $query = empty ($facetRequest->searchText) ? '*:*' : $facetRequest->searchText;
$query = rawurlencode ( $query ); $query = rawurlencode ($query);
$start = '&start=0'; $start = '&start=0';
$rows = '&rows=0'; $rows = '&rows=0';
$facets = '&facet=on&facet.mincount=1&facet.limit=20'; // enable facet and $facets = '&facet=on&facet.mincount=1&facet.limit=20'; // enable facet and
// only return facets // only return facets
// with minimun one // with minimun one
// instance // instance
foreach ( $facetRequest->facetFields as $value ) { foreach ($facetRequest->facetFields as $value) {
$facets .= '&facet.field=' . $value; $facets .= '&facet.field=' . $value;
} }
foreach ( $facetRequest->facetQueries as $value ) { foreach ($facetRequest->facetQueries as $value) {
$facets .= '&facet.query=' . $value; $facets .= '&facet.query=' . $value;
} }
if (! empty ( $facetRequest->facetDates )) { if (! empty ($facetRequest->facetDates)) {
foreach ( $facetRequest->facetDates as $value ) { foreach ($facetRequest->facetDates as $value) {
$facets .= '&facet.date=' . $value; $facets .= '&facet.date=' . $value;
} }
$facets .= '&facet.date.start=' . $facetRequest->facetDatesStart; $facets .= '&facet.date.start=' . $facetRequest->facetDatesStart;
@@ -395,14 +444,14 @@ class BpmnEngine_SearchIndexAccess_Solr {
$facets .= '&facet.date.gap=' . $facetRequest->facetDateGap; $facets .= '&facet.date.gap=' . $facetRequest->facetDateGap;
} }
$filters = ''; $filters = '';
foreach ( $facetRequest->filters as $value ) { foreach ($facetRequest->filters as $value) {
$filters .= '&fq=' . $value; $filters .= '&fq=' . $value;
} }
// echo "<pre>"; // echo "<pre>";
$resultFormat = '&wt=json'; $resultFormat = '&wt=json';
$solrIntruct = (substr($this->solrHost, -1) == "/")?$this->solrHost:$this->solrHost . "/"; $solrIntruct = (substr ($this->_solrHost, - 1) == "/") ? $this->_solrHost : $this->_solrHost . "/";
$solrIntruct .= $workspace; $solrIntruct .= $workspace;
$solrIntruct .= "/select/?q=$query"; $solrIntruct .= "/select/?q=$query";
$solrIntruct .= "&echoParams=none"; $solrIntruct .= "&echoParams=none";
@@ -415,15 +464,15 @@ class BpmnEngine_SearchIndexAccess_Solr {
// send query // send query
// search the cases in base to datatable parameters // search the cases in base to datatable parameters
$handler = curl_init ( $solrIntruct ); $handler = curl_init ($solrIntruct);
curl_setopt ( $handler, CURLOPT_RETURNTRANSFER, true ); curl_setopt ($handler, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec ( $handler ); $response = curl_exec ($handler);
curl_close ( $handler ); curl_close ($handler);
// decode // decode
$responseSolr = json_decode ( $response, true ); $responseSolr = G::json_decode ($response);
if ($responseSolr['responseHeader']['status'] != 0) { if ($responseSolr->responseHeader->status != 0) {
throw new Exception ( "Error getting faceted list from Solr." . $solrIntruct); throw new Exception ("Error getting faceted list from Solr." . $solrIntruct);
} }
return $responseSolr; return $responseSolr;

View File

@@ -651,19 +651,21 @@ class wsBase
$fileTemplate = $pathEmail . $sTemplate; $fileTemplate = $pathEmail . $sTemplate;
G::mk_dir( $pathEmail, 0777,true); G::mk_dir( $pathEmail, 0777,true);
if ( ! file_exists ( $fileTemplate ) ) { if (!file_exists($fileTemplate)) {
$data['FILE_TEMPLATE'] = $fileTemplate; $data['FILE_TEMPLATE'] = $fileTemplate;
$result = new wsResponse (28, G::LoadTranslation('ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data) ); $result = new wsResponse(28, G::LoadTranslation('ID_TEMPLATE_FILE_NOT_EXIST', SYS_LANG, $data));
return $result; return $result;
} }
if ( $appFields == null ) { if ($appFields == null) {
$Fields = $oldFields['APP_DATA']; $Fields = $oldFields['APP_DATA'];
} }
else { else {
$Fields = $appFields; $Fields = array_merge($oldFields['APP_DATA'], $appFields);
} }
$templateContents = file_get_contents ( $fileTemplate );
$templateContents = file_get_contents($fileTemplate);
//$sContent = G::unhtmlentities($sContent); //$sContent = G::unhtmlentities($sContent);
$iAux = 0; $iAux = 0;

View File

@@ -4,30 +4,34 @@ require_once ('Base.php');
/** /**
* Application Solr Queue * Application Solr Queue
*/ */
class Entity_AppSolrQueue extends Entity_Base { class Entity_AppSolrQueue extends Entity_Base
{
public $appUid = ''; public $appUid = '';
public $appUpdated = 0; public $appUpdated = 0;
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_AppSolrQueue (); $obj = new Entity_AppSolrQueue ();
return $obj; return $obj;
} }
static function CreateForRequest($data) { static function createForRequest($data)
{
$obj = new Entity_AppSolrQueue (); $obj = new Entity_AppSolrQueue ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
"appUid", "appUid",
"appUpdated" "appUpdated"
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -1,17 +1,19 @@
<?php <?php
class Entity_Base { class Entity_Base
{
/** /**
* this function check if a field is in the data sent in the constructor * this function check if a field is in the data sent in the constructor
* you can specify an array, and this function will use like alias * you can specify an array, and this function will use like alias
*/ */
protected function validateField($field, $default = false) { protected function validateField($field, $default = false)
{
$fieldIsEmpty = true; $fieldIsEmpty = true;
// this is a trick, if $fields is a string, $fields will be an array with // this is a trick, if $fields is a string, $fields will be an array with
// one element // one element
if (is_array ( $field )) { if (is_array ($field)) {
$fields = $field; $fields = $field;
} }
else { else {
@@ -21,8 +23,8 @@ class Entity_Base {
// if there are aliases for this field, evaluate all aliases and take the // if there are aliases for this field, evaluate all aliases and take the
// first occurence // first occurence
foreach ( $fields as $k => $f ) { foreach ($fields as $k => $f) {
if (isset ( $this->temp [$f] )) { if (isset ($this->temp [$f])) {
$fieldIsEmpty = false; $fieldIsEmpty = false;
return $this->temp [$f]; return $this->temp [$f];
} }
@@ -37,16 +39,18 @@ class Entity_Base {
} }
} }
protected function validateRequiredFields($requiredFields = array()) { protected function validateRequiredFields($requiredFields = array())
foreach ( $requiredFields as $k => $field ) { {
foreach ($requiredFields as $k => $field) {
if ($this->{$field} === NULL) { if ($this->{$field} === NULL) {
throw (new Exception ( "Field $field is required in " . get_class ( $this ) )); throw (new Exception ("Field $field is required in " . get_class ($this)));
die (); die ();
} }
} }
} }
/** /**
*
* *
* *
* Copy the values of the Entity to the array of aliases * Copy the values of the Entity to the array of aliases
@@ -54,15 +58,19 @@ class Entity_Base {
* *
* @return Array of alias with the Entity values * @return Array of alias with the Entity values
*/ */
public function getAliasDataArray() { public function getAliasDataArray()
{
$aAlias = array (); $aAlias = array ();
// get aliases from class // get aliases from class
$className = get_class ( $this ); $className = get_class ($this);
if (method_exists ( $className, 'GetAliases' )) { if (method_exists ($className, 'GetAliases')) {
$aliases = call_user_func(array($className, 'GetAliases')); $aliases = call_user_func (array (
//$aliases = $className::GetAliases (); $className,
foreach ( $this as $field => $value ) 'GetAliases'
if (isset ( $aliases [$field] )) { ));
// $aliases = $className::GetAliases ();
foreach ($this as $field => $value)
if (isset ($aliases [$field])) {
// echo "Field exists in Aliases: " . $field . "\n"; // echo "Field exists in Aliases: " . $field . "\n";
// echo "Alias Name:" . $aliases[$field] . "\n"; // echo "Alias Name:" . $aliases[$field] . "\n";
// echo "Alias value:" . $value . "\n"; // echo "Alias value:" . $value . "\n";
@@ -74,6 +82,7 @@ class Entity_Base {
} }
/** /**
*
* *
* *
* Set the data from array of alias to Entity * Set the data from array of alias to Entity
@@ -81,57 +90,68 @@ class Entity_Base {
* @param $aAliasData array * @param $aAliasData array
* of data of aliases * of data of aliases
*/ */
public function setAliasDataArray($aAliasData) { public function setAliasDataArray($aAliasData)
{
// get aliases from class // get aliases from class
$className = get_class ( $this ); $className = get_class ($this);
if (method_exists ( $className, 'GetAliases' )) { if (method_exists ($className, 'GetAliases')) {
$aliases = call_user_func(array($className, 'GetAliases')); $aliases = call_user_func (array (
//$aliases = $className::GetAliases (); $className,
foreach ( $this as $field => $value ) 'GetAliases'
if (isset ( $aliases [$field] )) ));
// $aliases = $className::GetAliases ();
foreach ($this as $field => $value)
if (isset ($aliases [$field]))
$this->{$field} = $aAliasData [$aliases [$field]]; $this->{$field} = $aAliasData [$aliases [$field]];
} }
} }
/** /**
*
* *
* *
* Initialize object with values from $data. * Initialize object with values from $data.
* The values from data use properties or alias array. * The values from data use properties or alias array.
* *
* @param * @param
* $data * $data
*/ */
protected function initializeObject($data) { protected function initializeObject($data)
{
// get aliases from class // get aliases from class
$className = get_class ( $this ); $className = get_class ($this);
$aliases = array (); $aliases = array ();
$swAliases = false; $swAliases = false;
if (method_exists ( $className, 'GetAliases' )) { if (method_exists ($className, 'GetAliases')) {
$aliases = call_user_func(array($className, 'GetAliases')); $aliases = call_user_func (array (
//$aliases = $className::GetAliases (); $className,
'GetAliases'
));
// $aliases = $className::GetAliases ();
$swAliases = true; $swAliases = true;
} }
// use object properties or aliases to initialize // use object properties or aliases to initialize
foreach ( $this as $field => $value ) foreach ($this as $field => $value)
if (isset ( $data [$field] )) { if (isset ($data [$field])) {
$this->$field = $data [$field]; $this->$field = $data [$field];
} }
elseif ($swAliases && isset ( $aliases [$field] ) && isset ( $data [$aliases [$field]] )) { elseif ($swAliases && isset ($aliases [$field]) && isset ($data [$aliases [$field]])) {
$this->$field = $data [$aliases [$field]]; $this->$field = $data [$aliases [$field]];
} }
} }
public function serialize() { public function serialize()
if (isset ( $this->temp )) {
unset ( $this->temp ); if (isset ($this->temp))
return serialize ( $this ); unset ($this->temp);
return serialize ($this);
} }
public function unserialize($str) { public function unserialize($str)
$className = get_class ( $this ); {
$data = unserialize ( $str ); $className = get_class ($this);
return new $className ( $data ); $data = unserialize ($str);
return new $className ($data);
} }
} }

View File

@@ -2,10 +2,8 @@
require_once ('Base.php'); require_once ('Base.php');
/** /**
*
*
* Facet group entity that represent a facet group * Facet group entity that represent a facet group
* *
* @property $facetGroupName: The name of the facet (field name in solr index) * @property $facetGroupName: The name of the facet (field name in solr index)
* @property $facetGroupPrintName: The print name of the facet (Human readable * @property $facetGroupPrintName: The print name of the facet (Human readable
* description) * description)
@@ -16,32 +14,36 @@ require_once ('Base.php');
* @author dev-HebertSaak * @author dev-HebertSaak
* *
*/ */
class Entity_FacetGroup extends Entity_Base { class Entity_FacetGroup extends Entity_Base
{
public $facetGroupName = ''; public $facetGroupName = '';
public $facetGroupPrintName = ''; public $facetGroupPrintName = '';
public $facetGroupType = ''; // field, daterange, query public $facetGroupType = ''; // field, daterange, query
public $facetGroupId = ''; public $facetGroupId = '';
public $facetItems = array (); public $facetItems = array ();
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_FacetGroup (); $obj = new Entity_FacetGroup ();
return $obj; return $obj;
} }
static function CreateForInsert($data) { static function createForInsert($data)
{
$obj = new Entity_FacetGroup (); $obj = new Entity_FacetGroup ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
"facetGroupName", "facetGroupName",
"facetItems" "facetItems"
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -1,34 +1,38 @@
<?php <?php
require_once ('Base.php'); require_once ('Base.php');
class Entity_FacetInterfaceRequest extends Entity_Base { class Entity_FacetInterfaceRequest extends Entity_Base
{
public $searchText = ''; public $searchText = '';
public $selectedFacetsString = ''; // string of selected facet groups and public $selectedFacetsString = ''; // string of selected facet groups and
// items in format: // items in format:
// groupkey1::groupdesc1:::itemkey1::itemdesc1,groupkey2::groupdesc2:::itemkey2::itemdesc2, // groupkey1::groupdesc1:::itemkey1::itemdesc1,groupkey2::groupdesc2:::itemkey2::itemdesc2,
// groupkey3::groupdesc3:::itemkey3::itemdesc3 // groupkey3::groupdesc3:::itemkey3::itemdesc3
// var $selectedFacetFields = array(); // var $selectedFacetFields = array();
// var $selectedFacetTypes = array(); // var $selectedFacetTypes = array();
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_FacetInterfaceRequest (); $obj = new Entity_FacetInterfaceRequest ();
return $obj; return $obj;
} }
static function CreateForRequest($data) { static function createForRequest($data)
{
$obj = new Entity_FacetInterfaceRequest (); $obj = new Entity_FacetInterfaceRequest ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
"searchText", "searchText",
"selectedFacetsString" "selectedFacetsString"
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -1,25 +1,29 @@
<?php <?php
require_once ('Base.php'); require_once ('Base.php');
class Entity_FacetInterfaceResult extends Entity_Base { class Entity_FacetInterfaceResult extends Entity_Base
{
// array of facetsgroups, array of Entity_SelectedFacetGroupItem, filter text // array of facetsgroups, array of Entity_SelectedFacetGroupItem, filter text
public $aFacetGroup = array (); public $aFacetGroup = array ();
public $aSelectedFacetGroupItem = array (); public $aSelectedFacetGroupItem = array ();
public $sFilterText = ''; public $sFilterText = '';
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_FacetInterfaceResult (); $obj = new Entity_FacetInterfaceResult ();
return $obj; return $obj;
} }
static function CreateForRequest($data) { static function createForRequest($data)
{
$obj = new Entity_FacetInterfaceResult (); $obj = new Entity_FacetInterfaceResult ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
"aFacetGroup", "aFacetGroup",
@@ -27,7 +31,7 @@ class Entity_FacetInterfaceResult extends Entity_Base {
"sFilterText" "sFilterText"
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -2,39 +2,44 @@
require_once ('Base.php'); require_once ('Base.php');
/** /**
*
* *
* *
* Entity Face item, represent an option in a facet group * Entity Face item, represent an option in a facet group
* *
* @author dev-HebertSaak * @author dev-HebertSaak
* *
*/ */
class Entity_FacetItem extends Entity_Base { class Entity_FacetItem extends Entity_Base
{
public $facetName = ''; public $facetName = '';
public $facetPrintName = ''; public $facetPrintName = '';
public $facetCount = ''; public $facetCount = '';
public $facetSelectCondition = ''; // selected condition used to select public $facetSelectCondition = ''; // selected condition used to select
// this facet // this facet
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_FacetItem (); $obj = new Entity_FacetItem ();
return $obj; return $obj;
} }
static function CreateForInsert($data) { static function createForInsert($data)
{
$obj = new Entity_FacetItem (); $obj = new Entity_FacetItem ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
"facetName", "facetName",
"facetCount" "facetCount"
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -1,7 +1,8 @@
<?php <?php
require_once ('Base.php'); require_once ('Base.php');
class Entity_FacetRequest extends Entity_Base { class Entity_FacetRequest extends Entity_Base
{
public $workspace = ''; public $workspace = '';
public $searchText = ''; public $searchText = '';
public $facetFields = array (); public $facetFields = array ();
@@ -14,24 +15,27 @@ class Entity_FacetRequest extends Entity_Base {
public $filters = array (); public $filters = array ();
public $selectedFacetsString = ''; public $selectedFacetsString = '';
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_FacetRequest (); $obj = new Entity_FacetRequest ();
return $obj; return $obj;
} }
static function CreateForRequest($data) { static function createForRequest($data)
{
$obj = new Entity_FacetRequest (); $obj = new Entity_FacetRequest ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
"workspace" "workspace"
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -1,23 +1,27 @@
<?php <?php
require_once ('Base.php'); require_once ('Base.php');
class Entity_FacetResult extends Entity_Base { class Entity_FacetResult extends Entity_Base
{
public $aFacetGroups = array (); public $aFacetGroups = array ();
public $aSelectedFacetGroups = array (); public $aSelectedFacetGroups = array ();
public $sFilterText = ''; public $sFilterText = '';
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_FacetResult (); $obj = new Entity_FacetResult ();
return $obj; return $obj;
} }
static function CreateForRequest($data) { static function createForRequest($data)
{
$obj = new Entity_FacetResult (); $obj = new Entity_FacetResult ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
"aFacetGroups", "aFacetGroups",
@@ -25,7 +29,7 @@ class Entity_FacetResult extends Entity_Base {
"sFilterText" "sFilterText"
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -1,34 +1,38 @@
<?php <?php
require_once ('Base.php'); require_once ('Base.php');
class Entity_SelectedFacetGroupItem extends Entity_Base { class Entity_SelectedFacetGroupItem extends Entity_Base
{
public $selectedFacetGroupName = ''; public $selectedFacetGroupName = '';
public $selectedFacetGroupPrintName = ''; public $selectedFacetGroupPrintName = '';
public $selectedFacetItemName = ''; public $selectedFacetItemName = '';
public $selectedFacetItemPrintName = ''; public $selectedFacetItemPrintName = '';
public $selectedFacetRemoveCondition = ''; // remove condition, string of public $selectedFacetRemoveCondition = ''; // remove condition, string of
// selected facets without this // selected facets without this
// facet // facet
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_SelectedFacetGroupItem (); $obj = new Entity_SelectedFacetGroupItem ();
return $obj; return $obj;
} }
static function CreateForRequest($data) { static function createForRequest($data)
{
$obj = new Entity_SelectedFacetGroupItem (); $obj = new Entity_SelectedFacetGroupItem ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
"selectedFacetGroupName", "selectedFacetGroupName",
"selectedFacetItemName" "selectedFacetItemName"
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -1,25 +1,29 @@
<?php <?php
require_once ('Base.php'); require_once ('Base.php');
class Entity_SolrQueryResult extends Entity_Base { class Entity_SolrQueryResult extends Entity_Base
{
public $sEcho = ''; public $sEcho = '';
public $iTotalRecords = 0; public $iTotalRecords = 0;
public $iTotalDisplayRecords = 10; public $iTotalDisplayRecords = 10;
public $aaData = array (); // array of arrays of records to public $aaData = array (); // array of arrays of records to
// display // display
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_SolrQueryResult (); $obj = new Entity_SolrQueryResult ();
return $obj; return $obj;
} }
static function CreateForRequest($data) { static function createForRequest($data)
{
$obj = new Entity_SolrQueryResult (); $obj = new Entity_SolrQueryResult ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
'sEcho', 'sEcho',
@@ -28,7 +32,7 @@ class Entity_SolrQueryResult extends Entity_Base {
'aaData' 'aaData'
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -1,7 +1,8 @@
<?php <?php
require_once ('Base.php'); require_once ('Base.php');
class Entity_SolrRequestData extends Entity_Base { class Entity_SolrRequestData extends Entity_Base
{
public $workspace = ''; public $workspace = '';
public $startAfter = 0; public $startAfter = 0;
public $pageSize = 10; public $pageSize = 10;
@@ -9,32 +10,35 @@ class Entity_SolrRequestData extends Entity_Base {
public $filterText = ''; // comma separated list of filters field:value public $filterText = ''; // comma separated list of filters field:value
public $numSortingCols = 0; // number of columns that are sorted public $numSortingCols = 0; // number of columns that are sorted
public $sortableCols = array (); // array of booleans indicating if column is public $sortableCols = array (); // array of booleans indicating if column is
// sortable (true, false) // sortable (true, false)
public $sortCols = array (); // array of indices of sorted columns index public $sortCols = array (); // array of indices of sorted columns index
// based in the total number of sorting cols // based in the total number of sorting cols
public $sortDir = array (); // array of direction of sorting for each public $sortDir = array (); // array of direction of sorting for each
// column (desc, asc) // column (desc, asc)
public $includeCols = array (); public $includeCols = array ();
public $resultFormat = 'xml'; // json, xml, php public $resultFormat = 'xml'; // json, xml, php
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_SolrRequestData (); $obj = new Entity_SolrRequestData ();
return $obj; return $obj;
} }
static function CreateForRequestPagination($data) { static function createForRequestPagination($data)
{
$obj = new Entity_SolrRequestData (); $obj = new Entity_SolrRequestData ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
'workspace' 'workspace'
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -1,29 +1,33 @@
<?php <?php
require_once ('Base.php'); require_once ('Base.php');
class Entity_SolrUpdateDocument extends Entity_Base { class Entity_SolrUpdateDocument extends Entity_Base
{
var $workspace = ''; var $workspace = '';
var $document = ''; var $document = '';
private function __construct() { private function __construct()
{
} }
static function CreateEmpty() { static function createEmpty()
{
$obj = new Entity_SolrUpdateDocument (); $obj = new Entity_SolrUpdateDocument ();
return $obj; return $obj;
} }
static function CreateForRequest($data) { static function createForRequest($data)
{
$obj = new Entity_SolrUpdateDocument (); $obj = new Entity_SolrUpdateDocument ();
$obj->initializeObject ( $data ); $obj->initializeObject ($data);
$requiredFields = array ( $requiredFields = array (
"workspace", "workspace",
"document" "document"
); );
$obj->validateRequiredFields ( $requiredFields ); $obj->validateRequiredFields ($requiredFields);
return $obj; return $obj;
} }

View File

@@ -109,7 +109,7 @@ class AppSolrQueue extends BaseAppSolrQueue {
$row = $rs->getRow(); $row = $rs->getRow();
while (is_array($row)) { while (is_array($row)) {
$appSolrQueue = Entity_AppSolrQueue::CreateEmpty(); $appSolrQueue = Entity_AppSolrQueue::createEmpty();
$appSolrQueue->appUid = $row['APP_UID']; $appSolrQueue->appUid = $row['APP_UID'];
$appSolrQueue->appUpdated = $row['APP_UPDATED']; $appSolrQueue->appUpdated = $row['APP_UPDATED'];
$updatedApplications[] = $appSolrQueue; $updatedApplications[] = $appSolrQueue;

View File

@@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ProcessMaker (Branch 2.0-testing) dummy-119-g6a8c61e\n" "Project-Id-Version: ProcessMaker (Branch 2.0-experimental) dummy-126-g6fb2f2d\n"
"POT-Creation-Date: \n" "POT-Creation-Date: \n"
"PO-Revision-Date: 2012-05-16 15:56:38\n" "PO-Revision-Date: 2012-05-31 19:14:21\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: Colosa Developers Team <developers@colosa.com>\n" "Language-Team: Colosa Developers Team <developers@colosa.com>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -3856,8 +3856,8 @@ msgstr "Field \"table\" is required"
# TRANSLATION # TRANSLATION
# JAVASCRIPT/ID_ASSIGN_RULES # JAVASCRIPT/ID_ASSIGN_RULES
#: JAVASCRIPT/ID_ASSIGN_RULES #: JAVASCRIPT/ID_ASSIGN_RULES
msgid "Error: There is a problem with next tasks of this process, one of them have manual assignment. Manual assignment shouldn't be used with subprocesses" msgid "Error: There is a problem with the next tasks of this process. One of them has manual assignment. Manual assignment shouldn't be used with subprocesses"
msgstr "Error: There is a problem with next tasks of this process, one of them have manual assignment. Manual assignment shouldn't be used with subprocesses" msgstr "Error: There is a problem with the next tasks of this process. One of them has manual assignment. Manual assignment shouldn't be used with subprocesses"
# TRANSLATION # TRANSLATION
# LABEL/ID_FIELD_INVALID # LABEL/ID_FIELD_INVALID
@@ -3880,8 +3880,8 @@ msgstr "Saved"
# TRANSLATION # TRANSLATION
# LABEL/ID_ASSIGN_RULES # LABEL/ID_ASSIGN_RULES
#: LABEL/ID_ASSIGN_RULES #: LABEL/ID_ASSIGN_RULES
msgid "Error: There is a problem with next tasks of this process, one of them have manual assignment. Manual assignment shouldn't be used with subprocesses" msgid "[LABEL/ID_ASSIGN_RULES] Error: There is a problem with the next tasks of this process. One of them has manual assignment. Manual assignment shouldn't be used with subprocesses"
msgstr "Error: There is a problem with next tasks of this process, one of them have manual assignment. Manual assignment shouldn't be used with subprocesses" msgstr "Error: There is a problem with the next tasks of this process. One of them has manual assignment. Manual assignment shouldn't be used with subprocesses"
# TRANSLATION # TRANSLATION
# LABEL/ID_SELECT_OPTION_TABLE # LABEL/ID_SELECT_OPTION_TABLE
@@ -5572,8 +5572,8 @@ msgstr "Do you want to delete all selected processes?"
# TRANSLATION # TRANSLATION
# LABEL/ID_PROCESS_CANT_DELETE # LABEL/ID_PROCESS_CANT_DELETE
#: LABEL/ID_PROCESS_CANT_DELETE #: LABEL/ID_PROCESS_CANT_DELETE
msgid "You can't delete the process \"{0}\" because has {1} cases." msgid "You can't delete the process \"{0}\" because it has {1} cases."
msgstr "You can't delete the process \"{0}\" because has {1} cases." msgstr "You can't delete the process \"{0}\" because it has {1} cases."
# TRANSLATION # TRANSLATION
# LABEL/ID_FILE # LABEL/ID_FILE
@@ -5812,8 +5812,8 @@ msgstr "The root password has been updated successfully!"
# TRANSLATION # TRANSLATION
# LABEL/ID_MESSAGE_ROOT_CHANGE_FAILURE # LABEL/ID_MESSAGE_ROOT_CHANGE_FAILURE
#: LABEL/ID_MESSAGE_ROOT_CHANGE_FAILURE #: LABEL/ID_MESSAGE_ROOT_CHANGE_FAILURE
msgid "The root password has can't be updated !" msgid "The root password can't be updated!"
msgstr "The root password has can't be updated !" msgstr "The root password can't be updated!"
# TRANSLATION # TRANSLATION
# LABEL/ID_LAN_TRANSLATOR # LABEL/ID_LAN_TRANSLATOR
@@ -13498,7 +13498,7 @@ msgstr "Yes"
# authSources/ldapEdit.xml?AUTH_SOURCE_SEARCH_USER # authSources/ldapEdit.xml?AUTH_SOURCE_SEARCH_USER
# authSources/ldapEdit.xml # authSources/ldapEdit.xml
#: text - AUTH_SOURCE_SEARCH_USER #: text - AUTH_SOURCE_SEARCH_USER
msgid "Search User" msgid "[authSources/ldapEdit.xml?AUTH_SOURCE_SEARCH_USER] Search User"
msgstr "Search User" msgstr "Search User"
# authSources/ldapEdit.xml?AUTH_SOURCE_PASSWORD # authSources/ldapEdit.xml?AUTH_SOURCE_PASSWORD
@@ -15543,7 +15543,7 @@ msgstr "DATE"
# cases/cases_MessagesView.xml?APP_MSG_BODY # cases/cases_MessagesView.xml?APP_MSG_BODY
# cases/cases_MessagesView.xml # cases/cases_MessagesView.xml
#: html - APP_MSG_BODY #: text - APP_MSG_BODY
msgid "[cases/cases_MessagesView.xml?APP_MSG_BODY] " msgid "[cases/cases_MessagesView.xml?APP_MSG_BODY] "
msgstr "" msgstr ""
@@ -21539,6 +21539,42 @@ msgstr "Send Request"
msgid "[login/forgotPassword.xml?BCANCEL] Cancel" msgid "[login/forgotPassword.xml?BCANCEL] Cancel"
msgstr "Cancel" msgstr "Cancel"
# login/login (copy).xml?TITLE
# login/login (copy).xml
#: title - TITLE
msgid "[login/login (copy).xml?TITLE] Login"
msgstr "Login"
# login/login (copy).xml?USR_USERNAME
# login/login (copy).xml
#: text - USR_USERNAME
msgid "[login/login (copy).xml?USR_USERNAME] User"
msgstr "User"
# login/login (copy).xml?USR_PASSWORD
# login/login (copy).xml
#: password - USR_PASSWORD
msgid "[login/login (copy).xml?USR_PASSWORD] Password"
msgstr "Password"
# login/login (copy).xml?USER_LANG
# login/login (copy).xml
#: dropdown - USER_LANG
msgid "[login/login (copy).xml?USER_LANG] Language"
msgstr "Language"
# login/login (copy).xml?BSUBMIT
# login/login (copy).xml
#: submit - BSUBMIT
msgid "[login/login (copy).xml?BSUBMIT] Login"
msgstr "Login"
# login/login (copy).xml?FORGOT_PASWORD_LINK
# login/login (copy).xml
#: link - FORGOT_PASWORD_LINK
msgid "[login/login (copy).xml?FORGOT_PASWORD_LINK] Forgot Password"
msgstr "Forgot Password"
# login/login.xml?TITLE # login/login.xml?TITLE
# login/login.xml # login/login.xml
#: title - TITLE #: title - TITLE

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -917,16 +917,18 @@ var processmap=function(){
this.observers.lineas.unregister(deri.to[i].object.indexObserver); this.observers.lineas.unregister(deri.to[i].object.indexObserver);
} }
if(deri.type===5 || deri.type===8) if(deri.type===5 || deri.type===8)
{ {
var toTask = this.data.db.task[this.tools.getIndexOfUid(deri.to[i].task)]; var toTask = this.data.db.task[this.tools.getIndexOfUid(deri.to[i].task)];
toTask.object.inJoin = toTask.object.inJoin-1; if (typeof(toTask) != 'undefined') {
if(toTask.object.inJoin===0) toTask.object.inJoin = toTask.object.inJoin-1;
{ if(toTask.object.inJoin===0)
this.parent.dom.setStyle(toTask.object.elements.init,{ {
backgroundPosition:"0 0", this.parent.dom.setStyle(toTask.object.elements.init,{
background:"" backgroundPosition:"0 0",
}); background:""
} });
}
}
} }
} }
} }
@@ -2207,7 +2209,7 @@ var processmap=function(){
iHeight = 350; iHeight = 350;
break; break;
case 4: case 4:
iWidth = 500; iWidth = 600;
iHeight = 350; iHeight = 350;
break; break;
case 5: case 5:
@@ -2227,7 +2229,7 @@ var processmap=function(){
position:{x:50,y:50,center:true}, position:{x:50,y:50,center:true},
title :G_STRINGS.ID_PROCESSMAP_WORKFLOW_PATTERNS+": "+task.label, title :G_STRINGS.ID_PROCESSMAP_WORKFLOW_PATTERNS+": "+task.label,
theme :this.options.theme, theme :this.options.theme,
control :{close:true,resize:false}, control :{close:true,resize:true},
fx :{modal:true} fx :{modal:true}
}; };
panel.make(); panel.make();

View File

@@ -95,11 +95,11 @@ try {
global $G_PUBLISH; global $G_PUBLISH;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
if ($aFields['AUTH_SOURCE_PROVIDER'] != 'ldap') { if ($aFields['AUTH_SOURCE_PROVIDER'] != 'ldap') {
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'authSources/ldapSearchResults', $oCriteria,' ',array('Checkbox' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER'))); $G_PUBLISH->AddContent('propeltable', 'pagedTableLdap', 'authSources/ldapSearchResults', $oCriteria,' ',array('Checkbox' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER')));
} }
else { else {
if (file_exists(PATH_XMLFORM . 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) { if (file_exists(PATH_XMLFORM . 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) {
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults', $oCriteria,' ',array('Checkbox' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER'))); $G_PUBLISH->AddContent('propeltable', 'pagedTableLdap', 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults', $oCriteria,' ',array('Checkbox' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER')));
} }
else { else {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => 'File: ' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults.xml' . ' doesn\'t exist.')); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => 'File: ' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults.xml' . ' doesn\'t exist.'));

View File

@@ -184,21 +184,35 @@
} }
function getAllCounters() { function getAllCounters() {
$userUid = ( isset($_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '' ) ? $_SESSION['USER_LOGGED'] : null; $userUid = ( isset($_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '' ) ? $_SESSION['USER_LOGGED'] : null;
$oAppCache = new AppCacheView(); $oAppCache = new AppCacheView();
//$aTypes = Array('to_do', 'draft', 'cancelled', 'sent', 'paused', 'completed','selfservice','to_revise','to_reassign');
$aTypes = Array(); $aTypes = Array();
$aTypes['to_do'] = 'CASES_INBOX'; $aTypes['to_do'] = 'CASES_INBOX';
$aTypes['draft'] = 'CASES_DRAFT'; $aTypes['draft'] = 'CASES_DRAFT';
$aTypes['cancelled'] = 'CASES_CANCELLED'; $aTypes['cancelled'] = 'CASES_CANCELLED';
$aTypes['sent'] = 'CASES_SENT'; $aTypes['sent'] = 'CASES_SENT';
$aTypes['paused'] = 'CASES_PAUSED'; $aTypes['paused'] = 'CASES_PAUSED';
$aTypes['completed'] = 'CASES_COMPLETED'; $aTypes['completed'] = 'CASES_COMPLETED';
$aTypes['selfservice'] = 'CASES_SELFSERVICE'; $aTypes['selfservice'] = 'CASES_SELFSERVICE';
//$aTypes['to_revise'] = 'CASES_TO_REVISE'; //$aTypes['to_revise'] = 'CASES_TO_REVISE';
//$aTypes['to_reassign'] = 'CASES_TO_REASSIGN'; //$aTypes['to_reassign'] = 'CASES_TO_REASSIGN';
$aCount = $oAppCache->getAllCounters( array_keys($aTypes), $userUid ); if ((($solrConf = System::solrEnv()) !== false)) {
G::LoadClass ( 'AppSolr' );
$ApplicationSolrIndex = new AppSolr ($solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance']);
$aCount = $ApplicationSolrIndex->getCasesCount ( $userUid );
//get paused count
$aCountMissing = $oAppCache->getAllCounters( array('paused', 'completed', 'cancelled'), $userUid );
$aCount = array_merge($aCount, $aCountMissing);
}
else {
$aCount = $oAppCache->getAllCounters( array_keys($aTypes), $userUid );
}
$response = Array(); $response = Array();
$i = 0; $i = 0;

View File

@@ -162,20 +162,20 @@ class SkinEngine
switch ($e->getCode()) { switch ($e->getCode()) {
case SE_LAYOUT_NOT_FOUND: case SE_LAYOUT_NOT_FOUND:
$data['exception_type'] = 'Skin Engine Exception'; $data['exception_type'] = G::LoadTranslation('ID_SKIN_EXCEPTION');
$data['exception_title'] = 'Layout not Found'; $data['exception_title'] = G::LoadTranslation('ID_SKIN_LAYOUT_NOT_FOUND');
$data['exception_message'] = 'You\'re trying to get a resource from a incorrent skin, please verify you url.'; $data['exception_message'] = G::LoadTranslation('ID_SKIN_INCORRECT_VERIFY_URL');
$data['exception_list'] = array(); $data['exception_list'] = array();
if (substr($this->mainSkin, 0, 2) != 'ux') { if (substr($this->mainSkin, 0, 2) != 'ux') {
$url = '../login/login'; $url = '../login/login';
} }
else { else {
$url = '../main/login'; $url = '../main/login';
} }
$link = '<a href="'.$url.'">Try Now</a>'; $link = '<a href="'.$url.'">Try Now</a>';
$data['exception_notes'][] = ' The System can try redirect to correct url. ' . $link; $data['exception_notes'][] = G::LoadTranslation('ID_REDIRECT_URL'). $link;
G::renderTemplate(PATH_TPL . 'exception', $data); G::renderTemplate(PATH_TPL . 'exception', $data);
break; break;

View File

@@ -38,7 +38,11 @@
</td> </td>
<td height="12" valign="middle" align="right" valign="top"> <td height="12" valign="middle" align="right" valign="top">
<a href="#" id="options-tool" class="options-tool"> <a href="#" id="options-tool" class="options-tool">
{$userfullname}<br /> {$userfullname}
<span>
<img src="/images/classic/roll.static.gif" width="10px" headerRightSection="10px"/>
</span>
<br />
<span style="font-size:9px">{$rolename}</span> <span style="font-size:9px">{$rolename}</span>
</a> </a>
</td> </td>

View File

@@ -122,13 +122,19 @@ Ext.onReady(function() {
name: 'processName', name: 'processName',
allowBlank:false, allowBlank:false,
value: '', value: '',
labelStyle: 'font-weight:bold;', labelStyle : 'font-size:11px;',
style : {
fontSize:'11px'
},
id:"processName" id:"processName"
}, },
{ {
xtype: 'compositefield', xtype: 'compositefield',
fieldLabel: TRANSLATIONS.ID_TASK, fieldLabel: TRANSLATIONS.ID_TASK,
labelStyle: 'font-weight:bold;', labelStyle : 'font-size:11px;',
style : {
fontSize:'11px'
},
items: [ items: [
{ {
xtype : 'button', xtype : 'button',
@@ -160,21 +166,30 @@ Ext.onReady(function() {
name: 'processDescription', name: 'processDescription',
value: '', value: '',
readOnly: true, readOnly: true,
labelStyle: 'font-weight:bold;', labelStyle : 'font-size:11px;',
style : {
fontSize:'11px'
},
id:"processDescription" id:"processDescription"
},{ },{
fieldLabel: TRANSLATIONS.ID_CATEGORY, fieldLabel: TRANSLATIONS.ID_CATEGORY,
name: 'processCategory', name: 'processCategory',
value: '', value: '',
readOnly: true, readOnly: true,
labelStyle: 'font-weight:bold;', labelStyle : 'font-size:11px;',
style : {
fontSize:'11px'
},
id:"processCategory" id:"processCategory"
}, },
{ {
xtype: 'grid', xtype: 'grid',
fieldLabel: ' ', fieldLabel: ' ',
labelSeparator : '', labelSeparator : '',
labelStyle: 'font-color:white;', labelStyle : 'font-size:11px;',
style : {
fontSize:'11px'
},
ds: processNumbers, ds: processNumbers,
cm: new Ext.grid.ColumnModel([ cm: new Ext.grid.ColumnModel([
{id:'inbox',header: TRANSLATIONS.ID_INBOX, width:70, sortable: false, locked:true, dataIndex: 'CASES_COUNT_TO_DO'}, {id:'inbox',header: TRANSLATIONS.ID_INBOX, width:70, sortable: false, locked:true, dataIndex: 'CASES_COUNT_TO_DO'},
@@ -190,7 +205,10 @@ Ext.onReady(function() {
{ {
fieldLabel: TRANSLATIONS.ID_CALENDAR, fieldLabel: TRANSLATIONS.ID_CALENDAR,
name: 'calendarName', name: 'calendarName',
labelStyle: 'font-weight:bold;', labelStyle : 'font-size:11px;',
style : {
fontSize:'11px'
},
id:"calendarName" id:"calendarName"
}, },
{ {
@@ -200,7 +218,10 @@ Ext.onReady(function() {
disabled: true, disabled: true,
readOnly: true, readOnly: true,
disabledClass:"", disabledClass:"",
labelStyle: 'font-weight:bold', labelStyle : 'font-size:11px;',
style : {
fontSize:'11px'
},
id:"calendarWorkDays", id:"calendarWorkDays",
columns: 7, columns: 7,
items: [ items: [
@@ -217,7 +238,10 @@ Ext.onReady(function() {
xtype:'checkbox', xtype:'checkbox',
fieldLabel: TRANSLATIONS.ID_DEBUG_MODE, fieldLabel: TRANSLATIONS.ID_DEBUG_MODE,
name: 'processDebug', name: 'processDebug',
labelStyle: 'font-weight:bold;', labelStyle : 'font-size:11px;',
style : {
fontSize:'11px'
},
disabled: true, disabled: true,
readOnly: true, readOnly: true,
id:"processDebug", id:"processDebug",

View File

@@ -0,0 +1,144 @@
<!-- START BLOCK : headBlock -->
<table cellpadding="0" cellspacing="0" border="0"><tr><td>
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="pagedTableDefault">
<table id="pagedtable[{pagedTable_Id}]" name="pagedtable[{pagedTable_Name}]" border="0" cellspacing="0" cellpadding="0" class="Default">
<tr >
<td valign="top">
<div class='subtitle'>{title}</div>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<!-- START BLOCK : headerBlock -->
<tr><td class="headerContent">{content}</td></tr>
<!-- END BLOCK : headerBlock -->
</table>
<table id="table[{pagedTable_Id}]" name="table[{pagedTable_Name}]" cellspacing="0" cellpadding="0" width="100%" class="pagedTable">
<!-- END BLOCK : headBlock -->
<!-- START BLOCK : contentBlock -->
<script type="text/javascript">{pagedTable_JS}</script>
<tr>
<!-- START BLOCK : headers -->
<td class="pagedTableHeader"><img style="{displaySeparator}" src="/js/maborak/core/images/separatorTable.gif" /></td>
<td width="{width}" style="{align}" class="pagedTableHeader" >
<a href="{href}" onclick="{onclick}{onsort}">{header}</a>
</td>
<!-- END BLOCK : headers -->
</tr>
<!-- START BLOCK : row -->
<!-- START BLOCK : rowMaster -->
<tr class='{masterRowClass}' id="{masterRowName}">
<!-- START BLOCK : fieldMaster -->
<td class="pagedTableHeader1"><a href="#" ><img src="/images/minus.gif" onclick="toggleMasterDetailGroup('table[{pagedTable_Name}]','{masterRowName}',this);return false;" border="0"></a><b>{value1}</b></td><td class="pagedTableHeader1" {alignAttr}><b>{value}</b>&nbsp;</td>
<!-- END BLOCK : fieldMaster -->
</tr>
<!-- END BLOCK : rowMaster -->
<tr class='{class}' onmouseover="setRowClass(this, 'RowPointer' )" onmouseout="setRowClass(this, '{class}')" name="{rowName}" id="{rowName}">
<!-- START BLOCK : field -->
<td{classAttr}></td><td{classAttr}{alignAttr}>{value}</td>
<!-- END BLOCK : field -->
</tr>
<!-- END BLOCK : row -->
<!-- START BLOCK : rowTag -->
<!-- END BLOCK : rowTag -->
<!-- START BLOCK : norecords -->
<tr class='Row2'>
<td nowrap colspan="{columnCount}" align='center' >&nbsp;
{noRecordsFound}<br>&nbsp;
</td>
</tr>
<!-- END BLOCK : norecords -->
<!-- START BLOCK : bottomFooter -->
<tr>
<td nowrap colspan="{columnCount}">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="pagedTableFooter">
<td width="110px" style="{indexStyle}">
{labels:ID_ROWS}&nbsp;{firstRow}-{lastRow}/{totalRows}&nbsp;
</td>
<!--<td style="text-align:center;{fastSearchStyle}"><!--{labels:ID_SEARCH}
<input type="text" class="FormField" onkeypress="if (event.keyCode===13){pagedTableId}.doFastSearch(this.value);if (event.keyCode===13)return false;" value="{fastSearchValue}" onfocus="this.select();" size="10" style="{fastSearchStyle}"/>
</td>-->
<td style="text-align:center;">
{first}&nbsp;{prev}&nbsp;{next}&nbsp;{last}
</td>
<td width="60px" style="text-align:right;padding-right:8px;{indexStyle}">{labels:ID_PAGE}&nbsp;{currentPage}/{totalPages}</td>
</tr>
</table>
</td>
</tr>
<!-- END BLOCK : bottomFooter -->
<!-- END BLOCK : contentBlock -->
<!-- START BLOCK : closeBlock -->
</table>
</td>
</tr>
</table>
</div>
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
</td></tr></table>
<!-- END BLOCK : closeBlock -->
<!-- START IGNORE -->
<script type="text/javascript">
if (typeof(document.getElementById("form[SelectAll]")) != undefined) {
document.getElementById("form[SelectAll]").innerHTML = '[SELECT-ALL]';
}
function toggleMasterDetailGroup(tablename,groupName,imgicon){
alert("ingresa");
groupNameArray=groupName.split(",");
table=getElementByName(tablename);
var rows = table.getElementsByTagName('tr');
for(i=0;i<rows.length;i++){
if(rows[i].id!=""){
currentRowArray=rows[i].id.split(",");
sw=false;
//alert(groupNameArray);
//alert(currentRowArray);
tempVar=currentRowArray[0].split("_MD_");
if(tempVar[0]==""){
if(currentRowArray.length>groupNameArray.length){
currentRowArray[0]=tempVar[1];
}
}
for(j=0;j<groupNameArray.length;j++){
if(currentRowArray[j]==groupNameArray[j]){
sw=true;
}else{
sw=false;
}
}
//alert(sw);
if(sw){
if (rows[i].style.display == '') {
rows[i].style.display = 'none';
imgicon.src="/images/plus_red.gif";
}else{
rows[i].style.display = '';
imgicon.src="/images/minus.gif";
}
}
}
}
}
</script>
<!-- END IGNORE -->

View File

@@ -24,9 +24,6 @@
<tr> <tr>
<td valign='top'> <td valign='top'>
<table cellspacing="0" cellpadding="0" border="0" width="95%"> <table cellspacing="0" cellpadding="0" border="0" width="95%">
<tr>
<td align="left" valign="baseline">&nbsp; &nbsp; {$form.CheckboxSelectAll} <span id="AgeLabel"><span> </td>
</tr>
<tr> <tr>
<td align="center"> <td align="center">
<span id="spanUsers" /> <span id="spanUsers" />

View File

@@ -23,47 +23,41 @@
<en>Cancel</en> <en>Cancel</en>
</BTN_CANCEL> </BTN_CANCEL>
<CheckboxSelectAll type="Checkbox">
<en></en>
</CheckboxSelectAll>
<JS type="javascript"><![CDATA[ <JS type="javascript"><![CDATA[
getField('CheckboxSelectAll').style.visibility = 'hidden';
getField('btnImport').style.visibility = 'hidden';
function disableEnterKey(e) function disableEnterKey(e)
{ {
var key; var key;
if(window.event) if(window.event)
key = window.event.keyCode; //IE key = window.event.keyCode; //IE
else else
key = e.which; //firefox key = e.which; //firefox
if(key == 13) { if(key == 13) {
searchUsers(); searchUsers();
e.cancelBubble = true; e.cancelBubble = true;
e.returnValue = false; e.returnValue = false;
if (e.stopPropagation) { if (e.stopPropagation) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
} }
return false; return false;
} else { } else {
return true; return true;
} }
} }
getField('btnImport').style.visibility = 'hidden';
var searchUsers = function() { var searchUsers = function() {
var oRPC = new leimnud.module.rpc.xmlhttp({ var oRPC = new leimnud.module.rpc.xmlhttp({
url : 'authSources_Ajax', url : 'authSources_Ajax',
args: 'action=searchUsers&sUID=' + getField('AUTH_SOURCE_UID').value + '&sKeyword=' + getField('KEYWORD').value args : 'action=searchUsers&sUID=' + getField('AUTH_SOURCE_UID').value + "&sKeyword=" + getField('KEYWORD').value
}); });
oRPC.callback = function(rpc){ oRPC.callback = function(rpc){
document.getElementById('spanUsers').innerHTML = rpc.xmlhttp.responseText; document.getElementById('spanUsers').innerHTML = rpc.xmlhttp.responseText;
if (document.getElementById('aUsers[0]')) { if (checkInfo()) {
getField('btnImport').style.visibility = 'visible'; getField('btnImport').style.visibility = 'visible';
getField('CheckboxSelectAll').style.visibility = 'visible';
document.getElementById("AgeLabel").innerHTML = '[SELECT-ALL]';
} }
else { else {
getField('btnImport').style.visibility = 'hidden'; getField('btnImport').style.visibility = 'hidden';
@@ -76,6 +70,17 @@ var searchUsers = function() {
}; };
function checkInfo() {
var input_obj = document.getElementsByTagName("input");
for (i = 0; i < input_obj.length; i++) {
if (input_obj.item(i).type == 'checkbox')
{
return true;
}
}
return false;
}
var importUsers = function(oForm) { var importUsers = function(oForm) {
var bContinue = false; var bContinue = false;
var i = 0; var i = 0;
@@ -94,42 +99,13 @@ var importUsers = function(oForm) {
} }
}; };
var selectAll = function(bChecked) {
var oAux;
var i = 0;
while (oAux = document.getElementById('aUsers[' + i + ']')) {
oAux.checked = true;
i++;
}
};
function cancel(){ function cancel(){
window.location = 'authSources_List'; window.location = 'authSources_List';
} }
leimnud.event.add(getField('KEYWORD'), 'keypress', function(event) { leimnud.event.add(getField('KEYWORD'), 'keypress', function(event) {
return disableEnterKey(event); return disableEnterKey(event);
}); });
leimnud.event.add(getField('CheckboxSelectAll'), 'click', function() {
var oAux;
var i = 0;
if (document.getElementById('form[CheckboxSelectAll]').checked)
{
document.getElementById("AgeLabel").innerHTML = '[DESELECT-ALL]';
while (oAux = document.getElementById('aUsers[' + i + ']')) {
oAux.checked = true;
i++;
}
}
else
{
document.getElementById("AgeLabel").innerHTML = '[SELECT-ALL]';
while (oAux = document.getElementById('aUsers[' + i + ']')) {
oAux.checked = false;
i++;
}
}
});
]]></JS> ]]></JS>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm type="xmlmenu">
<SelectAll type="link" value='[SELECT-ALL]' link="#" onclick="selectAll(); return false;" colAlign="left" colWidth="100">
<en></en>
</SelectAll>
<PAGE type="hidden" value="1"/>
<PAGED_TABLE_ID type="private"/>
<js type="javascript" replaceTags="1"><![CDATA[
function selectAll(){
var oAux;
var i = 0;
var input_obj = document.getElementsByTagName("input");
if (document.getElementById("form[SelectAll]").innerHTML == '[SELECT-ALL]') {
document.getElementById("form[SelectAll]").innerHTML = '[DESELECT-ALL]';
for (i = 0; i < input_obj.length; i++) {
if (input_obj.item(i).type == 'checkbox')
{
input_obj.item(i).checked = true;
}
}
}
else
{
document.getElementById("form[SelectAll]").innerHTML = '[SELECT-ALL]';
for (i = 0; i < input_obj.length; i++) {
if (input_obj.item(i).type == 'checkbox')
{
input_obj.item(i).checked = false;
}
}
}
}
]]></js>
</dynaForm>

View File

@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<dynaForm width="90%" rowsPerPage="1000"> <dynaForm menu="authSources/authSources_SearchUsersMenu" width="90%" rowsPerPage="1000">
<Checkbox type="text" titleAlign="center" align="left" enableHtml="1" onclick="return false;"> <Checkbox type="text" titleAlign="center" align="left" colWidth="20%" enableHtml="1" onclick="return false;">
<en><![CDATA[<span id="spanSelectAll"></span>]]></en> <en><![CDATA[<span id="spanSelectAll"></span>]]></en>
</Checkbox> </Checkbox>
<FullName type="text" colWidth="20%" titleAlign="center" align="left"> <FullName type="text" colWidth="15%" titleAlign="center" align="left">
<en>Name</en> <en>Name</en>
</FullName> </FullName>
<Email type="text" colWidth="20%" titleAlign="center" align="left"> <Email type="text" colWidth="15%" titleAlign="center" align="left">
<en><![CDATA[<span style="width:40px; display:block;">E-Mail</span>]]></en> <en><![CDATA[<span style="width:40px; display:block;">E-Mail</span>]]></en>
</Email> </Email>

View File

@@ -39,6 +39,7 @@ leimnud.event.add(getField('ROU_NEXT_TASK'), 'change', modified);
//leimnud.event.add(getField('ROU_TO_LAST_USER'), 'change', modified); //leimnud.event.add(getField('ROU_TO_LAST_USER'), 'change', modified);
Pm.tmp.derivationsPanel.events.remove = function() { Pm.tmp.derivationsPanel.events.remove = function() {
if (bModified) { if (bModified) {
Pm.tmp.derivationsPanel.inRemove = false;
Pm.tmp.derivationsPanel.cancelClose=true; Pm.tmp.derivationsPanel.cancelClose=true;
new leimnud.module.app.confirm().make({ new leimnud.module.app.confirm().make({
label: G_STRINGS.ID_SAVE_DERIVATION_RULES_BEFORE_CLOSING, label: G_STRINGS.ID_SAVE_DERIVATION_RULES_BEFORE_CLOSING,
@@ -46,7 +47,7 @@ Pm.tmp.derivationsPanel.events.remove = function() {
Pm.tmp.derivationsPanel.cancelClose=false; Pm.tmp.derivationsPanel.cancelClose=false;
bModified = false; bModified = false;
getField('SAVE').onclick(); getField('SAVE').onclick();
}.extend(this), },
cancel: function() { cancel: function() {
Pm.tmp.derivationsPanel.cancelClose=false; Pm.tmp.derivationsPanel.cancelClose=false;
bModified = false; bModified = false;

View File

@@ -41,6 +41,7 @@ leimnud.event.add(getField('ROU_NEXT_TASK'), 'change', modified);
//leimnud.event.add(getField('ROU_TO_LAST_USER'), 'change', modified); //leimnud.event.add(getField('ROU_TO_LAST_USER'), 'change', modified);
Pm.tmp.derivationsPanel.events.remove = function() { Pm.tmp.derivationsPanel.events.remove = function() {
if (bModified) { if (bModified) {
Pm.tmp.derivationsPanel.inRemove = false;
Pm.tmp.derivationsPanel.cancelClose=true; Pm.tmp.derivationsPanel.cancelClose=true;
new leimnud.module.app.confirm().make({ new leimnud.module.app.confirm().make({
label: G_STRINGS.ID_SAVE_DERIVATION_RULES_BEFORE_CLOSING, label: G_STRINGS.ID_SAVE_DERIVATION_RULES_BEFORE_CLOSING,
@@ -48,10 +49,10 @@ Pm.tmp.derivationsPanel.events.remove = function() {
Pm.tmp.derivationsPanel.cancelClose=false; Pm.tmp.derivationsPanel.cancelClose=false;
bModified = false; bModified = false;
getField('SAVE').onclick(); getField('SAVE').onclick();
}.extend(this), },
cancel: function() { cancel: function() {
Pm.tmp.derivationsPanel.cancelClose=false; Pm.tmp.derivationsPanel.cancelClose=false;
bModified = false; bModified = false;
Pm.tmp.derivationsPanel.remove(); Pm.tmp.derivationsPanel.remove();
} }
}); });