var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.text-area-process-designer { border: 1px solid var(--decor-border-light-color); min-width: var(--resgui-12column); width: var(--resgui-12column); max-width: var(--resgui-12column); margin-left: var(--resgui-1vw); height: calc(100% - 2vh); min-height: calc(100% - 2vh); max-height: calc(100% - 2vh); font-size: var(--resgui-font-height-m); color : var(--font-light) border-radius : 4px; background-color: var(--input-text-background); margin-left: var(--resgui-1vw); margin-right: var(--resgui-1vw); padding-left: var(--resgui-05vw); padding-right: var(--resgui-05vw); align-items : center; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.TextReadOnlyProcessDesigner { display:flex; align-items:center; height:var(--resgui-input-text-height); margin-left:var(--resgui-1vw); margin-right:var(--resgui-1vw); padding-left:var(--resgui-05vw); padding-right:var(--resgui-05vw); background-color:Transparent; border:1px solid var(--decor-border-light-color); border-radius:4px; font-family:var(--font-family-main); font-size:var(--resgui-font-height-m); color:var(--font-dark); min-width:var(--resgui-7column); display:block; white-space:unset; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.text-area-process-designer:hover { background-color: var(--input-text-background-hover);}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.variable-list-row-popup { align-items: center; justify-content: flex-start; background-color: var(--group-row-background); min-width: 100%; width: 100%; max-width: 100%; min-height: var(--resgui-1row); height: var(--resgui-1row); max-height: var(--resgui-1row); box-sizing: border-box; -moz-box-sizing: border-box, -webkit-box-sizing: border-box; border-bottom: 1px solid var(--main-gb-color); cursor:pointer;}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.variable-list-row-popup:hover { background: var(--group-header-background-hover); transition: background-color 0.3s linear; }'; document.getElementsByTagName('head')[0].appendChild(style); $MWGUI.RegisterLanguageString("SaveFlow", {"en":"Save flow", "it":"Salva Flusso"}); $MWGUI.RegisterLanguageString("NameFlow", {"en":"Flow's name", "it":"Nome del flusso"}); $MWGUI.RegisterLanguageString("DescriptionFlow", {"en":"Flow's description", "it":"Descrizione del flusso"}); $MWGUI.RegisterLanguageString("ErrorSaveFlowTitle", {"en":"Error", "it":"Error"}); $MWGUI.RegisterLanguageString("ErrorSaveFlowBody", {"en":"Flow not saved! Error on saving, please try again.", "it":"Flusso non salvato! Errore nel salvataggio, siete pregati di riprovare."}); $MWGUI.RegisterLanguageString("SaveButton", {"en":"Save", "it":"Salva"}); $MWGUI.RegisterLanguageString("CancelButton", {"en":"Cancel", "it":"Annulla"}); $MWGUI.RegisterLanguageString("ListVariablesButton", {"en":"List variables", "it":"Lista variabili"}); $MWGUI.RegisterLanguageString("AddButton", {"en":"Add", "it":"Aggiungi"}); $MWGUI.RegisterLanguageString("BlockName", {"en":"Name", "it":"Nome"}); $MWGUI.RegisterLanguageString("BlockTitle", {"en":"Title block", "it":"Titolo blocco"}); $MWGUI.RegisterLanguageString("BlockType", {"en":"Block Type", "it":"Tipo di Blocco"}); $MWGUI.RegisterLanguageString("Service", {"en":"Service", "it":"Servizio"}); $MWGUI.RegisterLanguageString("ServiceType", {"en":"Service's event", "it":"Evento del servizio"}); $MWGUI.RegisterLanguageString("SettingsTitle", {"en":"Settings", "it":"Impostazioni"}); $MWGUI.RegisterLanguageString("Text", {"en":"Text", "it":"Testo"}); $MWGUI.RegisterLanguageString("Buttons", {"en":"Buttons to show", "it":"Pulsanti da visualizzare"}); $MWGUI.RegisterLanguageString("TextButtons", {"en":"Text/buttons to show", "it":"Testo/pulsanti da visualizzare"}); $MWGUI.RegisterLanguageString("EmailSetting", {"en":"Email's setting", "it":"Impostazione dell'email"}); $MWGUI.RegisterLanguageString("Form", {"en":"Form Fields", "it":"Campi Form"}); $MWGUI.RegisterLanguageString("DefaultSmtp", {"en":"Default smtp", "it":"Default smtp"}); $MWGUI.RegisterLanguageString("SmtpHost", {"en":"Smtp host", "it":"Smtp host"}); $MWGUI.RegisterLanguageString("SmtpPort", {"en":"Port", "it":"Porta"}); $MWGUI.RegisterLanguageString("Ssl", {"en":"Enable ssl", "it":"Abilita ssl"}); $MWGUI.RegisterLanguageString("Auth", {"en":"Enable authentication", "it":"Abilita autenticazione"}); $MWGUI.RegisterLanguageString("User", {"en":"Username", "it":"Nome utente"}); $MWGUI.RegisterLanguageString("Password", {"en":"Password", "it":"Password"}); $MWGUI.RegisterLanguageString("EmailFrom", {"en":"From", "it":"Mittente"}); $MWGUI.RegisterLanguageString("EmailTo", {"en":"To", "it":"Destinatari"}); $MWGUI.RegisterLanguageString("Cc", {"en":"Carbon copy", "it":"Copia conoscenza"}); $MWGUI.RegisterLanguageString("EmailSubject", {"en":"Subject", "it":"Oggetto"}); $MWGUI.RegisterLanguageString("EmailBody", {"en":"Body", "it":"Corpo"}); $MWGUI.RegisterLanguageString("EnableTracing", {"en":"Enable tracing", "it":"Abilita tracciamento"}); $MWGUI.RegisterLanguageString("VariableName", {"en":"Variable", "it":"Variabile"}); $MWGUI.RegisterLanguageString("AttachName", {"en":"Attach's name", "it":"Nome dell'allegato"}); $MWGUI.RegisterLanguageString("Name", {"en":"Name", "it":"Nome"}); $MWGUI.RegisterLanguageString("Creator", {"en":"Creator", "it":"Creatore"}); $MWGUI.RegisterLanguageString("UpdateNotSavedMsgTitle", {"en":"Unsaved changes", "it":"Modifiche non salvate"}); $MWGUI.RegisterLanguageString("UpdateNotSavedMsgBody", {"en":"There are unsaved changes. Do you want to save them?", "it":"Ci sono modifiche non salvate. Vuoi salvarle?"}); $MWGUI.RegisterLanguageString("MessageButtonOK", {"en":"Ok", "it":"Ok"}); $MWGUI.RegisterLanguageString("MessageButtonCancel", {"en":"Cancel", "it":"Annulla"}); $MWGUI.RegisterLanguageString("SaveErrorMsgTitle", {"en":"Save Error", "it":"Errore nel salvataggio"}); $MWGUI.RegisterLanguageString("SaveErrorMsgBody", {"en":"There is a configuration error. Please correct the error before continuing.", "it":"E' presente un errore nella configurazione. Per favore, correggi l'errore prima di proseguire."}); $MWGUI.RegisterLanguageString("FormConfig", {"en":"Form Config", "it":"Configura Form"}); $MWGUI.RegisterLanguageString("FieldConfig", {"en":"Field Config", "it":"Configura Campi"}); $MWGUI.RegisterLanguageString("TestFlow", {"en":"Test flow", "it":"Testa il flusso"}); $MWGUI.RegisterLanguageString("ColumnDescription", {"en":"Key", "it":"Chiave"}); $MWGUI.RegisterLanguageString("ColumnDescriptionFields", {"en":"Desciption", "it":"Descrizione"}); $MWGUI.RegisterLanguageString("ColumnType", {"en":"Value", "it":"Valore"}); $MWGUI.RegisterLanguageString("ColumnTypeFields", {"en":"Type", "it":"Tipo"}); $MWGUI.RegisterLanguageString("ColumnRequired", {"en":"Required", "it":"Obbligatorio"}); $MWGUI.RegisterLanguageString("ColumnVariable", {"en":"Variable", "it":"Variabile"}); $MWGUI.RegisterLanguageString("ColumnValue", {"en":"Value", "it":"Valore"}); $MWGUI.RegisterLanguageString("CustomFormVar", {"en":"Variable Name", "it":"Nome Variabile"}); $MWGUI.RegisterLanguageString("CustomFormDescription", {"en":"Description", "it":"Descrizione"}); $MWGUI.RegisterLanguageString("CustomFormType", {"en":"Field Type", "it":"Tipo Campo"}); $MWGUI.RegisterLanguageString("CustomFormRequired", {"en":"Required", "it":"Obbligatorio"}); $MWGUI.RegisterLanguageString("ComboValueNull", {"en":"Choose field type...", "it":"Seleziona il tipo di campo..."}); $MWGUI.RegisterLanguageString("ComboValueText", {"en":"Text", "it":"Testo"}); $MWGUI.RegisterLanguageString("ComboValuePassword", {"en":"Password", "it":"Password"}); $MWGUI.RegisterLanguageString("ComboValueMail", {"en":"Email", "it":"Email"}); $MWGUI.RegisterLanguageString("SettingsTitle", {"en":"Settings", "it":"Impostazioni"}); $MWGUI.RegisterLanguageString("ImportFlow", {"en":"Open flow", "it":"Apri flusso"}); $MWGUI.RegisterLanguageString("SelectImportFlow", {"en":"Select the flow to open", "it":"Seleziona flusso da aprire"}); $MWGUI.RegisterLanguageString("SameNameError", {"en":"There is a block with the same name. Change the name to save the block.", "it":"C'è un blocco con lo stesso nome. Cambia il nome per salvare il blocco"}); $MWGUI.RegisterLanguageString("ComboValueEnum", {"en":"Enumerator", "it":"Enumeratore"}); $MWGUI.RegisterLanguageString("File", {"en":"File", "it":"File"}); $MWGUI.RegisterLanguageString("Number", {"en":"Number", "it":"Numero"}); $MWGUI.RegisterLanguageString("ConfigureFormType", {"en":"Configure Form Type", "it":"Configura Elemento"}); $MWGUI.RegisterLanguageString("AddButton", {"en":"Add button", "it":"Aggiungi pulsante"}); $MWGUI.RegisterLanguageString("AddField", {"en":"Add field", "it":"Aggiungi campo"}); $MWGUI.RegisterLanguageString("AddTextButtons", {"en":"Add row", "it":"Aggiungi riga"}); $MWGUI.RegisterLanguageString("AddButton", {"en":"Add button", "it":"Aggiungi pulsante"}); $MWGUI.RegisterLanguageString("AddFieldEnumerator", {"en":"Add key/value ", "it":"Aggiungi chiave/valore"}); $MWGUI.RegisterLanguageString("MessageButtonNo", {"en":"No", "it":"No"}); $MWGUI.RegisterLanguageString("MessageButtonYes", {"en":"Yes", "it":"Si"}); $MWGUI.RegisterLanguageString("Confirm", {"en":"Confirm", "it":"Conferma"}); $MWGUI.RegisterLanguageString("TextColumn", {"en":"Text", "it":"Testo"}); $MWGUI.RegisterLanguageString("ButtonsColumn", {"en":"Buttons", "it":"Pulsanti"}); $MWGUI.RegisterLanguageString("TextToShow", {"en":"Text to show", "it":"Testo da visualizzare"}); $MWGUI.RegisterLanguageString("ButtonsToShow", {"en":"Buttons to show", "it":"Pulsanti da visualizzare"}); $MWGUI.RegisterLanguageString("SelectAttach", {"en":"Add attachment", "it":"Aggiungi allegato"}); $MWGUI.RegisterLanguageString("SmtpTab", {"en":"Smtp settings", "it":"Impostazioni smtp"}); $MWGUI.RegisterLanguageString("EmailTab", {"en":"Email settings", "it":"Impostazioni email"}); $MWGUI.RegisterLanguageString("AttachmentTab", {"en":"Attachments", "it":"Allegati"}); $MWGUI.RegisterLanguageString("NewDateButton", {"en":"Add Date", "it":"Aggiungi Periodo"}); $MWGUI.RegisterLanguageString("NewDateFrom", {"en":"From", "it":"Da"}); $MWGUI.RegisterLanguageString("NewDateTo", {"en":"To", "it":"A"}); $MWGUI.RegisterLanguageString("NewDateOffset", {"en":"Timezone", "it":"Fuso orario"}); $MWGUI.RegisterLanguageString("OptionDateAll", {"en":"All", "it":"Tutti"}); $MWGUI.RegisterLanguageString("OptionDate1", {"en":"Monday", "it":"Lunedi"}); $MWGUI.RegisterLanguageString("OptionDate2", {"en":"Tuesday", "it":"Martedi"}); $MWGUI.RegisterLanguageString("OptionDate3", {"en":"Wednesday", "it":"Mercoledi"}); $MWGUI.RegisterLanguageString("OptionDate4", {"en":"Thursday", "it":"Giovedi"}); $MWGUI.RegisterLanguageString("OptionDate5", {"en":"Friday", "it":"Venerdi"}); $MWGUI.RegisterLanguageString("OptionDate6", {"en":"Saturday", "it":"Sabato"}); $MWGUI.RegisterLanguageString("OptionDate0", {"en":"Sunday", "it":"Domenica"}); $MWGUI.RegisterLanguageString("Holidays", {"en":"Holidays", "it":"Festivi"}); $MWGUI.RegisterLanguageString("Weekdays", {"en":"Weekdays", "it":"Feriali"}); $MWGUI.RegisterLanguageString("ListVariablesTitleCB", {"en":"Variables list", "it":"Lista delle variabili"}); $MWGUI.RegisterLanguageString("SelectVar", {"en":"Select variable", "it":"Seleziona variabile"}); $MWGUI.RegisterLanguageString("SelectFieldsSpan", {"en":"Select fields", "it":"Seleziona campi"}); $MWGUI.RegisterLanguageString("DefaultVariableListHeader", {"en":"System variables", "it":"Variabili di sistema"}); $MWGUI.RegisterLanguageString("CustomVariableListHeader", {"en":"Custom variables", "it":"Variabili personali"}); //STE VARS $MWGUI.RegisterLanguageString("STARTSTE-TSite-_id", {"en":"Variable that returns the id of the store.", "it":"Variabile che restituisce l'id del punto vendita."}); $MWGUI.RegisterLanguageString("STARTSTE-TSite-SgNode", {"en":"Variable that returns the id of the store.", "it":"Variabile che restituisce l'id del punto vendita."}); $MWGUI.RegisterLanguageString("STARTSTE-TSite-Name", {"en":"Variable that returns the name of the store.", "it":"Variabile che restituisce il nome del punto vendita."}); $MWGUI.RegisterLanguageString("STARTSTE-TSite-Address", {"en":"Variable that returns the address of the store.", "it":"Variabile che restituisce l'indirizzo del punto vendita."}); $MWGUI.RegisterLanguageString("STARTSTE-TSite-City", {"en":"Variable that returns the city of the store.", "it":"Variabile che restituisce la citta' del punto vendita."}); $MWGUI.RegisterLanguageString("STARTSTE-TSite-Region", {"en":"Variable that returns the province of the store.", "it":"Variabile che restituisce la provincia del punto vendita."}); $MWGUI.RegisterLanguageString("STARTSTE-TSite-State", {"en":"Variable that returns the country of the store.", "it":"Variabile che restituisce la nazione del punto vendita."}); $MWGUI.RegisterLanguageString("STARTSTE-TCustomerSTE-Name", {"en":"Variable that returns the name of the interlocutor of the switchboard ste.", "it":"Variabile che restituisce il nome dell'interlocutore del centralino ste."}); $MWGUI.RegisterLanguageString("STARTSTE-TCustomerSTE-Surname", {"en":"Variable that returns the surname of the interlocutor of the switchboard ste.", "it":"Variabile che restituisce il cognome dell'interlocutore del centralino ste."}); $MWGUI.RegisterLanguageString("STARTSTE-InboundNumber", {"en":"Variable that returns the inbound number of the call ste.", "it":"Variabile che restituisce il numero inbound della telefonata ste."}); $MWGUI.RegisterLanguageString("STARTSTE-TAgent", {"en":"Variable that returns the operator's name.", "it":"Variabile che restituisce il none dell'operatore."}); $MWGUI.RegisterLanguageString("VariableNamePlaceHolderSearch", {"en":"Variable name", "it":"Nome variabile"}); $MWGUI.RegisterLanguageString("SearchVariableAttachementsEnable", {"en":"Show attachments", "it":"Mostra allegati"}); $MWGUI.RegisterLanguageString("STEOtboundCall", {"en":"Insert phone number", "it":"Inserisci numero di telefono"}); //ARGO VARS $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TSite-_id", {"en":"Variable that returns the id of the store.", "it":"Variabile che restituisce l'id del punto vendita."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TSite-SgNode", {"en":"Variable that returns the id of the store.", "it":"Variabile che restituisce l'id del punto vendita."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TSite-Name", {"en":"Variable that returns the name of the store.", "it":"Variabile che restituisce il nome del punto vendita."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TSite-Address", {"en":"Variable that returns the address of the store.", "it":"Variabile che restituisce l'indirizzo del punto vendita."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TSite-City", {"en":"Variable that returns the city of the store.", "it":"Variabile che restituisce la citta' del punto vendita."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TSite-Region", {"en":"Variable that returns the province of the store.", "it":"Variabile che restituisce la provincia del punto vendita."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TSite-State", {"en":"Variable that returns the country of the store.", "it":"Variabile che restituisce la nazione del punto vendita."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TAsset-Name", {"en":"Variable that returns the name of the asset.", "it":"Variabile che restituisce il nome dell'asset."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TEvent-_id", {"en":"Variable that returns the id of the event.", "it":"Variabile che restituisce l'id dell'evento."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TEvent-Status", {"en":"Variable that returns the event's status.", "it":"Variabile che restituisce lo stato dell'evento."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TEvent-EventType", {"en":"Variable that returns the event's type. [START, STOP, LIFEOK, LIFEKO, WARNING]", "it":"Variabile che restituisce il tipo di evento. [INIZIO, FINE, SEGNALE DI VITA, SEGNALE DI VITA ASSENTE, AVVISO]"}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TEvent-Priority", {"en":"Variable that returns the event's priority.", "it":"Variabile che restituisce la priorità dell'evento."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TEvent-FlowStatus", {"en":"Variable that returns the status on the process in argo.", "it":"Variabile che restituisce lo stato di processo in argo"}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TEvent-FlowId", {"en":"Variable that returns the event's flow id.", "it":"Variabile che restituisce l'id di flusso di gestione dell'evento."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TEvent-CreationDateTime", {"en":"Variable that returns the creation date.", "it":"Variabile che restituisce la data di crezione."}); $MWGUI.RegisterLanguageString("ArgoStartManageEvent-TEvent-DateTime_Event_Showed", {"en":"Variable that returns the showing date (priority 10).", "it":"Variabile che restituisce l'ora di visualizzazione."}); function TMWProcessDesigner() { this.Canvas; this.SettingSideNav; this.Blocks = []; this.RigthToolBar; this.Variables = []; this.ObjStored = {"Description":""}; this.InputFileName; this.Execution = { IsRunningExucuteFlow : false }; this.ListVariables; var Me = this; this.Initialize = function(IdToAppend, FileName) { if(IdToAppend == undefined || IdToAppend == "") { throw "IdToAppend Empty. Please set it as the id of the div which insert the paper." } var DivToAppend = document.getElementById(IdToAppend); if(DivToAppend == null || DivToAppend == undefined) throw "div "+IdToAppend+" not founded." if(FileName) Me.ObjStored.Name = FileName; var ButtonsToolbar = []; var App = document.createElement("div"); App.className = "overflow-hidden resgui-32column relative-full-height column-direction"; App.id = "App"; var ToolBar = document.createElement("div"); ToolBar.className = "row-direction overflow-hidden resgui-1row resgui-32column justify-content-flex-start align-items-center"; ToolBar.id = "toolbar"; ToolBar.style.backgroundColor = "var(--secondary-toolbar-background)"; var LeftToolBar = document.createElement("div"); LeftToolBar.className = "row-direction overflow-hidden resgui-1row resgui-5column justify-content-flex-start align-items-center"; LeftToolBar.id = "Left-Toolbar"; var Menu = document.createElement("img"); Menu.className = "icon-image-button"; Menu.src = "../../../../../../images/icons/menuIcon.png"; Menu.style = "margin-left:var(--resgui-quartercolumn);" Menu.IsClicked = false; Menu.addEventListener("click", function(ev){ var SideNav = document.getElementById("Side-Nav-Left"); if(SideNav.className.indexOf("Side-Nav-Left-Off")>-1) { ev.target.SideNav.IsClicked = true; ev.target.IsClicked = true; $MWProcessDesigner.CreateMenuSideNav(SideNav); SideNav.className = SideNav.className.replace(" Side-Nav-Left-Off", " Side-Nav-Left-On"); } else { SideNav.innerHTML = ""; if(ev.target.SideNav.IsClicked) { if(ev.target.IsClicked) { ev.target.IsClicked = false; ev.target.SideNav.IsClicked = false; SideNav.className = SideNav.className.replace(" Side-Nav-Left-On", " Side-Nav-Left-Off"); } else { ev.target.IsClicked = true; ev.target.SideNav.Tools.IsClicked = false; $MWProcessDesigner.CreateMenuSideNav(SideNav); } } else { ev.target.IsClicked = true; $MWProcessDesigner.CreateMenuSideNav(SideNav); } } }); LeftToolBar.appendChild(Menu); var Tools = document.createElement("img"); Tools.className = "icon-image-button"; Tools.src = "../../../../../../images/icons/ToolsIcon2.png"; Tools.style = "margin-left:var(--resgui-quartercolumn);"; Tools.IsClicked = false; Tools.addEventListener("click", function(ev){ var SideNav = document.getElementById("Side-Nav-Left"); if(SideNav.className.indexOf("Side-Nav-Left-Off")>-1) { ev.target.SideNav.IsClicked = true; ev.target.IsClicked = true; $MWProcessDesigner.CreateToolsSideNav(SideNav); SideNav.className = SideNav.className.replace(" Side-Nav-Left-Off", " Side-Nav-Left-On"); } else { SideNav.innerHTML = ""; if(ev.target.SideNav.IsClicked) { if(ev.target.IsClicked) { ev.target.IsClicked = false; ev.target.SideNav.IsClicked = false; SideNav.className = SideNav.className.replace(" Side-Nav-Left-On", " Side-Nav-Left-Off"); } else { ev.target.IsClicked = true; ev.target.SideNav.Menu.IsClicked = false; $MWProcessDesigner.CreateToolsSideNav(SideNav); } } else { ev.target.IsClicked = true; $MWProcessDesigner.CreateToolsSideNav(SideNav); } } }); LeftToolBar.appendChild(Tools); var ListVariables = document.createElement("img"); ListVariables.className = "icon-image-button"; ListVariables.src = "../../../../../../images/icons/variableIcon.png"; ListVariables.style = "margin-left:var(--resgui-quartercolumn);"; ListVariables.addEventListener("click", function(ev){ //if(ev.target.Canvas) $MWProcessDesigner.PopupListVariables(); }); Me.ListVariables = ListVariables; LeftToolBar.appendChild(ListVariables); var CenterToolBar = document.createElement("div"); CenterToolBar.className = "row-direction overflow-hidden resgui-1row resgui-20column justify-content-flex-start align-items-center"; CenterToolBar.id = "Center-Toolbar"; var RigthToolBar = document.createElement("div"); RigthToolBar.className = "row-direction overflow-hidden resgui-1row resgui-7column justify-content-flex-end align-items-center"; RigthToolBar.id = "Right-Toolbar"; var ZoomIn = document.createElement("img"); ZoomIn.className = "icon-image-button"; ZoomIn.src = "../../../../../../images/icons/zoom_in_white.png"; ZoomIn.style = "margin-right:var(--resgui-quartercolumn);"; ButtonsToolbar.push({"Type":"ZoomIn","HTMLElement": ZoomIn}); var ZoomOut = document.createElement("img"); ZoomOut.className = "icon-image-button"; ZoomOut.src = "../../../../../../images/icons/zoom_out_white.png"; ZoomOut.style = "margin-right:var(--resgui-quartercolumn);"; ButtonsToolbar.push({"Type":"ZoomOut","HTMLElement": ZoomOut}); var Delete = document.createElement("img"); Delete.className = "icon-image-button"; Delete.src = "../../../../../../images/icons/deleteIcon.png"; Delete.style = "margin-right:var(--resgui-quartercolumn);"; ButtonsToolbar.push({"Type":"Delete","HTMLElement": Delete}); var Clone = document.createElement("img"); Clone.className = "icon-image-button"; Clone.src = "../../../../../../images/icons/cloneIcon.png"; Clone.style = "margin-right:var(--resgui-quartercolumn);"; ButtonsToolbar.push({"Type":"Clone","HTMLElement": Clone}); var CloneWithSettings = document.createElement("img"); CloneWithSettings.className = "icon-image-button"; CloneWithSettings.src = "../../../../../../images/icons/CloneWithSetting.png"; CloneWithSettings.style = "margin-right:var(--resgui-quartercolumn);"; ButtonsToolbar.push({"Type":"CloneWithSettings","HTMLElement": CloneWithSettings}); var OpenSetting = document.createElement("img"); OpenSetting.className = "icon-image-button"; OpenSetting.src = "../../../../../../images/icons/toolsIcon.png"; OpenSetting.style = "margin-right:var(--resgui-quartercolumn);"; ButtonsToolbar.push({"Type":"OpenSetting","HTMLElement": OpenSetting}); Me.ButtonsToolbar = ButtonsToolbar; RigthToolBar.appendChild(OpenSetting); RigthToolBar.appendChild(CloneWithSettings); RigthToolBar.appendChild(Clone); RigthToolBar.appendChild(Delete); RigthToolBar.appendChild(ZoomOut); RigthToolBar.appendChild(ZoomIn); ToolBar.appendChild(LeftToolBar); ToolBar.appendChild(CenterToolBar); ToolBar.appendChild(RigthToolBar); $MWProcessDesigner.RigthToolBar = RigthToolBar; App.appendChild(ToolBar); var ContainerCanvas = document.createElement("div"); ContainerCanvas.className = "resgui-17row resgui-32column"; ContainerCanvas.style.zIndex = 0; ContainerCanvas.id = "ContainerCanvas"; ContainerCanvas.style.display = "block"; var CanvasBox = document.createElement("div"); CanvasBox.id = "CanvasSvg"; ContainerCanvas.appendChild(CanvasBox); App.appendChild(ContainerCanvas); var SideNav = document.createElement("div"); SideNav.className = "column-direction overflow-hidden Side-Nav-Left-Off"; SideNav.id = "Side-Nav-Left"; SideNav.IsClicked = false; SideNav.Menu = Menu; SideNav.Tools = Tools; Tools.SideNav = SideNav; Menu.SideNav = SideNav; DivToAppend.appendChild(App); DivToAppend.appendChild(SideNav); var svg = new Canvas("CanvasSvg", "ContainerCanvas", 10000, 10000); svg.html[0].children[0].style.position = "relative"; svg.installEditPolicy(new draw2d.policy.canvas.ShowGridEditPolicy()); svg.installEditPolicy(new draw2d.policy.canvas.SnapToGeometryEditPolicy()); svg.installEditPolicy(new draw2d.policy.canvas.SnapToInBetweenEditPolicy()); svg.installEditPolicy(new draw2d.policy.canvas.SnapToCenterEditPolicy()); svg.installEditPolicy(new CanvasMouse()); svg.installEditPolicy(new KeyboardPolicy()); svg.StartZoom = svg.getZoom()*1.3; svg.setZoom(svg.getZoom()*1.3,true); svg.scrollTo(0,0); $MWProcessDesigner.Canvas = svg; ListVariables.Canvas = svg; var Toolbar = new toolbar(svg, ButtonsToolbar); }, this.OpenSettingsPopup = function(InstanceBlock) { var CustomBox = new TMWGUICustomBox(16, 25); CustomBox.InstanceBlock = InstanceBlock; $MWProcessDesigner.SettingsCustomBox = CustomBox; var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("SettingsTitle"); var spanClose = document.createElement("span"); spanClose.innerHTML = "×"; spanClose.style.fontSize = "var(--resgui-font-height-xl)"; spanClose.style.cursor = "pointer"; spanClose.style.marginRight = "var(--resgui-quartercolumn)"; spanClose.CustomBox = CustomBox; spanClose.InstanceBlock = InstanceBlock; spanClose.onclick = function (ev) { var Target = ev.target; if(Target.nodeName == "SPAN") Target = Target.parentNode; var GetObjectResponse = $MWProcessDesigner.GetSettingsPopupObject(); $MWProcessDesigner.SettingSideNav.EditObject = GetObjectResponse.UserDataToAssign; if(JSON.stringify($MWProcessDesigner.SettingSideNav.EditObject) != JSON.stringify($MWProcessDesigner.SettingSideNav.OriginalObject)) { setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("UpdateNotSavedMsgTitle"), $MWGUI.GetLanguageString("UpdateNotSavedMsgBody") ,"info",[{"text":$MWGUI.GetLanguageString("MessageButtonYes"),"Callback":function(){$MWProcessDesigner.SettingSideNav.SaveFunction(Target.InstanceBlock);}},{"text":$MWGUI.GetLanguageString("MessageButtonNo"),"Callback":function(){$MWProcessDesigner.CloseSettingsPopup();}},{"text":$MWGUI.GetLanguageString("MessageButtonCancel"),"Callback":function(){}}])}, 350); } else $MWProcessDesigner.CloseSettingsPopup(); }; CustomBox.Title.className += " justify-content-space-between"; CustomBox.Title.appendChild(spanTitle); CustomBox.Title.appendChild(spanClose); var SideNavRight = document.createElement("div"); SideNavRight.className = "column-direction overflow-hidden relative-full-width"; SideNavRight.id = "Side-Nav-Right"; $MWProcessDesigner.SettingSideNav = SideNavRight; $MWProcessDesigner.SettingSideNav.EditObject = JSON.parse(JSON.stringify(InstanceBlock.userData)); $MWProcessDesigner.SettingSideNav.OriginalObject = InstanceBlock.userData; $MWProcessDesigner.SettingSideNav.Rows = []; $MWProcessDesigner.SettingSideNav.Block = InstanceBlock; $MWProcessDesigner.SettingSideNav.SaveFunction = function(InstanceBlock) { var GetObjectResponse = $MWProcessDesigner.GetSettingsPopupObject(); if(!GetObjectResponse.ThereIsError) { $MWProcessDesigner.SettingSideNav.EditObject = GetObjectResponse.UserDataToAssign; var Blocks = $MWProcessDesigner.Canvas.getFigures(); var Figures = []; for(var Index in Blocks.data) { Figures.push(Blocks.data[Index]); } var IndexByName = Figures.findIndex(x => x.userData.BlockName.toLowerCase() == $MWProcessDesigner.SettingSideNav.EditObject.BlockName.toLowerCase()); if(IndexByName == -1) { if(InstanceBlock.ValidateObject($MWProcessDesigner.SettingSideNav.EditObject, $MWProcessDesigner.SettingSideNav.Rows)) { InstanceBlock.userData = GetObjectResponse.UserDataToAssign; InstanceBlock.UpdateGraphicBlock(); $MWProcessDesigner.CloseSettingsPopup(); } else { setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("SaveErrorMsgTitle"), $MWGUI.GetLanguageString("SaveErrorMsgBody") ,"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}])}, 350); } } else { if(Figures[IndexByName].id == $MWProcessDesigner.SettingSideNav.Block.id) { if(InstanceBlock.ValidateObject($MWProcessDesigner.SettingSideNav.EditObject, $MWProcessDesigner.SettingSideNav.Rows)) { InstanceBlock.userData = GetObjectResponse.UserDataToAssign; InstanceBlock.UpdateGraphicBlock(); $MWProcessDesigner.CloseSettingsPopup(); } else { setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("SaveErrorMsgTitle"), $MWGUI.GetLanguageString("SaveErrorMsgBody") ,"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}])}, 350); } } else { setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("SaveErrorMsgTitle"), $MWGUI.GetLanguageString("SameNameError"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}])}, 350); } } } else { setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("SaveErrorMsgTitle"), $MWGUI.GetLanguageString("SaveErrorMsgBody") ,"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}])}, 350); } } var SideNavBody = document.createElement("div"); SideNavBody.className = "resgui-14row relative-full-width column-direction overflow-y-auto overflow-x-hidden"; SideNavBody.style.backgroundColor = "var(--group-row-background)"; if($MWProcessDesigner.SettingSideNav.Block.userData.BlockType == "FLOW") SideNavBody.appendChild($MWProcessDesigner.CreateRightSideNavRow("BlockName","InputText", $MWProcessDesigner.SettingSideNav.EditObject.BlockName)); else SideNavBody.appendChild($MWProcessDesigner.CreateRightSideNavRow("BlockName","SpanReadOnly", $MWProcessDesigner.SettingSideNav.EditObject.BlockName)); SideNavBody.appendChild($MWProcessDesigner.CreateRightSideNavRow("BlockTitle","InputText", $MWProcessDesigner.SettingSideNav.EditObject.BlockTitle)); SideNavBody.appendChild($MWProcessDesigner.CreateRightSideNavRow("BlockType","SpanReadOnly", $MWProcessDesigner.SettingSideNav.EditObject.BlockType)); SideNavBody.appendChild($MWProcessDesigner.CreateRightSideNavRow("Service","SpanReadOnly", $MWProcessDesigner.SettingSideNav.EditObject.Service)); SideNavBody.appendChild($MWProcessDesigner.CreateRightSideNavRow("ServiceType","SpanReadOnly", $MWProcessDesigner.SettingSideNav.EditObject.ServiceType)); $MWProcessDesigner.CreateRightSideNavRow("BlockProperties","BlockProperties", $MWProcessDesigner.SettingSideNav.EditObject.BlockProperties); if(InstanceBlock.CreateSettingsPopupBody) InstanceBlock.CreateSettingsPopupBody(InstanceBlock, $MWProcessDesigner.SettingSideNav.EditObject, SideNavBody); var SideNavFooter = document.createElement("div"); SideNavFooter.className = "resgui-1row relative-full-width align-items-center justify-content-space-around"; SideNavFooter.style.backgroundColor = "var(--secondary-toolbar-background)"; var SideNavFooterSave = document.createElement("div"); SideNavFooterSave.className = "button-application"; SideNavFooterSave.InstanceBlock = InstanceBlock; SideNavFooterSave.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName == "SPAN") Target = Target.parentNode; $MWProcessDesigner.SettingSideNav.SaveFunction(Target.InstanceBlock); }); var SideNavFooterSpanSave = document.createElement("span"); SideNavFooterSpanSave.innerHTML = $MWGUI.GetLanguageString("SaveButton"); var SideNavFooterCancel = document.createElement("div"); SideNavFooterCancel.className = "button-application"; SideNavFooterCancel.InstanceBlock = InstanceBlock; SideNavFooterCancel.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName == "SPAN") Target = Target.parentNode; var GetObjectResponse = $MWProcessDesigner.GetSettingsPopupObject(); $MWProcessDesigner.SettingSideNav.EditObject = GetObjectResponse.UserDataToAssign; //console.log(JSON.stringify($MWProcessDesigner.SettingSideNav.EditObject), JSON.stringify($MWProcessDesigner.SettingSideNav.OriginalObject)) if(JSON.stringify($MWProcessDesigner.SettingSideNav.EditObject) != JSON.stringify($MWProcessDesigner.SettingSideNav.OriginalObject)) { setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("UpdateNotSavedMsgTitle"), $MWGUI.GetLanguageString("UpdateNotSavedMsgBody") ,"info",[{"text":$MWGUI.GetLanguageString("MessageButtonYes"),"Callback":function(){$MWProcessDesigner.SettingSideNav.SaveFunction(Target.InstanceBlock);}},{"text":$MWGUI.GetLanguageString("MessageButtonNo"),"Callback":function(){$MWProcessDesigner.CloseSettingsPopup();}},{"text":$MWGUI.GetLanguageString("MessageButtonCancel"),"Callback":function(){}}])}, 350); } else $MWProcessDesigner.CloseSettingsPopup(); }); var SideNavFooterSpanCancel = document.createElement("span"); SideNavFooterSpanCancel.innerHTML = $MWGUI.GetLanguageString("CancelButton"); SideNavFooterSave.appendChild(SideNavFooterSpanSave); SideNavFooterCancel.appendChild(SideNavFooterSpanCancel); SideNavFooter.appendChild(SideNavFooterSave); SideNavFooter.appendChild(SideNavFooterCancel); $MWProcessDesigner.SettingSideNav.appendChild(SideNavFooter); $MWProcessDesigner.SettingSideNav.appendChild(SideNavBody); CustomBox.Body.appendChild(SideNavRight); CustomBox.Open(); for(var IndexRow in $MWProcessDesigner.SettingSideNav.Rows) { if($MWProcessDesigner.SettingSideNav.Rows[IndexRow].OnLoadFunction) $MWProcessDesigner.SettingSideNav.Rows[IndexRow].OnLoadFunction(); } }, this.CloseSettingsPopup = function() { $MWProcessDesigner.SettingSideNav.EditObject = {}; $MWProcessDesigner.SettingSideNav.OriginalObject = {}; $MWProcessDesigner.SettingSideNav.Rows = []; $MWProcessDesigner.SettingSideNav.Block = {}; $MWProcessDesigner.SettingSideNav.innerHTML = ""; $MWProcessDesigner.SettingsCustomBox.Close(); }, this.GetSettingsPopupObject = function() { var Result = { ThereIsError : false, UserDataToAssign : {}, } var UserDataToAssign = { BlockName : "", BlockTitle : "", BlockType : "", Service : "", ServiceType : "", Config : {}, BlockProperties : { IsConfigured : false, AllPortsAreConnected :false } }; Result.UserDataToAssign = UserDataToAssign; if($MWProcessDesigner.SettingSideNav.Rows.length > 0) { for(var indexRow in $MWProcessDesigner.SettingSideNav.Rows) { switch($MWProcessDesigner.SettingSideNav.Rows[indexRow].RowType) { case "InputText": { if($MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName == "BlockName" || $MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName == "Service" || $MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName == "BlockType" || $MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName == "BlockTitle") { UserDataToAssign[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName] = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.value; } else { //console.log("TODO"); } break; } case "SpanReadOnly": { if($MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName == "BlockName" || $MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName == "Service" || $MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName == "BlockType" || $MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName == "BlockTitle" || $MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName == "ServiceType") { UserDataToAssign[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName] = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.innerHTML; } else { //console.log("TODO"); } break; } case "TextArea": { UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName] = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.value; break; } case "Buttons": { var Error = false; if(!UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName]) { UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName] = { "DefaultOk" : {}, "OptionalButtons" : [] } } UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName].OptionalButtons = []; for(var Index in $MWProcessDesigner.SettingSideNav.Rows[indexRow].ButtonRows) { var RowButton = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ButtonRows[Index]; if(RowButton.IsDefaultOk) { if(RowButton.InputToGetTheValue.value == "") { if(RowButton.InputToGetTheValue.className.indexOf("ErrorMark") == -1) RowButton.InputToGetTheValue.className = RowButton.InputToGetTheValue.className + " ErrorMark"; Result.ThereIsError = true; continue; } RowButton.InputToGetTheValue.className = RowButton.InputToGetTheValue.className.replace(" ErrorMark",""); var Object = { "Text" : RowButton.InputToGetTheValue.value, "Id" : RowButton.Id } UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName].DefaultOk = Object; continue; } if(RowButton.IsOptionalButton) { if(RowButton.InputToGetTheValue.value == "") { if(RowButton.InputToGetTheValue.className.indexOf("ErrorMark") == -1) RowButton.InputToGetTheValue.className = RowButton.InputToGetTheValue.className + " ErrorMark"; Result.ThereIsError = true; continue; } RowButton.InputToGetTheValue.className = RowButton.InputToGetTheValue.className.replace(" ErrorMark",""); var Object = { "Text" : RowButton.InputToGetTheValue.value, "Id" : "" } if(RowButton.Id) Object.Id = RowButton.Id; UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName].OptionalButtons.push(Object); continue; } } break; } case "Form": { if(!UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName]) { UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName] = { "FormFields" : [] } } UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName].FormFields = []; if($MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows.length > 0) { for(var Index in $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows) { var IndexOfVarName = UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName].FormFields.findIndex(x => x.VariableName.toLowerCase() == $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].Instance.VariableName.toLowerCase()); if(IndexOfVarName == -1) { if($MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].InputVarName.className.indexOf("ErrorMark") > -1) $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].InputVarName.className = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].InputVarName.className.replace(" ErrorMark", ""); UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName].FormFields.push($MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].Instance); } else { if($MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].InputVarName.className.indexOf("ErrorMark") == -1) $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].InputVarName.className = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].InputVarName.className + " ErrorMark"; Result.ThereIsError = true; } } } else Result.ThereIsError = true; break; } case "DefaultKo": { UserDataToAssign.Config["DefaultKo"] = $MWProcessDesigner.SettingSideNav.Rows[indexRow].Instance; break; } case "DefaultOk": { UserDataToAssign.Config["DefaultOk"] = $MWProcessDesigner.SettingSideNav.Rows[indexRow].Instance; break; } case "DefaultVariables": { UserDataToAssign.Config["DefaultVariables"] = $MWProcessDesigner.SettingSideNav.Rows[indexRow].Instance; break; } case "BlockProperties": { UserDataToAssign.BlockProperties = $MWProcessDesigner.SettingSideNav.Rows[indexRow].Instance break; } case "TextButtons": { if(!UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName]) { UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName] = [] } UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName] = []; for(var Index in $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows) { var Object = { "Text" : "", "Buttons": [], "Id" : "", "Name" : "" } var ResponseObject = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].GetObject(); if(ResponseObject.Text == "") { if($MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].TextArea.className.indexOf("ErrorMark") == -1) $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].TextArea.className = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].TextArea.className + " ErrorMark"; Result.ThereIsError = true } else { if($MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].TextArea.className.indexOf("ErrorMark") > -1) $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].TextArea.className = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].TextArea.className.replace(" ErrorMark", ""); Object.Text = ResponseObject.Text; } if(ResponseObject.Name == "") { if($MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].Name.className.indexOf("ErrorMark") == -1) $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].Name.className = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].Name.className + " ErrorMark"; Result.ThereIsError = true } else { if($MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].Name.className.indexOf("ErrorMark") > -1) $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].Name.className = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.Rows[Index].Name.className.replace(" ErrorMark", ""); Object.Name = ResponseObject.Name; } Object.Id = ResponseObject.Id; if(ResponseObject.Buttons.length > 0) Object.Buttons = []; for(var IndexButton in ResponseObject.Buttons) { var ButtonObj = {"Text":"", "Id" : ""}; var Button = ResponseObject.Buttons[IndexButton]; if(Button.Text == "") { if(Button.InputObj.className.indexOf("ErrorMark") == -1) Button.InputObj.className = Button.InputObj.className + " ErrorMark"; Result.ThereIsError = true } else { if(Button.InputObj.className.indexOf("ErrorMark") > -1) Button.InputObj.className = Button.InputObj.className.replace(" ErrorMark", ""); ButtonObj.Text = Button.Text; } ButtonObj.Id = Button.Id; if(ButtonObj.Id != "" || ButtonObj.Text != "") Object.Buttons.push(ButtonObj); } if(Object.Text != "" || Object.Id != "" || Object.Name != "" || Object.Buttons.length > 1) UserDataToAssign.Config[$MWProcessDesigner.SettingSideNav.Rows[indexRow].PropertyName].push(Object); } break; } case "Email": { if(!UserDataToAssign.Config.EmailSetting) UserDataToAssign.Config.EmailSetting = {}; var Obj = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.GetObject(); UserDataToAssign.Config.EmailSetting.Email = Obj.UserDataToAssign; Result.ThereIsError = Obj.ThereIsError; break; } case "DateOption": { if(!UserDataToAssign.Config.CronoData) UserDataToAssign.Config.CronoData = {}; var Obj = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.GetObject(); UserDataToAssign.Config.CronoData = Obj.UserDataToAssign; Result.ThereIsError = Obj.ThereIsError; break; } case "STEOutbound": { if(!UserDataToAssign.Config.OutboundSettings) UserDataToAssign.Config.OutboundSettings = {}; var Obj = $MWProcessDesigner.SettingSideNav.Rows[indexRow].ElementWhereGetValue.GetObject(); if(Obj.UserDataToAssign.PhoneNumber) { UserDataToAssign.Config.OutboundSettings = Obj.UserDataToAssign; UserDataToAssign.BlockProperties.IsConfigured = true; } Result.ThereIsError = Obj.ThereIsError; break; } } } } return Result; }, this.CreateRightSideNavRow = function(PropertyName, TypeValue, Value, Options) { //------------------- BUTTONS ----------------------------- function CreateRowButton(AddButton, IsClickedByAdd, Instance, Options) { if(Options) if(Options.Hide) return; var SideNavBodyRowButton = document.createElement("div"); SideNavBodyRowButton.className = "resgui-1row relative-full-width align-items-center row-direction"; SideNavBodyRowButton.IsOptionalButton = true; if(Instance) SideNavBodyRowButton.Id = Instance.Id; var SideNavBodyRowButtonDescription = document.createElement("div"); SideNavBodyRowButtonDescription.className = "resgui-1row resgui-13column align-items-center justify-content-flex-start"; var Spacer = document.createElement("div"); Spacer.className = "resgui-1row resgui-7column"; SideNavBodyRowButton.appendChild(Spacer); var InputText = document.createElement("input"); InputText.type = "text"; if(Instance) InputText.value = Instance.Text; InputText.style.minWidth = "calc(var(--resgui-12column)"; InputText.style.width = "calc(var(--resgui-12column)"; InputText.style.maxWidth = "calc(var(--resgui-12column)"; InputText.addEventListener("dblclick", function(ev) { $MWProcessDesigner.PopupListVariables(ev.target); }); SideNavBodyRowButton.InputToGetTheValue = InputText; SideNavBodyRowButtonDescription.appendChild(InputText); var SideNavBodyRowButtonValue = document.createElement("div"); SideNavBodyRowButtonValue.className = "resgui-1row resgui-4column align-items-center justify-content-flex-start"; var ImgDelete = document.createElement("img"); ImgDelete.src = "../../../../../../images/icons/deleteIcon.png"; ImgDelete.className = "icon-image-button"; ImgDelete.style.marginRight = "var(--resgui-1column)"; ImgDelete.Row = SideNavBodyRowButton; ImgDelete.addEventListener("click", function(ev){ //console.log( ev.target.Row, ev.target.Row.parentNode.parentNode) var Index = ev.target.Row.parentNode.parentNode.ButtonRows.indexOf(ev.target.Row); if(Index > -1) ev.target.Row.parentNode.parentNode.ButtonRows.splice(Index, 1); ev.target.Row.parentNode.removeChild(ImgDelete.Row); }); SideNavBodyRowButtonValue.appendChild(ImgDelete); SideNavBodyRowButton.appendChild(SideNavBodyRowButtonDescription); SideNavBodyRowButton.appendChild(SideNavBodyRowButtonValue); return SideNavBodyRowButton; } function CreateRowButtonDefault(AddButton, IsClickedByAdd, Instance, Options) { if(Options) if(Options.Hide) return; var SideNavBodyRowButton = document.createElement("div"); SideNavBodyRowButton.className = "resgui-1row relative-full-width align-items-center row-direction"; SideNavBodyRowButton.IsDefaultOk = true; SideNavBodyRowButton.Id = Instance.Id; var SideNavBodyRowButtonDescription = document.createElement("div"); SideNavBodyRowButtonDescription.className = "resgui-1row resgui-13column align-items-center justify-content-flex-start"; var Spacer = document.createElement("div"); Spacer.className = "resgui-1row resgui-7column"; SideNavBodyRowButton.appendChild(Spacer); var InputText = document.createElement("input"); InputText.type = "text"; InputText.value = Instance.Text; InputText.style.minWidth = "calc(var(--resgui-12column)"; InputText.style.width = "calc(var(--resgui-12column)"; InputText.style.maxWidth = "calc(var(--resgui-12column)"; InputText.addEventListener("dblclick", function(ev) { $MWProcessDesigner.PopupListVariables(ev.target); }); SideNavBodyRowButton.InputToGetTheValue = InputText; SideNavBodyRowButtonDescription.appendChild(InputText); SideNavBodyRowButton.appendChild(SideNavBodyRowButtonDescription); return SideNavBodyRowButton; } //-------------------------------------------------------- //------------------- FORM ----------------------------- function ConfigureFormField(Instance, isUpdate, callback, Rows) { var CustomBox = new TMWGUICustomBox(15, 20); CustomBox.InstanceBlock = Instance; CustomBox.Rows = []; CustomBox.isUpdate = isUpdate; CustomBox.RowsForm = Rows; CustomBox.ValidateObjectForm = function() { var Object = {}; var ThereIsError = false; if(this.Rows.length > 0) { for(var Index in this.Rows) { switch(this.Rows[Index].PropertyName) { case "VariableName": { if(this.Rows[Index].ElementWhereGetValue.value == "") { if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") == -1) { this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className + " ErrorMark"; } ThereIsError = true; } else { var Match = this.Rows[Index].ElementWhereGetValue.value.match(/^[a-zA-Z0-9]+$/gi); if(Match != null) { if(Match.length > 0) { if(this.isUpdate) { Object[this.Rows[Index].PropertyName] = this.Rows[Index].ElementWhereGetValue.value; if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") > -1) this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className.replace(" ErrorMark",""); } else { var IndexToUnique = this.RowsForm.findIndex(x => x.Instance.VariableName.toLowerCase() == this.Rows[Index].ElementWhereGetValue.value.toLowerCase()); if(IndexToUnique == -1) { Object[this.Rows[Index].PropertyName] = this.Rows[Index].ElementWhereGetValue.value; if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") > -1) this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className.replace(" ErrorMark",""); } else { if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") == -1) { this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className + " ErrorMark"; } ThereIsError = true; } } } else { if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") == -1) { this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className + " ErrorMark"; } ThereIsError = true; } } else { if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") == -1) { this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className + " ErrorMark"; } ThereIsError = true; } } break; } case "Description": { if(this.Rows[Index].ElementWhereGetValue.value == "") { if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") == -1) { this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className + " ErrorMark"; } ThereIsError = true; } else { Object[this.Rows[Index].PropertyName] = this.Rows[Index].ElementWhereGetValue.value; if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") > -1) this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className.replace(" ErrorMark",""); } break; } case "Require": { Object[this.Rows[Index].PropertyName] = this.Rows[Index].ElementWhereGetValue.checked; break; } case "Type": { if(this.Rows[Index].ElementWhereGetValue.selectedOptions[0].value != "-1") { if(this.Rows[Index].ElementWhereGetValue.selectedOptions[0].value == "enum") { Object[this.Rows[Index].PropertyName] = this.Rows[Index].ElementWhereGetValue.value; if(this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows.length > 0) { var Options = []; for(var IndexEnum in this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows) { var ObjKeyValue = {}; if(this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].KeyContainer.value == "") { if(this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].KeyContainer.className.indexOf("ErrorMark") == -1) { this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].KeyContainer.className = this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].KeyContainer.className + " ErrorMark"; } ThereIsError = true; } else { ObjKeyValue[this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].KeyContainer.value] = ""; if(this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].KeyContainer.className.indexOf("ErrorMark") > -1) this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].KeyContainer.className = this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].KeyContainer.className.replace(" ErrorMark",""); } if(this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].ValueContainer.value == "") { if(this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].ValueContainer.className.indexOf("ErrorMark") == -1) { this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].ValueContainer.className = this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].ValueContainer.className + " ErrorMark"; } ThereIsError = true; } else { ObjKeyValue[this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].KeyContainer.value] = this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].ValueContainer.value; if(this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].ValueContainer.className.indexOf("ErrorMark") > -1) this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].ValueContainer.className = this.Rows[Index].ElementWhereGetValue.DivTableEnumerator.Rows[IndexEnum].ValueContainer.className.replace(" ErrorMark",""); } Options.push(ObjKeyValue); } Object.Options = Options; } if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") > -1) this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className.replace(" ErrorMark",""); } else { Object[this.Rows[Index].PropertyName] = this.Rows[Index].ElementWhereGetValue.value; if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") > -1) this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className.replace(" ErrorMark",""); } } else { if(this.Rows[Index].ElementWhereGetValue.className.indexOf("ErrorMark") == -1) { this.Rows[Index].ElementWhereGetValue.className = this.Rows[Index].ElementWhereGetValue.className + " ErrorMark"; } ThereIsError = true; } break; } } } } else ThereIsError = true; return {"ThereIsError":ThereIsError, "Instance": Object}; } CustomBox.SaveFunction = function(ResponseValidation, Callback) { if(!ResponseValidation.ThereIsError) { if(Callback) { Callback(ResponseValidation.Instance); this.Close(); } } else setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("SaveErrorMsgTitle"), $MWGUI.GetLanguageString("SaveErrorMsgBody") ,"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}])}, 350); } var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("FieldConfig"); CustomBox.ResultEnumeratorField = []; if(isUpdate && Instance.Type == "enum") { CustomBox.ResultEnumeratorField = JSON.parse(JSON.stringify(Instance.Options)); } var spanClose = document.createElement("span"); spanClose.innerHTML = "×"; spanClose.style.fontSize = "var(--resgui-font-height-xl)"; spanClose.style.cursor = "pointer"; spanClose.style.marginRight = "var(--resgui-quartercolumn)"; spanClose.CustomBox = CustomBox; spanClose.Instance = Instance; spanClose.Callback = callback; spanClose.onclick = function (ev) { var Target = ev.target; var ResponseValidation = Target.CustomBox.ValidateObjectForm(); if(JSON.stringify(ResponseValidation.Instance) != JSON.stringify({Require: false})) { if(JSON.stringify(ResponseValidation.Instance) != JSON.stringify(Instance)) { setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("UpdateNotSavedMsgTitle"), $MWGUI.GetLanguageString("UpdateNotSavedMsgBody") ,"info",[{"text":$MWGUI.GetLanguageString("MessageButtonYes"),"Callback":function(){Target.CustomBox.SaveFunction(ResponseValidation, Target.Callback);}},{"text":$MWGUI.GetLanguageString("MessageButtonNo"),"Callback":function(){Target.CustomBox.Close()}},{"text":$MWGUI.GetLanguageString("MessageButtonCancel"),"Callback":function(){}}])}, 350); } else Target.CustomBox.Close(); } else Target.CustomBox.Close(); }; CustomBox.Title.className += " justify-content-space-between"; CustomBox.Title.appendChild(spanTitle); CustomBox.Title.appendChild(spanClose); var CustomBoxToolbar = document.createElement("div"); CustomBoxToolbar.className = "resgui-1row relative-full-width align-items-center justify-content-space-around "; CustomBoxToolbar.style.backgroundColor = "var(--messagebox-command-background)"; var CustomBoxRowField = document.createElement("div"); CustomBoxRowField.className = "resgui-13row relative-full-width column-direction overflow-y-auto overflow-x-hidden"; CustomBoxRowField.RowsValue = []; spanClose.Input = CustomBoxRowField.RowsValue; var CustomBoxToolbarSave = document.createElement("div"); CustomBoxToolbarSave.className = "button-application"; CustomBoxToolbarSave.CustomBox = CustomBox; CustomBoxToolbarSave.Input = CustomBoxRowField.RowsValue; CustomBoxToolbarSave.callback = callback; CustomBoxToolbarSave.isUpdate = isUpdate; CustomBoxToolbarSave.addEventListener("click",function(ev) { var Target = ev.target; if(Target.nodeName == "SPAN") Target = Target.parentNode; var ResponseValidation = Target.CustomBox.ValidateObjectForm(); Target.CustomBox.SaveFunction(ResponseValidation, Target.callback); }); var CustomBoxToolbarSpanSave = document.createElement("span"); CustomBoxToolbarSpanSave.innerHTML = $MWGUI.GetLanguageString("Confirm"); var CustomBoxToolbarCancel = document.createElement("div"); CustomBoxToolbarCancel.className = "button-application"; CustomBoxToolbarCancel.CustomBox = CustomBox; CustomBoxToolbarCancel.Instance = Instance; CustomBoxToolbarCancel.Input = CustomBoxRowField.RowsValue; CustomBoxToolbarCancel.Callback = callback; CustomBoxToolbarCancel.addEventListener("click",function(ev) { var Target = ev.target; if(Target.nodeName == "SPAN") Target = Target.parentNode; var ResponseValidation = Target.CustomBox.ValidateObjectForm(); if(JSON.stringify(ResponseValidation.Instance) != JSON.stringify({Require: false})) { if(JSON.stringify(ResponseValidation.Instance) != JSON.stringify(Instance)) { setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("UpdateNotSavedMsgTitle"), $MWGUI.GetLanguageString("UpdateNotSavedMsgBody") ,"info",[{"text":$MWGUI.GetLanguageString("MessageButtonYes"),"Callback":function(){Target.CustomBox.SaveFunction(ResponseValidation, Target.Callback);}},{"text":$MWGUI.GetLanguageString("MessageButtonNo"),"Callback":function(){Target.CustomBox.Close()}},{"text":$MWGUI.GetLanguageString("MessageButtonCancel"),"Callback":function(){}}])}, 350); } else Target.CustomBox.Close(); } else Target.CustomBox.Close(); }); var CustomBoxToolbarSpanCancel = document.createElement("span"); CustomBoxToolbarSpanCancel.innerHTML = $MWGUI.GetLanguageString("CancelButton"); CustomBoxToolbarSave.appendChild(CustomBoxToolbarSpanSave); CustomBoxToolbarCancel.appendChild(CustomBoxToolbarSpanCancel); CustomBoxToolbar.appendChild(CustomBoxToolbarSave); CustomBoxToolbar.appendChild(CustomBoxToolbarCancel); var CustomBoxContent = document.createElement("div"); CustomBoxContent.className = "resgui-14row relative-full-width align-items-center column-direction"; CustomBoxContent.style.backgroundColor = "var(--group-row-background)"; CustomBoxContent.appendChild(CustomBoxToolbar); var CustomBoxRowFieldDescription = document.createElement("div"); CustomBoxRowFieldDescription.className = "resgui-8column align-items-center justify-content-flex-end"; var CustomBoxRowDescriptionValue = document.createElement("div"); CustomBoxRowDescriptionValue.className = "resgui-12column align-items-center justify-content-flex-start"; var CustomBoxRowChooseType = document.createElement("div"); CustomBoxRowChooseType.className = "resgui-8column align-items-center justify-content-flex-end"; var CustomBoxRowTypeValue = document.createElement("div"); CustomBoxRowTypeValue.className = "resgui-12column align-items-center justify-content-flex-start"; var CustomBoxRowChooseRequire = document.createElement("div"); CustomBoxRowChooseRequire.className = "resgui-8column align-items-center justify-content-flex-end"; var CustomBoxRowChooseValue = document.createElement("div"); CustomBoxRowChooseValue.className = "resgui-12column align-items-center justify-content-flex-start"; var CustomBoxRowVarName = document.createElement("div"); CustomBoxRowVarName.className = "resgui-8column align-items-center justify-content-flex-end"; var CustomBoxRowVarNameValue = document.createElement("div"); CustomBoxRowVarNameValue.className = "resgui-12column align-items-center justify-content-flex-start"; var CustomBoxFieldDescriptionSpan = document.createElement("span"); CustomBoxFieldDescriptionSpan.className = "resgui-3column"; CustomBoxFieldDescriptionSpan.innerHTML = $MWGUI.GetLanguageString("CustomFormDescription"); var CustomBoxFieldDescription = document.createElement("input"); CustomBoxFieldDescription.type = "text"; CustomBoxFieldDescription.style.width = "var(--resgui-6column)"; CustomBoxRowField.RowsValue.push(CustomBoxFieldDescription); if(isUpdate) CustomBoxFieldDescription.value = Instance.Description; CustomBoxRowFieldDescription.appendChild(CustomBoxFieldDescriptionSpan); CustomBoxRowDescriptionValue.appendChild(CustomBoxFieldDescription); var ContentDescription = document.createElement("div"); ContentDescription.className = "resgui-1row relative-full-width row-direction decor-solid-border-bottom-wallpaper-color"; ContentDescription.appendChild(CustomBoxRowFieldDescription); ContentDescription.appendChild(CustomBoxRowDescriptionValue); var CustomBoxFieldTypeSelect = document.createElement("select"); CustomBoxFieldTypeSelect.type = "select"; CustomBoxFieldTypeSelect.style.width = "var(--resgui-6column)"; var CustomBoxFieldTypeSelectSpan = document.createElement("span"); CustomBoxFieldTypeSelectSpan.className = "resgui-3column"; CustomBoxFieldTypeSelectSpan.innerHTML = $MWGUI.GetLanguageString("CustomFormType"); var FieldTypeOptionNull = document.createElement("option"); FieldTypeOptionNull.setAttribute("value", "-1"); var DescriptionFieldTypeOption = document.createTextNode($MWGUI.GetLanguageString("ComboValueNull")); FieldTypeOptionNull.appendChild(DescriptionFieldTypeOption); var FieldTypeOptionText = document.createElement("option"); FieldTypeOptionText.setAttribute("value", "text"); var DescriptionFieldTypeOption = document.createTextNode($MWGUI.GetLanguageString("ComboValueText")); FieldTypeOptionText.appendChild(DescriptionFieldTypeOption); var FieldTypeOptionPassword = document.createElement("option"); FieldTypeOptionPassword.setAttribute("value", "password"); var DescriptionFieldTypeOption = document.createTextNode($MWGUI.GetLanguageString("ComboValuePassword")); FieldTypeOptionPassword.appendChild(DescriptionFieldTypeOption); var FieldTypeOptionMail = document.createElement("option"); FieldTypeOptionMail.setAttribute("value", "mail"); var DescriptionFieldTypeOption = document.createTextNode($MWGUI.GetLanguageString("ComboValueMail")); FieldTypeOptionMail.appendChild(DescriptionFieldTypeOption); var FieldTypeOptionEnumerator = document.createElement("option"); FieldTypeOptionEnumerator.setAttribute("value", "enum"); var DescriptionFieldEnumeratorOption = document.createTextNode($MWGUI.GetLanguageString("ComboValueEnum")); FieldTypeOptionEnumerator.appendChild(DescriptionFieldEnumeratorOption); var FieldTypeOptionFile = document.createElement("option"); FieldTypeOptionFile.setAttribute("value", "File"); var DescriptionFieldFileOption = document.createTextNode($MWGUI.GetLanguageString("File")); FieldTypeOptionFile.appendChild(DescriptionFieldFileOption); var FieldTypeOptionInt = document.createElement("option"); FieldTypeOptionInt.setAttribute("value", "Number"); var DescriptionFieldIntOption = document.createTextNode($MWGUI.GetLanguageString("Number")); FieldTypeOptionInt.appendChild(DescriptionFieldIntOption); CustomBoxFieldTypeSelect.appendChild(FieldTypeOptionNull); CustomBoxFieldTypeSelect.appendChild(FieldTypeOptionText); CustomBoxFieldTypeSelect.appendChild(FieldTypeOptionMail); CustomBoxFieldTypeSelect.appendChild(FieldTypeOptionPassword); CustomBoxFieldTypeSelect.appendChild(FieldTypeOptionEnumerator); CustomBoxFieldTypeSelect.appendChild(FieldTypeOptionFile); CustomBoxFieldTypeSelect.appendChild(FieldTypeOptionInt); CustomBoxFieldTypeSelect.setAttribute("selectedIndex",0); CustomBoxRowField.RowsValue.push(CustomBoxFieldTypeSelect); if(isUpdate) { var Index = 0; for(Index = 0;Index0) { for(Index in Instance.Options) { if(parseInt(Index) == 0) { var Row = CreateRowEnumerateTableOptions(TableEnum, true, Instance.Options[Index]); CustomBoxFieldTypeSelect.DivTableEnumerator.Rows.push(Row); } else { var Row = CreateRowEnumerateTableOptions(TableEnum, false, Instance.Options[Index]); CustomBoxFieldTypeSelect.DivTableEnumerator.Rows.push(Row); } } } DivEnumField.DivTableEnumerator = CustomBoxFieldTypeSelect.DivTableEnumerator; CustomBoxFieldTypeSelect.DivTableEnumerator.appendChild(ConfigureType); CustomBoxFieldTypeSelect.DivTableEnumerator.appendChild(TableEnum); ContentType.appendChild(CustomBoxFieldTypeSelect.DivTableEnumerator); ContentType.currentElement = CustomBoxFieldTypeSelect.DivTableEnumerator; } CustomBox.Open(); } function CreateTableEnumerateOptions() { var EnumTable = $MWGUI.NewTable(); EnumTable.id = Date.now(); EnumTable.children[2].children[1].style.overflowX = "hidden"; EnumTable.children[2].children[1].style.overflowY = "auto"; var ColDesctable = EnumTable.AddColumn("Description", 9); ColDesctable.className += " align-items-center justify-content-center"; var spanDescName = document.createElement("span"); spanDescName.innerHTML = $MWGUI.GetLanguageString("ColumnDescription"); spanDescName.style.marginLeft = "var(--resgui-1vw)"; ColDesctable.Header.appendChild(spanDescName); var ColValuetable = EnumTable.AddColumn("Value", 9); ColValuetable.className += " align-items-center justify-content-center"; var spanDescName = document.createElement("span"); spanDescName.innerHTML = $MWGUI.GetLanguageString("ColumnValue"); spanDescName.style.marginLeft = "var(--resgui-1vw)"; ColValuetable.Header.appendChild(spanDescName); var ColModtable = EnumTable.AddColumn("", 2); ColModtable.className += " align-items-center justify-content-center"; return EnumTable; } function CreateRowEnumerateTableOptions(Table, IsDefault, Instance) { var Row = Table.AddRow(); console.log(Table); Row.Cells[0].className += " align-items-center justify-content-flex-start"; var RowFieldDescription = document.createElement("input"); RowFieldDescription.type = "text"; if(Instance != null) { for(var PName in Instance) RowFieldDescription.value = PName; } RowFieldDescription.style.minWidth = "var(--resgui-8column)"; RowFieldDescription.style.maxWidth = "var(--resgui-8column)"; RowFieldDescription.style.width = "var(--resgui-8column)"; Row.Cells[0].appendChild(RowFieldDescription); Row.KeyContainer = RowFieldDescription; Row.Cells[1].className += " align-items-center justify-content-flex-start"; var RowFieldValue = document.createElement("input"); RowFieldValue.type = "text"; if(Instance != null) { for(var PName in Instance) RowFieldValue.value = Instance[PName]; } RowFieldValue.style.width = "var(--resgui-8column)"; RowFieldValue.style.maxWidth = "var(--resgui-8column)"; RowFieldValue.style.minWidth = "var(--resgui-8column)"; Row.Cells[1].appendChild(RowFieldValue); Row.ValueContainer = RowFieldValue; if(!IsDefault) { Row.Cells[2].className = Row.Cells[2].className + " justify-content-center "; var ImgDelete = document.createElement("img"); ImgDelete.src = "../../../../../../../../../../../../images/icons/deleteIcon.png"; ImgDelete.className = "icon-image-button"; ImgDelete.Table = Table; ImgDelete.Row = Row; ImgDelete.addEventListener("click", function(ev) { var Target = ev.target; Target.Table.DeleteRow(Target.Row); }); Row.Cells[2].appendChild(ImgDelete); } return Row; } function CreateTableFieldForm(Instance) { var Table = $MWGUI.NewTable(); var ColNametable = Table.AddColumn("VariableName", 6); ColNametable.className += " align-items-center justify-content-center"; var spanName = document.createElement("span"); spanName.innerHTML = $MWGUI.GetLanguageString("ColumnVariable"); spanName.style.marginLeft = "var(--resgui-1vw)"; ColNametable.Header.appendChild(spanName); var ColDesctable = Table.AddColumn("Description", 9); ColDesctable.className += " align-items-center justify-content-center"; var spanDescName = document.createElement("span"); spanDescName.innerHTML = $MWGUI.GetLanguageString("ColumnDescriptionFields"); spanDescName.style.marginLeft = "var(--resgui-1vw)"; ColDesctable.Header.appendChild(spanDescName); var ColTypectable = Table.AddColumn("Type", 4); ColTypectable.className += " align-items-center justify-content-center"; var spanTypeName = document.createElement("span"); spanTypeName.innerHTML = $MWGUI.GetLanguageString("ColumnTypeFields"); spanTypeName.style.marginLeft = "var(--resgui-1vw)"; ColTypectable.Header.appendChild(spanTypeName); var ColReqtable = Table.AddColumn("Require", 3); ColReqtable.className += " align-items-center justify-content-center"; var spanReqName = document.createElement("span"); spanReqName.innerHTML = $MWGUI.GetLanguageString("ColumnRequired"); spanReqName.style.marginLeft = "var(--resgui-1vw)"; ColReqtable.Header.appendChild(spanReqName); var ColModtable = Table.AddColumn("", 3); ColModtable.className += " align-items-center justify-content-center"; return Table; } function CreateRow(ObjectSaved,Table,Instance , Rows) { var Row = Table.AddRow(); Row.Instance = ObjectSaved; Row.Cells[0].className += " align-items-center justify-content-flex-start"; var VariableName = document.createElement("input"); Row.InputVarName = VariableName; VariableName.type = "text"; VariableName.style.minWidth = "var(--resgui-5column)"; VariableName.style.width = "var(--resgui-5column)"; VariableName.style.maxWidth = "var(--resgui-5column)"; VariableName.value = ObjectSaved.VariableName; VariableName.Rows = Rows; VariableName.Instance = ObjectSaved; VariableName.Row = Row; VariableName.addEventListener("change", function(ev) { var IndexToUniqueElement = ev.target.Rows.findIndex(x =>x.Instance.VariableName.toLowerCase() == ev.target.value.toLowerCase()); if(IndexToUniqueElement == -1) { ev.target.Instance.VariableName = ev.target.value; ev.target.ImgUpdate.Instance.VariableName = ev.target.value; ev.target.Row.Instance.VariableName = ev.target.value; if(ev.target.className.indexOf("ErrorMark") > -1) ev.target.className = ev.target.className.replace("ErrorMark", ""); } else { if(ev.target.className.indexOf("ErrorMark") == -1) ev.target.className = ev.target.className + " ErrorMark"; setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("SaveErrorMsgTitle"), $MWGUI.GetLanguageString("SaveErrorMsgBody") ,"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}])}, 350); } }); Row.Cells[0].appendChild(VariableName); Row.Cells[1].className += " align-items-center justify-content-flex-start"; var Descr = document.createElement("input"); Descr.type = "text"; Descr.Instance = ObjectSaved; Descr.style.minWidth = "var(--resgui-8column)"; Descr.style.width = "var(--resgui-8column)"; Descr.style.maxWidth = "var(--resgui-8column)"; Descr.value = ObjectSaved.Description; Descr.Row = Row; Descr.addEventListener("change", function(ev) { ev.target.Instance.Description = ev.target.value; ev.target.ImgUpdate.Instance.Description = ev.target.value; ev.target.Row.Instance.Description = ev.target.value; }); Row.Cells[1].appendChild(Descr); Row.Cells[2].className += " align-items-center justify-content-flex-start"; var Type = document.createElement("span"); Type.className = "TextReadOnly"; Type.style.minWidth = "var(--resgui-3column)"; Type.style.width = "var(--resgui-3column)"; Type.style.maxWidth = "var(--resgui-3column)"; Type.innerHTML = ObjectSaved.Type; Row.Cells[2].appendChild(Type); Row.Cells[3].className += " align-items-center justify-content-center"; var Check = document.createElement("input"); Check.type = "checkbox"; Check.Instance = ObjectSaved; Check.checked = ObjectSaved.Require; Check.Row = Row; Check.onchange = function(ev) { this.Instance.Require = this.checked; this.ImgUpdate.Instance.Require = this.checked; this.Row.Instance.Require = this.checked; }; Row.Cells[3].appendChild(Check); var ImgUpdate = document.createElement("img"); Check.ImgUpdate = ImgUpdate; Descr.ImgUpdate = ImgUpdate; VariableName.ImgUpdate = ImgUpdate; ImgUpdate.src = "../../../../../../../../../../../../images/icons/editIcon.png"; ImgUpdate.className = "icon-image-button"; ImgUpdate.style.marginLeft = "var(--resgui-1vw)"; ImgUpdate.Row = Row; ImgUpdate.Rows = Rows; ImgUpdate.Instance = ObjectSaved; ImgUpdate.addEventListener("click", function(ev){ var Target = ev.target; ConfigureFormField(ev.target.Instance,true,function(objectToUpdate) { Target.Instance = objectToUpdate; Target.Row.Instance = objectToUpdate; Target.Row.Cells[0].childNodes[0].value = objectToUpdate.VariableName; Target.Row.Cells[1].childNodes[0].value = objectToUpdate.Description; Target.Row.Cells[2].childNodes[0].innerHTML = objectToUpdate.Type; Target.Row.Cells[3].childNodes[1].checked = objectToUpdate.Require; }, Rows); }); Row.Cells[4].appendChild(ImgUpdate); var ImgDelete = document.createElement("img"); ImgDelete.src = "../../../../../../../../../../../../images/icons/deleteIcon.png"; ImgDelete.className = "icon-image-button"; ImgDelete.Instance = ObjectSaved; ImgDelete.Table = Table; ImgDelete.Row = Row; ImgDelete.Rows = Rows; ImgDelete.style.marginLeft = "var(--resgui-1vw)"; ImgDelete.addEventListener("click", function(ev){ var IndexToDelete = ev.target.Rows.indexOf(ev.target.Row); if(IndexToDelete > -1) ev.target.Rows.splice(IndexToDelete, 1); ev.target.Table.DeleteRow(ev.target.Row); }); Row.Cells[4].appendChild(ImgDelete); return Row; } //-------------------------------------------------------- //------------------- MULTIQUESTIONS ------------------------ function CreateRowTextButtons(IsDefault, Instance) { var Row = document.createElement("div"); Row.Buttons = []; Row.className = "relative-full-width resgui-3row align-item-center row-direction justify-content-center"; Row.CreateButtonRow = function(IsDefault, Instace) { var RowButton; if(this.RowRight) { RowButton = document.createElement("div"); RowButton.className = "resgui-10column resgui-1row row-direction align-items-center justify-content-space-between"; var InputText = document.createElement("input"); InputText.type = "text"; InputText.style.minWidth = "var(--resgui-8column)"; InputText.style.maxWidth = "var(--resgui-8column)"; InputText.style.width = "var(--resgui-8column)"; InputText.style.marginBottom = "calc(var(--quarter-row) + 3px)"; InputText.style.marginRight = "0"; InputText.addEventListener("dblclick", function(ev) { $MWProcessDesigner.PopupListVariables(ev.target); }); if(Instace) InputText.value = Instace.Text; if(Instace) InputText.Id = Instace.Id; RowButton.InputText = InputText; RowButton.appendChild(InputText); if(!IsDefault) { var ImgDelete = document.createElement("img"); ImgDelete.src = "../../../../../../../../../../../../images/icons/deleteIcon.png"; ImgDelete.className = "icon-image-button"; ImgDelete.style.marginBottom = "calc(var(--quarter-row) + 3px)"; ImgDelete.style.marginRight = "var(--resgui-halfcolumn)"; ImgDelete.RowButton = RowButton; ImgDelete.Row = this; ImgDelete.addEventListener("click", function(ev) { ev.target.Row.RowRight.removeChild(ev.target.RowButton); var IndexToDelete = ev.target.Row.Buttons.indexOf(ev.target.RowButton); if(IndexToDelete > -1) { ev.target.Row.Buttons.splice(IndexToDelete,1); ev.target.Row.style.height = "calc(var(--resgui-1row) * "+ (ev.target.Row.Buttons.length + 2) +")"; ev.target.Row.style.maxHeight = "calc(var(--resgui-1row) * "+ (ev.target.Row.Buttons.length + 2) +")"; ev.target.Row.style.minHeight = "calc(var(--resgui-1row) * "+ (ev.target.Row.Buttons.length + 2) +")"; } }); RowButton.appendChild(ImgDelete); } else { var DivContainer = document.createElement("div"); DivContainer.className = "resgui-1row resgui-10column align-items-center justify-content-space-between row-direction"; var Span = document.createElement("span"); Span.innerHTML = $MWGUI.GetLanguageString("ButtonsToShow"); Span.style.marginLeft = "var(--resgui-1vw)"; DivContainer.appendChild(Span); var ImgAdd = document.createElement("img"); ImgAdd.src = "../../../../../../images/icons/addIcon.png"; ImgAdd.className = "icon-image-button"; ImgAdd.Row = this; ImgAdd.style.marginRight = "var(--resgui-halfcolumn)"; ImgAdd.addEventListener("click",function(ev) { if(ev.target.Row.Buttons.length < 5) ev.target.Row.CreateButtonRow(false); }); DivContainer.appendChild(ImgAdd); this.RowRight.appendChild(DivContainer); } this.RowRight.appendChild(RowButton); this.Buttons.push(RowButton); this.style.height = "calc(var(--resgui-1row) * "+ (this.Buttons.length + 2) +")"; this.style.maxHeight = "calc(var(--resgui-1row) * "+ (this.Buttons.length + 2) +")"; this.style.minHeight = "calc(var(--resgui-1row) * "+ (this.Buttons.length + 2) +")"; } return RowButton; } Row.DeleteButtonRow = function() { if(this.parentNode != null) { var Index = this.parentNode.DivButtonAddQuestion.Rows.indexOf(this); if(Index > -1) this.parentNode.DivButtonAddQuestion.Rows.splice(Index, 1); this.parentNode.removeChild(this); } }; Row.GetObject = function() { var Object = { "Text" : "", "Buttons": [], "Id" : "", "Name" : "" } Object.Text = this.TextArea.value; Object.Name = this.Name.value; if(this.TextArea.Id) Object.Id = this.TextArea.Id; for(var Index in this.Buttons) { var ObjectButton = { "Text" : "", "InputObj" : null, "Id" : "" } ObjectButton.Text = this.Buttons[Index].InputText.value; ObjectButton.InputObj = this.Buttons[Index].InputText; if(this.Buttons[Index].InputText.Id) ObjectButton.Id = this.Buttons[Index].InputText.Id; Object.Buttons.push(ObjectButton); } return Object; } var RowLeft = document.createElement("div"); RowLeft.className = "resgui-12column relative-full-height align-items-center row-direction justify-content-flex-end decor-solid-border-bottom-wallpaper-color"; var DivSpanText = document.createElement("div"); DivSpanText.className = "resgui-1row resgui-10column align-items-center row-direction"; if(!IsDefault) { var ImgDelete = document.createElement("img"); ImgDelete.src = "../../../../../../../../../../../../images/icons/deleteIcon.png"; ImgDelete.className = "icon-image-button"; ImgDelete.style.marginLeft = "var(--resgui-1vw)"; ImgDelete.Row = Row; ImgDelete.addEventListener("click", function(ev) { ev.target.Row.DeleteButtonRow(); }); DivSpanText.appendChild(ImgDelete); DivSpanText.className = DivSpanText.className + " justify-content-flex-start"; } else DivSpanText.className = DivSpanText.className + " justify-content-flex-end"; var divContainerSpanTextArea = document.createElement("div"); divContainerSpanTextArea.className = "relative-full-height resgui-10column column-direction"; var InputTextName = document.createElement("input"); Row.Name = InputTextName; InputTextName.type = "text"; InputTextName.style.minWidth = "var(--resgui-5column)"; InputTextName.style.maxWidth = "var(--resgui-5column)"; InputTextName.style.width = "var(--resgui-5column)"; InputTextName.addEventListener("dblclick", function(ev) { $MWProcessDesigner.PopupListVariables(ev.target); }); if(!IsDefault) InputTextName.style.marginLeft = "calc(var(--resgui-3column) + var(--resgui-halfcolumn))"; if(Instance) { InputTextName.value = Instance.Name; } DivSpanText.appendChild(InputTextName); divContainerSpanTextArea.appendChild(DivSpanText); var TextArea = document.createElement("textarea"); Row.TextArea = TextArea; TextArea.type = "text"; TextArea.className = "text-area-process-designer"; TextArea.style.width = "var(--resgui-9column)"; TextArea.style.maxWidth = "var(--resgui-9column)"; TextArea.style.minWidth = "var(--resgui-9column)"; TextArea.style.height = "calc(100% - var(--resgui-1row) - 2vh)"; TextArea.style.minHeight = "calc(100% - var(--resgui-1row) - 2vh)"; TextArea.style.maxHeight = "calc(100% - var(--resgui-1row) - 2vh)"; TextArea.addEventListener("dblclick", function(ev) { $MWProcessDesigner.PopupListVariables(ev.target); }); if(Instance) { TextArea.value = Instance.Text; TextArea.Id = Instance.Id; } divContainerSpanTextArea.appendChild(TextArea); RowLeft.appendChild(divContainerSpanTextArea); Row.RowRight = document.createElement("div"); Row.RowRight.className = "resgui-12column relative-full-height column-direction decor-solid-border-bottom-wallpaper-color"; if(Instance) { for(var IndexButton in Instance.Buttons) { if(parseInt(IndexButton) == 0) { Row.CreateButtonRow(true, Instance.Buttons[IndexButton]); } else { Row.CreateButtonRow(false, Instance.Buttons[IndexButton]); } } } else Row.CreateButtonRow(true); Row.appendChild(RowLeft); Row.appendChild(Row.RowRight); return Row; } //----------------------------------------------------------- var SideNavBodyRow = document.createElement("div"); SideNavBodyRow.className = "resgui-1row relative-full-width align-items-center row-direction"; SideNavBodyRow.style.borderBottom = "1px solid var(--main-gb-color)"; SideNavBodyRow.PropertyName = PropertyName; var SideNavBodyRowDescription = document.createElement("div"); SideNavBodyRowDescription.className = "resgui-1row resgui-7column align-items-center justify-content-flex-end"; var SideNavBodyRowDescriptionSpan = document.createElement("span"); SideNavBodyRowDescriptionSpan.innerHTML = $MWGUI.GetLanguageString(PropertyName) + " :"; SideNavBodyRowDescription.appendChild(SideNavBodyRowDescriptionSpan); var SideNavBodyRowValue = document.createElement("div"); SideNavBodyRowValue.className = "resgui-1row resgui-13column align-items-center justify-content-flex-start"; switch(TypeValue){ case "InputText": { var InputText = document.createElement("input"); InputText.value = Value.replace(/(<([^>]+)>)/gi, "").replace(/]+)>)/gi, "").replace(/]+)>)/gi, "").replace(/ 0) { var divButtonAdd = document.createElement("div"); divButtonAdd.className = "button-application"; divButtonAdd.ButtonRows = SideNavBodyRow.ButtonRows; divButtonAdd.Options = Options; divButtonAdd.addEventListener("click", function(ev) { var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; var MaxCount = 1000; if(Target.Options.MaxCountButtons != undefined) MaxCount = Target.Options.MaxCountButtons; if(MaxCount >= Target.ButtonRows.length) { var RowButton = CreateRowButton( ev.target ,true); ButtonRowsGroup.appendChild(RowButton); Target.ButtonRows.push(RowButton); } }); var imgAdd = document.createElement("img"); imgAdd.src = "../../../../../../images/icons/addIcon.png"; imgAdd.classList = "icon-image"; divButtonAdd.appendChild(imgAdd); var divButtonAddSpan = document.createElement("span"); divButtonAddSpan.innerHTML = $MWGUI.GetLanguageString("AddButton"); divButtonAdd.appendChild(divButtonAddSpan); SideNavBodyRowValue.appendChild(divButtonAdd); } else { } SideNavBodyRow.RowType = TypeValue; SideNavBodyRow.ElementWhereGetValue = SideNavBodyRow; $MWProcessDesigner.SettingSideNav.Rows.push(SideNavBodyRow); SideNavBodyRow.appendChild(DivContainerDescValue); SideNavBodyRow.appendChild(ButtonRowsGroup); if(Value.DefaultOk) { var RowButton = CreateRowButtonDefault(null, false,Value.DefaultOk) ButtonRowsGroup.appendChild(RowButton); SideNavBodyRow.ButtonRows.push(RowButton); } if(Value.OptionalButtons.length > 0) { for(var Index in Value.OptionalButtons) { var RowButton = CreateRowButton(null, false,Value.OptionalButtons[Index]) ButtonRowsGroup.appendChild(RowButton); SideNavBodyRow.ButtonRows.push(RowButton); } } SideNavBodyRow.style.borderBottom = null; } break; } case "DefaultKo": { SideNavBodyRow.RowType = TypeValue; SideNavBodyRow.Instance = Value; $MWProcessDesigner.SettingSideNav.Rows.push(SideNavBodyRow); break; } case "DefaultVariables": { SideNavBodyRow.RowType = TypeValue; SideNavBodyRow.Instance = Value; $MWProcessDesigner.SettingSideNav.Rows.push(SideNavBodyRow); break; } case "Form": { SideNavBodyRowValue.className = SideNavBodyRowValue.className.replace("justify-content-flex-start", " justify-content-center "); SideNavBodyRow.className = SideNavBodyRow.className.replace("row-direction", " column-direction "); var DivContainerDescValue = document.createElement("div"); DivContainerDescValue.className = "resgui-1row relative-full-width align-items-center row-direction"; DivContainerDescValue.appendChild(SideNavBodyRowDescription); DivContainerDescValue.appendChild(SideNavBodyRowValue); var Table = CreateTableFieldForm(Value); Table.children[2].children[1].style.overflowX = "hidden"; Table.children[2].children[1].style.overflowY = "auto"; var DivButtonAddField = document.createElement("div"); DivButtonAddField.className = "button-application"; DivButtonAddField.Table = Table; DivButtonAddField.Instance = Value; DivButtonAddField.Rows = []; DivButtonAddField.addEventListener("click",function(ev) { var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; ConfigureFormField(Target.Instance,false,function(ObjectSaved) { Target.Rows.push(CreateRow(ObjectSaved, Target.Table,Target.Instance, Target.Rows)); }, Target.Rows); }) var ImgAdd = document.createElement("img"); ImgAdd.src = "../../../../../../images/icons/addIcon.png"; ImgAdd.className = "icon-image"; DivButtonAddField.appendChild(ImgAdd); var divButtonAddSpan = document.createElement("span"); divButtonAddSpan.innerHTML = $MWGUI.GetLanguageString("AddField"); DivButtonAddField.appendChild(divButtonAddSpan); SideNavBodyRowValue.appendChild(DivButtonAddField); SideNavBodyRow.RowType = TypeValue; SideNavBodyRow.ElementWhereGetValue = DivButtonAddField; $MWProcessDesigner.SettingSideNav.Rows.push(SideNavBodyRow); var DivContainerFormData = document.createElement("div"); DivContainerFormData.className = "relative-full-width align-items-center row-direction resgui-5row"; DivContainerFormData.appendChild(Table); SideNavBodyRow.appendChild(DivContainerDescValue); SideNavBodyRow.appendChild(DivContainerFormData); function Cicle_formField(Index, FormFields, DivButtonAddField, Callback) { if(Index < FormFields.length) { DivButtonAddField.Rows.push(CreateRow(FormFields[Index], DivButtonAddField.Table, FormFields[Index], DivButtonAddField.Rows)); Cicle_formField(parseInt(Index) + 1, FormFields, DivButtonAddField, Callback); } else { if(Callback) Callback(); } } if(Value.length > 0) { Cicle_formField(0, Value, DivButtonAddField, function() { }); } break; } case "TextButtons": { SideNavBodyRow.className = SideNavBodyRow.className.replace("row-direction", " column-direction "); var DivContainerDescValue = document.createElement("div"); DivContainerDescValue.className = "resgui-1row relative-full-width align-items-center row-direction"; DivContainerDescValue.appendChild(SideNavBodyRowDescription); DivContainerDescValue.appendChild(SideNavBodyRowValue); var DivButtonAddQuestion = document.createElement("div"); DivButtonAddQuestion.className = "button-application"; DivButtonAddQuestion.Rows = []; DivButtonAddQuestion.style.marginLeft = "var(--resgui-quartercolumn)"; DivButtonAddQuestion.addEventListener("click",function(ev) { var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; var Row = CreateRowTextButtons(false); Target.DivContainerFormData.appendChild(Row); Target.Rows.push(Row); }); var ImgAdd = document.createElement("img"); ImgAdd.src = "../../../../../../images/icons/addIcon.png"; ImgAdd.className = "icon-image"; DivButtonAddQuestion.appendChild(ImgAdd); var divButtonAddSpan = document.createElement("span"); divButtonAddSpan.innerHTML = $MWGUI.GetLanguageString("AddTextButtons"); DivButtonAddQuestion.appendChild(divButtonAddSpan); SideNavBodyRowValue.appendChild(DivButtonAddQuestion); SideNavBodyRow.RowType = TypeValue; SideNavBodyRow.ElementWhereGetValue = DivButtonAddQuestion; $MWProcessDesigner.SettingSideNav.Rows.push(SideNavBodyRow); var DivContainerFormData = document.createElement("div"); DivButtonAddQuestion.DivContainerFormData = DivContainerFormData; DivContainerFormData.DivButtonAddQuestion = DivButtonAddQuestion; DivContainerFormData.className = "relative-full-width align-items-center column-direction decor-solid-border-bottom-wallpaper-color"; if(Value.length > 0) { for(var IndexValue in Value) { if(parseInt(IndexValue) == 0) { var Row = CreateRowTextButtons(true, Value[IndexValue]); DivContainerFormData.appendChild(Row); DivButtonAddQuestion.Rows.push(Row); } else { var Row = CreateRowTextButtons(false, Value[IndexValue]); DivContainerFormData.appendChild(Row); DivButtonAddQuestion.Rows.push(Row); } } } else { var Row = CreateRowTextButtons(true); DivContainerFormData.appendChild(Row); DivButtonAddQuestion.Rows.push(Row); } SideNavBodyRow.appendChild(DivContainerDescValue); SideNavBodyRow.appendChild(DivContainerFormData); SideNavBodyRow.style.borderBottom = null; break; } case "Email": { SideNavBodyRow.className = SideNavBodyRow.className.replace("row-direction", " column-direction "); SideNavBodyRow.OnLoadFunction = function() { parent.parent.$MWTab.Initialize(); if(this.SmtpTabDiv) { this.SmtpTabDiv.CreateRow = function(PName, Type,Callback) { var Row = document.createElement("div"); Row.PName = PName; Row.className = "resgui-1row relative-full-width row-direction align-items-center decor-solid-border-bottom-wallpaper-color"; var DescriptionDiv = document.createElement("div"); DescriptionDiv.className = "resgui-1row resgui-7column align-items-center justify-content-flex-end"; Row.appendChild(DescriptionDiv); var SpanPName = document.createElement("span"); SpanPName.innerHTML = $MWGUI.GetLanguageString(PName) + " :"; DescriptionDiv.appendChild(SpanPName); var ValueDiv = document.createElement("div"); ValueDiv.className = "resgui-1row resgui-13column align-items-center justify-content-flex-start"; Row.appendChild(ValueDiv); switch(Type) { case "DefaultSmtpChoice": { var Checkbox = document.createElement("input"); Checkbox.type = "checkbox"; Checkbox.EmailTab = this.EmailTab; Checkbox.onchange = function() { this.ExecuteChange(); } Checkbox.ExecuteChange = function() { if(this.SmtpHost && this.SmtpPort && this.SSL && this.Auth && this.User && this.Password) { if(this.checked) { this.SmtpHost.ElementHTML.ConvertElementNotAndRO(true); this.SmtpPort.ElementHTML.ConvertElementNotAndRO(true); this.SSL.ElementHTML.ConvertElementNotAndRO(true); this.Auth.ElementHTML.ConvertElementNotAndRO(true); this.User.ElementHTML.ConvertElementNotAndRO(true); this.Password.ElementHTML.ConvertElementNotAndRO(true); } else { this.SmtpHost.ElementHTML.ConvertElementNotAndRO(); this.SmtpPort.ElementHTML.ConvertElementNotAndRO(); this.SSL.ElementHTML.ConvertElementNotAndRO(); this.Auth.ElementHTML.ConvertElementNotAndRO(); this.User.ElementHTML.ConvertElementNotAndRO(); this.Password.ElementHTML.ConvertElementNotAndRO(); } } if(this.EmailTab.Rows) { if(this.checked) { this.EmailTab.Rows[0].style.display = "none"; this.EmailTab.Rows[5].style.display = "flex"; } else { this.EmailTab.Rows[0].style.display = "flex"; this.EmailTab.Rows[5].style.display = "none"; } } } Row.ElementHTML = Checkbox; ValueDiv.appendChild(Checkbox); break; } case "Host": { var InputText = document.createElement("input"); InputText.Row = Row; InputText.type = "text"; InputText.style.marginLeft = "var(--resgui-quartercolumn)"; InputText.style.width = "var(--resgui-12column)"; InputText.style.minWidth = "var(--resgui-12column)"; InputText.style.maxWidth = "var(--resgui-12column)"; InputText.ConvertElementNotAndRO = function(ReadOnly) { if(ReadOnly) { this.Row.style.display = "none"; } else { this.Row.style.display = "flex"; } } Row.ElementHTML = InputText; ValueDiv.appendChild(InputText); break; } case "Port": { var InputPort = document.createElement("input"); InputPort.Row = Row; InputPort.type = "number"; InputPort.style.marginLeft = "var(--resgui-quartercolumn)"; InputPort.style.width = "var(--resgui-12column)"; InputPort.style.minWidth = "var(--resgui-12column)"; InputPort.style.maxWidth = "var(--resgui-12column)"; InputPort.ConvertElementNotAndRO = function(ReadOnly) { if(ReadOnly) { this.Row.style.display = "none"; } else { this.Row.style.display = "flex"; } } Row.ElementHTML = InputPort; ValueDiv.appendChild(InputPort); break; } case "Ssl": { var Checkbox = document.createElement("input"); Checkbox.Row = Row; Checkbox.type = "checkbox"; Checkbox.ConvertElementNotAndRO = function(ReadOnly) { if(ReadOnly) { this.Row.style.display = "none"; } else { this.Row.style.display = "flex"; } } Row.ElementHTML = Checkbox; ValueDiv.appendChild(Checkbox); break; } case "Auth": { var Checkbox = document.createElement("input"); Checkbox.Row = Row; Checkbox.type = "checkbox"; Checkbox.onchange = function() { if(this.User && this.Password) { if(this.checked) { this.User.ElementHTML.Transform(); this.Password.ElementHTML.Transform(); } else { this.User.ElementHTML.Transform(true); this.Password.ElementHTML.Transform(true); } } } Checkbox.ConvertElementNotAndRO = function(ReadOnly) { if(ReadOnly) { this.Row.style.display = "none"; } else { this.Row.style.display = "flex"; } } Row.ElementHTML = Checkbox; ValueDiv.appendChild(Checkbox); break; } case "User": case "Password": { var InputText = document.createElement("input"); InputText.Row = Row; InputText.Transform = function(ReadOnly) { if(ReadOnly) { var Span = document.createElement("span"); Span.className = "TextReadOnly"; Span.Transform = this.Transform; Span.ConvertElementNotAndRO = this.ConvertElementNotAndRO; Span.Row = this.Row; Span.style.width = "var(--resgui-12column)"; Span.style.minWidth = "var(--resgui-12column)"; Span.style.maxWidth = "var(--resgui-12column)"; Row.ElementHTML = Span; this.parentNode.appendChild(Span); this.parentNode.removeChild(this); } else { var InputText = document.createElement("input"); InputText.type = "text"; InputText.style.marginLeft = "var(--resgui-quartercolumn)"; InputText.Transform = this.Transform; InputText.Row = this.Row; InputText.ConvertElementNotAndRO = this.ConvertElementNotAndRO; InputText.style.width = "var(--resgui-12column)"; InputText.style.minWidth = "var(--resgui-12column)"; InputText.style.maxWidth = "var(--resgui-12column)"; if(this.value) InputText.value = this.value; Row.ElementHTML = InputText; this.parentNode.appendChild(InputText); this.parentNode.removeChild(this); } } InputText.ConvertElementNotAndRO = function(ReadOnly) { if(ReadOnly) { this.Row.style.display = "none"; } else { this.Row.style.display = "flex"; } } InputText.type = "text"; InputText.style.marginLeft = "var(--resgui-quartercolumn)"; InputText.style.width = "var(--resgui-12column)"; InputText.style.minWidth = "var(--resgui-12column)"; InputText.style.maxWidth = "var(--resgui-12column)"; Row.ElementHTML = InputText; ValueDiv.appendChild(InputText); break; } } this.Rows.push(Row); if(Callback) Callback(Row); return Row; } this.SmtpTabDiv.Rows = []; this.SmtpTabDiv.EmailTab = this.EmailTabDiv; var ContainerForm = document.createElement("div"); ContainerForm.className = "resgui-7row relative-full-width column-direction align-items-center"; this.SmtpTabDiv.appendChild(ContainerForm); var Instance = this.Instance; var RowChoice = this.SmtpTabDiv.CreateRow("DefaultSmtp", "DefaultSmtpChoice", function(Row) { if(Instance.DefaultSmtp) Row.ElementHTML.checked = Instance.DefaultSmtp; }); ContainerForm.appendChild(RowChoice); var SmtpHost = this.SmtpTabDiv.CreateRow("SmtpHost", "Host", function(Row) { if(Instance.SmtpHost) Row.ElementHTML.value = Instance.SmtpHost; }); RowChoice.ElementHTML.SmtpHost = SmtpHost; ContainerForm.appendChild(SmtpHost); var SmtpPort = this.SmtpTabDiv.CreateRow("SmtpPort", "Port", function(Row) { if(Instance.SmtpPort) Row.ElementHTML.value = Instance.SmtpPort; }); RowChoice.ElementHTML.SmtpPort = SmtpPort; ContainerForm.appendChild(SmtpPort); var SSL = this.SmtpTabDiv.CreateRow("Ssl", "Ssl", function(Row) { if(Instance.Ssl) Row.ElementHTML.checked = Instance.Ssl; }); RowChoice.ElementHTML.SSL = SSL; ContainerForm.appendChild(SSL); var Auth = this.SmtpTabDiv.CreateRow("Auth", "Auth", function(Row) { if(Instance.Auth) Row.ElementHTML.checked = Instance.Auth; }); RowChoice.ElementHTML.Auth = Auth; ContainerForm.appendChild(Auth); var User = this.SmtpTabDiv.CreateRow("User", "User", function(Row) { if(Instance.Auth) if(Instance.User) Row.ElementHTML.value = Instance.User; }); RowChoice.ElementHTML.User = User; Auth.ElementHTML.User = User; ContainerForm.appendChild(User); var Password = this.SmtpTabDiv.CreateRow("Password", "Password", function(Row) { if(Instance.Auth) if(Instance.Password) Row.ElementHTML.value = Instance.Password; }); Auth.ElementHTML.Password = Password; RowChoice.ElementHTML.Password = Password; Auth.ElementHTML.onchange(); RowChoice.ElementHTML.ExecuteChange(); ContainerForm.appendChild(Password); } if(this.EmailTabDiv) { this.EmailTabDiv.CreateRow = function(PName, Type,Callback) { var Result; var Row = document.createElement("div"); Row.PName = PName; Row.className = "relative-full-width row-direction align-items-center decor-solid-border-bottom-wallpaper-color"; Result = Row; var DescriptionDiv = document.createElement("div"); DescriptionDiv.className = "resgui-1row resgui-7column align-items-center justify-content-flex-end"; Row.appendChild(DescriptionDiv); var SpanPName = document.createElement("span"); SpanPName.innerHTML = $MWGUI.GetLanguageString(PName) + " :"; DescriptionDiv.appendChild(SpanPName); var ValueDiv = document.createElement("div"); ValueDiv.className = "resgui-1row resgui-13column align-items-center justify-content-flex-start row-direction"; Row.appendChild(ValueDiv); switch(Type) { case "From": { var InputText = document.createElement("input"); InputText.type = "email"; InputText.placeholder = "example@domain.com"; InputText.addEventListener("input",function() { var Patt = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ if (Patt.test(this.value)) { if (this.className.indexOf(" ErrorMark", "") > -1) this.className = this.className.replace(" ErrorMark", ""); } else { if(this.value != null && this.value != '') { if (this.className.indexOf(" ErrorMark", "") == -1) { this.className += " ErrorMark"; } } else { if (this.className.indexOf(" ErrorMark", "") > -1) this.className = this.className.replace(" ErrorMark", ""); } } }); InputText.style.width = "var(--resgui-12column)"; InputText.style.minWidth = "var(--resgui-12column)"; InputText.style.maxWidth = "var(--resgui-12column)"; Row.ElementHTML = InputText; ValueDiv.appendChild(InputText); break; } case "To": case "Cc": { Row.className = Row.className.replace(/decor-solid-border-bottom-wallpaper-color/gi, ""); var ContainerToEmails = document.createElement("div"); ContainerToEmails.PName = PName; ContainerToEmails.className = "relative-full-width column-direction overflow-y-auto decor-solid-border-bottom-wallpaper-color"; ContainerToEmails.style.maxHeight = "calc((var(--resgui-three-quarter-row) * 4) + var(--resgui-1row))"; ContainerToEmails.style.minHeight = "calc(var(--resgui-1row) + 1px)"; ContainerToEmails.style.height = null; ContainerToEmails.Rows = []; var InputText = document.createElement("input"); InputText.type = "email"; InputText.placeholder = "example@domain.com"; InputText.addEventListener("input", function() { var Patt = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ if (Patt.test(this.value)) { if (this.className.indexOf(" ErrorMark", "") > -1) this.className = this.className.replace(" ErrorMark", ""); } else { if(this.value != null && this.value != '') { if (this.className.indexOf(" ErrorMark", "") == -1) { this.className += " ErrorMark"; } } else { if (this.className.indexOf(" ErrorMark", "") > -1) this.className = this.className.replace(" ErrorMark", ""); } } }); InputText.style.width = "var(--resgui-12column)"; InputText.style.minWidth = "var(--resgui-12column)"; InputText.style.maxWidth = "var(--resgui-12column)"; ContainerToEmails.ElementHTML = InputText; ValueDiv.appendChild(InputText); var ImgAdd = document.createElement("img"); ImgAdd.src = "../../../../../../images/icons/addIcon.png"; ImgAdd.InputText = InputText; ImgAdd.className = "icon-image-button"; ImgAdd.ContainerToEmails = ContainerToEmails; ImgAdd.CreateRow = function(Value) { var RowEmailDest = document.createElement("div"); RowEmailDest.className = "resgui-three-quarter-row relative-full-width row-direction"; this.ContainerToEmails.appendChild(RowEmailDest); var RowDescrEmailDestination = document.createElement("div"); RowDescrEmailDestination.className = "relative-full-height resgui-7column align-items-center justify-content-flex-end"; RowEmailDest.appendChild(RowDescrEmailDestination); var RowValueEmailDestination = document.createElement("div"); RowValueEmailDestination.className = "relative-full-height resgui-13column align-items-center justify-content-flex-start row-direction"; RowEmailDest.appendChild(RowValueEmailDestination); var InputText = document.createElement("input"); InputText.type = "email"; InputText.value = Value; InputText.style.width = "var(--resgui-12column)"; InputText.style.minWidth = "var(--resgui-12column)"; InputText.style.maxWidth = "var(--resgui-12column)"; InputText.addEventListener("input", function() { var Patt = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ if (Patt.test(this.value)) { if (this.className.indexOf(" ErrorMark", "") > -1) this.className = this.className.replace(" ErrorMark", ""); } else { if(this.value != null && this.value != '') { if (this.className.indexOf(" ErrorMark", "") == -1) { this.className += " ErrorMark"; } } else { if (this.className.indexOf(" ErrorMark", "") > -1) this.className = this.className.replace(" ErrorMark", ""); } } }); RowEmailDest.ElementHTML = InputText; RowValueEmailDestination.appendChild(InputText); var ImgDelete = document.createElement("img"); ImgDelete.src = "../../../../../../images/icons/deleteIcon.png"; ImgDelete.className = "icon-image-button"; ImgDelete.Row = RowEmailDest; ImgDelete.addEventListener("click",function() { var IndexToRemove = this.Row.parentNode.Rows.indexOf(this.Row); if(IndexToRemove > -1) this.Row.parentNode.Rows.splice(IndexToRemove, 1); if(this.Row.parentNode.Rows.length <= 4) this.Row.parentNode.style.minHeight = "calc((var(--resgui-three-quarter-row) * "+ (parseInt(this.Row.parentNode.Rows.length)) +") + var(--resgui-1row) + 1px)"; this.Row.parentNode.removeChild(this.Row); }); RowValueEmailDestination.appendChild(ImgDelete); return RowEmailDest; }; ContainerToEmails.ImgAdd = ImgAdd; ImgAdd.addEventListener("click",function() { if(this.InputText.value != "") { var Patt = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ if(Patt.test(this.InputText.value)) { if(this.InputText.className.indexOf("ErrorMark") > -1) this.InputText.className = this.InputText.className.replace(/ ErrorMark/gi, ""); this.ContainerToEmails.Rows.push(this.CreateRow(this.InputText.value)); this.InputText.value = ""; if(this.ContainerToEmails.Rows.length <= 4) this.ContainerToEmails.style.minHeight = "calc((var(--resgui-three-quarter-row) * "+ (parseInt(this.ContainerToEmails.Rows.length)) +") + var(--resgui-1row) + 1px)"; } else if(this.InputText.className.indexOf("ErrorMark") == -1) this.InputText.className = this.InputText.className + " ErrorMark"; } else { if(this.InputText.className.indexOf("ErrorMark") == -1) this.InputText.className = this.InputText.className + " ErrorMark"; } }); ValueDiv.appendChild(ImgAdd); ContainerToEmails.appendChild(Row) Result = ContainerToEmails; break; } case "Subject": { var InputText = document.createElement("input"); InputText.type = "text"; InputText.addEventListener("dblclick",function() { $MWProcessDesigner.PopupListVariables(this); }); InputText.style.width = "var(--resgui-12column)"; InputText.style.minWidth = "var(--resgui-12column)"; InputText.style.maxWidth = "var(--resgui-12column)"; Row.ElementHTML = InputText; ValueDiv.appendChild(InputText); break; } case "Body": { ValueDiv.className = ValueDiv.className.replace(/resgui-1row/gi, "resgui-5row") DescriptionDiv.className = DescriptionDiv.className.replace(/resgui-1row/gi, "resgui-5row") var Text = document.createElement("textarea"); Text.className = "text-area-process-designer"; Text.style.minWidth = "var(--resgui-12column)"; Text.style.width = "var(--resgui-12column)"; Text.style.maxWidth = "var(--resgui-12column)"; Text.addEventListener("dblclick",function() { $MWProcessDesigner.PopupListVariables(this); }); Row.ElementHTML = Text; ValueDiv.appendChild(Text); break; } case "Tracing": { var Checkbox = document.createElement("input"); Checkbox.Row = Row; Checkbox.type = "checkbox"; Row.ElementHTML = Checkbox; ValueDiv.appendChild(Checkbox); break; } } this.Rows.push(Result); if(Callback) Callback(Result); return Result; } this.EmailTabDiv.Rows = []; var ContainerAll = document.createElement("div"); ContainerAll.className = "relative-full-width column-direction align-items-center overflow-y-auto"; ContainerAll.style.height = "calc(var(--resgui-7row) + var(--resgui-three-quarter-row))"; ContainerAll.style.maxHeight = "calc(var(--resgui-7row) + var(--resgui-three-quarter-row))"; ContainerAll.style.minHeight = "calc(var(--resgui-7row) + var(--resgui-three-quarter-row))"; this.EmailTabDiv.appendChild(ContainerAll); var ContainerForm = document.createElement("div"); ContainerForm.className = "relative-full-height relative-full-width column-direction align-items-center"; ContainerAll.appendChild(ContainerForm); var Instance = this.Instance; var RowFrom = this.EmailTabDiv.CreateRow("EmailFrom", "From", function(Row) { if(Instance.EmailFrom) Row.ElementHTML.value = Instance.EmailFrom; if(Instance.DefaultSmtp) Row.style.display = "none"; else Row.style.display = "flex"; }); ContainerForm.appendChild(RowFrom); var RowTo = this.EmailTabDiv.CreateRow("EmailTo", "To", function(Row) { if(Instance.EmailTo) { for(var Index in Instance.EmailTo) { Row.Rows.push(Row.ImgAdd.CreateRow(Instance.EmailTo[Index])); } if(Row.Rows.length <= 4) Row.style.minHeight = "calc((var(--resgui-three-quarter-row) * "+ (parseInt(Row.Rows.length)) +") + var(--resgui-1row) + 1px)"; } }); ContainerForm.appendChild(RowTo); var RowCc = this.EmailTabDiv.CreateRow("Cc", "Cc", function(Row) { if(Instance.Cc) { for(var Index in Instance.Cc) { Row.Rows.push(Row.ImgAdd.CreateRow(Instance.Cc[Index])); } if(Row.Rows.length <= 4) Row.style.minHeight = "calc((var(--resgui-three-quarter-row) * "+ (parseInt(Row.Rows.length)) +") + var(--resgui-1row) + 1px)"; } }); ContainerForm.appendChild(RowCc); var RowSubject = this.EmailTabDiv.CreateRow("EmailSubject", "Subject", function(Row) { if(Instance.EmailSubject) Row.ElementHTML.value = Instance.EmailSubject; }); ContainerForm.appendChild(RowSubject); var RowBody = this.EmailTabDiv.CreateRow("EmailBody", "Body", function(Row) { if(Instance.EmailBody) Row.ElementHTML.value = Instance.EmailBody; }); ContainerForm.appendChild(RowBody); var RowTracing = this.EmailTabDiv.CreateRow("EnableTracing", "Tracing", function(Row) { if(Instance.EnableTracing) Row.ElementHTML.checked = Instance.EnableTracing; if(Instance.DefaultSmtp) Row.style.display = "flex"; else Row.style.display = "none"; }); ContainerForm.appendChild(RowTracing); } if(this.AttachmentTabDiv) { this.AttachmentTabDiv.CreateRow = function(Value, AttachName) { if(this.Table) { var Row = this.Table.AddRow(); var VarAttachName = document.createElement("input"); VarAttachName.type = "text"; if(AttachName) VarAttachName.value = AttachName; VarAttachName.addEventListener("dblclick", function() { $MWProcessDesigner.PopupListVariables(this); }); Row.Cells[0].appendChild(VarAttachName); var VarName = document.createElement("input"); VarName.type = "text"; VarName.value = Value; VarName.addEventListener("dblclick", function() { var Element = this; $MWProcessDesigner.PopupListVariables(this, {"Callback":function(Value){ Element.value = Value; }}); }); Row.Cells[1].appendChild(VarName); var ImgDelete = document.createElement("img"); ImgDelete.src = "../../../../../../images/icons/deleteIcon.png"; ImgDelete.className = "icon-image-button"; ImgDelete.style.marginLeft = "var(--resgui-quartercolumn)"; ImgDelete.Row = Row; ImgDelete.Table = this.Table; ImgDelete.addEventListener("click",function() { this.Table.DeleteRow(this.Row); }); Row.Cells[2].appendChild(ImgDelete); } }; var ContainerAll = document.createElement("div"); ContainerAll.className = "relative-full-width column-direction align-items-center overflow-y-auto"; ContainerAll.style.height = "calc(var(--resgui-7row) + var(--resgui-three-quarter-row))"; ContainerAll.style.maxHeight = "calc(var(--resgui-7row) + var(--resgui-three-quarter-row))"; ContainerAll.style.minHeight = "calc(var(--resgui-7row) + var(--resgui-three-quarter-row))"; this.AttachmentTabDiv.appendChild(ContainerAll); var ContainerForm = document.createElement("div"); ContainerForm.className = "relative-full-height relative-full-width column-direction align-items-center"; ContainerAll.appendChild(ContainerForm); var RowButton = document.createElement("div"); RowButton.className = "resgui-1row relative-full-width justify-content-center align-items-center"; RowButton.style.backgroundColor = "var(--secondary-toolbar-background)"; ContainerForm.appendChild(RowButton); var Button = document.createElement("div"); Button.className = "button-application"; Button.ContainerAll = ContainerAll; Button.addEventListener("click", function() { var Container = this.ContainerAll; $MWProcessDesigner.PopupListVariables(this, {"Callback":function(Value){ Container.parentNode.CreateRow(Value); }, "Query":{Attach:true}}); }); RowButton.appendChild(Button); var SpanButton = document.createElement("span"); SpanButton.innerHTML = $MWGUI.GetLanguageString("SelectAttach"); Button.appendChild(SpanButton); var Table = $MWGUI.NewTable(); this.AttachmentTabDiv.Table = Table; Table.children[2].children[1].style.overflowX = "hidden"; Table.children[2].children[1].style.overflowY = "auto"; var ColAttachName = Table.AddColumn("AttachName", 12); ColAttachName.className += " align-items-center justify-content-center"; var spanAttachName = document.createElement("span"); spanAttachName.innerHTML = $MWGUI.GetLanguageString("AttachName"); spanAttachName.style.marginLeft = "var(--resgui-1vw)"; ColAttachName.Header.appendChild(spanAttachName); var ColVariableName = Table.AddColumn("VariableName", 11); ColVariableName.className += " align-items-center justify-content-center"; var spanVariableName = document.createElement("span"); spanVariableName.innerHTML = $MWGUI.GetLanguageString("VariableName"); spanVariableName.style.marginLeft = "var(--resgui-1vw)"; ColVariableName.Header.appendChild(spanVariableName); var ColMod = Table.AddColumn("", 2); ColMod.className += " align-items-center justify-content-center"; var Instance = this.Instance; if(Instance.Attachments) { for(var Index in Instance.Attachments) { this.AttachmentTabDiv.CreateRow(Instance.Attachments[Index].VariableName, Instance.Attachments[Index].AttachName); } } ContainerForm.appendChild(Table); } } SideNavBodyRow.GetObject = function() { var Object = {}; var ThereIsError = false; for(var Index in this.SmtpTabDiv.Rows) { switch(this.SmtpTabDiv.Rows[Index].PName) { case "SmtpHost": case "SmtpPort": { if(!Object.DefaultSmtp) { if(this.SmtpTabDiv.Rows[Index].ElementHTML.value == "") { if(this.SmtpTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") == -1) this.SmtpTabDiv.Rows[Index].ElementHTML.className = this.SmtpTabDiv.Rows[Index].ElementHTML.className + " ErrorMark" ThereIsError = true; } else { Object[this.SmtpTabDiv.Rows[Index].PName] = this.SmtpTabDiv.Rows[Index].ElementHTML.value; if(this.SmtpTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") > -1) this.SmtpTabDiv.Rows[Index].ElementHTML.className = this.SmtpTabDiv.Rows[Index].ElementHTML.className.replace(/ ErrorMark/gi, ""); } } else { if(this.SmtpTabDiv.Rows[Index].PName == "SmtpPort") Object[this.SmtpTabDiv.Rows[Index].PName] = 0; else Object[this.SmtpTabDiv.Rows[Index].PName] =""; } break; } case "User": case "Password": { if(Object.Auth) { var value; if(this.SmtpTabDiv.Rows[Index].ElementHTML.value) value = this.SmtpTabDiv.Rows[Index].ElementHTML.value; else value = this.SmtpTabDiv.Rows[Index].ElementHTML.innerHTML; if(value == "") { if(this.SmtpTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") == -1) this.SmtpTabDiv.Rows[Index].ElementHTML.className = this.SmtpTabDiv.Rows[Index].ElementHTML.className + " ErrorMark" ThereIsError = true; } else { if(this.SmtpTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") > -1) this.SmtpTabDiv.Rows[Index].ElementHTML.className = this.SmtpTabDiv.Rows[Index].ElementHTML.className.replace(/ ErrorMark/gi, ""); Object[this.SmtpTabDiv.Rows[Index].PName] = value; } } else Object[this.SmtpTabDiv.Rows[Index].PName] = ""; break; } case "DefaultSmtp": { Object[this.SmtpTabDiv.Rows[Index].PName] = this.SmtpTabDiv.Rows[Index].ElementHTML.checked; break; } default: { if(!Object.DefaultSmtp) Object[this.SmtpTabDiv.Rows[Index].PName] = this.SmtpTabDiv.Rows[Index].ElementHTML.checked; else Object[this.SmtpTabDiv.Rows[Index].PName] = false; break; } } } for(var Index in this.EmailTabDiv.Rows) { switch(this.EmailTabDiv.Rows[Index].PName) { case "Cc": { if(this.EmailTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") > -1) this.EmailTabDiv.Rows[Index].ElementHTML.className = this.EmailTabDiv.Rows[Index].ElementHTML.className.replace(/ ErrorMark/gi, ""); var ListEmails = []; for(var IndexDest in this.EmailTabDiv.Rows[Index].Rows) { var Patt = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ if(Patt.test(this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.value)) { ListEmails.push(this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.value) if(this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className.indexOf("ErrorMark") > -1) this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className = this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className.replace(/ ErrorMark/gi, ""); } else { if(this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className.indexOf("ErrorMark") == -1) this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className = this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className + " ErrorMark"; ThereIsError = true; } } if(ListEmails.length > 0) Object[this.EmailTabDiv.Rows[Index].PName] = ListEmails; else Object[this.EmailTabDiv.Rows[Index].PName] = []; break; } case "EmailTo": { if(this.EmailTabDiv.Rows[Index].Rows.length == 0) { if(this.EmailTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") == -1) this.EmailTabDiv.Rows[Index].ElementHTML.className = this.EmailTabDiv.Rows[Index].ElementHTML.className + " ErrorMark"; ThereIsError = true; } else { if(this.EmailTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") > -1) this.EmailTabDiv.Rows[Index].ElementHTML.className = this.EmailTabDiv.Rows[Index].ElementHTML.className.replace(/ ErrorMark/gi, ""); var ListEmails = []; for(var IndexDest in this.EmailTabDiv.Rows[Index].Rows) { var Patt = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ if(Patt.test(this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.value)) { ListEmails.push(this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.value) if(this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className.indexOf("ErrorMark") > -1) this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className = this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className.replace(/ ErrorMark/gi, ""); } else { if(this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className.indexOf("ErrorMark") == -1) this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className = this.EmailTabDiv.Rows[Index].Rows[IndexDest].ElementHTML.className + " ErrorMark"; ThereIsError = true; } } if(ListEmails.length > 0) Object[this.EmailTabDiv.Rows[Index].PName] = ListEmails; } break; } case "EmailSubject": case "EmailBody": { if(this.EmailTabDiv.Rows[Index].ElementHTML.value == "") { if(this.EmailTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") == -1) this.EmailTabDiv.Rows[Index].ElementHTML.className = this.EmailTabDiv.Rows[Index].ElementHTML.className + " ErrorMark" ThereIsError = true; } else { if(this.EmailTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") > -1) this.EmailTabDiv.Rows[Index].ElementHTML.className = this.EmailTabDiv.Rows[Index].ElementHTML.className.replace(/ ErrorMark/gi, ""); Object[this.EmailTabDiv.Rows[Index].PName] = this.EmailTabDiv.Rows[Index].ElementHTML.value; } break; } case "EmailFrom": { if(!Object.DefaultSmtp) { if(this.EmailTabDiv.Rows[Index].ElementHTML.value == "") { if(this.EmailTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") == -1) this.EmailTabDiv.Rows[Index].ElementHTML.className = this.EmailTabDiv.Rows[Index].ElementHTML.className + " ErrorMark" ThereIsError = true; } else { if(this.EmailTabDiv.Rows[Index].ElementHTML.className.indexOf("ErrorMark") > -1) this.EmailTabDiv.Rows[Index].ElementHTML.className = this.EmailTabDiv.Rows[Index].ElementHTML.className.replace(/ ErrorMark/gi, ""); Object[this.EmailTabDiv.Rows[Index].PName] = this.EmailTabDiv.Rows[Index].ElementHTML.value; } } else Object[this.EmailTabDiv.Rows[Index].PName] = ""; break; } case "EnableTracing": { Object[this.EmailTabDiv.Rows[Index].PName] = this.EmailTabDiv.Rows[Index].ElementHTML.checked; break; } } } var Attachments = []; for(var Index in this.AttachmentTabDiv.Table.RowList) { var objAttach = { "AttachName" : "", "VariableName" : "" } for(var IndexCell in this.AttachmentTabDiv.Table.RowList[Index].Cells) { if(this.AttachmentTabDiv.Table.RowList[Index].Cells[IndexCell].children[0].value != undefined) { var value = this.AttachmentTabDiv.Table.RowList[Index].Cells[IndexCell].children[0].value; if(value == "") { if(this.AttachmentTabDiv.Table.RowList[Index].Cells[IndexCell].children[0].className.indexOf("ErrorMark") == -1) this.AttachmentTabDiv.Table.RowList[Index].Cells[IndexCell].children[0].className = this.AttachmentTabDiv.Table.RowList[Index].Cells[IndexCell].children[0].className + " ErrorMark"; ThereIsError = true; } else { if(this.AttachmentTabDiv.Table.RowList[Index].Cells[IndexCell].children[0].className.indexOf("ErrorMark") > -1) this.AttachmentTabDiv.Table.RowList[Index].Cells[IndexCell].children[0].className = this.AttachmentTabDiv.Table.RowList[Index].Cells[IndexCell].children[0].className.replace(/ ErrorMark/gi,""); if(parseInt(IndexCell) == 0) { objAttach.AttachName = value; } else if(parseInt(IndexCell) == 1) { objAttach.VariableName = value; } } } } if(objAttach.AttachName != "" || objAttach.VariableName != "") Attachments.push(objAttach); } if(Attachments.length > 0) { Object.Attachments = Attachments; } return {"UserDataToAssign" : Object, "ThereIsError" : ThereIsError}; }; SideNavBodyRow.Instance = Value; var DivContainerDescValue = document.createElement("div"); DivContainerDescValue.className = "resgui-1row relative-full-width align-items-center row-direction"; DivContainerDescValue.style.display = "none"; DivContainerDescValue.appendChild(SideNavBodyRowDescription); DivContainerDescValue.appendChild(SideNavBodyRowValue); var DivContainer = document.createElement("div"); DivContainer.className = "relative-full-width relative-full-height align-items-center column-direction"; var DivMainContainer = document.createElement("div"); DivMainContainer.id = "MainContainer"; DivMainContainer.className = "relative-full-width relative-full-height column-direction"; DivContainer.appendChild(DivMainContainer); var DivHeader = document.createElement("div"); DivHeader.className = "MWTabClass"; DivHeader.setAttribute("data-MWTab", '{"IsHeader":true}'); DivMainContainer.appendChild(DivHeader); var SmtpTabDiv = document.createElement("div"); SideNavBodyRow.SmtpTabDiv = SmtpTabDiv; SmtpTabDiv.className = "MWTabClass"; SmtpTabDiv.setAttribute("data-MWTab", '{"Title":"SmtpTab","Icon":"../../../../../../../../../../../../../../../../../../images/icons/argoIcon.png","Show":true}'); DivMainContainer.appendChild(SmtpTabDiv); var EmailTabDiv = document.createElement("div"); SideNavBodyRow.EmailTabDiv = EmailTabDiv; EmailTabDiv.className = "MWTabClass"; EmailTabDiv.setAttribute("data-MWTab", '{"Title":"EmailTab","Icon":"../../../../../../../../../../../../../../../../../../images/icons/argoIcon.png","TabReference":"Email","IDHeaderButton":"EmailTab"}'); DivMainContainer.appendChild(EmailTabDiv); var AttachmentTabDiv = document.createElement("div"); SideNavBodyRow.AttachmentTabDiv = AttachmentTabDiv; AttachmentTabDiv.className = "MWTabClass"; AttachmentTabDiv.setAttribute("data-MWTab", '{"Title":"AttachmentTab","Icon":"../../../../../../../../../../../../../../../../../../images/icons/argoIcon.png","TabReference":"Attachment","IDHeaderButton":"Attachment"}'); DivMainContainer.appendChild(AttachmentTabDiv); SideNavBodyRow.appendChild(DivContainerDescValue); SideNavBodyRow.appendChild(DivContainer); SideNavBodyRow.RowType = TypeValue; SideNavBodyRow.ElementWhereGetValue = SideNavBodyRow; $MWProcessDesigner.SettingSideNav.Rows.push(SideNavBodyRow); SideNavBodyRow.style.borderBottom = null; break; } case "DateOption": { SideNavBodyRow.className = SideNavBodyRow.className.replace("resgui-1row", " resgui8row "); SideNavBodyRow.OnLoadFunction = function() { var DivMainContainer = document.createElement("div"); DivMainContainer.className = "relative-full-width resgui-1row column-direction justify-content-flex-start"; DivMainContainer.DateObject = []; DivMainContainer.Rows = []; DivMainContainer.DateOptionObject = []; DivMainContainer.OldDateObject = []; SideNavBodyRow.DateObject = DivMainContainer.DateObject; SideNavBodyRow.DateOptionObject = DivMainContainer.DateOptionObject; DivMainContainer.CreateRow = function(ValuesObj) { var Row = document.createElement("div"); Row.className = "relative-full-width resgui-2row align-items-center justify-content-flex-start decor-solid-border-bottom-wallpaper-color row-direction"; var ContainerDateAndOptions = document.createElement("div"); ContainerDateAndOptions.className = "resgui-2row resgui-23column column-direction"; var RowDate = document.createElement("div"); RowDate.className = "relative-full-width resgui-1row align-items-center justify-content-flex-start row-direction"; ContainerDateAndOptions.appendChild(RowDate); var RowOptionDate = document.createElement("div"); RowOptionDate.className = "relative-full-width resgui-1row align-items-center justify-content-flex-start row-direction"; ContainerDateAndOptions.appendChild(RowOptionDate); var RowDateFrom = document.createElement("div"); RowDateFrom.className = "resgui-7column resgui-1row align-items-center justify-content-flex-start"; RowDateFrom.style.marginLeft = "var(--resgui-quartercolumn)"; var DateSelectFromSpan = document.createElement("span"); DateSelectFromSpan.innerHTML = $MWGUI.GetLanguageString("NewDateFrom"); var DateSelectFrom = document.createElement("input"); DateSelectFrom.type = "date"; DateSelectFrom.style.minWidth = "var(--resgui-5column)"; DateSelectFrom.style.width = "var(--resgui-5column)"; DateSelectFrom.style.maxWidth = "var(--resgui-5column)"; if(ValuesObj != null) DateSelectFrom.value = ValuesObj.From; RowDate.ValueFrom = DateSelectFrom; RowDateFrom.appendChild(DateSelectFromSpan); RowDateFrom.appendChild(DateSelectFrom); var RowDateTo = document.createElement("div"); RowDateTo.className = "resgui-7column resgui-1row align-items-center justify-content-flex-start"; var DateSelectToSpan = document.createElement("span"); DateSelectToSpan.innerHTML = $MWGUI.GetLanguageString("NewDateTo"); var DateSelectTo = document.createElement("input"); DateSelectTo.type = "date"; DateSelectTo.style.minWidth = "var(--resgui-5column)"; DateSelectTo.style.width = "var(--resgui-5column)"; DateSelectTo.style.maxWidth = "var(--resgui-5column)"; if(ValuesObj != null) DateSelectTo.value = ValuesObj.To; RowDate.ValueTo = DateSelectTo; RowDateTo.appendChild(DateSelectToSpan); RowDateTo.appendChild(DateSelectTo); if(ValuesObj != null) { if(ValuesObj.Id) RowDate.Id = ValuesObj.Id; else RowDate.Id = ""; } else RowDate.Id = ""; var OptionDay = document.createElement("div"); OptionDay.className = "resgui-15column resgui-1row align-items-center justify-content-flex-start row-direction"; var OptionDayType = document.createElement("div"); OptionDayType.className = "resgui-5column resgui-1row align-items-center justify-content-flex-start row-direction"; OptionDayType.style.marginLeft = "var(--resgui-1column)"; RowOptionDate.DayValues = []; for(var i = 0;i<7;i++) { var DayDiv = document.createElement("DIV"); DayDiv.className = "calc(resgui-2column+resgui-quartercolumn) resgui-1row align-items-center justify-content-flex-start row-direction"; var Day = document.createElement("input"); Day.Preserve = true; Day.type = "checkbox"; Day.checked = false; if(ValuesObj != null) if(ValuesObj.Id !="") { Day.checked = ValuesObj.Option[i]; } Day.value = i; Day.OptionDay = OptionDay; Day.addEventListener("change",function(ev) { ev.target.OptionDay.children[7].childNodes[0].checked = false; var foundChecked=false; for(var IndexDay = 0 ; IndexDay< ev.target.OptionDay.children.length ; IndexDay++ ) { if(IndexDay != 7) { if(ev.target.OptionDay.children[IndexDay].childNodes[0].checked) foundChecked = true; } } if(!foundChecked) { for(var IndexDay = 0 ; IndexDay< ev.target.OptionDay.children.length ; IndexDay++ ) { if(IndexDay != 7) ev.target.OptionDay.children[IndexDay].childNodes[0].checked = true; } } }); RowOptionDate.DayValues.push(Day); var DayName = document.createElement("span"); DayName.style.fontSize = "var(--resgui-font-height-s)"; DayName.innerHTML = $MWGUI.GetLanguageString("OptionDate" + i); DayDiv.appendChild(Day); DayDiv.appendChild(DayName); OptionDay.appendChild(DayDiv); } var DayDiv = document.createElement("DIV"); DayDiv.className = "calc(resgui-2column+resgui-quartercolumn) resgui-1row align-items-center justify-content-flex-start row-direction"; var Day = document.createElement("input"); Day.Preserve = true; Day.type = "checkbox"; Day.checked = true; if(ValuesObj != null) if(ValuesObj.Id !="") { Day.checked = ValuesObj.Option[7]; } Day.value = "-1"; Day.OptionDay = OptionDay; Day.addEventListener("change",function(ev) { var Target = ev.target.OptionDay; if(Target.children[7].childNodes[0].checked) { for(var OptionIndex = 0;OptionIndex < Target.children.length;OptionIndex++) { if(OptionIndex != "7" ) Target.children[OptionIndex].childNodes[0].checked = false; } } else { for(var OptionIndex = 0;OptionIndex < Target.children.length;OptionIndex++) { if(OptionIndex != "7" ) Target.children[OptionIndex].childNodes[0].checked = true; } } }); RowOptionDate.DayValues.push(Day); var DayName = document.createElement("span"); DayName.style.fontSize = "var(--resgui-font-height-s)"; DayName.innerHTML = $MWGUI.GetLanguageString("OptionDateAll"); DayDiv.appendChild(Day); DayDiv.appendChild(DayName); OptionDay.appendChild(DayDiv); RowOptionDate.appendChild(OptionDay); var WeekdaysDiv = document.createElement("DIV"); WeekdaysDiv.className = "calc(resgui-2column+resgui-quartercolumn) resgui-1row align-items-center justify-content-flex-start row-direction"; var Weekdays = document.createElement("input"); Weekdays.Preserve = true; Weekdays.type = "checkbox"; Weekdays.checked = false; if(ValuesObj != null) if(ValuesObj.Id !="") { Weekdays.checked = ValuesObj.Option.Weekdays; } var WeekdaysName = document.createElement("span"); WeekdaysName.style.fontSize = "var(--resgui-font-height-s)"; WeekdaysName.innerHTML = $MWGUI.GetLanguageString("Weekdays"); WeekdaysDiv.appendChild(Weekdays); WeekdaysDiv.appendChild(WeekdaysName); OptionDayType.appendChild(WeekdaysDiv); RowOptionDate.Weekdays = Weekdays; var HolidaysDiv = document.createElement("DIV"); HolidaysDiv.className = "calc(resgui-2column+resgui-quartercolumn) resgui-1row align-items-center justify-content-flex-start row-direction"; var Holidays = document.createElement("input"); Holidays.Preserve = true; Holidays.type = "checkbox"; Holidays.checked = false; if(ValuesObj != null) if(ValuesObj.Id !="") { Holidays.checked = ValuesObj.Option.Holidays; } var HolidaysName = document.createElement("span"); HolidaysName.style.fontSize = "var(--resgui-font-height-s)"; HolidaysName.innerHTML = $MWGUI.GetLanguageString("Holidays"); HolidaysDiv.appendChild(Holidays); HolidaysDiv.appendChild(HolidaysName); OptionDayType.appendChild(HolidaysDiv); RowOptionDate.appendChild(OptionDayType); RowOptionDate.Holidays = Holidays; var ImgDelete = document.createElement("img"); /*if(IndexValue > 0) {*/ ImgDelete.src = "../../../../../../images/icons/deleteIcon.png"; ImgDelete.className = "icon-image-button"; ImgDelete.MainContainer = this; ImgDelete.Row = Row; ImgDelete.addEventListener("click", function(ev) { var IndexToRemove = ev.target.MainContainer.Rows.indexOf(ev.target.Row); if(IndexToRemove > -1) { ev.target.MainContainer.DateObject.splice(IndexToRemove, 1); ev.target.MainContainer.DateOptionObject.splice(IndexToRemove, 1); ev.target.MainContainer.Rows.splice(IndexToRemove, 1); ev.target.Row.parentNode.removeChild(ImgDelete.Row); } }); RowDate.appendChild(RowDateFrom); RowDate.appendChild(RowDateTo); Row.appendChild(ContainerDateAndOptions); if(IndexValue > 0) { var DivDelete = document.createElement("div"); DivDelete.className = "resgui-2row resgui-2column justify-content-center align-items-center"; DivDelete.appendChild(ImgDelete); Row.appendChild(DivDelete); } else if(ValuesObj == null) { var DivDelete = document.createElement("div"); DivDelete.className = "resgui-2row resgui-2column justify-content-center align-items-center"; DivDelete.appendChild(ImgDelete); Row.appendChild(DivDelete); } //Row.appendChild(RowDate); //Row.appendChild(RowOptionDate); this.appendChild(Row); this.DateObject.push(RowDate); this.DateOptionObject.push(RowOptionDate); this.Rows.push(Row); } var firstRow = document.createElement("div"); firstRow.className = "relative-full-width resgui-1row align-items-center justify-content-center"; var AddRow = document.createElement("div"); AddRow.className = "button-application"; AddRow.MainContainer = DivMainContainer; AddRow.addEventListener("click",function(ev) { var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; Target.MainContainer.CreateRow(null); }); var ImgAdd = document.createElement("img"); ImgAdd.src = "../../../../../../images/icons/addIcon.png"; ImgAdd.className = "icon-image"; AddRow.appendChild(ImgAdd); var SpanAddRow = document.createElement("span"); SpanAddRow.innerHTML = $MWGUI.GetLanguageString("NewDateButton"); AddRow.appendChild(SpanAddRow); firstRow.appendChild(AddRow); DivMainContainer.appendChild(firstRow); if(Value.length > 0) { for(var IndexValue in Value) { DivMainContainer.CreateRow(Value[IndexValue]); } } SideNavBodyRow.appendChild(DivMainContainer); } SideNavBodyRow.GetObject = function() { var Object = []; var ThereIsError = false; if(this.DateObject.length > 0) { for(var Index in this.DateObject) { var IndexDuplicate = Object.findIndex(x => (x.From == this.DateObject[Index].ValueFrom.value && x.To == this.DateObject[Index].ValueTo.value)) if(IndexDuplicate > -1) ThereIsError = true; if(this.DateObject[Index].ValueFrom.valueAsDate == null) ThereIsError = true; if(this.DateObject[Index].ValueFrom.valueAsDate > this.DateObject[Index].ValueTo.valueAsDate) ThereIsError = true; if(this.DateObject[Index].ValueTo.valueAsDate == null) ThereIsError = true; if(this.DateObject[Index].ValueTo.valueAsDate < this.DateObject[Index].ValueFrom.valueAsDate) ThereIsError = true; var IndexDuplicatePeriod = Object.findIndex(x => (Date.parse(x.From) <= this.DateObject[Index].ValueTo.valueAsDate) && (Date.parse(x.To) >= this.DateObject[Index].ValueFrom.valueAsDate) && (Date.parse(x.From) <= Date.parse(x.To) && (this.DateObject[Index].ValueFrom.valueAsDate <= this.DateObject[Index].ValueTo.valueAsDate) )) if(IndexDuplicatePeriod > -1) ThereIsError = true; if(!ThereIsError) { this.DateObject[Index].ValueTo.className.replace(/ ErrorMark/gi, ""); this.DateObject[Index].ValueFrom.className.replace(/ ErrorMark/gi, ""); var DateElement; if(this.DateObject[Index].Id) { if(this.DateObject[Index].Id=="") DateElement = { "From" : this.DateObject[Index].ValueFrom.value , "To": this.DateObject[Index].ValueTo.value, "Id":""} ; else DateElement = { "From" : this.DateObject[Index].ValueFrom.value , "To": this.DateObject[Index].ValueTo.value, "Id": this.Instance[Index].Id } ; }else DateElement = { "From" : this.DateObject[Index].ValueFrom.value , "To": this.DateObject[Index].ValueTo.value, "Id":""} ; if(this.DateOptionObject.length > 0) { if(this.DateOptionObject[Index].DayValues.length > 0) { DateElement.Option = {}; for(var IndexDay in this.DateOptionObject[Index].DayValues) { DateElement.Option[IndexDay] = this.DateOptionObject[Index].DayValues[IndexDay].checked; } } DateElement.Option.Weekdays = this.DateOptionObject[Index].Weekdays.checked; DateElement.Option.Holidays = this.DateOptionObject[Index].Holidays.checked; Object.push(DateElement); } } else { this.DateObject[Index].ValueFrom.className = this.DateObject[Index].ValueFrom.className + " ErrorMark"; this.DateObject[Index].ValueTo.className = this.DateObject[Index].ValueTo.className + " ErrorMark"; } } } else { ThereIsError = true; } return {"UserDataToAssign" : Object, "ThereIsError" : ThereIsError}; } SideNavBodyRow.Instance = Value; SideNavBodyRow.RowType = TypeValue; SideNavBodyRow.ElementWhereGetValue = SideNavBodyRow; $MWProcessDesigner.SettingSideNav.Rows.push(SideNavBodyRow); SideNavBodyRow.style.borderBottom = null; } case "STEOutbound": { var DivContainerMainPhoneNumber = document.createElement("div"); DivContainerMainPhoneNumber.className = "resgui-1row relative-full-width align-items-center row-direction"; DivContainerMainPhoneNumber.Rows = []; var DivContainerPhoneNumberLabel = document.createElement("div"); DivContainerPhoneNumberLabel.className = "resgui-1row resgui-7column align-items-center justify-content-right "; var DivContainerPhoneNumberValue = document.createElement("div"); DivContainerPhoneNumberValue.className = "resgui-1row resgui-7column align-items-center "; DivContainerMainPhoneNumber.appendChild(DivContainerPhoneNumberLabel); DivContainerMainPhoneNumber.appendChild(DivContainerPhoneNumberValue); var LabelPhoneSpan = document.createElement("span"); LabelPhoneSpan.innerHTML = $MWGUI.GetLanguageString("STEOtboundCall") + " : "; DivContainerPhoneNumberLabel.appendChild(LabelPhoneSpan); var LabelPhoneValue = document.createElement("input"); LabelPhoneValue.type = "text"; if(Value.PhoneNumber) LabelPhoneValue.value = Value.PhoneNumber; else LabelPhoneValue.placeholder = "+39123456789"; DivContainerPhoneNumberValue.appendChild(LabelPhoneValue); SideNavBodyRow.GetObject = function() { var Object = {}; var ThereIsError = false; var pattern = /^\d+$/; //if(LabelPhoneValue.value.trim() != "" && LabelPhoneValue.value.startsWith("+") && pattern.test(LabelPhoneValue.value)) if(LabelPhoneValue.value.trim() != "") { Object.PhoneNumber = LabelPhoneValue.value.trim(); } else { ThereIsError = true; } return {"UserDataToAssign" : Object, "ThereIsError" : ThereIsError}; } SideNavBodyRow.appendChild(DivContainerMainPhoneNumber); SideNavBodyRow.RowType = TypeValue; SideNavBodyRow.Instance = Value; SideNavBodyRow.ElementWhereGetValue = SideNavBodyRow; $MWProcessDesigner.SettingSideNav.Rows.push(SideNavBodyRow); break; } } return SideNavBodyRow; }, this.StoreFlow = function(NeedCustomBox) { if(!NeedCustomBox) { $MWProcessDesigner.Canvas.MinimizeFlowResult(function(ArgoFlow, JsonFlow, Error){ if(!Error) { var Item = { database : "MWProcessDesigner", Collection : "Flows", Item : { Flow : ArgoFlow, UserPool : $MW.User.UserPool.ID, Name : Me.ObjStored.Name } } if(Me.ObjStored["_id"]) Item.Item["_id"] = Me.ObjStored["_id"]; $MW.ExeLambda("ArgoMWApplication-ProcessDesignerSaveFlow-SHKRgRdxvNHN", Item, function(Answer, OriginalMessage) { if(Answer == null) setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorSaveFlowTitle"), $MWGUI.GetLanguageString("ErrorSaveFlowBody") ,"Error",[{"text":$MWGUI.GetLanguageString("SaveFlow"),"Callback":function(){$MWProcessDesigner.StoreFlow(false)}},{"text":$MWGUI.GetLanguageString("CancelButton"),"Callback":function(){}}])}, 350); else { console.log(Answer); var RequestS3 = { Body : JsonFlow, Bucket : "sg365v2", Key : "MW-Process-Designer/Flows/" + Answer["_id"] } $MW.S3.putObject(RequestS3, function(err, data) { if (err) console.log(err, err.stack); else { } }); } }, function(Error, ErrorStack) { setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorSaveFlowTitle"), $MWGUI.GetLanguageString("ErrorSaveFlowBody") ,"Error",[{"text":$MWGUI.GetLanguageString("SaveFlow"),"Callback":function(){$MWProcessDesigner.StoreFlow(false)}},{"text":$MWGUI.GetLanguageString("CancelButton"),"Callback":function(){}}])}, 350); }, "Argo"); } }); } else { $MWProcessDesigner.Canvas.MinimizeFlowResult(function(ArgoFlow, JsonFlow, Error){ if(!Error) { var CustomBox = new TMWGUICustomBox(4, 20); var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("SaveFlow"); var spanClose = document.createElement("span"); spanClose.innerHTML = "×"; spanClose.style.fontSize = "var(--resgui-font-height-xl)"; spanClose.style.cursor = "pointer"; spanClose.style.marginRight = "var(--resgui-quartercolumn)"; spanClose.CustomBox = CustomBox; spanClose.onclick = function (ev) { CustomBox.Close(); }; CustomBox.Title.className += " justify-content-space-between"; CustomBox.Title.appendChild(spanTitle); CustomBox.Title.appendChild(spanClose); var Container = document.createElement("div"); Container.className = "resgui-3row resgui-20column align-items-center justify-content-center column-direction"; var RowButton = document.createElement("div"); RowButton.className = "resgui-1row resgui-20column align-items-center justify-content-center"; RowButton.style.backgroundColor = "var(--secondary-toolbar-background)"; var ButtonSaveDiv = document.createElement("div"); ButtonSaveDiv.className = "button-application"; ButtonSaveDiv.CustomBox = CustomBox; ButtonSaveDiv.ArgoFlow = ArgoFlow; ButtonSaveDiv.JsonFlow = JsonFlow; if(Me.InputFileName) ButtonSaveDiv.InputFileName = Me.InputFileName; ButtonSaveDiv.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; if(Target.Input.value == "") { if(Target.Input.className.indexOf("ErrorMark") == -1) { Target.Input.className = Target.Input.className + " ErrorMark"; } } else { if(Target.Input.className.indexOf("ErrorMark") > -1) Target.Input.className = Target.Input.className.replace(/ ErrorMark/gi,""); if(Target.InputFileName) Target.InputFileName.value = Target.Input.value; Me.ObjStored.Name = Target.Input.value; var Item = { database : "MWProcessDesigner", Collection : "Flows", Item : { Flow : ArgoFlow, UserPool : $MW.User.UserPool.ID, Name : Me.ObjStored.Name } } if(Me.ObjStored["_id"]) Item.Item["_id"] = Me.ObjStored["_id"]; $MW.ExeLambda("ArgoMWApplication-ProcessDesignerSaveFlow-SHKRgRdxvNHN", Item, function(Answer, OriginalMessage) { if(Answer != null) { console.log(Answer); Target.CustomBox.Close(); var RequestS3 = { Body : JsonFlow, Bucket : "sg365v2", Key : "MW-Process-Designer/Flows/" + Answer["_id"] } $MW.S3.putObject(RequestS3, function(err, data) { if (err) console.log(err, err.stack); else { } }); } else setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorSaveFlowTitle"), $MWGUI.GetLanguageString("ErrorSaveFlowBody") ,"Error",[{"text":$MWGUI.GetLanguageString("SaveFlow"),"Callback":function(){$MWProcessDesigner.StoreFlow(false)}},{"text":$MWGUI.GetLanguageString("CancelButton"),"Callback":function(){}}])}, 350); }, function(Error, ErrorStack) { setTimeout(function(){$MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorSaveFlowTitle"), $MWGUI.GetLanguageString("ErrorSaveFlowBody") ,"Error",[{"text":$MWGUI.GetLanguageString("SaveFlow"),"Callback":function(){$MWProcessDesigner.StoreFlow(true)}},{"text":$MWGUI.GetLanguageString("CancelButton"),"Callback":function(){}}])}, 350); }, "Argo"); } //ev.target.View.MinimizeFlowResult(); }) var ButtonSaveSpan = document.createElement("span"); ButtonSaveSpan.innerHTML = $MWGUI.GetLanguageString("SaveFlow"); ButtonSaveDiv.appendChild(ButtonSaveSpan); RowButton.appendChild(ButtonSaveDiv); Container.appendChild(RowButton); var BodyContainer = document.createElement("div"); BodyContainer.className = "resgui-1row resgui-20column align-items-center row-direction"; var DivDesc = document.createElement("div"); DivDesc.className = "resgui-1row resgui-8column align-items-center justify-content-flex-end"; BodyContainer.appendChild(DivDesc); var SaveSpan = document.createElement("span"); SaveSpan.innerHTML = $MWGUI.GetLanguageString("NameFlow") + " :"; DivDesc.appendChild(SaveSpan); var DivValue = document.createElement("div"); DivValue.className = "resgui-1row resgui-12column align-items-center justify-content-flex-start"; BodyContainer.appendChild(DivValue); var Input = document.createElement("input"); Input.type = "text"; if(Me.ObjStored.Name) Input.value = Me.ObjStored.Name; Input.placeholder = $MWGUI.GetLanguageString("NameFlow"); ButtonSaveDiv.Input = Input; DivValue.appendChild(Input); var DivRowDesc = document.createElement("div"); DivRowDesc.className = "resgui-1row resgui-20column align-items-center row-direction"; var DivDescDesc = document.createElement("div"); DivDescDesc.className = "resgui-1row resgui-8column align-items-center justify-content-flex-end"; DivRowDesc.appendChild(DivDescDesc); var SaveSpanDesc = document.createElement("span"); SaveSpanDesc.innerHTML = $MWGUI.GetLanguageString("DescriptionFlow") + " :"; DivDescDesc.appendChild(SaveSpanDesc); var DivValueDesc = document.createElement("div"); DivValueDesc.className = "resgui-1row resgui-12column align-items-center justify-content-flex-start"; DivRowDesc.appendChild(DivValueDesc); var InputDesc = document.createElement("input"); InputDesc.type = "text"; if(Me.ObjStored.Description) InputDesc.value = Me.ObjStored.Description; InputDesc.placeholder = $MWGUI.GetLanguageString("DescriptionFlow"); ButtonSaveDiv.InputDesc = InputDesc; DivValueDesc.appendChild(InputDesc); Container.appendChild(BodyContainer); Container.appendChild(DivRowDesc); CustomBox.Body.appendChild(Container); CustomBox.Open(); } }); } } this.CreateMenuSideNav = function(SideNav) { var SaveDiv = document.createElement("div"); SaveDiv.className = "SideNavElement decor-solid-border-bottom-dark main_menu_row align-items-center justify-content-flex-start"; SaveDiv.View = $MWProcessDesigner.Canvas; SaveDiv.addEventListener("click",function(ev){ if(ev.target.View) { ev.target.View.MinimizeFlowResult(function(ArgoFlow, JsonFlow, Error){ console.log(ArgoFlow, JsonFlow); if(!Error) { var CustomBox = new TMWGUICustomBox(4, 20); var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("SaveFlow"); var spanClose = document.createElement("span"); spanClose.innerHTML = "×"; spanClose.style.fontSize = "var(--resgui-font-height-xl)"; spanClose.style.cursor = "pointer"; spanClose.style.marginRight = "var(--resgui-quartercolumn)"; spanClose.CustomBox = CustomBox; spanClose.onclick = function (ev) { CustomBox.Close(); }; CustomBox.Title.className += " justify-content-space-between"; CustomBox.Title.appendChild(spanTitle); CustomBox.Title.appendChild(spanClose); var Container = document.createElement("div"); Container.className = "resgui-3row resgui-20column align-items-center justify-content-center column-direction"; var RowButton = document.createElement("div"); RowButton.className = "resgui-1row resgui-20column align-items-center justify-content-center"; RowButton.style.backgroundColor = "var(--secondary-toolbar-background)"; var ButtonSaveDiv = document.createElement("div"); ButtonSaveDiv.className = "button-application"; ButtonSaveDiv.CustomBox = CustomBox; ButtonSaveDiv.ArgoFlow = ArgoFlow; ButtonSaveDiv.JsonFlow = JsonFlow; if(Me.InputFileName) ButtonSaveDiv.InputFileName = Me.InputFileName; ButtonSaveDiv.addEventListener("click",function(ev){ var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; if(Target.Input.value == "") { if(Target.Input.className.indexOf("ErrorMark") == -1) { Target.Input.className = Target.Input.className + " ErrorMark"; } } else { if(Target.Input.className.indexOf("ErrorMark") > -1) Target.Input.className = Target.Input.className.replace(/ ErrorMark/gi,""); if(Target.InputFileName) Target.InputFileName.value = Target.Input.value; Me.ObjStored.Name = Target.Input.value; Me.ObjStored.Description = Target.InputDesc.value; var Item = { database : "MWProcessDesigner", Collection : "Flows", Item : { Flow : ArgoFlow, UserPool : $MW.User.UserPool.ID, Name : Me.ObjStored.Name, Description : Me.ObjStored.Description } } if(Me.ObjStored["_id"]) Item.Item["_id"] = Me.ObjStored["_id"]; $MW.ExeLambda("ArgoMWApplication-ProcessDesignerSaveFlow-SHKRgRdxvNHN", Item, function(Answer, OriginalMessage) { if(Answer != null) { console.log(Answer); Target.CustomBox.Close(); var RequestS3 = { Body : JsonFlow, Bucket : "sg365v2", Key : "MW-Process-Designer/Flows/" + Answer["_id"] } $MW.S3.putObject(RequestS3, function(err, data) { if (err) console.log(err, err.stack); else { } }); } }, function(Error, ErrorStack) { }, "Argo"); } //ev.target.View.MinimizeFlowResult(); }) var ButtonSaveSpan = document.createElement("span"); ButtonSaveSpan.innerHTML = $MWGUI.GetLanguageString("SaveFlow"); ButtonSaveDiv.appendChild(ButtonSaveSpan); RowButton.appendChild(ButtonSaveDiv); Container.appendChild(RowButton); var BodyContainer = document.createElement("div"); BodyContainer.className = "resgui-1row resgui-20column align-items-center row-direction"; var DivDesc = document.createElement("div"); DivDesc.className = "resgui-1row resgui-8column align-items-center justify-content-flex-end"; BodyContainer.appendChild(DivDesc); var SaveSpan = document.createElement("span"); SaveSpan.innerHTML = $MWGUI.GetLanguageString("NameFlow") + " :"; DivDesc.appendChild(SaveSpan); var DivValue = document.createElement("div"); DivValue.className = "resgui-1row resgui-12column align-items-center justify-content-flex-start"; BodyContainer.appendChild(DivValue); var Input = document.createElement("input"); Input.type = "text"; if(Me.ObjStored.Name) Input.value = Me.ObjStored.Name; Input.placeholder = $MWGUI.GetLanguageString("NameFlow"); ButtonSaveDiv.Input = Input; DivValue.appendChild(Input); var DivRowDesc = document.createElement("div"); DivRowDesc.className = "resgui-1row resgui-20column align-items-center row-direction"; var DivDescDesc = document.createElement("div"); DivDescDesc.className = "resgui-1row resgui-8column align-items-center justify-content-flex-end"; DivRowDesc.appendChild(DivDescDesc); var SaveSpanDesc = document.createElement("span"); SaveSpanDesc.innerHTML = $MWGUI.GetLanguageString("DescriptionFlow") + " :"; DivDescDesc.appendChild(SaveSpanDesc); var DivValueDesc = document.createElement("div"); DivValueDesc.className = "resgui-1row resgui-12column align-items-center justify-content-flex-start"; DivRowDesc.appendChild(DivValueDesc); var InputDesc = document.createElement("input"); InputDesc.type = "text"; if(Me.ObjStored.Description) InputDesc.value = Me.ObjStored.Description; InputDesc.placeholder = $MWGUI.GetLanguageString("DescriptionFlow"); ButtonSaveDiv.InputDesc = InputDesc; DivValueDesc.appendChild(InputDesc); Container.appendChild(BodyContainer); Container.appendChild(DivRowDesc); CustomBox.Body.appendChild(Container); CustomBox.Open(); } }); } }); var SaveImgDiv = document.createElement("div"); SaveImgDiv.className = "relative-1row"; SaveImgDiv.style.marginLeft = "var(--resgui-quartercolumn)"; SaveImgDiv.View = $MWProcessDesigner.Canvas; var ImgSave = document.createElement("img"); ImgSave.className = "button-icon-image"; ImgSave.src = "../../../../../../images/icons/saveIcon.png"; ImgSave.View = $MWProcessDesigner.Canvas; SaveImgDiv.appendChild(ImgSave); var SpanSave = document.createElement("span"); SpanSave.innerHTML = $MWGUI.GetLanguageString("SaveFlow"); SpanSave.View = $MWProcessDesigner.Canvas; SaveDiv.appendChild(SaveImgDiv); SaveDiv.appendChild(SpanSave); SideNav.appendChild(SaveDiv); var ImportDiv = document.createElement("div"); ImportDiv.className = "SideNavElement decor-solid-border-bottom-dark main_menu_row align-items-center justify-content-flex-start"; ImportDiv.View = $MWProcessDesigner.Canvas; ImportDiv.addEventListener("click",function(ev){ if(ev.target.View) { /*var Container = document.getElementById("CanvasSvg"); for(var Index in Container.children) { //console.log(Container.children[Index].nodeName); if(Container.children[Index].nodeName == "svg") Container.removeChild(Container.children[Index]) } var svg = new Canvas("CanvasSvg", "ContainerCanvas", 10000, 10000); svg.html[0].children[0].style.position = "relative"; svg.installEditPolicy(new draw2d.policy.canvas.ShowGridEditPolicy()); svg.installEditPolicy(new draw2d.policy.canvas.SnapToGeometryEditPolicy()); svg.installEditPolicy(new draw2d.policy.canvas.SnapToInBetweenEditPolicy()); svg.installEditPolicy(new draw2d.policy.canvas.SnapToCenterEditPolicy()); svg.installEditPolicy(new CanvasMouse()); svg.installEditPolicy(new KeyboardPolicy()); svg.StartZoom = svg.getZoom()*1.3; svg.setZoom(svg.getZoom()*1.3,true); svg.scrollTo(0,0); $MWProcessDesigner.Canvas = svg; Me.ListVariables.Canvas = svg; var Toolbar = new toolbar(svg, Me.ButtonsToolbar);*/ //Me.Canvas.clear() Me.ImportPopup(); /*if(JsonToLoad) { var reader = new draw2d.io.json.Reader(); reader.unmarshal($MWProcessDesigner.Canvas, JsonToLoad); }*/ } }); var ImportImgDiv = document.createElement("div"); ImportImgDiv.className = "relative-1row"; ImportImgDiv.style.marginLeft = "var(--resgui-quartercolumn)"; ImportImgDiv.View = $MWProcessDesigner.Canvas; var ImgImport = document.createElement("img"); ImgImport.className = "button-icon-image"; ImgImport.src = "../../../../../../images/icons/ProtocolsIcon.png"; ImgImport.View = $MWProcessDesigner.Canvas; ImportImgDiv.appendChild(ImgImport); var SpanImport = document.createElement("span"); SpanImport.innerHTML = $MWGUI.GetLanguageString("ImportFlow"); SpanImport.View = $MWProcessDesigner.Canvas; ImportDiv.appendChild(ImportImgDiv); ImportDiv.appendChild(SpanImport); SideNav.appendChild(ImportDiv); var TesterDiv = document.createElement("div"); TesterDiv.className = "SideNavElement decor-solid-border-bottom-dark main_menu_row align-items-center justify-content-flex-start"; TesterDiv.View = $MWProcessDesigner.Canvas; TesterDiv.addEventListener("click",function(ev){ if(ev.target.View) ev.target.View.TestFlow(); }); var TestImgDiv = document.createElement("div"); TestImgDiv.className = "relative-1row"; TestImgDiv.style.marginLeft = "var(--resgui-quartercolumn)"; TestImgDiv.View = $MWProcessDesigner.Canvas; var ImgTest = document.createElement("img"); ImgTest.className = "button-icon-image"; ImgTest.src = "../../../../../../images/icons/actionsIcon.png"; ImgTest.View = $MWProcessDesigner.Canvas; TestImgDiv.appendChild(ImgTest); var SpanTest = document.createElement("span"); SpanTest.innerHTML = $MWGUI.GetLanguageString("TestFlow"); SpanTest.View = $MWProcessDesigner.Canvas; TesterDiv.appendChild(TestImgDiv); TesterDiv.appendChild(SpanTest); SideNav.appendChild(TesterDiv); }, this.CreateToolsSideNav = function(SideNav) { function CreateRow(SideNav, DataShape, UrlImg) { var MessageBoxBlock = document.createElement("div"); MessageBoxBlock.className = "SideNavElement decor-solid-border-bottom-dark main_menu_row draw2d_droppable"; MessageBoxBlock.setAttribute("data-shape",DataShape); MessageBoxBlock.style.zIndex = 1; var ImgDiv = document.createElement("div"); ImgDiv.className = "relative-1row"; ImgDiv.style.marginLeft = "var(--resgui-quartercolumn)"; ImgDiv.View = $MWProcessDesigner.Canvas; var ImgSave = document.createElement("img"); ImgSave.className = "button-icon-image"; ImgSave.src = UrlImg; ImgSave.View = $MWProcessDesigner.Canvas; ImgDiv.appendChild(ImgSave); var Span = document.createElement("span"); Span.innerHTML = DataShape; Span.View = $MWProcessDesigner.Canvas; MessageBoxBlock.appendChild(ImgDiv); MessageBoxBlock.appendChild(Span); SideNav.appendChild(MessageBoxBlock); } CreateRow(SideNav, "STEStartBoxBlock", "../../../../../../../../../images/icons/argoIcon.png"); CreateRow(SideNav, "EndBoxBlock", "../../../../../../../../../images/icons/argoIcon.png"); CreateRow(SideNav, "MessageBoxBlock", "../../../../../../../../../images/icons/argoIcon.png"); CreateRow(SideNav, "FormBoxBlock", "../../../../../../../../../images/icons/argoIcon.png"); CreateRow(SideNav, "TextButtonsBlock", "../../../../../../../../../images/icons/argoIcon.png"); CreateRow(SideNav, "EmailBlock", "../../../../../../../../../images/icons/argoIcon.png"); CreateRow(SideNav, "CronoDataBlock", "../../../../../../../../../images/icons/argoIcon.png"); CreateRow(SideNav, "STEEndCallBoxBlock", "../../../../../../../../../images/icons/argoIcon.png"); CreateRow(SideNav, "ArgoManageEventStartBoxBlock", "../../../../../../../../../images/icons/argoIcon.png"); CreateRow(SideNav, "ArgoNavigateToSiteBlock", "../../../../../../../../../images/icons/argoIcon.png"); CreateRow(SideNav, "STEMakeOutboundCallBlock", "../../../../../../../../../images/icons/argoIcon.png"); $MWProcessDesigner.Canvas.AddDroppableItems(); }, this.RegisterDefaultVariables = function(BlockName, BlockVariables) { if(BlockVariables) { if(BlockVariables != null) { if(BlockName) { if(BlockName != "") { for(var Index in BlockVariables) { if(BlockVariables[Index].Root) { for(var IndexVar in BlockVariables[Index].Vars) { var VarName = BlockName + "." + BlockVariables[Index].Root + "." + BlockVariables[Index].Vars[IndexVar].Name; if(this.Variables.findIndex(x => x.Name == VarName) == -1) { var obj = { "Name" : VarName, "Description" : BlockVariables[Index].Vars[IndexVar].Description, "IsDefault" : true } this.Variables.push(obj); } } } else { var VarName = BlockName + "." + BlockVariables[Index].Name; if(this.Variables.findIndex(x => x.Name == VarName) == -1) { var obj = { "Name" : VarName, "Description" : BlockVariables[Index].Description, "IsDefault" : true } this.Variables.push(obj); } } } } } } } }, this.UnregisterDefaultVariable = function(BlockName, BlockVariables) { if(BlockVariables) { if(BlockVariables != null) { if(BlockName) { if(BlockName != "") { for(var Index in BlockVariables) { if(BlockVariables[Index].Root) { for(var IndexVar in BlockVariables[Index].Vars) { var VarName = BlockName + "." + BlockVariables[Index].Root + "." + BlockVariables[Index].Vars[IndexVar].Name; var IndexObj = this.Variables.findIndex(x => x.Name == VarName); if(IndexObj > -1) { this.Variables.splice(IndexObj, 1); } /*if(this.Variables.indexOf(VarName) == -1) this.Variables.push(VarName);*/ } } else { var VarName = BlockName + "." + BlockVariables[Index].Name; var IndexObj = this.Variables.findIndex(x => x.Name == VarName); if(IndexObj > -1) { this.Variables.splice(IndexObj, 1); } } } console.log(this.Variables); } } } } }, this.UnregisterVariable = function(obj) { var Index = this.Variables.findIndex(x => x.Name == obj.Name); if(Index > -1) this.Variables.splice(Index, 1); }, this.RegisterVariables = function(obj) { if(this.Variables.findIndex(x => x.Name == obj.Name) == -1) this.Variables.push(obj); }, this.GetVariableValue = function(VariableName , InputObject) { var Result = "undefined"; //if(this.Variables.findIndex(x => x.Name == VariableName) > -1) //{ var VarNameSplitted = VariableName.split("."); var Obj = {...InputObject}; //JSON.parse(JSON.stringify(InputObject)); for(var Index in VarNameSplitted) { if(Obj[VarNameSplitted[Index]]) Obj = Obj[VarNameSplitted[Index]]; else Obj = "undefined"; } Result = Obj; //} return Result; }, this.GetTextVariable = function(Text, InputObject) { var Result = Text; var Matches = Text.match(/(?<=\[#)(.*?)(?=#\])/g); for(var Index in Matches) { Result = Result.replace("[#"+Matches[Index]+"#]", this.GetVariableValue(Matches[Index], InputObject)) } return Result; }, this.GetVariable = function(VarName, InputObject) { var Result = this.GetVariableValue(VarName, InputObject); return Result; }, this.PopupListVariables = function(TargetHtmlElement, Options) { var DivDescriptionVariable; function CreateDescriptionDiv(Instance, TargetHtmlElement) { if(DivDescriptionVariable && Instance) { if(!DivDescriptionVariable.Name) { var RowName = document.createElement("div"); RowName.className = "resgui-1row relative-full-width align-items-center justify-content-center decor-solid-border-bottom-wallpaper-color"; RowName.style.backgroundColor = "var(--group-header-background)"; var NameSpan = document.createElement("span"); NameSpan.innerHTML = Instance.Name; NameSpan.className = "TextReadOnly"; DivDescriptionVariable.Name = NameSpan; RowName.appendChild(NameSpan); DivDescriptionVariable.appendChild(RowName); var DescriptionContent = document.createElement("div"); if(TargetHtmlElement) DescriptionContent.className = "resgui-11row relative-full-width align-items-center justify-content-center"; else DescriptionContent.className = "resgui-12row relative-full-width align-items-center justify-content-center"; var Description = document.createElement("span"); if(!Instance.IsDefault) Description.innerHTML = Instance.Description; else Description.innerHTML = $MWGUI.GetLanguageString(Instance.Name.replace(/\./gi,"-")); Description.className = "TextReadOnlyProcessDesigner"; Description.style.marginLeft = "var(--resgui-quartercolumn)"; Description.style.height = "calc(100% - var(--resgui-1row))"; Description.style.width = "100%"; Description.style.alignItems = "start"; Description.style.paddingTop = "var(--resgui-05vh)"; DivDescriptionVariable.Description = Description; DescriptionContent.appendChild(Description); DivDescriptionVariable.appendChild(DescriptionContent); } else { DivDescriptionVariable.Name.innerHTML = Instance.Name; if(!Instance.IsDefault) DivDescriptionVariable.Description.innerHTML = Instance.Description; else DivDescriptionVariable.Description.innerHTML = $MWGUI.GetLanguageString(Instance.Name.replace(/\./gi,"-")); } } } var CustomBox = new TMWGUICustomBox(15, 25); var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("ListVariablesTitleCB"); var spanClose = document.createElement("span"); spanClose.innerHTML = "×"; spanClose.style.fontSize = "var(--resgui-font-height-xl)"; spanClose.style.cursor = "pointer"; spanClose.style.marginRight = "var(--resgui-quartercolumn)"; spanClose.CustomBox = CustomBox; spanClose.onclick = function (ev) { CustomBox.Close(); }; CustomBox.Title.className += " justify-content-space-between"; CustomBox.Title.appendChild(spanTitle); CustomBox.Title.appendChild(spanClose); var ContainerBody = document.createElement("div"); ContainerBody.className = "resgui-14row resgui-25column column-direction"; var SelectVarDiv; if(TargetHtmlElement) { var HeaderRowButtons = document.createElement("div"); HeaderRowButtons.className = "resgui-1row relative-full-width align-items-center justify-content-space-around"; HeaderRowButtons.style.backgroundColor = "var(--secondary-toolbar-background)"; SelectVarDiv = document.createElement("div"); SelectVarDiv.className = "button-application"; SelectVarDiv.TargetHtmlElement = TargetHtmlElement; SelectVarDiv.CustomBox = CustomBox; if(Options) if(Options.Callback) SelectVarDiv.Callback = Options.Callback; SelectVarDiv.addEventListener("click", function(ev) { var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; if(Target.Instance) { if(Target.Callback) { Target.Callback("[#"+Target.Instance.Name+"#]"); Target.CustomBox.Close(); } else { Target.TargetHtmlElement.value = Target.TargetHtmlElement.value + " [#"+Target.Instance.Name+"#]"; Target.CustomBox.Close(); } } }); var SelectVarSpan = document.createElement("span"); SelectVarSpan.innerHTML = $MWGUI.GetLanguageString("SelectVar"); SelectVarDiv.appendChild(SelectVarSpan); HeaderRowButtons.appendChild(SelectVarDiv); ContainerBody.appendChild(HeaderRowButtons); } var SearchBar = document.createElement("div"); SearchBar.className = "resgui-1row relative-full-width row-direction align-items-center justify-content-flex-start"; SearchBar.style.backgroundColor = "var(--secondary-toolbar-background)"; if(TargetHtmlElement) SearchBar.className = SearchBar.className + " decor-solid-border-top-wallpaper-color"; ContainerBody.appendChild(SearchBar); var SearchNameInput = document.createElement("input"); SearchNameInput.type = "text"; SearchNameInput.placeholder = $MWGUI.GetLanguageString("VariableNamePlaceHolderSearch"); SearchNameInput.TargetHtmlElement = TargetHtmlElement; SearchNameInput.SelectVarDiv = SelectVarDiv; SearchNameInput.oninput = function(){ //this.SelectVarDiv = null; this.DivGroupBodyDefaultVariables.innerHTML = ""; this.DivGroupBodyCustomVariables.innerHTML = ""; DivDescriptionVariable.innerHTML = ""; DivDescriptionVariable.Name = undefined; if(this.SystemVars.length > 0 || this.CustomVars.length > 0) { var CheckValue = this.value.toLowerCase(); var SystemVarsFiltered = this.SystemVars.filter(x => x.Name.toLowerCase().indexOf(CheckValue) > -1); for(var IndexFilter in SystemVarsFiltered) { var RowSystemVar = document.createElement("div"); RowSystemVar.className = "variable-list-row-popup"; RowSystemVar.Instance = SystemVarsFiltered[IndexFilter]; RowSystemVar.SelectVarDiv = this.SelectVarDiv; RowSystemVar.TargetHtmlElement = this.TargetHtmlElement; RowSystemVar.addEventListener("click", function(ev){ var Target = ev.target; if(Target.nodeName == "SPAN") Target = Target.parentNode; if(Target.SelectVarDiv) Target.SelectVarDiv.Instance = Target.Instance; CreateDescriptionDiv(Target.Instance, Target.TargetHtmlElement); }); var SpanRowSystemVar = document.createElement("span"); SpanRowSystemVar.innerHTML = SystemVarsFiltered[IndexFilter].Name; SpanRowSystemVar.title = SystemVarsFiltered[IndexFilter].Name; SpanRowSystemVar.style.marginLeft = "var(--resgui-quartercolumn)"; RowSystemVar.appendChild(SpanRowSystemVar); this.DivGroupBodyDefaultVariables.appendChild(RowSystemVar); } var CustomVarsFiltered = this.CustomVars.filter(x => x.Name.toLowerCase().indexOf(CheckValue) > -1); for(var IndexFilter in CustomVarsFiltered) { var RowCustomVar = document.createElement("div"); RowCustomVar.className = "variable-list-row-popup"; RowCustomVar.Instance = CustomVarsFiltered[IndexFilter]; RowCustomVar.SelectVarDiv = this.SelectVarDiv; RowCustomVar.TargetHtmlElement = this.TargetHtmlElement; RowCustomVar.addEventListener("click", function(ev){ var Target = ev.target; if(Target.nodeName == "SPAN") Target = Target.parentNode; if(Target.SelectVarDiv) Target.SelectVarDiv.Instance = Target.Instance; CreateDescriptionDiv(Target.Instance, Target.TargetHtmlElement); }); var SpanRowCustomVar = document.createElement("span"); SpanRowCustomVar.innerHTML = CustomVarsFiltered[IndexFilter].Name; SpanRowCustomVar.title = CustomVarsFiltered[IndexFilter].Name; SpanRowCustomVar.style.marginLeft = "var(--resgui-quartercolumn)"; RowCustomVar.appendChild(SpanRowCustomVar); this.DivGroupBodyCustomVariables.appendChild(RowCustomVar); } } }; SearchBar.appendChild(SearchNameInput); var ContainerAttachOpt = document.createElement("div"); ContainerAttachOpt.className = "regui-7column align-items-center justify-content-flex-start relative-full-height"; var SearchAttachments = document.createElement("input"); SearchAttachments.type = "checkbox"; SearchAttachments.SearchNameInput = SearchNameInput; SearchAttachments.Variables = this.Variables; if(Options) if(Options.Query) if(Options.Query.Attachment) SearchAttachSpan.value = true; SearchAttachments.onchange = function() { //console.log(this.SearchNameInput); if(this.checked) { var SystemVars = this.SearchNameInput.SystemVars.filter(x => x.IsAttach == true); this.SearchNameInput.SystemVars = SystemVars; var CustomVars = this.SearchNameInput.CustomVars.filter(x => x.IsAttach == true); //console.log(CustomVars); this.SearchNameInput.CustomVars = CustomVars; this.SearchNameInput.value = ""; this.SearchNameInput.oninput(); } else { var SystemVars = this.Variables.filter(x => x.IsDefault == true); this.SearchNameInput.SystemVars = SystemVars; var CustomVars = this.Variables.filter(x => x.IsDefault == false); this.SearchNameInput.CustomVars = CustomVars; this.SearchNameInput.value = ""; this.SearchNameInput.oninput(); } }; SearchNameInput.SearchAttachments = SearchAttachments; ContainerAttachOpt.appendChild(SearchAttachments); var SearchAttachSpan = document.createElement("span"); SearchAttachSpan.innerHTML = $MWGUI.GetLanguageString("SearchVariableAttachementsEnable"); ContainerAttachOpt.appendChild(SearchAttachSpan); SearchBar.appendChild(ContainerAttachOpt); var DivBody = document.createElement("div"); if(TargetHtmlElement) DivBody.className = "resgui-12row relative-full-width row-direction"; else DivBody.className = "resgui-13row relative-full-width row-direction"; var DivListVariables = document.createElement("div"); DivListVariables.className = "relative-full-height resgui-8column column-direction overflow-y-auto"; var DivGroupDefaultVariables = document.createElement("div"); DivGroupDefaultVariables.className = "divGroup"; var DivGroupHeaderDefaultVariables = document.createElement("div"); DivGroupHeaderDefaultVariables.className = "divHeader"; DivGroupHeaderDefaultVariables.addEventListener("click",function(ev) { var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; if(Target.Image.style.transform == "rotate(-90deg)") { // chiudi Target.Image.style.transform = "rotate(-180deg)"; Target.DivToClose.style.display = "none"; } else { Target.Image.style.transform = "rotate(-90deg)"; Target.DivToClose.style.display = "flex"; } }); var DivGroupHeaderDefaultVariablesImgArrow = document.createElement("img"); DivGroupHeaderDefaultVariablesImgArrow.className = "icon-image"; DivGroupHeaderDefaultVariablesImgArrow.style.marginLeft = "var(--resgui-quartercolumn)"; DivGroupHeaderDefaultVariablesImgArrow.src = "../../../../../../../../../images/icons/ArrowIcon.png"; DivGroupHeaderDefaultVariablesImgArrow.style.transform = "rotate(-90deg)"; DivGroupHeaderDefaultVariables.Image = DivGroupHeaderDefaultVariablesImgArrow; var DivGroupHeaderDefaultVariablesSpan = document.createElement("span"); DivGroupHeaderDefaultVariablesSpan.style.marginLeft = "var(--resgui-quartercolumn)"; DivGroupHeaderDefaultVariablesSpan.innerHTML = $MWGUI.GetLanguageString("DefaultVariableListHeader"); DivGroupHeaderDefaultVariables.appendChild(DivGroupHeaderDefaultVariablesImgArrow); DivGroupHeaderDefaultVariables.appendChild(DivGroupHeaderDefaultVariablesSpan); DivGroupDefaultVariables.appendChild(DivGroupHeaderDefaultVariables); var DivGroupBodyDefaultVariables = document.createElement("div"); DivGroupBodyDefaultVariables.className = "column-direction"; SearchNameInput.DivGroupBodyDefaultVariables = DivGroupBodyDefaultVariables; DivGroupHeaderDefaultVariables.DivToClose = DivGroupBodyDefaultVariables; var SystemVars = this.Variables.filter(x => x.IsDefault == true); SearchNameInput.SystemVars = SystemVars; for(var Index in SystemVars) { var RowSystemVar = document.createElement("div"); RowSystemVar.className = "variable-list-row-popup"; RowSystemVar.Instance = SystemVars[Index]; RowSystemVar.SelectVarDiv = SelectVarDiv; RowSystemVar.TargetHtmlElement = TargetHtmlElement; RowSystemVar.addEventListener("click", function(ev){ var Target = ev.target; if(Target.nodeName == "SPAN") Target = Target.parentNode; if(Target.SelectVarDiv) Target.SelectVarDiv.Instance = Target.Instance; CreateDescriptionDiv(Target.Instance, Target.TargetHtmlElement); }); var SpanRowSystemVar = document.createElement("span"); SpanRowSystemVar.innerHTML = SystemVars[Index].Name; SpanRowSystemVar.title = SystemVars[Index].Name; SpanRowSystemVar.style.marginLeft = "var(--resgui-quartercolumn)"; RowSystemVar.appendChild(SpanRowSystemVar); DivGroupBodyDefaultVariables.appendChild(RowSystemVar); } DivGroupDefaultVariables.appendChild(DivGroupBodyDefaultVariables); var DivGroupCustomVariables = document.createElement("div"); DivGroupCustomVariables.className = "divGroup"; var DivGroupHeaderCustomVariables = document.createElement("div"); DivGroupHeaderCustomVariables.className = "divHeader"; DivGroupHeaderCustomVariables.addEventListener("click",function(ev) { var Target = ev.target; if(Target.nodeName != "DIV") Target = Target.parentNode; if(Target.Image.style.transform == "rotate(-90deg)") { Target.Image.style.transform = "rotate(-180deg)"; Target.DivToClose.style.display = "none"; } else { Target.Image.style.transform = "rotate(-90deg)"; Target.DivToClose.style.display = "flex"; } }); var DivGroupHeaderCustomVariablesImgArrow = document.createElement("img"); DivGroupHeaderCustomVariablesImgArrow.className = "icon-image"; DivGroupHeaderCustomVariablesImgArrow.style.marginLeft = "var(--resgui-quartercolumn)"; DivGroupHeaderCustomVariablesImgArrow.src = "../../../../../../../../../images/icons/ArrowIcon.png"; DivGroupHeaderCustomVariablesImgArrow.style.transform = "rotate(-90deg)"; DivGroupHeaderCustomVariables.Image = DivGroupHeaderCustomVariablesImgArrow; var DivGroupHeaderCustomVariablesSpan = document.createElement("span"); DivGroupHeaderCustomVariablesSpan.style.marginLeft = "var(--resgui-quartercolumn)"; DivGroupHeaderCustomVariablesSpan.innerHTML = $MWGUI.GetLanguageString("CustomVariableListHeader"); DivGroupHeaderCustomVariables.appendChild(DivGroupHeaderCustomVariablesImgArrow); DivGroupHeaderCustomVariables.appendChild(DivGroupHeaderCustomVariablesSpan); DivGroupCustomVariables.appendChild(DivGroupHeaderCustomVariables); var DivGroupBodyCustomVariables = document.createElement("div"); DivGroupBodyCustomVariables.className = "column-direction"; SearchNameInput.DivGroupBodyCustomVariables = DivGroupBodyCustomVariables; DivGroupHeaderCustomVariables.DivToClose = DivGroupBodyCustomVariables; var CustomVars = this.Variables.filter(x => x.IsDefault == false); SearchNameInput.CustomVars = CustomVars; for(var Index in CustomVars) { var RowCustomVar = document.createElement("div"); RowCustomVar.className = "variable-list-row-popup"; RowCustomVar.Instance = CustomVars[Index]; RowCustomVar.SelectVarDiv = SelectVarDiv; RowCustomVar.TargetHtmlElement = TargetHtmlElement; RowCustomVar.addEventListener("click", function(ev){ var Target = ev.target; if(Target.nodeName == "SPAN") Target = Target.parentNode; if(Target.SelectVarDiv) Target.SelectVarDiv.Instance = Target.Instance; CreateDescriptionDiv(Target.Instance, Target.TargetHtmlElement); }); var SpanRowCustomVar = document.createElement("span"); SpanRowCustomVar.innerHTML = CustomVars[Index].Name; SpanRowCustomVar.title = CustomVars[Index].Name; SpanRowCustomVar.style.marginLeft = "var(--resgui-quartercolumn)"; RowCustomVar.appendChild(SpanRowCustomVar); DivGroupBodyCustomVariables.appendChild(RowCustomVar); } DivGroupCustomVariables.appendChild(DivGroupBodyCustomVariables); DivListVariables.appendChild(DivGroupDefaultVariables); DivListVariables.appendChild(DivGroupCustomVariables); DivDescriptionVariable = document.createElement("div"); if(TargetHtmlElement) DivDescriptionVariable.className = "resgui-12row resgui-17column column-direction decor-solid-border-left-light"; else DivDescriptionVariable.className = "resgui-13row resgui-17column column-direction decor-solid-border-left-light"; //DivDescriptionVariable.style.backgroundColor = "var(--group-row-background)"; DivBody.appendChild(DivListVariables); DivBody.appendChild(DivDescriptionVariable); ContainerBody.appendChild(DivBody); CustomBox.Body.appendChild(ContainerBody); CustomBox.Open(); }, this.Execution.ExecuteFlow = function(InputObject, Flow, FlowBlock, ResultObject) { if(Flow) if(Flow != null) { if(FlowBlock == null) { Me.IsRunningExucuteFlow = true; if(typeof UiBlocksGenerator != "undefined") { if(Flow.Starts) { if(InputObject.Service && InputObject.ServiceType) { var Index = Flow.Starts.findIndex(x => x.Element.Service == InputObject.Service && InputObject.ServiceType); if(Index > -1) { var StartElement = Flow.Starts[Index]; var indexNextBlock = Flow.Flows.findIndex(x => x.Element.Id == StartElement.Children[0].Target); if(indexNextBlock > -1) { Me.Execution.ExecuteFlow(InputObject, Flow, Flow.Flows[indexNextBlock], ResultObject); } } else throw "Service not founded in flow"; } else throw "inputObject.Service not fonded"; } else throw "Flow.Starts not founded"; } else { var JS = document.createElement("script"); JS.src = "../../../../../../../Argo/Frameworks/ProcessDesigner/UIBlocks/UIBlocks.js"; JS.onload = function() { if(Flow.Starts) { if(InputObject.Service) { var Index = Flow.Starts.findIndex(x => x.Element.Service == InputObject.Service); if(Index > -1) { var StartElement = Flow.Starts[Index]; var indexNextBlock = Flow.Flows.findIndex(x => x.Element.Id == StartElement.Children[0].Target); if(indexNextBlock > -1) { Me.Execution.ExecuteFlow(InputObject, Flow, Flow.Flows[indexNextBlock], ResultObject); } } else throw "Service not founded in flow"; } else throw "inputObject.Service not fonded"; } else throw "Flow.Starts not founded"; } document.head.appendChild(JS); } } else { if(Me.IsRunningExucuteFlow) { Me.Execution.Block = eval("new T"+FlowBlock.Element.Type+"()"); if(Me.Execution.Block.Constructor) { Me.Execution.Block.Constructor(FlowBlock, function(ExitChoosed, Result) { var indexNextBlock = Flow.Flows.findIndex(x => x.Element.Id == ExitChoosed.Target); if(indexNextBlock > -1) { if(Flow.Flows[indexNextBlock].Element.BlockType!="END") { Me.Execution.ExecuteFlow(InputObject, Flow, Flow.Flows[indexNextBlock], Result); } else { Me.IsRunningExucuteFlow = false; console.log("FINIO"); console.log(Result); } } }, InputObject); } } } } } this.Execution.StopExecutionFlow = function() { Me.IsRunningExucuteFlow = false; if(Me.Execution.Block) if(Me.Execution.Block.CustomBox) Me.Execution.Block.CustomBox.Close(); } this.ImportPopup = function() { var CustomBox = new TMWGUICustomBox(20, 25); CustomBox.LoadFlow = function(Flow, CallBack) { if(Flow) { Me.ObjStored = Flow; if(Me.InputFileName) Me.InputFileName.value = Flow["Name"]; var Request = { Bucket : "sg365v2", Key : "MW-Process-Designer/Flows/" + Flow["_id"] } $MW.S3.getObject(Request, function(err, data) { if (err) console.log(err, err.stack); // an error occurred else { var reader = new draw2d.io.json.Reader(); reader.unmarshal($MWProcessDesigner.Canvas, data.Body.toString('utf-8')); if(CallBack) CallBack(); } }) } } var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("SelectImportFlow"); var spanClose = document.createElement("span"); spanClose.innerHTML = "×"; spanClose.style.fontSize = "var(--resgui-font-height-xl)"; spanClose.style.cursor = "pointer"; spanClose.style.marginRight = "var(--resgui-quartercolumn)"; spanClose.CustomBox = CustomBox; spanClose.onclick = function (ev) { CustomBox.Close(); }; CustomBox.Title.className += " justify-content-space-between"; CustomBox.Title.appendChild(spanTitle); CustomBox.Title.appendChild(spanClose); var CustomContainer = document.createElement("div"); CustomContainer.className = "resgui-18row relative-full-width column-direction "; CustomBox.Body.appendChild(CustomContainer); var Options = {}; Options.DisableCache = true; Options.IsChild = true; Options.CheckOnlyOneCheckBox = true; Options.DisableAddButton = true; Options.DisableDelete = true; Options.Buttons = [{"Description":$MWGUI.GetLanguageString("Confirm"), "SourceIcon":"../../../../../../../../images/icons/linkIcon.png", "Tag":"ConfirmImport"}]; var Iframe = document.createElement("iframe"); Iframe.src = "../../../../../../../../Argo/Flows/FlowList.html?" + $MW.Base64Encode(JSON.stringify(Options)); Iframe.style.height = "calc(var(--resgui-18row) - 0.3vh)"; Iframe.style.maxHeight = "calc(var(--resgui-18row) - 0.3vh)"; Iframe.style.minHeight = "calc(var(--resgui-18row) - 0.3vh)"; Iframe.style.width = "calc(var(--resgui-25column) - 3px)"; Iframe.style.maxWidth = "calc(var(--resgui-25column) - 3px)"; Iframe.style.minWidth = "calc(var(--resgui-25column) - 3px)"; Iframe.CustomBox = CustomBox; Iframe.addEventListener("load", function(ev){ ev.target.contentWindow.ActionCallback = function(Event, Elements, ButtonTag) { switch(ButtonTag) { case("ConfirmImport"): { if(Elements.length > 0) { ev.target.CustomBox.LoadFlow(Elements[0].Object, function() { ev.target.CustomBox.Close(); }); } break; } } } }); CustomContainer.appendChild(Iframe); CustomBox.Open(); } } var $MWProcessDesigner = new TMWProcessDesigner();