The variable picker in the event section is now the same as the rest of ProcessMaker
This commit is contained in:
@@ -1,84 +1,84 @@
|
||||
/**
|
||||
* 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=@@';
|
||||
|
||||
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();
|
||||
}
|
||||
/**
|
||||
* 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=@@';
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -75,11 +75,12 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
*/
|
||||
public function attachEvents ($element)
|
||||
{
|
||||
//cleaning the conflictive prototype functions
|
||||
$editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"';
|
||||
|
||||
$editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; ';
|
||||
|
||||
switch ($this->editorType){
|
||||
case 'EMAIL_TEMPLATE':
|
||||
$editorDefinition = '
|
||||
$editorDefinition .= '
|
||||
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",
|
||||
@@ -110,7 +111,7 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
break;
|
||||
case 'OUTPUT_DOCUMENT':
|
||||
|
||||
$editorDefinition = '
|
||||
$editorDefinition .= '
|
||||
tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"
|
||||
tinyMCE.init({
|
||||
theme : "advanced",
|
||||
@@ -136,7 +137,7 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
break;
|
||||
|
||||
case 'DYNAFORM_TEMPLATE':
|
||||
$editorDefinition = '
|
||||
$editorDefinition .= '
|
||||
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",
|
||||
@@ -168,12 +169,11 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
return true;
|
||||
}
|
||||
});
|
||||
alert("new");
|
||||
alert(tinyMCE.execCommand("mceRmoveControl", false, "form[HTML]"));
|
||||
|
||||
';
|
||||
break;
|
||||
default:
|
||||
$editorDefinition = '
|
||||
$editorDefinition .= '
|
||||
tinyMCE.init({
|
||||
theme : "advanced",
|
||||
plugins : "fullpage",
|
||||
@@ -192,7 +192,6 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
';
|
||||
break;
|
||||
}
|
||||
|
||||
return $editorDefinition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
var setVariablePickerJS = function(){
|
||||
|
||||
document.getElementById('_Var_Form_').addEventListener('dblclick', function(){
|
||||
insertFormVar(document.getElementById('selectedField').value, this.value);
|
||||
if (this.getAttribute('displayOption')=='event'){
|
||||
e.insertFormVar(this.value.substring(2), this.value.substring(2), 'dyn' );
|
||||
} else {
|
||||
insertFormVar(document.getElementById('selectedField').value, this.value);
|
||||
}
|
||||
});
|
||||
|
||||
var getVariableList = function (queryText, proUid, varType){
|
||||
|
||||
@@ -161,8 +161,10 @@ var EventCompose = function(t){
|
||||
oPanel.make();
|
||||
oPanel.loader.show();
|
||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||
url : '../events/eventsAjax',
|
||||
args: 'request=showDynavars'
|
||||
// url : '../events/eventsAjax',
|
||||
// args: 'request=showDynavars',
|
||||
url : '../controls/varsAjax',
|
||||
args: 'sSymbol=@@&displayOption=event'
|
||||
});
|
||||
oRPC.callback = function(rpc) {
|
||||
oPanel.loader.hide();
|
||||
@@ -197,6 +199,26 @@ var EventCompose = function(t){
|
||||
newOption.selected=true;
|
||||
o.options[o.options.length] = newOption;
|
||||
}
|
||||
this.insertFormVar= function(id, value, prefix){
|
||||
|
||||
if(this.exists(id)) {
|
||||
new leimnud.module.app.alert().make({label: G_STRINGS.EVENT_EMAILEXISTS});
|
||||
return false;
|
||||
}
|
||||
|
||||
this.deselectAll();
|
||||
o = getField(this.target);
|
||||
|
||||
if(prefix == 'dyn'){
|
||||
var newOption = new Option('@#'+value, prefix+"|"+id);
|
||||
} else {
|
||||
var newOption = new Option(value, prefix+"|"+id);
|
||||
}
|
||||
|
||||
newOption.selected=true;
|
||||
o.options[o.options.length] = newOption;
|
||||
oPanel.remove();
|
||||
}
|
||||
this.dropSel= function(){
|
||||
var o = getField(this.target);
|
||||
c=0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* 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"]:'';
|
||||
$_POST["sProcess"] = isset($_POST["sProcess"])?$_POST["sProcess"]:$_SESSION['process'];
|
||||
$_POST["sFieldName"] = isset($_POST["sFieldName"])?$_POST["sFieldName"]:'';
|
||||
$_POST['sSymbol']= isset($_POST["sSymbol"])?$_POST["sSymbol"]:'';
|
||||
|
||||
@@ -98,9 +98,15 @@ $aFields = getDynaformsVars( $_POST['sProcess'], true, isset( $_POST['bIncMulSel
|
||||
|
||||
//$html .= '<select name="_Var_Form_" id="_Var_Form_" size="' . count( $aFields ) . '" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:50%;' : '') . '" ondblclick="insertFormVar(\'' . $_POST['sFieldName'] . '\', this.value);">';
|
||||
|
||||
$html .= '<select name="_Var_Form_" id="_Var_Form_" size="8" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:170;' : '') . '" >';
|
||||
$displayOption = '';
|
||||
if (isset($_REQUEST['displayOption'])){
|
||||
$displayOption = 'displayOption="'.$_REQUEST['displayOption'].'"';
|
||||
} else {
|
||||
$displayOption = 'displayOption="normal"' ;
|
||||
}
|
||||
$html .= '<select name="_Var_Form_" id="_Var_Form_" size="8" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:170;' : '') . '" '.$displayOption.'>';
|
||||
|
||||
foreach ($aFields as $aField) {
|
||||
foreach ($aFields as $aField) {
|
||||
$html .= '<option value="' . $_REQUEST['sSymbol'] . $aField['sName'] . '">' . $_REQUEST['sSymbol'] . $aField['sName'] . ' (' . $aField['sType'] . ')</option>';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user