135 lines
4.4 KiB
XML
Executable File
135 lines
4.4 KiB
XML
Executable File
<?xml version="1.0" encoding="UTF-8"?>
|
|
<dynaForm name="outputdocs/outputdocs_Edit" 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"/>
|
|
|
|
<OUT_DOC_UID type="hidden" showInTable="0"/>
|
|
|
|
<OUT_DOC_TEMPLATE type="html" width="100%" height="365px" defaultValue="<br/>"/>
|
|
|
|
<ACCEPT type="button" onclick="outputdocsSave(this.form);">
|
|
<en>Save</en>
|
|
</ACCEPT>
|
|
<BTN_CANCEL type="button" onclick="cancel();">
|
|
<en>Cancel</en>
|
|
</BTN_CANCEL>
|
|
|
|
<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 showDynaformsFormVars = function(sFieldName, sAjaxServer, sProcess, sSymbol) {
|
|
|
|
|
|
_oVarsPanel_ = new leimnud.module.panel();
|
|
_oVarsPanel_.options = {
|
|
limit : true,
|
|
size : {w:440,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(){
|
|
currentPopupWindow.remove();
|
|
}
|
|
|
|
]]></JS>
|
|
|
|
</dynaForm> |