BUG 9548 "Agregar la posibilidad de copiar triggers" SOLVED

- New feature
- Add the ability to copy triggers
- Copy trigger option was added in DESIGNER>TRIGGERS
* Available from version 2.0.46
This commit is contained in:
Victor Saisa Lopez
2012-11-07 16:59:48 -04:00
parent c8379820db
commit ba6c87b9f2
7 changed files with 300 additions and 87 deletions

View File

@@ -0,0 +1,62 @@
<form id="{$form_id}" name="" action="{$form_action}" class="{$form_className}" method="post" encType="multipart/form-data" style="margin:0px;" onsubmit="return validateForm('{$form_objectRequiredFields}');"> <div class="borderForm" style="width:{$form_width}; padding-left:0; padding-right:0; border-width:{$form_border};">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content" style="height:{$form_height};" >
<table width="99%">
<tr>
<td valign='top'>
<input type="hidden" class="notValidateThisFields" name="__notValidateThisFields__" id="__notValidateThisFields__" value="{$form_objectRequiredFields}" />
<input type="hidden" name="DynaformRequiredFields" id="DynaformRequiredFields" value="{$form_objectRequiredFields}" />
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr style="display: none">
<td colspan="2">{$form.PRO_UID}</td>
</tr>
<tr style="display: none">
<td colspan="2">{$form.TRI_UID}</td>
</tr>
<tr style="display: none">
<td colspan="2">{$form.TRI_PARAM}</td>
</tr>
<tr style="display: none">
<td colspan="2">{$form.TRI_TYPE}</td>
</tr>
<tr style="display: none">
<td colspan="2">{$form.FIELDS_REQUIRED}</td>
</tr>
<tr>
<td class='FormTitle' colspan="2" align="">{$form.LBLTITLE1}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}">{$PROCESS_UID}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.PROCESS_UID}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}">{$TRIGGER_UID}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRIGGER_UID}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}"><font color="red">* </font>{$TRI_TITLE}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_TITLE}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}">{$TRI_DESCRIPTION}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_DESCRIPTION}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}">{$TRI_WEBBOT}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_WEBBOT}</td>
</tr>
<tr>
<td class='FormButton' colspan="2" align="center">{$form.BTNCOPYSAVE}&nbsp;{$form.BTNCANCEL}</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="FormRequiredTextMessage"><font color="red">* </font>Required Field</div> </div>
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
</div>
<script type="text/javascript">
{$form.JS}
</script>
</form>

View File

@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm mode="edit" width="100%" labelWidth="28%" enableTemplate="1">
<PRO_UID type="hidden"/>
<TRI_UID type="hidden"/>
<TRI_PARAM type="hidden"/>
<TRI_TYPE type="hidden"/>
<FIELDS_REQUIRED type="hidden"/>
<LANG type="private"/>
<LBLTITLE1 type="title">
<en>Trigger Information</en>
</LBLTITLE1>
<PROCESS_UID type="dropdown" dependentfields="TRIGGER_UID">
SELECT PRO.PRO_UID, CON.CON_VALUE
FROM PROCESS AS PRO, CONTENT AS CON
WHERE PRO.PRO_UID = CON.CON_ID AND CON.CON_CATEGORY = 'PRO_TITLE' AND CON.CON_LANG = '@#LANG'
ORDER BY CON.CON_VALUE ASC
<en>
Process
<option name="">- Select a process -</option>
</en>
</PROCESS_UID>
<TRIGGER_UID type="dropdown" dependentfields="TRI_DESCRIPTION,TRI_WEBBOT">
SELECT TGR.TRI_UID, CON.CON_VALUE
FROM TRIGGERS AS TGR, CONTENT AS CON
WHERE TGR.PRO_UID = '@#PROCESS_UID' AND
TGR.TRI_UID = CON.CON_ID AND CON.CON_CATEGORY = 'TRI_TITLE' AND CON.CON_LANG = '@#LANG'
ORDER BY CON.CON_VALUE ASC
<en>
Trigger
<option name="">- Select a trigger -</option>
</en>
</TRIGGER_UID>
<TRI_TITLE type="text" size="70" maxlength="100" required="1">
<en>Title of the new trigger</en>
</TRI_TITLE>
<TRI_DESCRIPTION type="textarea" rows="3" cols="67">
SELECT CON.CON_VALUE
FROM CONTENT AS CON
WHERE CON.CON_ID = '@#TRIGGER_UID' AND CON.CON_CATEGORY = 'TRI_DESCRIPTION' AND CON.CON_LANG = '@#LANG'
<en>Description of the new trigger</en>
</TRI_DESCRIPTION>
<TRI_WEBBOT type="textarea" rows="10" cols="67" readonly="1">
SELECT TGR.TRI_WEBBOT
FROM TRIGGERS AS TGR
WHERE TGR.TRI_UID = '@#TRIGGER_UID'
<en>Script</en>
</TRI_WEBBOT>
<BTNCOPYSAVE type="button" onclick="triggerSave1(this.form);">
<en>Copy/Import and Save</en>
</BTNCOPYSAVE>
<BTNCANCEL type="button" onclick="cancel(); triggerFromLibrary();">
<en>Cancel</en>
</BTNCANCEL>
<JS type="javascript">
<![CDATA[
function cancel()
{
currentPopupWindow.remove();
}
var cboTriggerUid = getField("TRIGGER_UID");
var txtTgrTitle = getField("TRI_TITLE");
leimnud.event.add(
getField("PROCESS_UID"),
"change",
function ()
{
txtTgrTitle.value = "";
}
);
leimnud.event.add(
cboTriggerUid,
"change",
function ()
{
txtTgrTitle.value = "";
if (cboTriggerUid.value != "") {
txtTgrTitle.value = cboTriggerUid.options[cboTriggerUid.selectedIndex].text;
}
}
);
txtTgrTitle.form.onsubmit = function () { return false; };
]]>
</JS>
</dynaForm>

View File

@@ -19,7 +19,7 @@
<tr>
<td class='FormLabel' width="{$form_labelWidth}">{$TRI_TITLE}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.TRI_TITLE} </td> //-->
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_TITLE}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_TITLE}</td>
</tr>
<tr style="display: none">
<td colspan="2">{$form.TRI_PARAM}</td>
@@ -30,17 +30,17 @@
<tr>
<td class='FormLabel' width="{$form_labelWidth}">{$TRI_DESCRIPTION}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.TRI_DESCRIPTION} </td> //-->
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_DESCRIPTION}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_DESCRIPTION}</td>
</tr>
<tr>
<td class='FormLabel' width="{$form_labelWidth}">{$TRI_WEBBOT}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.TRI_WEBBOT} </td> //-->
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_WEBBOT}</td>
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.TRI_WEBBOT}</td>
</tr>
<tr>
<td class='FormButton' colspan="2" align="center">{$form.SAVE}{$form.BTN_CANCEL}</td>
<td class='FormButton' colspan="2" align="center">{$form.SAVE}&nbsp;{$form.BTN_CANCEL}</td>
</tr>
</table>
</td>
</tr>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="triggersProperties" type="xmlform" width="100%" labelWidth="20%" enableTemplate="1">
<PRO_UID type="hidden"/>
<FIELDS_REQUIRED type="hidden"/>
@@ -19,7 +19,7 @@
<en>Description</en>
</TRI_DESCRIPTION>
<TRI_WEBBOT type="textareapm" class="formLabel" cols="60" rows="15" width="100%" height="380px" showVars="1" process="@#PRO_UID">
<TRI_WEBBOT type="textareapm" class="formLabel" cols="55" rows="13" width="100%" height="380px" showVars="1" process="@#PRO_UID">
</TRI_WEBBOT>
<SAVE type="button" onclick="triggerSave1(this.form);">
<en>Save</en>

View File

@@ -15,6 +15,8 @@
<triggersEditCustom type="private" defaultValue="../triggers/triggers_EditCustom"/>
<triggerCopy type="private" defaultValue="../triggers/triggerCopy"/>
<triggersDelete type="private" defaultValue="../triggers/triggers_Delete"/>
<triggersProperties type="private" defaultValue="../triggers/triggersProperties"/>
@@ -29,7 +31,7 @@
<triggerNewGoogleCreateEvent type="private" defaultValue="../triggers/triggers_CreateGoogleEvent"/>
<PAGED_TABLE_ID type="private"/>
<PAGED_TABLE_ID type="private" />
<PAGED_TABLE_FAST_SEARCH type="FastSearch" label="@G::LoadTranslation(ID_SEARCH)"/>
<JS type="javascript" replaceTags="1">
@@ -44,6 +46,9 @@
}
}
*/
var windowWidth = 600;
var windowHeight = 460;
function triggerEditWizardSource (sUID){
popupWindow('@G::LoadTranslation(ID_EDIT_TRIGGERS)', '@G::encryptlink(@#triggersEdit)?TRI_UID=' + sUID +'&BYPASS=1' , 770, 510);
}
@@ -51,23 +56,30 @@
function triggerNew() {
popupWindow('@G::LoadTranslation(ID_NEW_TRIGGERS)', '@G::encryptlink(@#triggersEdit)?PRO_UID=@%PRO_UID' , 600, 340);
}
function triggerNewCustom() {
popupWindow('@G::LoadTranslation(ID_NEW_TRIGGERS)', '@G::encryptlink(@#triggersEditCustom)?PRO_UID=@%PRO_UID' , 600, 460);
function triggerNewCustom()
{
popupWindow("@G::LoadTranslation(ID_NEW_TRIGGERS)", "@G::encryptlink(@#triggersEditCustom)?PRO_UID=@%PRO_UID" , windowWidth, windowHeight);
}
function triggerCopy()
{
popupWindow("@G::LoadTranslation(ID_TRIGGER_COPY_TITLE)", "@G::encryptlink(@#triggerCopy)?PRO_UID=@%PRO_UID" , windowWidth, windowHeight);
}
function triggerFromLibrary() {
popupWindow('@G::LoadTranslation(ID_NEW_TRIGGERS)', '@G::encryptlink(@#triggersOptionList)?PRO_UID=@%PRO_UID' , 600, 400);
popupWindow('@G::LoadTranslation(ID_NEW_TRIGGERS)', '@G::encryptlink(@#triggersOptionList)?PRO_UID=@%PRO_UID' , 600, 460);
if (navigator.appName != "Microsoft Internet Explorer") {
try {
var oAllPs = document.querySelectorAll("div.panel_content___processmaker");
oAllPs[3].style.height = "340px";
oAllPs[3].style.height = "410px";
}
catch(e) {
// nothing to do
}
}
}
function triggerEdit(sUID) {
popupWindow('@G::LoadTranslation(ID_EDIT_TRIGGERS)', '@G::encryptlink(@#triggersEdit)?TRI_UID='+ sUID , 930, 600);
}
@@ -75,18 +87,18 @@
function triggerProperties( sUID ) {
popupWindow('@G::LoadTranslation(ID_TRIGGERS)', '@G::encryptlink(@#triggersProperties)?TRI_UID='+ sUID , 600, 340);
}
function triggerPropertiesSave( form ) {
var doc = getField("OUT_DOC_FILENAME");
var doc = getField("OUT_DOC_FILENAME");
if(doc.value=='')
{ alert(G_STRINGS.ID_FILEGENERATED);
}
else
else
{ ajax_post( form.action, form, 'POST' );
currentPopupWindow.remove();
@#PAGED_TABLE_ID.refresh();
}
}
}
}
function triggerSave(form)
{
@@ -94,7 +106,7 @@
if(document.getElementById('TRI_UID')) {
var triUid = document.getElementById('TRI_UID').value;
}
var triTitle =document.getElementById('TRI_TITLE').value;
var triTitle =document.getElementById('TRI_TITLE').value;
if(triTitle==''){
alert(G_STRINGS.ID_REQUIRED_NAME_TRIGGERS);return false;
}
@@ -109,7 +121,7 @@
}
}
if(triUid==''){
reqName=ajax_function("../triggers/triggers_Save",'lookforNameTrigger','NAMETRIGGER='+encodeURIComponent(triTitle)+'&proUid='+(document.getElementById('PRO_UID').value),'POST') ;
reqName=ajax_function("../triggers/triggers_Save",'lookforNameTrigger','NAMETRIGGER='+encodeURIComponent(triTitle)+'&proUid='+(document.getElementById('PRO_UID').value),'POST') ;
if(!reqName){
alert(G_STRINGS.ID_EXIST_TRIGGERS);return false;
}else{
@@ -123,22 +135,22 @@
@#PAGED_TABLE_ID.refresh();
}
}
//with this function, we are removing the spaces after and before of a string
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
//with this function, we are removing the spaces after and before of a string
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
};
//for trigger no wizard
function triggerSave1(form)
{
var triUid = "";
var triUid = "";
if(getField('TRI_UID')) {
var triUid = getField('TRI_UID').value;
}
if(triUid==''){
var triTitle =getField('TRI_TITLE').value.trim();
}
if(triUid==''){
var triTitle =getField('TRI_TITLE').value.trim();
if(triTitle==''){
alert(G_STRINGS.ID_REQUIRED_NAME_TRIGGERS);return false;
}
}
reqName=ajax_function("../triggers/triggers_Save",'lookforNameTrigger','NAMETRIGGER='+encodeURIComponent(triTitle)+'&proUid='+(getField('PRO_UID').value),'POST') ;
if(!reqName){
alert(G_STRINGS.ID_EXIST_TRIGGERS);return false;
@@ -157,7 +169,7 @@
function triggerDelete(sUID) {
var validateResult;
oRPC = XHRequest();
oRPC.options = {
url : '../triggers/triggers_Ajax',
@@ -184,11 +196,11 @@
}.extend(this);
oRPC.make();
}
function triggerNewWizard(nameFunction, library) {//alert('@G::encryptlink(@#triggerNewWizard)?PRO_UID=@%PRO_UID&amp;NAME_FUN='+nameFunction+'&amp; PARAMETERS_FUN='+parametersFunct+'&amp;PAGED_TABLE_ID='+@#PAGED_TABLE_ID);return;
popupWindow('@G::LoadTranslation(ID_NEW_TRIGGERS)', '@G::encryptlink(@#triggerNewWizard)?PRO_UID=@%PRO_UID&NAME_FUN='+nameFunction+'&LIBRARY='+library+'&PAGED_TABLE_ID='+@#PAGED_TABLE_ID , 600, 600);
}
]]>
</JS>