Merge branch 'master' of bitbucket.org:colosa/processmaker into PM-1404
This commit is contained in:
3
Rakefile
3
Rakefile
@@ -383,6 +383,8 @@ def getJsIncludeFiles
|
||||
"gulliver/js/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin.js",
|
||||
|
||||
"gulliver/js/codemirror/lib/codemirror.js",
|
||||
"gulliver/js/codemirror/addon/hint/show-hint.js",
|
||||
"gulliver/js/codemirror/addon/hint/javascript-hint.js",
|
||||
"gulliver/js/codemirror/mode/javascript/javascript.js",
|
||||
"gulliver/js/codemirror/addon/edit/matchbrackets.js",
|
||||
"gulliver/js/codemirror/mode/htmlmixed/htmlmixed.js",
|
||||
@@ -398,6 +400,7 @@ end
|
||||
def getCssIncludeFiles
|
||||
return [
|
||||
"gulliver/js/codemirror/lib/codemirror.css",
|
||||
"gulliver/js/codemirror/addon/hint/show-hint.css",
|
||||
# DEPRECATED
|
||||
# "gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui.css",
|
||||
# "gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css",
|
||||
|
||||
@@ -568,7 +568,7 @@ class Process extends BaseProcess
|
||||
return (is_object( $oPro ) && get_class( $oPro ) == 'Process');
|
||||
}
|
||||
|
||||
public static function existsByProTitle ($PRO_TITLE)
|
||||
public static function existsByProTitle ($proTitle)
|
||||
{
|
||||
$oCriteria = new Criteria("workflow");
|
||||
|
||||
@@ -576,7 +576,7 @@ class Process extends BaseProcess
|
||||
|
||||
$oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' );
|
||||
$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
|
||||
$oCriteria->add( ContentPeer::CON_VALUE, $PRO_TITLE );
|
||||
$oCriteria->add( ContentPeer::CON_VALUE, $proTitle );
|
||||
$oDataset = ContentPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
|
||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
|
||||
@@ -586,6 +586,51 @@ class Process extends BaseProcess
|
||||
return ((int)($aRow["NUM_REC"]) > 0)? true : false;
|
||||
}
|
||||
|
||||
public static function getByProTitle($proTitle) {
|
||||
$oCriteria = new Criteria("workflow");
|
||||
|
||||
$oCriteria->addSelectColumn(ContentPeer::CON_ID);
|
||||
|
||||
$oCriteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE');
|
||||
$oCriteria->add(ContentPeer::CON_LANG, SYS_LANG);
|
||||
$oCriteria->add(ContentPeer::CON_VALUE, $proTitle);
|
||||
$oDataset = ContentPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro'));
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
$oProcess = new Process();
|
||||
return isset($aRow["CON_ID"]) ? $oProcess->load($aRow["CON_ID"]) : null;
|
||||
}
|
||||
|
||||
public static function getNextTitle($proTitle) {
|
||||
$oCriteria = new Criteria('workflow');
|
||||
|
||||
$oCriteria->addSelectColumn(ContentPeer::CON_VALUE);
|
||||
|
||||
$oCriteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE');
|
||||
$oCriteria->add(ContentPeer::CON_LANG, SYS_LANG);
|
||||
$oCriteria->add(ContentPeer::CON_VALUE, $proTitle . '-%', Criteria::LIKE);
|
||||
$oCriteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE);
|
||||
|
||||
$oDataset = ContentPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro'));
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$data = array();
|
||||
$may = 0;
|
||||
while ($oDataset->next()) {
|
||||
$row = $oDataset->getRow();
|
||||
$number = explode("-", $row["CON_VALUE"]);
|
||||
$number = $number[count($number) - 1] + 0;
|
||||
if ($number > $may) {
|
||||
$may = $number;
|
||||
}
|
||||
$row["CON_VALUE"] = $number;
|
||||
$data[] = $row;
|
||||
}
|
||||
return $proTitle . "-" . ($may + 1);
|
||||
}
|
||||
|
||||
public function getAllProcessesCount ()
|
||||
{
|
||||
$c = $this->tmpCriteria;
|
||||
|
||||
@@ -26,6 +26,7 @@ class Designer extends Controller
|
||||
$proUid = isset($httpData->prj_uid) ? $httpData->prj_uid : '';
|
||||
$appUid = isset($httpData->app_uid) ? $httpData->app_uid : '';
|
||||
$proReadOnly = isset($httpData->prj_readonly) ? $httpData->prj_readonly : 'false';
|
||||
$stringBpmn = isset($httpData->stringBpmn) ? '<textarea id="stringBpmn" style="display:none">' . base64_decode($httpData->stringBpmn) . '</textarea>' : '';
|
||||
$client = $this->getClientCredentials();
|
||||
$authCode = $this->getAuthorizationCode($client);
|
||||
$debug = false; //System::isDebugMode();
|
||||
@@ -56,6 +57,7 @@ class Designer extends Controller
|
||||
|
||||
$this->setVar('prj_uid', $proUid);
|
||||
$this->setVar('app_uid', $appUid);
|
||||
$this->setVar('stringBpmn', $stringBpmn);
|
||||
$this->setVar('prj_readonly', $proReadOnly);
|
||||
$this->setVar('credentials', base64_encode(json_encode($clientToken)));
|
||||
$this->setVar('isDebugMode', $debug);
|
||||
|
||||
@@ -31,11 +31,13 @@ class Installer extends Controller
|
||||
$this->path_shared = PATH_TRUNK . 'shared/';
|
||||
$this->path_sep = PATH_SEP;
|
||||
$this->systemName = '';
|
||||
//$this->path_documents = ;
|
||||
$this->path_translations = PATH_CORE . 'js/labels/';
|
||||
$this->path_translationsMafe = PATH_HOME . 'public_html/translations/';
|
||||
}
|
||||
|
||||
public function index ($httpData)
|
||||
{
|
||||
|
||||
if ((strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') && (file_exists($this->path_shared . 'partner.info'))){
|
||||
$this->includeExtJS( 'installer/stopInstall');
|
||||
$this->setView( 'installer/mainStopInstall' );
|
||||
@@ -62,6 +64,8 @@ class Installer extends Controller
|
||||
$this->setJSVar( 'path_public', $this->path_public );
|
||||
$this->setJSVar( 'path_shared', $this->path_shared );
|
||||
$this->setJSVar( 'path_sep', $this->path_sep );
|
||||
$this->setJSVar( 'path_translations', $this->path_translations );
|
||||
$this->setJSVar( 'path_translationsMafe', $this->path_translationsMafe );
|
||||
|
||||
$this->setView( 'installer/main' );
|
||||
|
||||
@@ -232,7 +236,6 @@ class Installer extends Controller
|
||||
$info = new StdClass();
|
||||
$info->success = true;
|
||||
$noWritableFiles = array ();
|
||||
|
||||
// pathConfig
|
||||
$info->pathConfig = new stdclass();
|
||||
$info->pathConfig->message = G::LoadTranslation('ID_INDEX_NOT_WRITEABLE');
|
||||
@@ -270,6 +273,24 @@ class Installer extends Controller
|
||||
$info->success = false;
|
||||
}
|
||||
|
||||
$info->pathTranslations = new stdclass();
|
||||
$info->pathTranslations->message = G::LoadTranslation('ID_TRANSLATION_NOT_WRITEABLE');
|
||||
$info->pathTranslations->result = G::is_writable_r( $_REQUEST['pathTranslations'], $noWritableFiles );
|
||||
if ($info->pathTranslations->result) {
|
||||
$info->pathTranslations->message = G::LoadTranslation('ID_WRITEABLE');
|
||||
} else {
|
||||
$info->success = false;
|
||||
}
|
||||
|
||||
$info->pathTranslationsMafe = new stdclass();
|
||||
$info->pathTranslationsMafe->message = G::LoadTranslation('ID_MAFE_TRANSLATION_NOT_WRITEABLE');
|
||||
$info->pathTranslationsMafe->result = G::is_writable_r( $_REQUEST['pathTranslationsMafe'], $noWritableFiles );
|
||||
if ($info->pathTranslationsMafe->result) {
|
||||
$info->pathTranslationsMafe->message = G::LoadTranslation('ID_WRITEABLE');
|
||||
} else {
|
||||
$info->success = false;
|
||||
}
|
||||
|
||||
$info->pathPublic = new stdclass();
|
||||
|
||||
$info->pathShared = new stdclass();
|
||||
|
||||
@@ -184,6 +184,47 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (isset($_FILES["PROCESS_FILENAME"]) &&
|
||||
pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION) == "bpmn"
|
||||
) {
|
||||
$createMode = $_REQUEST["createMode"];
|
||||
$name = pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_FILENAME);
|
||||
$data = array(
|
||||
"type" => "bpmnProject",
|
||||
"PRO_TITLE" => $name,
|
||||
"PRO_DESCRIPTION" => "",
|
||||
"PRO_CATEGORY" => "",
|
||||
"PRO_CREATE_USER" => $_SESSION['USER_LOGGED']
|
||||
);
|
||||
$stringBpmn = base64_encode(file_get_contents($_FILES["PROCESS_FILENAME"]["tmp_name"]));
|
||||
try {
|
||||
if ($createMode === "overwrite") {
|
||||
$process = Process::getByProTitle($data["PRO_TITLE"]);
|
||||
if ($process !== null) {
|
||||
$oProcess = new Process();
|
||||
$oProcess->remove($process["PRO_UID"]);
|
||||
}
|
||||
}
|
||||
if ($createMode === "rename") {
|
||||
$data["PRO_TITLE"] = Process::getNextTitle($data["PRO_TITLE"]);
|
||||
}
|
||||
$project = new \ProcessMaker\Project\Adapter\WorkflowBpmn($data);
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => "",
|
||||
"prj_uid" => $project->getUid(),
|
||||
"stringBpmn" => $stringBpmn
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => $e->getMessage()
|
||||
);
|
||||
}
|
||||
echo G::json_encode($result);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$action = isset( $_REQUEST['ajaxAction'] ) ? $_REQUEST['ajaxAction'] : null;
|
||||
|
||||
$importer = new XmlImporter();
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
</head>
|
||||
<body onresize="resizingFrame();">
|
||||
|
||||
{$stringBpmn}
|
||||
|
||||
<div class="ui-layout-north">
|
||||
<section class="navBar" id="idNavBar">
|
||||
|
||||
@@ -86,7 +86,9 @@ Ext.onReady(function(){
|
||||
Ext.get('pathXmlformsSpan').dom.innerHTML = (response.pathXmlforms.result ? okImage : badImage);
|
||||
Ext.get('pathPublicSpan').dom.innerHTML = (response.pathPublic.result ? okImage : badImage);
|
||||
Ext.get('pathSharedSpan').dom.innerHTML = (response.pathShared.result ? okImage : badImage);
|
||||
Ext.get('pathLogFileSpan').dom.innerHTML = (response.pathLogFile.result ? okImage : badImage);
|
||||
Ext.get('pathLogFileSpan').dom.innerHTML = (response.pathLogFile.result ? okImage : badImage);
|
||||
Ext.get('pathTranslationsSpan').dom.innerHTML = (response.pathTranslations.result ? okImage : badImage);
|
||||
Ext.get('pathTranslationsMafeSpan').dom.innerHTML = (response.pathTranslationsMafe.result ? okImage : badImage);
|
||||
|
||||
wizard.onClientValidation(1,
|
||||
response.pathConfig.result &&
|
||||
@@ -95,7 +97,9 @@ Ext.onReady(function(){
|
||||
response.pathXmlforms.result &&
|
||||
response.pathPublic.result &&
|
||||
response.pathShared.result &&
|
||||
response.pathLogFile.result
|
||||
response.pathLogFile.result &&
|
||||
response.pathTranslations.result &&
|
||||
response.pathTranslationsMafe.result
|
||||
);
|
||||
|
||||
wizard.showLoadMask(false);
|
||||
@@ -115,7 +119,9 @@ Ext.onReady(function(){
|
||||
'pathXmlforms': Ext.getCmp('pathXmlforms').getValue(),
|
||||
'pathShared': Ext.getCmp('pathShared').getValue(),
|
||||
'pathLogFile': Ext.getCmp('pathLogFile').getValue(),
|
||||
'pathPublic': Ext.getCmp('pathPublic').getValue()
|
||||
'pathPublic': Ext.getCmp('pathPublic').getValue(),
|
||||
'pathTranslations': Ext.getCmp('pathTranslations').getValue(),
|
||||
'pathTranslationsMafe': Ext.getCmp('pathTranslationsMafe').getValue()
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -413,6 +419,22 @@ Ext.onReady(function(){
|
||||
value: path_public,
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
xtype: 'textfield',
|
||||
fieldLabel: '<span id="pathTranslationsSpan"></span> ' + _('ID_TRANSLATIONS_DIRECTORY'),
|
||||
id: 'pathTranslations',
|
||||
width: 430,
|
||||
value: path_translations,
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
xtype: 'textfield',
|
||||
fieldLabel: '<span id="pathTranslationsMafeSpan"></span> ' + _('ID_MAFE_TRANSLATION_DIRECTORY'),
|
||||
id: 'pathTranslationsMafe',
|
||||
width: 430,
|
||||
value: path_translationsMafe,
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
xtype: 'textfield',
|
||||
fieldLabel: '<span id="pathSharedSpan"></span> ' + _('ID_WORFLOW_DATA_DIRECTORY'),
|
||||
|
||||
@@ -306,6 +306,14 @@ Ext.onReady(function(){
|
||||
importProcessGlobal.processFileType = "pm";
|
||||
importProcess();
|
||||
}
|
||||
},{
|
||||
text: _('ID_IMPORT_BPMN'),
|
||||
iconCls: 'silk-add',
|
||||
icon: '/images/import.gif',
|
||||
handler : function(){
|
||||
importProcessGlobal.processFileType = "bpmn";
|
||||
importProcessBpmn();
|
||||
}
|
||||
},{
|
||||
xtype: 'tbfill'
|
||||
},{
|
||||
@@ -1303,6 +1311,172 @@ importProcess = function()
|
||||
});
|
||||
w.show();
|
||||
}
|
||||
|
||||
importProcessBpmn = function ()
|
||||
{
|
||||
var w = new Ext.Window({
|
||||
id: 'import_process_bpmn',
|
||||
title: _('ID_IMPORT_PROCESS'),
|
||||
width: 420,
|
||||
height: 130,
|
||||
modal: true,
|
||||
autoScroll: false,
|
||||
maximizable: false,
|
||||
resizable: false,
|
||||
items: [
|
||||
new Ext.FormPanel({
|
||||
id: 'uploader',
|
||||
fileUpload: true,
|
||||
width: 400,
|
||||
height: 90,
|
||||
frame: true,
|
||||
title: _('ID_IMPORT_PROCESS'),
|
||||
header: false,
|
||||
autoHeight: false,
|
||||
bodyStyle: 'padding: 10px 10px 0 10px;',
|
||||
labelWidth: 50,
|
||||
defaults: {
|
||||
anchor: '90%',
|
||||
allowBlank: false,
|
||||
msgTarget: 'side'
|
||||
},
|
||||
items: [
|
||||
{
|
||||
name: 'ajaxAction',
|
||||
xtype: 'hidden',
|
||||
value: 'uploadFileNewProcess'
|
||||
}, {
|
||||
name: 'processFileType',
|
||||
xtype: 'hidden',
|
||||
value: importProcessGlobal.processFileType
|
||||
},{
|
||||
name: 'createMode',
|
||||
xtype: 'hidden',
|
||||
value: 'create'
|
||||
}, {
|
||||
xtype: 'fileuploadfield',
|
||||
id: 'form-file',
|
||||
emptyText: _('ID_SELECT_PROCESS_FILE'),
|
||||
fieldLabel: _('ID_LAN_FILE'),
|
||||
name: 'PROCESS_FILENAME',
|
||||
buttonText: '',
|
||||
buttonCfg: {
|
||||
iconCls: 'upload-icon'
|
||||
}
|
||||
}
|
||||
],
|
||||
buttons: [
|
||||
{
|
||||
text: _('ID_UPLOAD'),
|
||||
handler: function () {
|
||||
importProcessBpmnSubmit();
|
||||
}
|
||||
}, {
|
||||
text: _('ID_CANCEL'),
|
||||
handler: function () {
|
||||
w.close();
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
]
|
||||
});
|
||||
w.show();
|
||||
}
|
||||
|
||||
var windowbpmnoption = new Ext.Window({
|
||||
title: _('ID_IMPORT_PROCESS'),
|
||||
header: false,
|
||||
width: 420,
|
||||
height: 200,
|
||||
modal: true,
|
||||
autoScroll: false,
|
||||
maximizable: false,
|
||||
resizable: false,
|
||||
closeAction: 'hide',
|
||||
items: [
|
||||
{
|
||||
xtype: 'panel',
|
||||
border: false,
|
||||
bodyStyle: 'padding:15px;background-color:#e8e8e8;',
|
||||
items: [
|
||||
{
|
||||
xtype: 'box',
|
||||
autoEl: {
|
||||
tag: 'div',
|
||||
html: '<div style="margin-bottom:15px;background-color:#e8e8e8;"><img style="display:inline-block;vertical-align:top;" src="/images/ext/default/window/icon-warning.gif"/><div style="display:inline-block;width:338px;margin-left:5px;">' +
|
||||
_('ID_IMPORT_ALREADY_EXISTS_BPMN') + "<br><br>" + _('ID_IMPORT_ALREADY_EXISTS_BPMN_NOTE') +
|
||||
'</div></div>'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
buttons: [
|
||||
{
|
||||
text: _('ID_CREATE_NEW'),
|
||||
handler: function () {
|
||||
Ext.getCmp('uploader').getForm().setValues({"createMode": "rename"})
|
||||
importProcessBpmnSubmit();
|
||||
}
|
||||
}, {
|
||||
text: _('ID_OVERWRITE'),
|
||||
handler: function () {
|
||||
Ext.getCmp('uploader').getForm().setValues({"createMode": "overwrite"})
|
||||
importProcessBpmnSubmit();
|
||||
}
|
||||
}, {
|
||||
text: _('ID_CANCEL'),
|
||||
handler: function () {
|
||||
Ext.getCmp('import_process_bpmn').close();
|
||||
windowbpmnoption.hide();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
importProcessBpmnSubmit = function () {
|
||||
windowbpmnoption.hide();
|
||||
var uploader = Ext.getCmp('uploader');
|
||||
if (uploader.getForm().isValid()) {
|
||||
uploader.getForm().submit({
|
||||
url: 'processes_Import_Ajax',
|
||||
waitMsg: _('ID_UPLOADING_PROCESS_FILE'),
|
||||
waitTitle: " ",
|
||||
success: function (o, resp) {
|
||||
var resp_ = Ext.util.JSON.decode(resp.response.responseText);
|
||||
if (resp_.catchMessage !== "") {
|
||||
windowbpmnoption.show();
|
||||
return;
|
||||
}
|
||||
Ext.getCmp('import_process_bpmn').close();
|
||||
var stringxml = document.createElement("input");
|
||||
stringxml.type = "hidden";
|
||||
stringxml.name = "stringBpmn";
|
||||
stringxml.value = resp_.stringBpmn;
|
||||
var form = document.createElement("form");
|
||||
document.body.appendChild(form);
|
||||
form.appendChild(stringxml);
|
||||
form.style.display = "none";
|
||||
form.action = "../designer?prj_uid=" + resp_.prj_uid;
|
||||
form.method = "POST";
|
||||
form.submit();
|
||||
},
|
||||
failure: function (o, resp) {
|
||||
Ext.getCmp('import_process_bpmn').close();
|
||||
Ext.MessageBox.show({
|
||||
title: '',
|
||||
msg: resp.catchMessage,
|
||||
buttons: Ext.MessageBox.OK,
|
||||
animEl: 'mb9',
|
||||
fn: function () {
|
||||
},
|
||||
icon: Ext.MessageBox.ERROR
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function activeDeactive(){
|
||||
var rows = processesGrid.getSelectionModel().getSelections();
|
||||
|
||||
Reference in New Issue
Block a user