Changes to the variable picker feature before revision meeting with the CTO

This commit is contained in:
user
2012-11-27 15:42:28 -04:00
parent c8f209d90d
commit 8dd2b641da
4 changed files with 124 additions and 110 deletions

View File

@@ -44,12 +44,12 @@ function pmVariablePicker(field_name, url, type, win) {
strUploaderURL = strUploaderURL + "&type=" + type + "&d=" + strUploadPath + "&subs=" + strSubstitutePath;
}
tinyMCE.activeEditor.windowManager.open({ // open the plugin popup
//file : strUploaderURL,
file : strPluginPath + '/VariablePicker.html',
file : '/sysworkflow/en/classic/controls/varsAjax?displayOption=tinyMCE&sSymbol=@@',
title : 'Upload Variable',
width : '600px',
height : '150px',
width : '400px',
height : '350px',
resizable : "yes",
overflow : false,
inline : 1, // This parameter only has an effect if you use the inlinepopups plugin!
close_previous : "no"
}, {
@@ -69,3 +69,8 @@ function closePluginPopup(){
function updateEditorContent(serializedHTML){
tinyMCE.activeEditor.execCommand('mceInsertContent', false, serializedHTML);
}
function insertFormVar(fieldName,serializedHTML){
tinyMCE.activeEditor.execCommand('mceInsertContent', false, serializedHTML);
closePluginPopup();
}

View File

@@ -1,111 +1,113 @@
//function onLoad(){
// generateListValues(document.getElementById('prefix').value);
//}
//window.onload=function(){
//generateListValues(document.getElementById('prefix').value);
//};
var setVariablePickerJS = function(){
var getValue = function (list) {
insertFormVar(document.getElementById('selectedField').value,list.value);
}
var getVariableList = function (queryText, proUid, varType){
varType = varType.toLowerCase();
var responseData
var oRPC = new leimnud.module.rpc.xmlhttp({
url : "../processes/processes_Ajax",
async : false,
method: "POST",
args : "action=getVariableList&process="+proUid+"&queryText="+queryText+"&type="+varType
document.getElementById('_Var_Form_').addEventListener('dblclick', function(){
insertFormVar(document.getElementById('selectedField').value, this.value);
});
oRPC.make();
//alert(oRPC.xmlhttp.responseText);
responseData = eval ("(" +oRPC.xmlhttp.responseText+ ")");
var getVariableList = function (queryText, proUid, varType){
varType = varType.toLowerCase();
var responseData
var oRPC = new leimnud.module.rpc.xmlhttp({
url : "../processes/processes_Ajax",
async : false,
method: "POST",
args : "action=getVariableList&process="+proUid+"&queryText="+queryText+"&type="+varType
});
return responseData;
}
oRPC.make();
//alert(oRPC.xmlhttp.responseText);
responseData = eval ("(" +oRPC.xmlhttp.responseText+ ")");
var getPrefix = function (prefix) {
if(document.getElementById('prefix').value=='ID_TO_STRING')
prefix='@@';
else if(document.getElementById('prefix').value=='ID_TO_FLOAT')
prefix='@#';
else if(document.getElementById('prefix').value=='ID_TO_INTEGER')
prefix='@%';
else if(document.getElementById('prefix').value=='ID_TO_URL')
prefix='@?';
else if(document.getElementById('prefix').value=='ID_SQL_ESCAPE')
prefix='@$';
else if(document.getElementById('prefix').value=='ID_REPLACE_WITHOUT_CHANGES')
prefix='@=';
return prefix;
}
return responseData;
}
var getPrefixInfo = function (prefix){
var oRPC = new leimnud.module.rpc.xmlhttp({
url : "../processes/processes_Ajax",
async : false,
method: "POST",
args : "action=getVariablePrefix&prefix="+prefix
});
oRPC.make();
return oRPC.xmlhttp.responseText;
}
var getPrefix = function (prefix) {
if(document.getElementById('prefix').value=='ID_TO_STRING')
prefix='@@';
else if(document.getElementById('prefix').value=='ID_TO_FLOAT')
prefix='@#';
else if(document.getElementById('prefix').value=='ID_TO_INTEGER')
prefix='@%';
else if(document.getElementById('prefix').value=='ID_TO_URL')
prefix='@?';
else if(document.getElementById('prefix').value=='ID_SQL_ESCAPE')
prefix='@$';
else if(document.getElementById('prefix').value=='ID_REPLACE_WITHOUT_CHANGES')
prefix='@=';
return prefix;
}
leimnud.event.add(document.getElementById('type_variables'), 'change', function(event) {
var prefix=getPrefix(document.getElementById('prefix').value);
generateListValues(prefix);
});
var getPrefixInfo = function (prefix){
var oRPC = new leimnud.module.rpc.xmlhttp({
url : "../processes/processes_Ajax",
async : false,
method: "POST",
args : "action=getVariablePrefix&prefix="+prefix
});
oRPC.make();
return oRPC.xmlhttp.responseText;
}
leimnud.event.add(document.getElementById('prefix'), 'change', function(event) {
var prefix=getPrefix(document.getElementById('prefix').value);
generateListValues(prefix);
});
leimnud.event.add(document.getElementById('_Var_Form_'), 'change', function(event) {
document.getElementById('selectedVariableLabel').textContent = document.getElementById('_Var_Form_').value
});
leimnud.event.add(document.getElementById('search'), 'keypress', function(e) {
var prefix=getPrefix(document.getElementById('prefix').value);
var key = e.keyCode;
if(key == '13'){
leimnud.event.add(document.getElementById('type_variables'), 'change', function(event) {
var prefix=getPrefix(document.getElementById('prefix').value);
generateListValues(prefix);
});
e.cancelBubble = true;
e.returnValue = false;
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
leimnud.event.add(document.getElementById('prefix'), 'change', function(event) {
var prefix=getPrefix(document.getElementById('prefix').value);
generateListValues(prefix);
});
leimnud.event.add(document.getElementById('_Var_Form_'), 'change', function(event) {
document.getElementById('selectedVariableLabel').textContent = document.getElementById('_Var_Form_').value
});
leimnud.event.add(document.getElementById('search'), 'keypress', function(e) {
var prefix=getPrefix(document.getElementById('prefix').value);
var key = e.keyCode;
if(key == '13'){
generateListValues(prefix);
e.cancelBubble = true;
e.returnValue = false;
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
}
}
});
});
function generateListValues (prefix){
var list = getVariableList(document.getElementById('search').value, document.getElementById('process').value, document.getElementById('type_variables').value);
var combo = document.getElementById("_Var_Form_");
var option = document.createElement('option');
function generateListValues (prefix){
var list = getVariableList(document.getElementById('search').value, document.getElementById('process').value, document.getElementById('type_variables').value);
var combo = document.getElementById("_Var_Form_");
var option = document.createElement('option');
for(i=(combo.length-1); i>=0; i--)
{
aBorrar = combo.options[i];
aBorrar.parentNode.removeChild(aBorrar);
}
if(list.length>0){
for(i=0; i<list.length; i++)
for(i=(combo.length-1); i>=0; i--)
{
option = document.createElement("OPTION");
option.value = list[i].sName;
option.text = prefix+list[i].sName+' ('+list[i].sLabel+')';
combo.add(option);
aBorrar = combo.options[i];
aBorrar.parentNode.removeChild(aBorrar);
}
if(list.length>0){
for(i=0; i<list.length; i++)
{
option = document.createElement("OPTION");
option.value = prefix+list[i].sName;
option.text = prefix+list[i].sName+' ('+list[i].sLabel+')';
combo.add(option);
}
} else {
option = document.createElement("OPTION");
option.value = 0;
option.text = 'No results';
combo.add(option);
}
} else {
option = document.createElement("OPTION");
option.value = 0;
option.text = 'No results';
combo.add(option);
}
}
if (document.readyState == 'complete'){
setVariablePickerJS();
} else {
document.body.onload = setVariablePickerJS;
}

View File

@@ -95,10 +95,10 @@ $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;' : '') . '" ondblclick="getValue(this);">';
$html .= '<select name="_Var_Form_" id="_Var_Form_" size="8" style="width:100%;' . (! isset( $_POST['sNoShowLeyend'] ) ? 'height:170;' : '') . '" >';
foreach ($aFields as $aField) {
$html .= '<option value="' . $_POST['sSymbol'] . $aField['sName'] . '">' . $_POST['sSymbol'] . $aField['sName'] . ' (' . $aField['sType'] . ')</option>';
$html .= '<option value="' . $_REQUEST['sSymbol'] . $aField['sName'] . '">' . $_REQUEST['sSymbol'] . $aField['sName'] . ' (' . $aField['sType'] . ')</option>';
}
$aRows[0] = Array ('fieldname' => 'char','variable' => 'char','type' => 'type','label' => 'char');
@@ -134,13 +134,20 @@ $html .= '</div>';
$html .= '</form>';
$display = 'raw';
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/controls/variablePicker.js');
if($_REQUEST['displayOption']=='tinyMCE'){
$display = 'blank';
$oHeadPublisher->addScriptFile('/js/tinymce/jscripts/tiny_mce/tiny_mce_popup.js');
$oHeadPublisher->addScriptFile('/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin_src.js');
}
echo $html;
G::RenderPage( 'publish', 'raw' );
G::RenderPage( 'publish', $display );
/*
$alll = '<script type="text/javascript" language="javascript">';
$alll .= 'function Seleccionar(combo){';

View File

@@ -8,7 +8,7 @@
<en><![CDATA[<div align="center">Edit @#filename email template</div>]]></en>
</TITLE>
<fcontent type="wysiwyg_editor" editorType="EMAIL_TEMPLATE" height="420" width="720" defaultValue="">
<fcontent type="wysiwyg_editor" editorType="EMAIL_TEMPLATE" height="380" width="720" defaultValue="">
<en/>
</fcontent>