diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/editor_plugin.js b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/editor_plugin.js new file mode 100644 index 000000000..90487919b --- /dev/null +++ b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/editor_plugin.js @@ -0,0 +1,69 @@ +/** +* Name: editor_plugin_src.js (for pmSimpleUploader tinyMCE plugin) +**/ + +(function(){ + var strPluginURL; + tinymce.create('tinymce.plugins.pmSimpleUploaderPlugin', { + init: function(ed, url) + { + strPluginURL = url; // store the URL for future use.. + ed.addCommand('mcepmSimpleUploader', function() { + pmSimpleUploader(); + }); + ed.addButton('pmSimpleUploader', { + title: 'pmSimpleUploader', + label : 'Upload File', + cmd: 'mcepmSimpleUploader', + image: url + '/img/pmSimpleUploader.png' + }); + }, + createControl: function(n, cm) { + return null; + }, + getPluginURL: function() { + return strPluginURL; + } + }); + tinymce.PluginManager.add('pmSimpleUploader', tinymce.plugins.pmSimpleUploaderPlugin); +})(); + +// this function can get called from the plugin inint (above) or from the callback on advlink/advimg plugins.. +// in the latter case, win and type will be set.. In the rist case, we will just update the main editor window +// with the path of the uploaded file +function pmSimpleUploader(field_name, url, type, win) { + var strPluginPath = tinyMCE.activeEditor.plugins.pmSimpleUploader.getPluginURL(); // get the path to the uploader plugin + var strUploaderURL = strPluginPath + "/uploader.php"; // generate the path to the uploader script + var strUploadPath = tinyMCE.activeEditor.getParam('plugin_pmSimpleUploader_upload_path'); // get the relative upload path + var strSubstitutePath = tinyMCE.activeEditor.getParam('plugin_pmSimpleUploader_upload_substitute_path'); // get the path we'll substitute for the for the upload path (i.e. fully qualified) + + if (strUploaderURL.indexOf("?") < 0){ // if we were called without any GET params + strUploaderURL = strUploaderURL + "?type=" + type + "&d=" + strUploadPath + "&subs=" + strSubstitutePath; // add our own params + } else { + strUploaderURL = strUploaderURL + "&type=" + type + "&d=" + strUploadPath + "&subs=" + strSubstitutePath; + } + tinyMCE.activeEditor.windowManager.open({ // open the plugin popup + file : strUploaderURL, + title : 'Upload from file', + width : 500, + height : 100, + resizable : "yes", + inline : 1, // This parameter only has an effect if you use the inlinepopups plugin! + close_previous : "no" + }, { + window : win, + input : field_name + }); + + return false; +} +// 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(){ + tinyMCEPopup.close(); // close popup window +} + +function updateEditorContent(serializedHTML){ + tinyMCE.activeEditor.execCommand('mceSetContent', false, serializedHTML); +} \ No newline at end of file diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin.js b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin.js new file mode 100644 index 000000000..8941d8204 --- /dev/null +++ b/gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin.js @@ -0,0 +1,83 @@ +/** +* Name: editor_plugin_src.js (for pmVariablePicker tinyMCE plugin) +**/ + +(function(){ + var strPluginURL; + tinymce.create('tinymce.plugins.pmVariablePickerPlugin', { + init: function(ed, url) + { + strPluginURL = url; // store the URL for future use.. + ed.addCommand('mcepmVariablePicker', function() { + pmVariablePicker(); + }); + ed.addButton('pmVariablePicker', { + title: 'pmVariablePicker', + label : ' @#', + cmd: 'mcepmVariablePicker', + image: url + '/img/picker.png' + }); + }, + createControl: function(n, cm) { + return null; + }, + getPluginURL: function() { + return strPluginURL; + } + }); + tinymce.PluginManager.add('pmVariablePicker', tinymce.plugins.pmVariablePickerPlugin); +})(); + +// this function can get called from the plugin inint (above) or from the callback on advlink/advimg plugins.. +// in the latter case, win and type will be set.. In the rist case, we will just update the main editor window +// with the path of the uploaded file +function pmVariablePicker(field_name, url, type, win) { + + var uloc=String(location); + //alert(uloc); + var new_text = uloc.split('/'); + var loc='/'+new_text[3]+'/'+new_text[4]+'/'+new_text[5]+'/controls/varsAjax?displayOption=tinyMCE&sSymbol=@@&&sProcess='+tinyMCE.activeEditor.processID; + var strPluginPath = tinyMCE.activeEditor.plugins.pmVariablePicker.getPluginURL(); // get the path to the uploader plugin + var strUploaderURL = strPluginPath + "/uploader.php"; // generate the path to the uploader script + var strUploadPath = tinyMCE.activeEditor.getParam('plugin_pmVariablePicker_upload_path'); // get the relative upload path + var strSubstitutePath = tinyMCE.activeEditor.getParam('plugin_pmVariablePicker_upload_substitute_path'); // get the path we'll substitute for the for the upload path (i.e. fully qualified) + + if (strUploaderURL.indexOf("?") < 0){ // if we were called without any GET params + strUploaderURL = strUploaderURL + "?type=" + type + "&d=" + strUploadPath + "&subs=" + strSubstitutePath; // add our own params + } else { + strUploaderURL = strUploaderURL + "&type=" + type + "&d=" + strUploadPath + "&subs=" + strSubstitutePath; + } + //tinyMCE.activeEditor.anyVariable='path/to/ProcessMaker' + tinyMCE.activeEditor.windowManager.open({ // open the plugin popup + //file : '/sysworkflow/en/classic/controls/varsAjax?displayOption=tinyMCE&sSymbol=@@', + file : loc, + title : 'Upload Variable', + width : '600px', + height : '330px', + resizable : "yes", + scrollbars : "no", + overflow : false, + inline : 1, // This parameter only has an effect if you use the inlinepopups plugin! + close_previous : "no" + }, { + window : win, + input : field_name + }); + + return false; +} +// 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(){ + tinyMCEPopup.close(); // close popup window +} + +function updateEditorContent(serializedHTML){ + tinyMCE.activeEditor.execCommand('mceInsertContent', false, serializedHTML); +} + +function insertFormVar(fieldName,serializedHTML){ + tinyMCE.activeEditor.execCommand('mceInsertContent', false, serializedHTML); + closePluginPopup(); +} diff --git a/gulliver/system/class.wysiwygEditor.php b/gulliver/system/class.wysiwygEditor.php index 63d12e987..b658f8362 100644 --- a/gulliver/system/class.wysiwygEditor.php +++ b/gulliver/system/class.wysiwygEditor.php @@ -76,14 +76,14 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field */ public function attachEvents ($element) { - + $editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; '; - + switch ($this->editorType){ case 'EMAIL_TEMPLATE': $editorDefinition .= ' // is necessary the process uid variable in order to load the picker correctly - var formProcessID = document.getElementById("form[pro_uid]").value; + var formProcessID = document.getElementById("form[pro_uid]").value; tinyMCE.init({ theme : "advanced", plugins : "advhr,advimage,advlink,advlist,autolink,autoresize,autosave,contextmenu,directionality,emotions,example,example_dependency,fullpage,fullscreen,iespell,inlinepopups,insertdatetime,layer,legacyoutput,lists,media,nonbreaking,noneditable,pagebreak,paste,preview,print,save,searchreplace,spellchecker,style,tabfocus,table,template,visualblocks,visualchars,wordcount,xhtmlxtras,pmSimpleUploader,pmVariablePicker", @@ -91,9 +91,7 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field editor_selector : "tmceEditor", width : 760, height : "'.$this->height.'", - //theme_advanced_buttons1 : "pmSimpleUploader,|,pmVariablePicker,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull", - //theme_advanced_buttons2 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull", - + 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 (){ @@ -115,7 +113,7 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field '; break; case 'OUTPUT_DOCUMENT': - $editorDefinition .= ' + $editorDefinition .= ' // is necessary the process uid variable in order to load the picker correctly var formProcessID = document.getElementById("form[PRO_UID]").value; tinyMCE.init({ @@ -125,13 +123,11 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field editor_selector : "tmceEditor", width : "770", height : "305", - //theme_advanced_buttons1 : "pmSimpleUploader,|,pmVariablePicker", - //theme_advanced_buttons2 : "fontselect,bold,italic,underline,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,numlist,bullist,|,code", - + 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; }, onchange_callback: function(inst) { if(inst.isDirty()) { @@ -154,9 +150,9 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field editor_selector : "tmceEditor", width : "700", height : "300", - theme_advanced_buttons1 : "pmSimpleUploader,|,pmVariablePicker,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste,|,bullist,numlist", + theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste,|,bullist,numlist", theme_advanced_buttons2 : "outdent,indent,blockquote,|,undo,redo,|,link,unlink,image,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,sub,sup,|,ltr,rtl,|,code", - + skin : "o2k7", skin_variant : "silver", @@ -176,7 +172,7 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field return true; } }); - + '; break; default: @@ -188,7 +184,7 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field editor_selector : "tmceEditor", width : "'. $this->width. '", height : "'. $this->height. '", - theme_advanced_buttons3_add : "fullpage", + theme_advanced_buttons3_add : "fullpage", handle_event_callback : function(e) { if(this.isDirty()) { this.save(); diff --git a/workflow/engine/methods/controls/varsAjax.php b/workflow/engine/methods/controls/varsAjax.php index 687fa26f9..436b88cbf 100755 --- a/workflow/engine/methods/controls/varsAjax.php +++ b/workflow/engine/methods/controls/varsAjax.php @@ -22,9 +22,9 @@ * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ $_SERVER["QUERY_STRING"] = isset($_SERVER["QUERY_STRING"])?$_SERVER["QUERY_STRING"]:''; -$_POST["sProcess"] = isset($_POST["sProcess"])?$_POST["sProcess"]:$_SESSION['PROCESS']; -$_POST["sFieldName"] = isset($_POST["sFieldName"])?$_POST["sFieldName"]:''; -$_POST['sSymbol']= isset($_POST["sSymbol"])?$_POST["sSymbol"]:''; +$_REQUEST["sProcess"] = isset($_REQUEST["sProcess"])?$_REQUEST["sProcess"]:''; +$_REQUEST["sFieldName"] = isset($_REQUEST["sFieldName"])?$_REQUEST["sFieldName"]:''; +$_REQUEST['sSymbol']= isset($_REQUEST["sSymbol"])?$_REQUEST["sSymbol"]:''; $html = '
'; $html .= '
';