diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/VariablePicker.html b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/VariablePicker.html deleted file mode 100644 index 1210d28e6..000000000 --- a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/VariablePicker.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - -
' -
- - - - - - - - - - - - -
- - -      - - -
-
- -
- -
- - - - - - - - - -
Result@#SYS_LANG
DescriptionDescription @#SYS_LANG
-
- -
- -
- -
-
- - \ No newline at end of file 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 655d90fd3..a22b6d6fb 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 @@ -13,7 +13,7 @@ }); ed.addButton('pmGrids', { title: 'pmGrids', - label : ' @# Grids', + label : ' @#', cmd: 'mcepmGrids', image: url + '/img/grids.png' }); @@ -33,11 +33,14 @@ // with the path of the uploaded file function pmGrids(field_name, url, type, win) { //tinyMCE.activeEditor.anyVariable='path/to/ProcessMaker' - tinyMCE.activeEditor.windowManager.open({ // open the plugin popup - file : '/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.html', - title : '', + 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', - height : '330px', + height : '230px', resizable : "yes", scrollbars : "no", overflow : false, 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 655d90fd3..a79d0a8dc 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 @@ -13,7 +13,7 @@ }); ed.addButton('pmGrids', { title: 'pmGrids', - label : ' @# Grids', + label : ' @#', cmd: 'mcepmGrids', image: url + '/img/grids.png' }); @@ -33,11 +33,14 @@ // 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 - file : '/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.html', - title : '', + file : strScriptURL, + title : 'ProcessMaker Grid Wizard', width : '600px', - height : '330px', + height : '230px', resizable : "yes", scrollbars : "no", overflow : false, 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 003b4ebc7..88adc2e3b 100644 --- a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.html +++ b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.html @@ -10,33 +10,29 @@ and open the template in the editor. - + +
@@ -44,7 +40,9 @@ and open the template in the editor.
- +
@@ -53,8 +51,11 @@ and open the template in the editor. Prefix
-
- +
+
@@ -63,7 +64,7 @@ and open the template in the editor.
-
+
Border
@@ -73,15 +74,32 @@ and open the template in the editor.
-
+
Headers
-
- -
+
+ +
+
+
+
+
+
+ + +
+ +
+
+
diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.js b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.js new file mode 100644 index 000000000..434ef4b30 --- /dev/null +++ b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.js @@ -0,0 +1,125 @@ + $(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", + 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+ ")"); + 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", + type: "POST", + data: {action : 'getGridFieldList', PRO_UID: tinyMCE.activeEditor.processID, DYN_UID: gridUid}, + dataType: "json", + success: function (data) { + $.each(responseData, function(index, element) { + $('#listContainer').append($('
', { + text: element.name + })); + }); + } + });*/ + + $('#listContainer').html(''); + var divHeader = ''; + var divCell = ''; + $.each(responseData, function(index, element){ + divHeader += ""; + divCell += ""+element.name+""; + }); + divHeader += ""; + divCell += ""; + + $('#listContainer').append(divHeader+divCell); + + } + + var generateListValues = function(){ + var list = getGridList(); + var combo = document.getElementById("gridList"); + var option = document.createElement('option'); + for(i=(combo.length-1); i>=0; i--) + { + var aDelete = combo.options[i]; + aDelete.parentNode.removeChild(aDelete); + } + + if(list.length>0){ + for(i=0; i-->"; + var headerCode = ""; + var fieldCode = ""; + + $('#listContainer .headerField').each(function(i){ + if (this.checked == true) { + headerCode += ""+$('#'+this.value).val()+""; + fieldCode += ""+$('#prefixList').val()+$('#field_'+this.value).val()+""; + } + }); + headerCode += ""; + fieldCode += ""; + + gridCode += fieldCode+""; + tableCode += gridCode+"" + updateEditorContent (tableCode); + closePluginPopup(); + } + + $('#gridList').change(function(){ + getGridFieldList($(this).val()); + }); + + $('#addButton').click(function(){ + insertFormatedGrid(); + }); + + $('#cancelButton').click(function(){ + closePluginPopup(); + }); + + generateListValues(); + getGridFieldList($("#gridList").val()); +}); \ No newline at end of file diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.php b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.php deleted file mode 100644 index 857caf9a6..000000000 --- a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/pmGrids.php +++ /dev/null @@ -1,128 +0,0 @@ - - Upload an Output Document - - - - - - - - - -' - //.'Variable Name:
' - .'
' - .'' - - .'' - .'' - - .'' - - .'' - .'' - - .'' - .'' - - .'' - - .'' - .'' - .'
' - .'' - .'' - .'' - .'' - .'' - .'
' - .'     ' - .'' - .'     ' - .'' - .'' - .'
' - .'
' - - .'
' - .'
' - .'' - .'' - .'' - .'' - .'' - .'' - .'' - .'' - .'' - .'
Result@#SYS_LANG
DescriptionDescription @#SYS_LANG
' - .'
' - - .'
' - .'
' - .'' - .'
' - - //.'
' - // .'' - //.' ' - .''; - */ -} -// uploads the file to the destination path, and returns a link with link path substituted for destination path -function uploadVariablePicker() -{ - $StatusMessage = ""; - $ActualFileName = ""; - $FileObject = $_REQUEST["upload_variable"]; // find data on the file - - updateEditorContent(trim($FileObject)); - closeWindow(); -} - - -function showPopUp($PopupText) -{ - echo ""; -} - -function updateEditorContent($serializedHTML) -{ - echo ""; -} - -function closeWindow() -{ - echo ' - - '; -} -?> - diff --git a/gulliver/system/class.wysiwygEditor.php b/gulliver/system/class.wysiwygEditor.php index 28b75fe55..a9a108f16 100644 --- a/gulliver/system/class.wysiwygEditor.php +++ b/gulliver/system/class.wysiwygEditor.php @@ -123,8 +123,8 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field editor_selector : "tmceEditor", width : "770", height : "305", - - theme_advanced_buttons1 : "pmSimpleUploader,|,pmVariablePicker,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste,|,bullist,numlist,|,outdent,indent,blockquote", + 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; diff --git a/workflow/engine/js/controls/variablePicker.js b/workflow/engine/js/controls/variablePicker.js index db9df41b3..ed7aee41f 100755 --- a/workflow/engine/js/controls/variablePicker.js +++ b/workflow/engine/js/controls/variablePicker.js @@ -109,9 +109,13 @@ var setVariablePickerJS = function(){ } } } +// check wether the document has been already loaded or not, +// whatever the state is this condition ensures that the events are always loaded if (document.readyState == 'complete'){ + // if completed load the functions and events setVariablePickerJS(); } else { + // if not set the function call in the body onload event document.body.onload = setVariablePickerJS; }