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

This commit is contained in:
Brayan Osmar Pereyra Suxo
2012-08-08 11:15:00 -04:00
24 changed files with 605 additions and 245 deletions

View File

@@ -410,7 +410,7 @@ function _DF(DATE_TIME, D_FORMAT)
_('ID_WEEKDAY_6'),_('ID_WEEKDAY_ABB_0'),_('ID_WEEKDAY_ABB_1'),_('ID_WEEKDAY_ABB_2'),_('ID_WEEKDAY_ABB_3'),_('ID_WEEKDAY_ABB_4'), _('ID_WEEKDAY_6'),_('ID_WEEKDAY_ABB_0'),_('ID_WEEKDAY_ABB_1'),_('ID_WEEKDAY_ABB_2'),_('ID_WEEKDAY_ABB_3'),_('ID_WEEKDAY_ABB_4'),
_('ID_WEEKDAY_ABB_5'),_('ID_WEEKDAY_ABB_6')); _('ID_WEEKDAY_ABB_5'),_('ID_WEEKDAY_ABB_6'));
var date = new Date(arrF[0],parseInt(arrF[1])-1,arrF[2],arrH[0],arrH[1],arrH[2],0); var date = new Date(arrF[0],parseFloat(arrF[1])-1,arrF[2],arrH[0],arrH[1],arrH[2],0);
var y=date.getFullYear()+''; var y=date.getFullYear()+'';
var M=date.getMonth()+1; var M=date.getMonth()+1;
var d=date.getDate(); var d=date.getDate();
@@ -482,3 +482,13 @@ String.prototype.nl2br = function () {
return this.replace(/\n/g,'<br />'); return this.replace(/\n/g,'<br />');
} }
/**
* String Replace function, if StrSearch has special characters "(", "[", must be escape "\\(", "\\[".
*/
function stringReplace(strSearch, stringReplace, str)
{
var expression = eval("/" + strSearch + "/g");
return str.replace(expression, stringReplace);
}

View File

@@ -563,15 +563,22 @@ class G
} }
if (is_dir($dirName)) { if (is_dir($dirName)) {
foreach(glob($dirName . '/*') as $file) { foreach(glob($dirName . '/{,.}*', GLOB_BRACE) as $file) {
if ( $file == $dirName . '/.' || $file == $dirName . '/..') {
continue;
}
if(is_dir($file)) { if(is_dir($file)) {
G::rm_dir($file); G::rm_dir($file);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
exec('DEL /F /S /Q %' . $dirName . '%', $res); $dirNameWin = str_replace('/','\\' ,$dirName);
else exec('DEL /F /S /Q ' . $dirNameWin . '', $res);
exec('RD /S /Q ' . $dirNameWin . '', $res);
} else {
@rmdir($file); @rmdir($file);
} }
}
else { else {
@unlink($file); @unlink($file);
} }

View File

@@ -1242,6 +1242,17 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek
$depValues = '+'; $depValues = '+';
} }
$aDepFields = array();
$count = 0;
if ($this->dependentFields !== '') {
$sqlDepField = $owner->fields[$this->dependentFields]->sql;
$count = preg_match_all('/\@(?:([\@\%\#\=\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/',
$sqlDepField, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
for ($cnt = 0; $cnt < $count; $cnt++) {
$aDepFields[$cnt] = $match[2][$cnt][0];
}
}
$sOptions = 'script: function (input) { '; $sOptions = 'script: function (input) { ';
$sOptions .= ' var inputValue = base64_encode(getField(\''. $this->name .'_label\').value); '; $sOptions .= ' var inputValue = base64_encode(getField(\''. $this->name .'_label\').value); ';
@@ -1251,7 +1262,7 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek
$sOptions .= '},'; $sOptions .= '},';
$sOptions .= 'json: true,'; $sOptions .= 'json: true,';
$sOptions .= 'limit: '.$this->maxresults.','; $sOptions .= 'limit: '.$this->maxresults.',';
// $sOptions .= 'varname: "input",';
$sOptions .= 'shownoresults: ' . ($this->shownoresults ? 'true' : 'false') . ','; $sOptions .= 'shownoresults: ' . ($this->shownoresults ? 'true' : 'false') . ',';
$sOptions .= 'maxresults: '.$this->maxresults.','; $sOptions .= 'maxresults: '.$this->maxresults.',';
$sOptions .= 'chache: true,'; $sOptions .= 'chache: true,';
@@ -1260,8 +1271,20 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek
$sOptions .= 'callback: function(obj){'; $sOptions .= 'callback: function(obj){';
$sOptions .= ' var jField = { ' . $this->name . ' : obj.id };'; $sOptions .= ' var jField = { };';
$sOptions .= ' var sField = "[]"; ';
if ($count > 0) {
for ($cnt = 0; $cnt < $count; $cnt++ ) {
$sOptions .= 'if ( "' . $this->name . '" == "' . $aDepFields[$cnt] . '" ) {';
$sOptions .= ' jField[\'' . $aDepFields[$cnt] . '\'] = obj.id;';
$sOptions .= '} else { ';
$sOptions .= ' jField[\'' . $aDepFields[$cnt] . '\'] = getField(\'' . $aDepFields[$cnt] . '\').value; ';
$sOptions .= '}';
}
}
$sOptions .= ' var sField = "["+ encodeURIComponent(jField.toJSONString()) + "]"; '; $sOptions .= ' var sField = "["+ encodeURIComponent(jField.toJSONString()) + "]"; ';
$sOptions .= $sCallBack . '; getField("' . $this->name . '").value = obj.id;'; $sOptions .= $sCallBack . '; getField("' . $this->name . '").value = obj.id;';
$sOptions .= 'var response = ajax_function("../gulliver/defaultAjaxDynaform", "reloadField", '; $sOptions .= 'var response = ajax_function("../gulliver/defaultAjaxDynaform", "reloadField", ';
@@ -1279,6 +1302,7 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek
$sOptions .= ' for (ni = 0; ni < fieldLength; ni++ ){ '; $sOptions .= ' for (ni = 0; ni < fieldLength; ni++ ){ ';
$sOptions .= ' getField(newcont[i].name).options.remove(ni); '; $sOptions .= ' getField(newcont[i].name).options.remove(ni); ';
$sOptions .= ' } '; $sOptions .= ' } ';
$sOptions .= ' getField(newcont[i].name).length = 0; ';
$sOptions .= ' for (ni = 0; ni < newcont[i].content.options.length; ni++ ){ '; $sOptions .= ' for (ni = 0; ni < newcont[i].content.options.length; ni++ ){ ';
$sOptions .= ' var opt = document.createElement("OPTION"); '; $sOptions .= ' var opt = document.createElement("OPTION"); ';

View File

@@ -23,14 +23,51 @@
*/ */
// check script parameters // check script parameters
// php reindex_solr.php workspacename [reindexall|reindexmissing] // php reindex_solr.php workspacename [reindexall|reindexmissing|optimizeindex] [-skip 1005] [-reindextrunksize 1000]
// var_dump($argv); // var_dump($argv);
if (count ($argv) != 3) { //(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip'))
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"; $commandLineSyntaxMsg = "Invalid command line arguments: \n " .
"syntax: ".
"php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex] [-skip {record_number}] [-reindextrunksize {trunk_size}]\n" .
" Where \n".
" reindexall : reindex all the database. \n" .
" reindexmissing: reindex only the missing records stored in database. \n".
" (records defined in APP_SOLR_QUEUE table are required)\n" .
" optimizeindex: optimize the changes in the search index. (used to get faster results) \n" .
" Optional Options: \n" .
" -skip {record_number}: used to skip a number of records. \n ex: -skip 10000 //skips the first 10000 records. \n" .
" -reindextrunksize {trunk_size}: specify the number of records sent to index each time. \n ex: -reindextrunksize 100 //(default = 1000) \n Reduce the trunk if using big documents, and memory is not enough. \n";
if ( (count ($argv) < 3) || ((count ($argv) % 2) == 0) ||
($argv [2] != 'reindexall' && $argv [2] != 'reindexmissing' && $argv [2] != 'optimizeindex')) {
print $commandLineSyntaxMsg;
die (); die ();
} }
$workspaceName = $argv [1]; $workspaceName = $argv [1];
$ScriptAction = $argv [2]; $ScriptAction = $argv [2];
$SkipRecords = 0;
$TrunkSize = 1000;
//3 5 7
if(count ($argv) > 3) {
for($argNumber = 3 ; $argNumber < count ($argv) ; $argNumber += 2) {
if(($argv [$argNumber] == '-skip' || $argv [$argNumber] == '-reindextrunksize')) {
//get options
if($argv [$argNumber] == '-skip') {
//use skip option
$SkipRecords = intval($argv [$argNumber + 1]);
}
if($argv [$argNumber] == '-reindextrunksize') {
//use skip option
$TrunkSize = intval($argv [$argNumber + 1]);
}
}
else {
print $commandLineSyntaxMsg;
die ();
}
}
}
ini_set ('display_errors', 1); ini_set ('display_errors', 1);
error_reporting (E_ALL); error_reporting (E_ALL);
@@ -237,6 +274,8 @@ function processWorkspace()
{ {
global $sLastExecution; global $sLastExecution;
global $ScriptAction; global $ScriptAction;
global $SkipRecords;
global $TrunkSize;
try { try {
@@ -249,11 +288,14 @@ function processWorkspace()
$oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']); $oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']);
if ($ScriptAction == "reindexall") { if ($ScriptAction == "reindexall") {
$oAppSolr->reindexAllApplications (); $oAppSolr->reindexAllApplications ($SkipRecords, $TrunkSize);
} }
if ($ScriptAction == "reindexmissing") { if ($ScriptAction == "reindexmissing") {
$oAppSolr->synchronizePendingApplications (); $oAppSolr->synchronizePendingApplications ();
} }
if ($ScriptAction == "optimizeindex") {
$oAppSolr->optimizeSearchIndex ();
}
} }
else { else {
print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini"; print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini";

View File

@@ -85,6 +85,31 @@ class ApplicationWithoutDelegationRecordsException extends Exception
} }
} }
/**
* Dynaform file corrupt
*
* @author Herbert Saal Gutierrez
*
* @category Colosa
* @copyright Copyright (c) 2005-2012 Colosa Inc. (http://www.colosa.com)
*/
class ApplicationWithCorruptDynaformException extends Exception
{
// Redefine the exception so message isn't optional
public function __construct($message, $code = 0)
{
// some code
// make sure everything is assigned properly
parent::__construct ($message, $code);
}
// custom string representation of object
public function __toString()
{
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}
/** /**
* Application APP_DATA could not be unserialized exception * Application APP_DATA could not be unserialized exception
* *
@@ -219,6 +244,7 @@ class AppSolr
$swErrorInSearchText = false; $swErrorInSearchText = false;
$solrQueryResult = null; $solrQueryResult = null;
$aPriorities = array('1'=>'VL', '2'=>'L', '3'=>'N', '4'=>'H', '5'=>'VH'); $aPriorities = array('1'=>'VL', '2'=>'L', '3'=>'N', '4'=>'H', '5'=>'VH');
$delegationIndexes = array();
$result = array (); $result = array ();
$result ['totalCount'] = 0; $result ['totalCount'] = 0;
@@ -321,30 +347,30 @@ class AppSolr
if ($userUid != null && $action == 'todo') { if ($userUid != null && $action == 'todo') {
if ($filter == 'read') { if ($filter == 'read') {
$solrSearchText .= "APP_ASSIGNED_USERS_READ:" . $userUid . " AND "; $solrSearchText .= "APP_ASSIGNED_USERS_READ:" . $userUid . " AND ";
$delIndexDynaField = "APP_ASSIGNED_USER_READ_DEL_INDEX_" . trim ($userUid) . '_txt'; $delegationIndexes[] = "APP_ASSIGNED_USER_READ_DEL_INDEX_" . trim ($userUid) . '_txt';
} }
elseif ($filter == 'unread') { elseif ($filter == 'unread') {
$solrSearchText .= "APP_ASSIGNED_USERS_UNREAD:" . $userUid . " AND "; $solrSearchText .= "APP_ASSIGNED_USERS_UNREAD:" . $userUid . " AND ";
$delIndexDynaField = "APP_ASSIGNED_USER_UNREAD_DEL_INDEX_" . trim ($userUid) . '_txt'; $delegationIndexes[] = "APP_ASSIGNED_USER_UNREAD_DEL_INDEX_" . trim ($userUid) . '_txt';
} }
else { else {
$solrSearchText .= "APP_ASSIGNED_USERS:" . $userUid . " AND "; $solrSearchText .= "APP_ASSIGNED_USERS:" . $userUid . " AND ";
$delIndexDynaField = "APP_ASSIGNED_USER_DEL_INDEX_" . trim ($userUid) . '_txt'; $delegationIndexes[] = "APP_ASSIGNED_USER_DEL_INDEX_" . trim ($userUid) . '_txt';
} }
} }
// participated, add condition // participated, add condition
if ($userUid != null && $action == 'sent') { if ($userUid != null && $action == 'sent') {
if ($filter == 'started') { if ($filter == 'started') {
$solrSearchText .= "APP_PARTICIPATED_USERS_STARTED:" . $userUid . " AND "; $solrSearchText .= "APP_PARTICIPATED_USERS_STARTED:" . $userUid . " AND ";
$delIndexDynaField = "APP_PARTICIPATED_USER_STARTED_DEL_INDEX_" . trim ($userUid) . '_txt'; $delegationIndexes[] = "APP_PARTICIPATED_USER_STARTED_DEL_INDEX_" . trim ($userUid) . '_txt';
} }
elseif ($filter == 'completed') { elseif ($filter == 'completed') {
$solrSearchText .= "APP_PARTICIPATED_USERS_COMPLETED:" . $userUid . " AND "; $solrSearchText .= "APP_PARTICIPATED_USERS_COMPLETED:" . $userUid . " AND ";
$delIndexDynaField = "APP_PARTICIPATED_USER_COMPLETED_DEL_INDEX_" . trim ($userUid) . '_txt'; $delegationIndexes[] = "APP_PARTICIPATED_USER_COMPLETED_DEL_INDEX_" . trim ($userUid) . '_txt';
} }
else { else {
$solrSearchText .= "APP_PARTICIPATED_USERS:" . $userUid . " AND "; $solrSearchText .= "APP_PARTICIPATED_USERS:" . $userUid . " AND ";
$delIndexDynaField = "APP_PARTICIPATED_USER_DEL_INDEX_" . trim ($userUid) . '_txt'; $delegationIndexes[] = "APP_PARTICIPATED_USER_DEL_INDEX_" . trim ($userUid) . '_txt';
} }
} }
// draft, add condition // draft, add condition
@@ -356,6 +382,7 @@ class AppSolr
if ($userUid != null && $action == 'unassigned') { if ($userUid != null && $action == 'unassigned') {
// get the list of groups to which belongs the user. // get the list of groups to which belongs the user.
$userGroups = $this->getUserGroups ($userUid); $userGroups = $this->getUserGroups ($userUid);
$solrSearchText .= "(APP_UNASSIGNED_USERS:" . $userUid; $solrSearchText .= "(APP_UNASSIGNED_USERS:" . $userUid;
if (count ($userGroups) > 0) { if (count ($userGroups) > 0) {
$solrSearchText .= " OR "; $solrSearchText .= " OR ";
@@ -370,7 +397,10 @@ class AppSolr
} }
$solrSearchText .= ") AND "; $solrSearchText .= ") AND ";
$delIndexDynaField = "APP_UNASSIGNED_USER_GROUP_DEL_INDEX_" . trim ($userUid) . '_txt'; $delegationIndexes[] = "APP_UNASSIGNED_USER_GROUP_DEL_INDEX_" . trim ($userUid) . '_txt';
foreach ($userGroups as $group) {
$delegationIndexes[] = "APP_UNASSIGNED_USER_GROUP_DEL_INDEX_" . trim ($group ['GRP_UID']) . '_txt';
}
} }
// remove last AND in condition // remove last AND in condition
@@ -392,10 +422,9 @@ class AppSolr
if ($search != "") if ($search != "")
$solrSearchText .= "(" . $search . ")"; $solrSearchText .= "(" . $search . ")";
} }
// add del_index dynamic field to list of resulting columns // add del_index dynamic fields to list of resulting columns
$columsToInclude = array_merge ($columsToInclude, array ( // the fields begin in the 30th column and more
$delIndexDynaField $columsToInclude = array_merge ($columsToInclude, $delegationIndexes);
));
// if is a counter no records are returned // if is a counter no records are returned
if ($doCount) { if ($doCount) {
@@ -420,6 +449,7 @@ class AppSolr
'resultFormat' => 'json' 'resultFormat' => 'json'
); );
$solrRequestData = Entity_SolrRequestData::createForRequestPagination ($data); $solrRequestData = Entity_SolrRequestData::createForRequestPagination ($data);
// use search index to return list of cases // use search index to return list of cases
$searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost); $searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost);
@@ -465,13 +495,24 @@ class AppSolr
$result ['totalCount'] = $solrQueryResult->iTotalDisplayRecords; $result ['totalCount'] = $solrQueryResult->iTotalDisplayRecords;
// complete the missing data to display it in the grid. // complete the missing data to display it in the grid.
$delIndexes = array(); //store all the delegation indexes
foreach ($solrQueryResult->aaData as $i => $data) { foreach ($solrQueryResult->aaData as $i => $data) {
//initialize array
$delIndexes = array();
// complete empty values // complete empty values
$appUID = $data [11]; $appUID = $data [11];
$delIndexes = $data [30]; //get all the delindexes
for($i = 30 ; $i < count($data) ; $i++) {
if (is_array ($data [$i])) {
foreach($data [$i] as $delIndex){
$delIndexes[] = $delIndex;
}
}
}
// verify if the delindex is an array // verify if the delindex is an array
// if is not an array all the indexed must be returned // if is not check different types of repositories
if (! is_array ($delIndexes)) { // the delegation index must always be defined.
if (count($delIndexes) == 0) {
// if is draft // if is draft
if ($action == 'draft') { if ($action == 'draft') {
$delIndexes [] = 1; // the first default index $delIndexes [] = 1; // the first default index
@@ -481,8 +522,13 @@ class AppSolr
$delIndexes = $this->getApplicationDelegationsIndex ($appUID); $delIndexes = $this->getApplicationDelegationsIndex ($appUID);
} }
else { else {
$delIndexes = array(); //error an index must always be defined
print "Delegation not defined\n";
} }
/*
elseif ($action == 'unassigned'){
$delIndexes = $this->getApplicationDelegationsIndex ($appUID);
}*/
} }
foreach ($delIndexes as $delIndex) { foreach ($delIndexes as $delIndex) {
$aRow = array (); $aRow = array ();
@@ -535,14 +581,14 @@ class AppSolr
return $result; return $result;
} // end try } // end try
catch ( InvalidIndexSearchTextException $e ) { catch ( InvalidIndexSearchTextException $ex ) {
// return empty result with description of error // return empty result with description of error
$result = array (); $result = array ();
$result ['totalCount'] = 0; $result ['totalCount'] = 0;
$result ['data'] = array (); $result ['data'] = array ();
$result ['success'] = true; $result ['success'] = true;
$result ['result'] = false; $result ['result'] = false;
$result ['message'] = $e->getMessage (); $result ['message'] = $ex->getMessage ();
return $result; return $result;
} }
} }
@@ -928,6 +974,7 @@ class AppSolr
} }
/** /**
* Update the information of the specified applications in Solr * Update the information of the specified applications in Solr
* *
@@ -954,6 +1001,7 @@ class AppSolr
foreach ($aaAPPUIDs as $aAPPUID) { foreach ($aaAPPUIDs as $aAPPUID) {
$this->applicationChangedUpdateSolrQueue ($aAPPUID ['APP_UID'], true); $this->applicationChangedUpdateSolrQueue ($aAPPUID ['APP_UID'], true);
} }
return;
} }
// create XML document // create XML document
$xmlDoc = $this->createSolrXMLDocument ($aaAPPUIDs); $xmlDoc = $this->createSolrXMLDocument ($aaAPPUIDs);
@@ -974,8 +1022,8 @@ class AppSolr
$oSearchIndex->updateIndexDocument ($oSolrUpdateDocument); $oSearchIndex->updateIndexDocument ($oSolrUpdateDocument);
// commit changes // commit changes
$oSearchIndex->commitIndexChanges ($this->_solrInstance); $oSearchIndex->commitIndexChanges ($this->_solrInstance);
} catch(Exception $ex) }
{ catch(Exception $ex) {
//print "Excepcion indexing data: " . $ex->getMessage() . "\n"; die; //print "Excepcion indexing data: " . $ex->getMessage() . "\n"; die;
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors."); $fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
fwrite($fh, $ex->getMessage()); fwrite($fh, $ex->getMessage());
@@ -1032,11 +1080,27 @@ class AppSolr
try { try {
$result = $this->getApplicationIndexData ($aAPPUID ['APP_UID']); $result = $this->getApplicationIndexData ($aAPPUID ['APP_UID']);
} }
catch ( ApplicationWithoutDelegationRecordsException $e ) { catch ( ApplicationWithoutDelegationRecordsException $ex ) {
// exception trying to get application information // exception trying to get application information
// skip and continue with the next application // skip and continue with the next application
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
fwrite($fh, $ex->getMessage());
fclose($fh);
continue; continue;
} }
catch( ApplicationWithCorruptDynaformException $ex) {
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
fwrite($fh, $ex->getMessage());
fclose($fh);
continue;
}
catch (Exception $ex) {
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
fwrite($fh, "getApplicationIndexData " . $aAPPUID . ":" . $ex->getMessage() . "\n");
fclose($fh);
continue;
}
$documentInformation = $result [0]; $documentInformation = $result [0];
$dynaformFieldTypes = $result [1]; $dynaformFieldTypes = $result [1];
$lastUpdateDate = $result [2]; $lastUpdateDate = $result [2];
@@ -1058,14 +1122,20 @@ class AppSolr
$draftUser, $participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser, $draftUser, $participatedUsers, $participatedUsersStartedByUser, $participatedUsersCompletedByUser,
$unassignedUsers, $unassignedGroups); $unassignedUsers, $unassignedGroups);
} }
catch ( ApplicationAPP_DATAUnserializeException $e ) { catch ( ApplicationAPP_DATAUnserializeException $ex ) {
// exception trying to get application information // exception trying to get application information
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors."); $fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
fwrite($fh, $e->getMessage()); fwrite($fh, $ex->getMessage());
fclose($fh); fclose($fh);
// skip and continue with the next application // skip and continue with the next application
continue; continue;
} }
catch (Exception $ex) {
$fh = fopen("./SolrIndexErrors.txt", 'a') or die("can't open file to store Solr index errors.");
fwrite($fh, "buildSearchIndexDocumentPMOS2 " . $aAPPUID . ":" . $ex->getMessage() . "\n");
fclose($fh);
continue;
}
} }
@@ -1315,8 +1385,8 @@ class AppSolr
// add dynamic field for del_index information // add dynamic field for del_index information
$writer->startElement ("field"); $writer->startElement ("field");
$writer->writeAttribute ('name', 'APP_UNASSIGNED_USER_GROUP_DEL_INDEX_' . trim ($userUID ['USR_UID']) . '_txt'); $writer->writeAttribute ('name', 'APP_UNASSIGNED_USER_GROUP_DEL_INDEX_' . trim ($groupUID ['USR_UID']) . '_txt');
$writer->text ($userUID ['DEL_INDEX']); $writer->text ($groupUID ['DEL_INDEX']);
$writer->endElement (); $writer->endElement ();
} }
} }
@@ -1333,7 +1403,7 @@ class AppSolr
if (! $UnSerializedCaseData) { if (! $UnSerializedCaseData) {
// error unserializing // error unserializing
throw new ApplicationAPP_DATAUnserializeException ("Could not unserialize APP_DATA of APP_UID: " . $documentData ['APP_UID']); throw new ApplicationAPP_DATAUnserializeException ("Could not unserialize APP_DATA of APP_UID: " . $documentData ['APP_UID'] . "\n");
} }
else { else {
foreach ($UnSerializedCaseData as $k => $value) { foreach ($UnSerializedCaseData as $k => $value) {
@@ -1481,7 +1551,7 @@ class AppSolr
// this case occurs when the application doesn't have related delegation // this case occurs when the application doesn't have related delegation
// records. // records.
if (empty ($allAppDbData) || ! isset ($allAppDbData [0])) { if (empty ($allAppDbData) || ! isset ($allAppDbData [0])) {
throw new ApplicationWithoutDelegationRecordsException ("Application without delegation records. APP_UID: " . $AppUID); throw new ApplicationWithoutDelegationRecordsException ("Application without delegation records. APP_UID: " . $AppUID . "\n");
} }
// copy the application information // copy the application information
@@ -1593,33 +1663,42 @@ class AppSolr
// search information of unassigned users // search information of unassigned users
// the unassigned users are the self service users and groups. // the unassigned users are the self service users and groups.
// the self service users are defined in the TASKs of the PROCESS. // the self service users are defined in the TASKs of the PROCESS.
foreach ($allAppDbData as $row) { $unassignedUsers = array ();
$unassignedGroups = array ();
//filter only the delegations that are in selfservice status
// `USR_UID` = '' AND `DEL_FINISH_DATE` IS NULL
$indexes = $this->aaSearchRecords ($allAppDbData, array (
'USR_UID' => 'NULL',
'DEL_FINISH_DATE' => 'NULL',
'APP_THREAD_STATUS' => 'OPEN'
));
foreach ($indexes as $index) {
$unassignedUsersGroups = array (); $unassignedUsersGroups = array ();
// use cache // use cache
$oMemcache = PMmemcached::getSingleton ($this->_solrInstance); $oMemcache = PMmemcached::getSingleton ($this->_solrInstance);
$unassignedUsersGroups = $oMemcache->get ($row ['PRO_UID'] . "_" . $row ['TAS_UID']); $unassignedUsersGroups = $oMemcache->get ($allAppDbData [$index] ['PRO_UID'] . "_" . $allAppDbData [$index] ['TAS_UID']);
if (! $unassignedUsersGroups) { if (! $unassignedUsersGroups) {
$unassignedUsersGroups = $this->getTaskUnassignedUsersGroupsData ($row ['PRO_UID'], $row ['TAS_UID']); $unassignedUsersGroups = $this->getTaskUnassignedUsersGroupsData ($allAppDbData [$index] ['PRO_UID'], $allAppDbData [$index] ['TAS_UID']);
// add del_index // if the task has unassigned users or groups add del_index of delegation
foreach ($unassignedUsersGroups as $i => $newRow) { foreach ($unassignedUsersGroups as $i => $newRow) {
$unassignedUsersGroups [$i] ['DEL_INDEX'] = $row ['DEL_INDEX']; $unassignedUsersGroups [$i] ['DEL_INDEX'] = $allAppDbData [$index] ['DEL_INDEX'];
} }
// store in cache // store in cache
$oMemcache->set ($row ['PRO_UID'] . "_" . $row ['TAS_UID'], $unassignedUsersGroups); $oMemcache->set ($allAppDbData [$index] ['PRO_UID'] . "_" . $allAppDbData [$index] ['TAS_UID'], $unassignedUsersGroups);
} }
// copy list of unassigned users and groups // copy list of unassigned users and groups
$unassignedUsers = array ();
$unassignedGroups = array ();
foreach ($unassignedUsersGroups as $unassignedUserGroup) { foreach ($unassignedUsersGroups as $unassignedUserGroup) {
//unassigned users
if ($unassignedUserGroup ['TU_RELATION'] == 1) { if ($unassignedUserGroup ['TU_RELATION'] == 1) {
$unassignedUsers [] = array ( $unassignedUsers [] = array (
'USR_UID' => $unassignedUserGroup ['USR_UID'], 'USR_UID' => $unassignedUserGroup ['USR_UID'],
'DEL_INDEX' => $unassignedUserGroup ['DEL_INDEX'] 'DEL_INDEX' => $unassignedUserGroup ['DEL_INDEX']
); );
} }
//unassigned groups
elseif ($unassignedUserGroup ['TU_RELATION'] == 2) { elseif ($unassignedUserGroup ['TU_RELATION'] == 2) {
$unassignedGroups [] = array ( $unassignedGroups [] = array (
'USR_UID' => $unassignedUserGroup ['USR_UID'], 'USR_UID' => $unassignedUserGroup ['USR_UID'],
@@ -1650,6 +1729,11 @@ class AppSolr
$dyn = new dynaFormHandler (PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName ['DYN_FILENAME'] . '.xml'); $dyn = new dynaFormHandler (PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName ['DYN_FILENAME'] . '.xml');
$dynaformFields [] = $dyn->getFields (); $dynaformFields [] = $dyn->getFields ();
} }
if (file_exists (PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName ['DYN_FILENAME'] . '.xml') &&
filesize(PATH_DATA . '/sites/workflow/xmlForms/' . $dynaformFileName ['DYN_FILENAME'] . '.xml') == 0 ) {
throw new ApplicationWithCorruptDynaformException("Application with corrupt dynaform. APP_UID: " . $AppUID . "\n");
}
} }
foreach ($dynaformFields as $aDynFormFields) { foreach ($dynaformFields as $aDynFormFields) {
@@ -1787,10 +1871,10 @@ class AppSolr
* Search array of indexes that fullfill the conditions * Search array of indexes that fullfill the conditions
* *
* @param * @param
* array o arrays $arr contains the arrays that are searched * array of arrays $arr contains the arrays that are searched
* @param array $andColumnsConditions * @param array $andColumnsConditions
* contain the conditions that must fullfill 'Column'=>'Condition' * contain the conditions that must fullfill 'Column'=>'Condition'
* @return array array of indexes with the found records * @return array of indexes with the found records
*/ */
public function aaSearchRecords($arr, $andColumnsConditions) public function aaSearchRecords($arr, $andColumnsConditions)
{ {
@@ -2092,6 +2176,8 @@ class AppSolr
*/ */
public function getCountApplicationsSearchIndex() public function getCountApplicationsSearchIndex()
{ {
G::LoadClass ('searchIndex');
$searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost); $searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost);
// execute query // execute query
$count = $searchIndex->getNumberDocuments ($this->_solrInstance); $count = $searchIndex->getNumberDocuments ($this->_solrInstance);
@@ -2099,6 +2185,21 @@ class AppSolr
return $count; return $count;
} }
/**
* Optimize the records in search index
*
* @return
*/
public function optimizeSearchIndex()
{
G::LoadClass ('searchIndex');
$searchIndex = new BpmnEngine_Services_SearchIndex ($this->_solrIsEnabled, $this->_solrHost);
// execute query
$searchIndex->optimizeIndexChanges ($this->_solrInstance);
}
/** /**
* Get a paginated list of application uids from database. * Get a paginated list of application uids from database.
* *
@@ -2135,9 +2236,9 @@ class AppSolr
* Reindex all the application records in Solr server * Reindex all the application records in Solr server
* update applications in groups of 1000 * update applications in groups of 1000
*/ */
public function reindexAllApplications() public function reindexAllApplications($SkipRecords = 0, $indexTrunkSize = 1000)
{ {
$trunk = 1000; $trunk = $indexTrunkSize;
// delete all documents to begin reindex // delete all documents to begin reindex
// deleteAllDocuments(); // deleteAllDocuments();
// commitChanges(); // commitChanges();
@@ -2147,8 +2248,8 @@ class AppSolr
print "Total number of records: " . $numRows . "\n"; print "Total number of records: " . $numRows . "\n";
// //
$initTimeAll = microtime (true); $initTimeAll = microtime (true);
// $numRows = 15;
for ($skip = 0; $skip <= $numRows;) { for ($skip = $SkipRecords; $skip <= $numRows;) {
$aaAPPUIds = $this->getPagedApplicationUids ($skip, $trunk); $aaAPPUIds = $this->getPagedApplicationUids ($skip, $trunk);
printf ("Indexing %d to %d \n", $skip, $skip + $trunk); printf ("Indexing %d to %d \n", $skip, $skip + $trunk);
@@ -2162,6 +2263,7 @@ class AppSolr
$curTimeDoc = gmdate ('H:i:s', (microtime (true) - $initTimeAll)); $curTimeDoc = gmdate ('H:i:s', (microtime (true) - $initTimeAll));
printf ("Total reindex time: %s \n", $curTimeDoc); printf ("Total reindex time: %s \n", $curTimeDoc);
printf ("Reindex completed successfully!!.\n");
} }
} }

View File

@@ -445,6 +445,7 @@ class processMap {
//If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar //If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar
$aFields['PRO_CALENDAR'] = $calendarInfo ['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo ['CALENDAR_UID'] : ""; $aFields['PRO_CALENDAR'] = $calendarInfo ['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo ['CALENDAR_UID'] : "";
$aFields['SYS_LANG'] = SYS_LANG;
global $G_PUBLISH; global $G_PUBLISH;
$G_PUBLISH = new Publisher ( ); $G_PUBLISH = new Publisher ( );

View File

@@ -331,6 +331,20 @@ class BpmnEngine_Services_SearchIndex
$solr->commitChanges ($workspace); $solr->commitChanges ($workspace);
} }
/**
* Optimize index changes
* @param string $workspace
*/
public function optimizeIndexChanges($workspace)
{
G::LoadClass ('solr');
$solr = new BpmnEngine_SearchIndexAccess_Solr ($this->_solrIsEnabled, $this->_solrHost);
// commit
$solr->optimizeChanges ($workspace);
}
/** /**
* Call Solr server to return the list of paginated pages. * Call Solr server to return the list of paginated pages.
* @param FacetRequest $solrRequestData * @param FacetRequest $solrRequestData

View File

@@ -968,10 +968,16 @@ class workspaceTools {
$backup = new Archive_Tar($filename); $backup = new Archive_Tar($filename);
//Get a temporary directory in the upgrade directory //Get a temporary directory in the upgrade directory
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, '')); $tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
$parentDirectory = PATH_DATA . "upgrade";
if (is_writable($parentDirectory)) {
mkdir($tempDirectory); mkdir($tempDirectory);
} else {
throw new Exception("Could not create directory:" . $parentDirectory);
}
//Extract all backup files, including database scripts and workspace files //Extract all backup files, including database scripts and workspace files
if (!$backup->extract($tempDirectory)) if (!$backup->extract($tempDirectory)) {
throw new Exception("Could not extract backup"); throw new Exception("Could not extract backup");
}
//Search for metafiles in the new standard (the old standard would contain //Search for metafiles in the new standard (the old standard would contain
//txt files). //txt files).
$metaFiles = glob($tempDirectory . "/*.meta"); $metaFiles = glob($tempDirectory . "/*.meta");
@@ -1015,9 +1021,9 @@ class workspaceTools {
else else
throw new Exception("Destination workspace already exist (use -o to overwrite)"); throw new Exception("Destination workspace already exist (use -o to overwrite)");
if (file_exists($workspace->path)) if (file_exists($workspace->path)) {
G::rm_dir($workspace->path); G::rm_dir($workspace->path);
}
foreach ($metadata->directories as $dir) { foreach ($metadata->directories as $dir) {
CLI::logging("+> Restoring directory '$dir'\n"); CLI::logging("+> Restoring directory '$dir'\n");

View File

@@ -509,8 +509,12 @@ class OutputDocument extends BaseOutputDocument
$aProperties=array() $aProperties=array()
) { ) {
if (($sUID != '') && is_array($aFields) && ($sPath != '')) { if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
$nrt = array("\n", "\r", "\t");
$nrthtml = array("(n /)", "(r /)", "(t /)");
$sContent = G::unhtmlentities($sContent); $sContent = G::unhtmlentities($sContent);
$strContentAux = str_replace(array("\n", "\r", "\t"), array(null, null, null), $sContent);
$strContentAux = str_replace($nrt, $nrthtml, $sContent);
$iOcurrences = preg_match_all('/\@(?:([\>])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/', $strContentAux, $arrayMatch1, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); $iOcurrences = preg_match_all('/\@(?:([\>])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/', $strContentAux, $arrayMatch1, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
@@ -554,6 +558,8 @@ class OutputDocument extends BaseOutputDocument
} }
} }
$strContentAux = str_replace($nrthtml, $nrt, $strContentAux);
$sContent = $strContentAux; $sContent = $strContentAux;
foreach ($aFields as $sKey => $vValue) { foreach ($aFields as $sKey => $vValue) {

View File

@@ -191,6 +191,9 @@ class Process extends BaseProcess {
$this->setProDescription ( 'Default Process Description' ); $this->setProDescription ( 'Default Process Description' );
$con->commit(); $con->commit();
$this->memcachedDelete();
return $this->getProUid(); return $this->getProUid();
} }
else { else {
@@ -515,6 +518,9 @@ class Process extends BaseProcess {
{ {
Content::removeContent('PRO_TITLE', '', $oPro->getProUid()); Content::removeContent('PRO_TITLE', '', $oPro->getProUid());
Content::removeContent('PRO_DESCRIPTION', '', $oPro->getProUid()); Content::removeContent('PRO_DESCRIPTION', '', $oPro->getProUid());
$this->memcachedDelete();
return $oPro->delete(); return $oPro->delete();
} }
else { else {
@@ -751,7 +757,23 @@ class Process extends BaseProcess {
return $aProc; return $aProc;
} }
} // Process public function memcachedDelete()
{
//Limit defined in processmaker/workflow/engine/templates/processes/main.js
$limit = 25;
$start = 0;
$memcache = &PMmemcached::getSingleton(SYS_SYS);
for ($start = 0; $start <= 50 - 1; $start++) {
$memkey = "processList-allProcesses-" . ($start * $limit) . "-" . $limit;
$memkeyTotal = $memkey . "-total";
$r = $memcache->delete($memkey);
$r = $memcache->delete($memkeyTotal);
}
}
} //Process
function ordProcessByProTitle($a, $b){ function ordProcessByProTitle($a, $b){

View File

@@ -192,27 +192,25 @@ class Main extends Controller
$availableLangArray = $this->getLanguagesList(); $availableLangArray = $this->getLanguagesList();
//$G_PUBLISH = new Publisher ();
//$G_PUBLISH->AddContent ('xmlform', 'xmlform', 'login/login', '', $aFields, SYS_URI .
//'login/authentication.php');
G::LoadClass ('serverConfiguration'); G::LoadClass ('serverConfiguration');
if (($nextBeatDate = $this->memcache->get('nextBeatDate')) === false) {
//get the serverconf singleton, and check if we can send the heartbeat
$oServerConf = & serverConf::getSingleton (); $oServerConf = & serverConf::getSingleton ();
$flagHeartBeat = '';
$sflag = $oServerConf->getHeartbeatProperty('HB_OPTION','HEART_BEAT_CONF'); $sflag = $oServerConf->getHeartbeatProperty('HB_OPTION', 'HEART_BEAT_CONF');
$sflag = (trim($sflag)!='')?$sflag:'1'; $sflag = (trim($sflag) != '') ? $sflag : '1';
//get date of next beat //get date of next beat
$nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE','HEART_BEAT_CONF'); $nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF');
$this->memcache->set('nextBeatDate', $nextBeatDate, 1*3600);
//if flag to send heartbeat is enabled, and it is time to send heartbeat, sent it using asynchronous beat.
if (($sflag == "1") && ((strtotime("now") > $nextBeatDate) || is_null($nextBeatDate))) {
//To do: we need to change to ExtJs
$this->setJSVar('flagHeartBeat', ($flagHeartBeat == 1));
} else {
$this->setJSVar('flagHeartBeat', ($flagHeartBeat == 0));
} }
$sflag = 1;
//check if we show the panel with the getting started info //check if we show the panel with the getting started info
if (($flagGettingStarted = $this->memcache->get('flagGettingStarted')) === false) {
require_once 'classes/model/Configuration.php'; require_once 'classes/model/Configuration.php';
$oConfiguration = new Configuration (); $oConfiguration = new Configuration ();
$oCriteria = new Criteria ('workflow'); $oCriteria = new Criteria ('workflow');
@@ -223,10 +221,11 @@ class Main extends Controller
$oCriteria->add (ConfigurationPeer::USR_UID, ''); $oCriteria->add (ConfigurationPeer::USR_UID, '');
$oCriteria->add (ConfigurationPeer::APP_UID, ''); $oCriteria->add (ConfigurationPeer::APP_UID, '');
$flagGettingStarted = ConfigurationPeer::doCount ($oCriteria); $flagGettingStarted = ConfigurationPeer::doCount ($oCriteria);
$this->memcache->set('flagGettingStarted', $flagGettingStarted, 8*3600) ; if ($flagGettingStarted == 0) {
} $this->setJSVar('flagGettingStarted', ($flagGettingStarted == 1));
} else {
$this->setJSVar('flagGettingStarted', ($flagGettingStarted == 0)); $this->setJSVar('flagGettingStarted', ($flagGettingStarted == 0));
}
G::loadClass('configuration'); G::loadClass('configuration');
$oConf = new Configurations; $oConf = new Configurations;

View File

@@ -318,6 +318,8 @@
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = ''; $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = '';
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = '#'; $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = '#';
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'return false;'; $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'return false;';
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['DYNUIDPRINT'] = $_POST['DYN_UID'];
$_SESSION['DYN_UID_PRINT'] = $_POST['DYN_UID']; $_SESSION['DYN_UID_PRINT'] = $_POST['DYN_UID'];
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view'); $G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_POST['DYN_UID'], '', $Fields['APP_DATA'], '', '', 'view');

View File

@@ -27,10 +27,18 @@ try {
require_once 'classes/model/Dynaform.php'; require_once 'classes/model/Dynaform.php';
require_once 'classes/model/Process.php'; require_once 'classes/model/Process.php';
$currentDynUid = '';
if (isset($_GET['DYNUIDPRINT']) && $_GET['DYNUIDPRINT'] != '') {
$currentDynUid = $_GET['DYNUIDPRINT'];
} elseif (isset($_SESSION['DYN_UID_PRINT'])) {
$currentDynUid = $_SESSION['DYN_UID_PRINT'];
} elseif (isset($_SESSION['CURRENT_DYN_UID'])) {
$currentDynUid = $_SESSION['CURRENT_DYN_UID'];
}
$oDynaform = new Dynaform(); $oDynaform = new Dynaform();
$aDyn = $oDynaform->load($_SESSION['CURRENT_DYN_UID']); $aDyn = $oDynaform->load($currentDynUid);
G::LoadClass('case'); G::LoadClass('case');
$oCase = new Cases(); $oCase = new Cases();
@@ -75,9 +83,7 @@ try {
$array['PROCESS'] = G::LoadTranslation('ID_PROCESS'); $array['PROCESS'] = G::LoadTranslation('ID_PROCESS');
$array['DATELABEL'] = G::LoadTranslation('DATE_LABEL'); $array['DATELABEL'] = G::LoadTranslation('DATE_LABEL');
$aDyn['DYN_UID'] = (isset($_SESSION['DYN_UID_PRINT']) && $_SESSION['DYN_UID_PRINT'] != '') $aDyn['DYN_UID'] = $currentDynUid;
? $_SESSION['DYN_UID_PRINT']
: $aDyn['DYN_UID'];
if ($noShowTitle == 0) { if ($noShowTitle == 0) {
$G_PUBLISH->AddContent('smarty', 'cases/cases_PrintViewTitle', '', '', $array); $G_PUBLISH->AddContent('smarty', 'cases/cases_PrintViewTitle', '', '', $array);
} }

View File

@@ -58,7 +58,7 @@
/*if (strtoupper($Fields['APP_STATUS']) != 'COMPLETED') { /*if (strtoupper($Fields['APP_STATUS']) != 'COMPLETED') {
$oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'SHOW_MESSAGE'); $oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'SHOW_MESSAGE');
}*/ }*/
$aMessage['MESSAGE'] = G::LoadTranslation('ID_NO_PERMISSION_NO_PARTICIPATED '); $aMessage['MESSAGE'] = G::LoadTranslation('ID_NO_PERMISSION_NO_PARTICIPATED');
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
G::RenderPage('publishBlank', 'blank'); G::RenderPage('publishBlank', 'blank');

View File

@@ -207,6 +207,7 @@
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = $aNextStep['PAGE']; $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = $aNextStep['PAGE'];
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = G::loadTranslation('ID_NEXT_STEP'); $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = G::loadTranslation('ID_NEXT_STEP');
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PHPSESSID'] = @session_id(); $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PHPSESSID'] = @session_id();
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['DYNUIDPRINT'] = $_GET['UID'];
$oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptCode(" $oHeadPublisher->addScriptCode("

View File

@@ -160,7 +160,6 @@ $sflag = (trim($sflag) != '') ? $sflag : '1';
//get date of next beat //get date of next beat
$nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF'); $nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF');
$sflag = 1;
//if flag to send heartbeat is enabled, and it is time to send heartbeat, sent it using asynchronous beat. //if flag to send heartbeat is enabled, and it is time to send heartbeat, sent it using asynchronous beat.
if (($sflag == "1") && ((strtotime("now") > $nextBeatDate) || is_null($nextBeatDate))) { if (($sflag == "1") && ((strtotime("now") > $nextBeatDate) || is_null($nextBeatDate))) {

View File

@@ -53,6 +53,8 @@ switch($function){
$_POST['form']['PRO_UID'] = $_GET['PRO_UID']; $_POST['form']['PRO_UID'] = $_GET['PRO_UID'];
} }
$_POST['form']['PRO_TITLE'] = trim($_POST['form']['PRO_TITLE']);
G::LoadClass('processMap'); G::LoadClass('processMap');
$oProcessMap = new ProcessMap(); $oProcessMap = new ProcessMap();
if (!isset($_POST['form']['PRO_UID'])) { if (!isset($_POST['form']['PRO_UID'])) {

View File

@@ -16,6 +16,7 @@ new Ext.KeyMap(document, {
} }
}); });
/*** global variables **/ /*** global variables **/
var storeCases; var storeCases;
var storeReassignCases; var storeReassignCases;
@@ -210,7 +211,7 @@ function pauseCase(date){
xtype:'checkbox', xtype:'checkbox',
name: 'notifyReason', name: 'notifyReason',
hideLabel: true, hideLabel: true,
boxLabel: _('ID_NOTIFY_USERS_CASE'), boxLabel: _('ID_NOTIFY_USERS_CASE')
} }
], ],

View File

@@ -493,7 +493,7 @@ Ext.onReady(function(){
xtype:'checkbox', xtype:'checkbox',
name: 'notifyReason', name: 'notifyReason',
hideLabel: true, hideLabel: true,
boxLabel: _('ID_NOTIFY_USERS_CASE'), boxLabel: _('ID_NOTIFY_USERS_CASE')
} }
], ],
@@ -688,7 +688,7 @@ Ext.onReady(function(){
id: 'notifyReason', id: 'notifyReason',
xtype:'checkbox', xtype:'checkbox',
name: 'notifyReason', name: 'notifyReason',
fieldLabel: _('ID_NOTIFY_USERS_CASE'), fieldLabel: _('ID_NOTIFY_USERS_CASE')
} }
], ],
buttons : [ buttons : [

View File

@@ -72,6 +72,9 @@ var Login = function() {
if (flagGettingStarted) { if (flagGettingStarted) {
this.gettingStartedWindow.show(); this.gettingStartedWindow.show();
} }
if (flagHeartBeat) {
processHbInfo();
}
} }
} }
}(); }();
@@ -374,6 +377,19 @@ Login.initComponents = function()
//Ext.getCmp('login-form').hide(); //Ext.getCmp('login-form').hide();
} }
processHbInfo = function() {
Ext.Ajax.request({
url : '../services/processHeartBeat_Ajax' ,
params : {action:'processInformation'},
success: function ( result, request ) {
//console.info("");
},
failure: function ( result, request) {
//Ext.MessageBox.alert(_('ID_FAILED'), result.responseText);
}
});
}
Login.forgotPassword = function() Login.forgotPassword = function()
{ {
this.window.hide(); this.window.hide();

View File

@@ -1,13 +1,96 @@
function setGridHtml(outdocHtml, swEdit)
{
var outdocHtmlAux = outdocHtml;
outdocHtmlAux = stringReplace("\\x0A", "(n /)", outdocHtmlAux); //\n 10
outdocHtmlAux = stringReplace("\\x0D", "(r /)", outdocHtmlAux); //\r 13
outdocHtmlAux = stringReplace("\\x09", "(t /)", outdocHtmlAux); //\t 9
var arrayMatch1 = [];
var outdocHtmlAux1 = "";
var strHtml = "";
///////
outdocHtmlAux1 = outdocHtmlAux;
strHtml = "";
//@>
if (swEdit == 1) {
while ((arrayMatch1 = /^(.*)<tr>[\(\)nrt\s\/]*<td>[\(\)nrt\s\/]*(@>[a-zA-Z\_]\w*)[\(\)nrt\s\/]*<\/td>[\(\)nrt\s\/]*<\/tr>(.*)$/ig.exec(outdocHtmlAux1))) {
outdocHtmlAux1 = arrayMatch1[1];
strHtml = arrayMatch1[2] + arrayMatch1[3] + strHtml;
}
} else {
while ((arrayMatch1 = /^(.*<table.*>.*)(@>[a-zA-Z\_]\w*)(.*<\/table>.*)$/ig.exec(outdocHtmlAux1))) {
outdocHtmlAux1 = arrayMatch1[1];
strHtml = "<tr><td>" + arrayMatch1[2] + "</td></tr>" + arrayMatch1[3] + strHtml;
}
}
strHtml = outdocHtmlAux1 + strHtml;
///////
outdocHtmlAux1 = strHtml;
strHtml = "";
//@< //Copy of @>
if (swEdit == 1) {
while ((arrayMatch1 = /^(.*)<tr>[\(\)nrt\s\/]*<td>[\(\)nrt\s\/]*(@<[a-zA-Z\_]\w*)[\(\)nrt\s\/]*<\/td>[\(\)nrt\s\/]*<\/tr>(.*)$/ig.exec(outdocHtmlAux1))) {
outdocHtmlAux1 = arrayMatch1[1];
strHtml = arrayMatch1[2] + arrayMatch1[3] + strHtml;
}
} else {
while ((arrayMatch1 = /^(.*<table.*>.*)(@<[a-zA-Z\_]\w*)(.*<\/table>.*)$/ig.exec(outdocHtmlAux1))) {
outdocHtmlAux1 = arrayMatch1[1];
strHtml = "<tr><td>" + arrayMatch1[2] + "</td></tr>" + arrayMatch1[3] + strHtml;
}
}
strHtml = outdocHtmlAux1 + strHtml;
///////
strHtml = stringReplace("\\(n \\/\\)", "\n", strHtml);
strHtml = stringReplace("\\(r \\/\\)", "\r", strHtml);
strHtml = stringReplace("\\(t \\/\\)", "\t", strHtml);
outdocHtml = strHtml;
return outdocHtml;
}
function setHtml(outdocHtml, swEdit)
{
if (outdocHtml.indexOf("@>") > 0 || outdocHtml.indexOf("@&gt;") > 0) {
if (swEdit == 1) {
outdocHtml = stringReplace("@&gt;", "@>", outdocHtml);
outdocHtml = stringReplace("@&lt;", "@<", outdocHtml);
outdocHtml = setGridHtml(outdocHtml, swEdit);
} else {
outdocHtml = setGridHtml(outdocHtml, swEdit);
outdocHtml = stringReplace("@>", "@&gt;", outdocHtml);
outdocHtml = stringReplace("@<", "@&lt;", outdocHtml);
}
}
return outdocHtml;
}
var importOption; var importOption;
Ext.onReady(function(){ Ext.onReady(function(){
Ext.QuickTips.init(); Ext.QuickTips.init();
// turn on validation errors beside the field globally // turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side'; Ext.form.Field.prototype.msgTarget = 'side';
var bd = Ext.getBody(); var bd = Ext.getBody();
var sourceEdit = 0;
importOption = new Ext.Action({ importOption = new Ext.Action({
text: _('ID_LOAD_FROM_FILE'), text: _('ID_LOAD_FROM_FILE'),
@@ -58,25 +141,21 @@ Ext.onReady(function(){
uploader.getForm().submit({ uploader.getForm().submit({
url: 'outputdocs_Ajax?action=setTemplateFile', url: 'outputdocs_Ajax?action=setTemplateFile',
waitMsg: _('ID_UPLOADING_FILE'), waitMsg: _('ID_UPLOADING_FILE'),
success: function(o, resp){ success: function (o, resp) {
w.close(); w.close();
Ext.Ajax.request({ Ext.Ajax.request({
url: 'outputdocs_Ajax?action=getTemplateFile&r='+Math.random(), url: "outputdocs_Ajax?action=getTemplateFile&r=" + Math.random(),
success: function(response){ success: function (response) {
txtParse = response.responseText; Ext.getCmp("OUT_DOC_TEMPLATE").setValue(setHtml(response.responseText, sourceEdit));
if ((txtParse.indexOf('@>')>0)||(txtParse.indexOf('@&gt;')>0)){
txtParse = txtParse.replace('@<','@&lt;');
response.responseText = txtParse;
}
Ext.getCmp('OUT_DOC_TEMPLATE').setValue(response.responseText);
if(Ext.getCmp('OUT_DOC_TEMPLATE').getValue(response.responseText)=='')
Ext.Msg.alert(_('ID_ALERT_MESSAGE'), _('ID_INVALID_FILE'));
},
failure: function(){},
params: {request: 'getRows'}
});
if (Ext.getCmp("OUT_DOC_TEMPLATE").getValue() == "") {
Ext.Msg.alert(_("ID_ALERT_MESSAGE"), _("ID_INVALID_FILE"));
}
},
failure: function () {},
params: {request: "getRows"}
});
}, },
failure: function(o, resp){ failure: function(o, resp){
w.close(); w.close();
@@ -116,36 +195,17 @@ Ext.onReady(function(){
height:300, height:300,
anchor:'98%', anchor:'98%',
listeners: { listeners: {
editmodechange: function(he,b){ editmodechange: function (he, srcEdit) {
txtParse = he.getRawValue(); sourceEdit = (srcEdit == true)? 1 : 0;
if (!b){
if ((txtParse.indexOf('@>')>0)||(txtParse.indexOf('@&gt;')>0)){ he.setValue(setHtml(he.getRawValue(), sourceEdit));
txtParse = txtParse.replace('@<','@&lt;');
he.setValue(txtParse);
}
}
}, },
beforepush: function(he, h){ beforepush: function (he, outdocHtml) {
txtParse = h; //
if ((txtParse.indexOf('@>')>0)||(txtParse.indexOf('@&gt;')>0)){
if (txtParse.indexOf('@<')>0){
txtParse = txtParse.replace('@<','@&lt;');
he.setValue(txtParse);
} }
//return false; //,
} //beforesync: function (he, h) {
}//, //}
// beforesync: function(he, h){
// alert(h);
// txtParse = h;
// if ((txtParse.indexOf('@>')>0)||(txtParse.indexOf('@&gt;')>0)){
// if (txtParse.indexOf('@<')>0){
// txtParse = txtParse.replace('@<','@&lt;');
// he.setValue(txtParse);
// }
// //return false;
// }
// }
} }
}], }],
@@ -153,21 +213,21 @@ Ext.onReady(function(){
text: _('ID_SAVE'), text: _('ID_SAVE'),
handler: function(){ handler: function(){
Ext.Ajax.request({ Ext.Ajax.request({
url: 'outputdocs_Save', url: "outputdocs_Save",
success: function(response){ success: function (response) {
Ext.Msg.show({ Ext.Msg.show({
title: '', title: "",
msg: _('ID_SAVED_SUCCESSFULLY'), msg: _("ID_SAVED_SUCCESSFULLY"),
fn: function(){}, fn: function () {},
animEl: 'elId', animEl: "elId",
icon: Ext.MessageBox.INFO, icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK buttons: Ext.MessageBox.OK
}); });
}, },
failure: function(){}, failure: function () {},
params: { params: {
'form[OUT_DOC_UID]': OUT_DOC_UID, "form[OUT_DOC_UID]": OUT_DOC_UID,
'form[OUT_DOC_TEMPLATE]':Ext.getCmp('OUT_DOC_TEMPLATE').getValue() "form[OUT_DOC_TEMPLATE]": setHtml(Ext.getCmp("OUT_DOC_TEMPLATE").getValue(), 1)
} }
}); });
} }
@@ -186,16 +246,12 @@ Ext.onReady(function(){
top.render(document.body); top.render(document.body);
Ext.Ajax.request({ Ext.Ajax.request({
url: 'outputdocs_Ajax?action=loadTemplateContent&r='+Math.random(), url: "outputdocs_Ajax?action=loadTemplateContent&r=" + Math.random(),
success: function(response){ success: function(response){
Ext.getCmp('OUT_DOC_TEMPLATE').setValue(response.responseText); Ext.getCmp("OUT_DOC_TEMPLATE").setValue(setHtml(response.responseText, 0));
}, },
failure: function(){}, failure: function () {},
params: {OUT_DOC_UID: OUT_DOC_UID} params: {OUT_DOC_UID: OUT_DOC_UID}
}); });
}); });
//function _(ID){
// return TRANSLATIONS[ID];
//}

View File

@@ -6,7 +6,8 @@
<PREVIOUS_ACTION type="private"/> <PREVIOUS_ACTION type="private"/>
<NEXT_ACTION type="private"/> <NEXT_ACTION type="private"/>
<PHPSESSID type="private"/> <PHPSESSID type="private"/>
<PRINT_PREVIEW_ACTION type="private" defaultValue="../cases/cases_PrintView?PHPSESSID=@#PHPSESSID"/> <DYNUIDPRINT type="private"/>
<PRINT_PREVIEW_ACTION type="private" defaultValue="../cases/cases_PrintView?PHPSESSID=@#PHPSESSID&amp;DYNUIDPRINT=@#DYNUIDPRINT"/>
<MNUP type="print" colWidth="20" title="" value='' colAlign="left" link="@#PRINT_PREVIEW_ACTION" width="800" height="600" left="0" top="0" resizable="1"> <MNUP type="print" colWidth="20" title="" value='' colAlign="left" link="@#PRINT_PREVIEW_ACTION" width="800" height="600" left="0" top="0" resizable="1">
<en>Print form</en> <en>Print form</en>
</MNUP> </MNUP>

View File

@@ -19,6 +19,9 @@
<tr style="display: none;"> <tr style="display: none;">
<td colspan="2">{$form.THETYPE}</td> <td colspan="2">{$form.THETYPE}</td>
</tr> </tr>
<tr style="display: none;">
<td colspan="2">{$form.SYS_LANG} {$form.PRO_VALIDATE_TITLE}</td>
</tr>
<tr> <tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$PRO_TITLE}</td> <td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$PRO_TITLE}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.PRO_TITLE}</td> <td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.PRO_TITLE}</td>

View File

@@ -9,10 +9,24 @@
<THETYPE type="hidden"/> <THETYPE type="hidden"/>
<PRO_TITLE type="text" size="50" maxlength="255" defaultvalue="" required="1" group="1" dependentfields="" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection=""> <SYS_LANG type="text"/>
<PRO_TITLE type="text" size="50" maxlength="255" defaultvalue="" required="1" group="1" dependentfields="PRO_VALIDATE_TITLE" linkfield="" strto="" readonly="0" noshowingrid="0" readonlyingrid="0" totalizeable="0" sqlconnection="">
<en>Title</en> <en>Title</en>
</PRO_TITLE> </PRO_TITLE>
<PRO_VALIDATE_TITLE type="text">
SELECT
PRO_UID
FROM
PROCESS
INNER JOIN CONTENT ON (CONTENT.CON_ID = PROCESS.PRO_UID)
WHERE
CON_LANG = @@SYS_LANG AND
CON_VALUE = TRIM(@@PRO_TITLE)
<en>Title</en>
</PRO_VALIDATE_TITLE>
<PRO_DESCRIPTION type="textarea" rows="8" cols="60"> <PRO_DESCRIPTION type="textarea" rows="8" cols="60">
<en>Description</en> <en>Description</en>
</PRO_DESCRIPTION> </PRO_DESCRIPTION>
@@ -66,7 +80,12 @@
<JS type="javascript" replacetags="1"> <JS type="javascript" replacetags="1">
<![CDATA[ <![CDATA[
var validateNameProcess = true;
var naProcess = new input(getField('PRO_TITLE'));
naProcess.passed();
var verifyProcessInformation = function(oForm) { var verifyProcessInformation = function(oForm) {
if (validateNameProcess) {
var oAux; var oAux;
var bContinue = true; var bContinue = true;
oAux = oForm.elements['form[PRO_TITLE]']; oAux = oForm.elements['form[PRO_TITLE]'];
@@ -77,6 +96,7 @@ var verifyProcessInformation = function(oForm) {
} }
var regExp = /^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\";|/]+$/; var regExp = /^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\";|/]+$/;
if (oAux.value.search(regExp)==-1) { if (oAux.value.search(regExp)==-1) {
alert('@G::LoadTranslation(ID_INVALID_PROCESS_NAME)'); alert('@G::LoadTranslation(ID_INVALID_PROCESS_NAME)');
oAux.focus(); oAux.focus();
@@ -88,8 +108,28 @@ var verifyProcessInformation = function(oForm) {
Pm.data.db.title.label = Pm.data.db.title.object.elements.label.innerHTML = getField('PRO_TITLE').value.escapeHTML(); Pm.data.db.title.label = Pm.data.db.title.object.elements.label.innerHTML = getField('PRO_TITLE').value.escapeHTML();
Pm.tmp.editProcessPanel.remove(); Pm.tmp.editProcessPanel.remove();
} }
} else {
var nProcess = new input(getField('PRO_TITLE'));
nProcess.focus();
}
}; };
leimnud.event.add(getField('PRO_TITLE'), 'change', function() {
var nProcess = new input(getField('PRO_TITLE'));
getField('PRO_TITLE').value = getField('PRO_TITLE').value.replace(/^\s*|\s*$/g,"");
if ( (getField('PRO_VALIDATE_TITLE').value == '') ||
(getField('PRO_VALIDATE_TITLE').value == getField('PRO_UID').value)
) {
validateNameProcess = true;
nProcess.passed();
} else {
validateNameProcess = false;
nProcess.failed();
nProcess.focus();
}
});
function cancel() { function cancel() {
Pm.tmp.editProcessPanel.remove(); Pm.tmp.editProcessPanel.remove();
} }