adding the getVariableList action to the processes Ajax method in order to obtain the variables list in JSON format
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dynaForm name="outputdocs/outputdocs_Edit" action="outputdocs/outputdocs_Save" type="xmlform" width="100%" labelWidth="2px" enableTemplate="1">
|
||||
|
||||
<INSERT_VARIABLE type="button" align="right" style="position:absolute;left:700px;top:420px;border-style:double;" onmouseover="saveSelection();" onclick="showDynaformsFormVars('form[TEXT_TEST]','../controls/varsAjax','@#PRO_UID','@#');">
|
||||
<en>@#</en>
|
||||
</INSERT_VARIABLE>
|
||||
|
||||
<PRO_UID type="hidden"/>
|
||||
|
||||
@@ -21,117 +18,9 @@
|
||||
|
||||
<JS type="JavaScript"><![CDATA[
|
||||
|
||||
var _oVarsPanel_;
|
||||
var previousRange;
|
||||
var previousSelection;
|
||||
|
||||
// this section validates if the browser is Internet Explorer
|
||||
// in that case validates if the range of selection is a valid range
|
||||
|
||||
leimnud.event.add(getField('INSERT_VARIABLE'), 'mouseover', function() {
|
||||
// In IE8 and IE7 the iframe is number 3 and Firefox is iframe 1
|
||||
if(document.getElementsByTagName('iframe')[3]!=null){
|
||||
previousRange = document.getElementsByTagName('iframe')[3].contentWindow.document.selection.createRange();
|
||||
// this validates if the selection is out the boundaries of the editor the osffset Left is 2
|
||||
// this lines are to solve some inexplicable issues about IE behavior with
|
||||
// selection ranges
|
||||
if (previousRange.offsetLeft!=2)
|
||||
previousSelection = document.getElementsByTagName('iframe')[3].contentWindow.document.selection.createRange();
|
||||
} else {
|
||||
previousSelection = 0;
|
||||
}
|
||||
});
|
||||
|
||||
//var _oVarsPanel_;
|
||||
|
||||
var showDynaformsFormVars = function(sFieldName, sAjaxServer, sProcess, sSymbol) {
|
||||
|
||||
|
||||
_oVarsPanel_ = new leimnud.module.panel();
|
||||
_oVarsPanel_.options = {
|
||||
limit : true,
|
||||
size : {w:840,h:600},
|
||||
position : {x:0,y:0,center:true},
|
||||
title : '',
|
||||
theme : 'processmaker',
|
||||
statusBar: false,
|
||||
control : {drag:false,resize:true,close:true},
|
||||
fx : {opacity:true,rolled:false,modal:true}
|
||||
};
|
||||
_oVarsPanel_.make();
|
||||
_oVarsPanel_.events = {
|
||||
remove:function() {
|
||||
delete _oVarsPanel_;
|
||||
}.extend(this)
|
||||
};
|
||||
_oVarsPanel_.loader.show();
|
||||
oRPC = new leimnud.module.rpc.xmlhttp({
|
||||
url : sAjaxServer,
|
||||
method: 'POST',
|
||||
args : 'sFieldName=' + sFieldName + '&sProcess=' + sProcess + '&sSymbol=' + sSymbol + '&sType=2'
|
||||
});
|
||||
oRPC.callback = function(oRPC) {
|
||||
_oVarsPanel_.loader.hide();
|
||||
var scs = oRPC.xmlhttp.responseText.extractScript();
|
||||
_oVarsPanel_.addContent(oRPC.xmlhttp.responseText);
|
||||
scs.evalScript();
|
||||
}.extend(this);
|
||||
oRPC.make();
|
||||
};
|
||||
|
||||
/*
|
||||
*
|
||||
* @function insertFormVar
|
||||
* @addedBy Gustavo Cruz
|
||||
* @parameter sFieldName Field objective
|
||||
* @parameter sValue Data that mut be inserted
|
||||
* @sumary This function is a variant of the original insertForm
|
||||
* it works exclusively with the htmlarea editor or perhaps
|
||||
* with some iframe based editors, it pass a sValue o symbol to insert.
|
||||
* The sFieldName is deprecated.
|
||||
* Takes the cursor position and replace the selected
|
||||
* text with the symbol o case variable.
|
||||
* then removes the panel
|
||||
*
|
||||
*/
|
||||
|
||||
var insertFormVar = function(sFieldName, sValue) {
|
||||
// alert(previousRange.text);
|
||||
|
||||
var userSelection;
|
||||
var myIFrame = document.getElementsByTagName('iframe')[0];
|
||||
var myIFrameIE = document.getElementsByTagName('iframe')[3];
|
||||
|
||||
if (myIFrame.contentWindow.getSelection) {
|
||||
|
||||
userSelection = myIFrame.contentWindow.getSelection();
|
||||
var test = document.createElement("span");
|
||||
test.innerHTML = sValue;
|
||||
range = myIFrame.contentWindow.getSelection().getRangeAt(0);
|
||||
range.deleteContents();
|
||||
range.insertNode(test);
|
||||
|
||||
}else if (myIFrameIE.contentWindow.document.selection) {
|
||||
|
||||
var test = document.createElement("span");
|
||||
test.innerHTML = sValue + " ";
|
||||
|
||||
if(userSelection = myIFrameIE.contentWindow.document.selection.createRange()){
|
||||
|
||||
if(previousSelection!=0){
|
||||
previousSelection.pasteHTML(test.outerHTML);
|
||||
}else{
|
||||
_oVarsPanel_.remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
_oVarsPanel_.remove();
|
||||
};
|
||||
function cancel(){
|
||||
outputdocsEditor.remove();
|
||||
}
|
||||
function cancel(){
|
||||
outputdocsEditor.remove();
|
||||
}
|
||||
|
||||
]]></JS>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user