diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin.js b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin.js index a22b6d6fb..d715b8f5a 100644 --- a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin.js +++ b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin.js @@ -33,10 +33,10 @@ // with the path of the uploaded file function pmGrids(field_name, url, type, win) { //tinyMCE.activeEditor.anyVariable='path/to/ProcessMaker' - var strPluginPath = tinyMCE.activeEditor.plugins.pmGrids.getPluginURL(); // get the path to the uploader plugin - var strScriptURL = strPluginPath + "/pmGrids.html"; - -tinyMCE.activeEditor.windowManager.open({ // open the plugin popup + var strPluginPath = tinyMCE.activeEditor.plugins.pmGrids.getPluginURL(); // get the path to the uploader plugin + var strScriptURL = strPluginPath + "/pmGrids.html"; + + tinyMCE.activeEditor.windowManager.open({ // open the plugin popup file : strScriptURL, title : 'ProcessMaker Grid Wizard', width : '600px', diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin_src.js b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin_src.js index a79d0a8dc..3ddb74098 100644 --- a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin_src.js +++ b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin_src.js @@ -33,7 +33,7 @@ // with the path of the uploaded file function pmGrids(field_name, url, type, win) { //tinyMCE.activeEditor.anyVariable='path/to/ProcessMaker' - var strPluginPath = tinyMCE.activeEditor.plugins.pmGrids.getPluginURL(); // get the path to the uploader plugin + var strPluginPath = tinyMCE.activeEditor.plugins.pmGrids.getPluginURL(); // get the path to the uploader plugin var strScriptURL = strPluginPath + "/pmGrids.html"; tinyMCE.activeEditor.windowManager.open({ // open the plugin popup @@ -62,5 +62,6 @@ function closePluginPopup(){ function updateEditorContent(serializedHTML){ tinyMCE.activeEditor.execCommand('mceInsertContent', false, serializedHTML); + closePluginPopup(); } diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.html b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.html index 88adc2e3b..c398521ed 100644 --- a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.html +++ b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.html @@ -19,26 +19,26 @@ and open the template in the editor. left: 45%; margin-left: -70px; } - #container { + .container { display: table; } - #row { + .row { display: table-row; } - #left, #right, #middle, .gridCell { + .left, .right, .middle, .gridCell { display: table-cell; } -
-
-
+
+
+
Chose a grid
-
+
@@ -59,36 +59,25 @@ and open the template in the editor.
-
-
- -
-
-
- Border -
+
+
+ Border
-
-
- -
-
-
- Headers -
+
+
+ Headers
-
-
-
-
+
+
+
-
+
@@ -96,10 +85,9 @@ and open the template in the editor. Cancel
-
-
diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.js b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.js index 434ef4b30..b13348b5a 100644 --- a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.js +++ b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.js @@ -1,64 +1,40 @@ - $(document).ready(function () { - +$(document).ready(function () { var getGridList = function(){ var responseData - responseData = '[{"id":"grid_01","name":"grid_01"},{"id":"grid_02","name":"grid_02"}]'; - /*$.ajax({ - url : "/processes/processes_Ajax", +// responseData = '[{"id":"grid_01","name":"grid_01"},{"id":"grid_02","name":"grid_02"}]'; + var url = tinyMCE.activeEditor.domainURL+"processes/processes_Ajax"; + responseData = $.ajax({ + url : url, type: "POST", - data: {action : 'getDynagridList', PRO_UID: tinyMCE.activeEditor.processID}, - dataType: "html", - - success: function (data) { - - $.each(data, function(index, element) { - $('#listContainer').append($('
', { - text: element.name - })); - }); - }, - failure: function(){ -// responseData = '[{"id":"1","name":"grid_01"},{"id":"2","name":"grid_02"}]'; - } - });*/ - responseData = eval ("(" +responseData+ ")"); + data: {action : 'getGridList', PRO_UID: tinyMCE.activeEditor.processID}, + async: false, + dataType: "json" + }).responseText; + responseData = eval("(" +responseData+ ")"); return responseData; } - var getGridFieldList = function (gridUid){ - var responseData - if (gridUid=='1'||gridUid==1){ - responseData = eval ('([{"id":"1","name":"field01"},{"id":"2","name":"field02"}])'); - } else { - responseData = eval ('([{"id":"3","name":"field03"},{"id":"4","name":"field04"}])'); - } - /*$.ajax({ - url: "/processes/processes_Ajax", + var getGridFieldList = function(gridUid){ + var responseData = $.ajax({ + url : tinyMCE.activeEditor.domainURL+"processes/processes_Ajax", type: "POST", - data: {action : 'getGridFieldList', PRO_UID: tinyMCE.activeEditor.processID, DYN_UID: gridUid}, + data: {action : 'getVariableGrid', PRO_UID: tinyMCE.activeEditor.processID, DYN_UID: gridUid}, dataType: "json", - success: function (data) { - $.each(responseData, function(index, element) { - $('#listContainer').append($('
', { - text: element.name - })); - }); - } - });*/ + async:false + }).responseText; + responseData = eval("("+responseData+")"); $('#listContainer').html(''); var divHeader = ''; var divCell = ''; $.each(responseData, function(index, element){ - divHeader += ""; - divCell += ""+element.name+""; + divHeader += ""; + divCell += ""+element+""; }); - divHeader += ""; - divCell += ""; - - $('#listContainer').append(divHeader+divCell); - - } + divHeader += ''; + divCell += ''; + $('#listContainer').append(divHeader+divCell); + }; var generateListValues = function(){ var list = getGridList(); @@ -66,16 +42,16 @@ var option = document.createElement('option'); for(i=(combo.length-1); i>=0; i--) { - var aDelete = combo.options[i]; - aDelete.parentNode.removeChild(aDelete); + var aDelete = combo.options[i]; + aDelete.parentNode.removeChild(aDelete); } if(list.length>0){ for(i=0; i"; + if ($("#headersCheckbox").attr("checked")!="checked"){ + headerCode = ''; + } + gridCode += headerCode+fieldCode+""; tableCode += gridCode+"" updateEditorContent (tableCode); - closePluginPopup(); } $('#gridList').change(function(){ diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin_src.js b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin_src.js index 8941d8204..654bdd8bd 100644 --- a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin_src.js +++ b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin_src.js @@ -3,6 +3,7 @@ **/ (function(){ + tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; var strPluginURL; tinymce.create('tinymce.plugins.pmVariablePickerPlugin', { init: function(ed, url) @@ -69,7 +70,7 @@ function pmVariablePicker(field_name, url, type, win) { // This function will get called when the uploader is done uploading the file and ready to update // calling dialog and close the upload popup // strReturnURL should be the string with the path to the uploaded file -function closePluginPopup(){ +function closePluginPopup(){ tinyMCEPopup.close(); // close popup window } diff --git a/gulliver/system/class.wysiwygEditor.php b/gulliver/system/class.wysiwygEditor.php index a9a108f16..d388fb877 100644 --- a/gulliver/system/class.wysiwygEditor.php +++ b/gulliver/system/class.wysiwygEditor.php @@ -76,8 +76,8 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field */ public function attachEvents ($element) { - - $editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; '; + $editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; '; + $editorDefinition .= 'var domainURL = "/sys'.SYS_SYS.'/'.SYS_LANG.'/'.SYS_SKIN.'/"'; switch ($this->editorType){ case 'EMAIL_TEMPLATE': @@ -95,11 +95,13 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field theme_advanced_buttons1 : "pmSimpleUploader,|,pmVariablePicker,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste,|,bullist,numlist,|,outdent,indent,blockquote", theme_advanced_buttons2 : "tablecontrols,|,undo,redo,|,link,unlink,image,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,sub,sup,|,ltr,rtl,|,code", oninit: function (){ - tinyMCE.activeEditor.processID =formProcessID; + tinyMCE.activeEditor.processID = formProcessID; + tinyMCE.activeEditor.domainURL = domainURL; + }, onchange_callback: function(inst) { if(inst.isDirty()) { - inst.save(); + inst.save(); } return true; }, @@ -126,8 +128,9 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field verify_html : false, theme_advanced_buttons1 : "pmSimpleUploader,|,pmVariablePicker,|,pmGrids,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste,|,bullist,numlist,|,outdent,indent,blockquote", theme_advanced_buttons2 : "tablecontrols,|,undo,redo,|,link,unlink,image,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,sub,sup,|,ltr,rtl,|,code", - oninit: function (){ - tinyMCE.activeEditor.processID=formProcessID; + oninit: function () { + tinyMCE.activeEditor.processID = formProcessID; + tinyMCE.activeEditor.domainURL = domainURL; }, onchange_callback: function(inst) { if(inst.isDirty()) { diff --git a/workflow/engine/classes/class.xmlfield_InputPM.php b/workflow/engine/classes/class.xmlfield_InputPM.php index b5272cb36..4efb8d361 100755 --- a/workflow/engine/classes/class.xmlfield_InputPM.php +++ b/workflow/engine/classes/class.xmlfield_InputPM.php @@ -457,46 +457,46 @@ function getGridsVars ($sProcessUID) return $aFields; } /* -function getVarsGrid () +function getVarsGrid () { - - $aFields = array (); - $aFieldsNames = array (); - require_once 'classes/model/Dynaform.php'; + + $aFields = array (); + $aFieldsNames = array (); + require_once 'classes/model/Dynaform.php'; $aFields = new Dynaform(); //$aFields->getDynaformFields( $caseId ); $aFields->getDynaformFields( '45855056550a69a8cbeed24036053462' ); G::pr($aFields); - return $aFields; + return $aFields; } */ -function getVarsGrid ($proUid, $dynUid) +function getVarsGrid ($proUid, $dynUid) { G::LoadClass( 'dynaformhandler' ); - G::LoadClass( 'AppSolr' ); + G::LoadClass( 'AppSolr' ); - $dynaformFields = array (); + $dynaformFields = array (); - if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { - $dyn = new dynaFormHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); - $dynaformFields[] = $dyn->getFields(); - } + if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { + $dyn = new dynaFormHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); + $dynaformFields[] = $dyn->getFields(); + } $dynaformFieldTypes = array (); - foreach ($dynaformFields as $aDynFormFields) { - foreach ($aDynFormFields as $field) { + foreach ($dynaformFields as $aDynFormFields) { + foreach ($aDynFormFields as $field) { - if ($field->getAttribute( 'validate' ) == 'Int') { - $dynaformFieldTypes[$field->nodeName] = 'Int'; - } elseif ($field->getAttribute( 'validate' ) == 'Real') { - $dynaformFieldTypes[$field->nodeName] = 'Real'; - } else { - $dynaformFieldTypes[$field->nodeName] = $field->getAttribute( 'type' ); - } - } + if ($field->getAttribute( 'validate' ) == 'Int') { + $dynaformFieldTypes[$field->nodeName] = 'Int'; + } elseif ($field->getAttribute( 'validate' ) == 'Real') { + $dynaformFieldTypes[$field->nodeName] = 'Real'; + } else { + $dynaformFieldTypes[$field->nodeName] = $field->getAttribute( 'type' ); + } + } } return $dynaformFieldTypes; } diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index d93ecb72b..8cb588376 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -553,34 +553,34 @@ try { echo G::LoadTranslation($_REQUEST['prefix']); break; - case 'getGridList': - G::LoadClass('xmlfield_InputPM'); - $proUid= isset( $_REQUEST['PRO_UID'] )?$_REQUEST['PRO_UID']:''; - - $aFields = getGridsVars( $proUid ); + case 'getGridList': + G::LoadClass('xmlfield_InputPM'); + $proUid= isset( $_REQUEST['PRO_UID'] )?$_REQUEST['PRO_UID']:''; - $aVariables = array(); - foreach ($aFields as $key => $value){ + $aFields = getGridsVars( $proUid ); + + $aVariables = array(); + foreach ($aFields as $key => $value){ $aVariables[] = $aFields[$key]; - } - echo Bootstrap::json_encode( $aVariables ); + } + echo Bootstrap::json_encode( $aVariables ); break; - case 'getVariableGrid': - G::LoadClass('xmlfield_InputPM'); - + case 'getVariableGrid': + G::LoadClass('xmlfield_InputPM'); + $proUid= isset( $_REQUEST['PRO_UID'] )?$_REQUEST['PRO_UID']:''; $dynUid= isset( $_REQUEST['DYN_UID'] )?$_REQUEST['DYN_UID']:''; - $aFields = getVarsGrid($proUid, $dynUid); - + $aFields = getVarsGrid($proUid, $dynUid); + $aVariables = array(); foreach ($aFields as $key => $value) { $aVariables[] = $key; - } - - echo Bootstrap::json_encode( $aVariables ); + } + + echo Bootstrap::json_encode( $aVariables ); break; /* case 'saveFile':