Merged in dheeyi/processmaker/MT-100 (pull request #4056)

MT-100
This commit is contained in:
Julio Cesar Laura Avendaño
2016-04-08 12:21:34 -04:00
4 changed files with 69 additions and 46 deletions

View File

@@ -31,7 +31,16 @@ $conf = new Configurations();
$pmVersion = (preg_match("/^([\d\.]+).*$/", System::getVersion(), $arrayMatch))? $arrayMatch[1] : ""; //Otherwise: Branch master $pmVersion = (preg_match("/^([\d\.]+).*$/", System::getVersion(), $arrayMatch))? $arrayMatch[1] : ""; //Otherwise: Branch master
$arrayFlagImportFileExtension = array("pm", "pmx", "bpmn"); /*----------------------------------********---------------------------------*/
if (true) {
$arrayFlagImportFileExtension = array("pm", "pmx", "pmx2", "bpmn");
} else {
/*----------------------------------********---------------------------------*/
$arrayFlagImportFileExtension = array("pm", "pmx", "bpmn");
/*----------------------------------********---------------------------------*/
}
/*----------------------------------********---------------------------------*/
$arrayFlagMenuNewOption = array("pm" => true, "bpmn" => true); $arrayFlagMenuNewOption = array("pm" => true, "bpmn" => true);
if ($pmVersion != "") { if ($pmVersion != "") {

View File

@@ -33,7 +33,7 @@ $objectsToImport = '';
if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=") && if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=") &&
isset($_FILES["PROCESS_FILENAME"]) && isset($_FILES["PROCESS_FILENAME"]) &&
$_FILES["PROCESS_FILENAME"]["error"] == 0 && $_FILES["PROCESS_FILENAME"]["error"] == 0 &&
preg_match("/^(?:pm|pmx)$/", pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION)) preg_match("/^(?:pm|pmx|pmx2)$/", pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION))
) { ) {
//Check disabled code //Check disabled code
$response = array(); $response = array();
@@ -55,6 +55,7 @@ if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm
} }
break; break;
case "pmx": case "pmx":
case "pmx2":
$importer = new XmlImporter(); $importer = new XmlImporter();
$data = $importer->load($_FILES["PROCESS_FILENAME"]["tmp_name"]); $data = $importer->load($_FILES["PROCESS_FILENAME"]["tmp_name"]);
if (isset($data["tables"]["workflow"]["triggers"]) && is_array($data["tables"]["workflow"]["triggers"]) && !empty($data["tables"]["workflow"]["triggers"])) { if (isset($data["tables"]["workflow"]["triggers"]) && is_array($data["tables"]["workflow"]["triggers"]) && !empty($data["tables"]["workflow"]["triggers"])) {
@@ -109,8 +110,9 @@ if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
if (isset($_FILES["PROCESS_FILENAME"]) && if (isset($_FILES["PROCESS_FILENAME"]) && (pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION) == "pmx"
pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION) == "pmx" || pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION) == "pmx2")
) { ) {
$importer = new XmlImporter(); $importer = new XmlImporter();
$importer->setData("usr_uid", $_SESSION["USER_LOGGED"]); $importer->setData("usr_uid", $_SESSION["USER_LOGGED"]);
@@ -219,8 +221,10 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
} }
if (isset($_POST["PRO_FILENAME"]) && if (isset($_POST["PRO_FILENAME"]) &&
file_exists(PATH_DOCUMENT . "input" . PATH_SEP . $_POST["PRO_FILENAME"]) && file_exists(PATH_DOCUMENT . "input" . PATH_SEP . $_POST["PRO_FILENAME"]) && (pathinfo(PATH_DOCUMENT . "input" .
pathinfo(PATH_DOCUMENT . "input" . PATH_SEP . $_POST["PRO_FILENAME"], PATHINFO_EXTENSION) == "pmx" PATH_SEP . $_POST["PRO_FILENAME"], PATHINFO_EXTENSION) == "pmx" || pathinfo(PATH_DOCUMENT . "input" .
PATH_SEP . $_POST["PRO_FILENAME"], PATHINFO_EXTENSION) == "pmx2")
) { ) {
$option = XmlImporter::IMPORT_OPTION_CREATE_NEW; $option = XmlImporter::IMPORT_OPTION_CREATE_NEW;

View File

@@ -55,8 +55,8 @@ class GranularExporter
$projectData = $bpmnProject->getProject(); $projectData = $bpmnProject->getProject();
$getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false); $getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false);
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; $outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1; $version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx2") + 1;
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx"); $outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx2");
$bpnmDefinition = array( $bpnmDefinition = array(
'ACTIVITY' => [], 'ACTIVITY' => [],

View File

@@ -989,48 +989,55 @@ var deleteCases = function(){
} }
function exportProcess() { function exportProcess() {
var record = processesGrid.getSelectionModel().getSelections(); var record = processesGrid.getSelectionModel().getSelections();
if(record.length == 1) { if (record.length == 1) {
if(Ext.getCmp('exportProcessObjectsWindow')) { if (Ext.getCmp('exportProcessObjectsWindow')) {
Ext.getCmp('exportProcessObjectsWindow').close(); Ext.getCmp('exportProcessObjectsWindow').close();
}
var myMask = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING")});
var proUid = record[0].get("PRO_UID");
myMask.show();
Ext.Ajax.request({
url: "../processes/processes_Export",
method: "GET",
params: {
"pro_uid": proUid,
"objects": processObjectsArray
},
success: function (response) {
var result = JSON.parse(response.responseText);
myMask.hide();
if (result.success) {
window.location = "../processes/processes_DownloadFile?file_hash=" + result.file_hash;
} else { } else {
Ext.Msg.show({title: "", msg: result.message, icon: Ext.MessageBox.ERROR, buttons: Ext.MessageBox.OK}); processObjectsArray = '';
} }
}, var myMask = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING")});
var proUid = record[0].get("PRO_UID");
failure: function (response, opts) { myMask.show();
myMask.hide();
} Ext.Ajax.request({
}); url: "../processes/processes_Export",
} method: "GET",
else { params: {
Ext.Msg.show({ "pro_uid": proUid,
title: _("ID_INFORMATION"), "objects": processObjectsArray
msg: _("ID_NO_SELECTION_WARNING"), },
icon: Ext.MessageBox.INFO, success: function (response) {
buttons: Ext.MessageBox.OK var result = JSON.parse(response.responseText);
}); myMask.hide();
}
if (result.success) {
window.location = "../processes/processes_DownloadFile?file_hash=" + result.file_hash;
} else {
Ext.Msg.show({
title: "",
msg: result.message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK
});
}
},
failure: function (response, opts) {
myMask.hide();
}
});
}
else {
Ext.Msg.show({
title: _("ID_INFORMATION"),
msg: _("ID_NO_SELECTION_WARNING"),
icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK
});
}
} }
function exportImportProcessObjects(typeAction) function exportImportProcessObjects(typeAction)
@@ -1914,6 +1921,9 @@ importProcess = function()
switch (fileExtension) { switch (fileExtension) {
case "pm": case "pm":
case "pmx": case "pmx":
/*----------------------------------********---------------------------------*/
case "pmx2":
/*----------------------------------********---------------------------------*/
var uploader = Ext.getCmp("uploader"); var uploader = Ext.getCmp("uploader");
if (uploader.getForm().isValid()) { if (uploader.getForm().isValid()) {