Merge remote-tracking branch 'origin/master'

This commit is contained in:
Gustavo Cruz
2012-11-30 14:29:13 -04:00
4 changed files with 166 additions and 18 deletions

View File

@@ -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);
}

View File

@@ -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();
}

View File

@@ -91,8 +91,6 @@ 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",
@@ -125,8 +123,6 @@ 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",
@@ -154,7 +150,7 @@ 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",

View File

@@ -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 = '<form action="uploader.php?'.$_SERVER["QUERY_STRING"].'&q=upload" onLoad="onLoad()" method="post" enctype="multipart/form-data" onsubmit="">';
$html .= '<div id="d_variables">';