function TMWGUIForm() { $MWGUI.RegisterLanguageString("NewDescription",{"en":"Inserisci una nuova proprietà","it":"Insert New Property"}); $MWGUI.RegisterLanguageString("Monday",{"en":"Monday","it":"Lunedì"}); $MWGUI.RegisterLanguageString("Tuesday",{"en":"Tuesday","it":"Martedì"}); $MWGUI.RegisterLanguageString("Wednesday",{"en":"Wednesday","it":"Mercoledì"}); $MWGUI.RegisterLanguageString("Thursday",{"en":"Thursday","it":"Giovedì"}); $MWGUI.RegisterLanguageString("Friday",{"en":"Friday","it":"Venerdì"}), $MWGUI.RegisterLanguageString("Saturday",{"en":"Saturday","it":"Sabato"}); $MWGUI.RegisterLanguageString("Sunday",{"en":"Sunday","it":"Domenica"}); $MWGUI.RegisterLanguageString("SelectDevice",{"en":"Select device","it":"Seleziona dispositivo"}); $MWGUI.RegisterLanguageString("Address",{"en":"Address","it":"Indirizzo"}); $MWGUI.RegisterLanguageString("DownloadCSV",{"en":"Download CSV","it":"Scarica CSV"}); $MWGUI.RegisterLanguageString("UploadCSV",{"en":"Upload CSV","it":"Carica CSV"}); $MWGUI.RegisterLanguageString("TMWGUIFormErrorMsgTitle",{"en":"Error","it":"Errore"}); $MWGUI.RegisterLanguageString("TMWGUIFormErrorMsgBody",{"en":"There is an empty property. Plese check the property: ","it":"C'è una proprietà vuota. Cortesemente controllare la proprietà: "}); $MWGUI.RegisterLanguageString("TMWGUIFormMessageButtonOK",{"en":"Ok","it":"Ok"}); $MWGUI.RegisterLanguageString("TMWGUIFromSelectParentButtonText",{"en":"Select","it":"Seleziona"}); $MWGUI.RegisterLanguageString("UploadFile",{"en":"Upload file","it":"Carica file"}); $MWGUI.RegisterLanguageString("PrimaryKeyArgo",{"en":"Argos's primary key","it":"Chiave primaria di argo"}); $MWGUI.RegisterLanguageString("SecondaryKeyArgo",{"en":"Argos's secondary keys","it":"Chiavi secondarie di argo"}); $MWGUI.RegisterLanguageString("STEKeyName",{"en":"Name","it":"Nome"}); $MWGUI.RegisterLanguageString("STEKeyClusterInstance",{"en":"Cluster Instance","it":"Istanza Cluster"}); $MWGUI.RegisterLanguageString("STEKeyIsAdConnectionType",{"en":"Is AD connection type","it":"Connessione tramite AD"}); $MWGUI.RegisterLanguageString("STEKeyConnectsLink",{"en":"Instance connect link","it":"Link connessione centralino"}); $MWGUI.RegisterLanguageString("STEKeyADLink",{"en":"Active Directory link","it":"Link Active Directory"}); $MWGUI.RegisterLanguageString("STEInstanceID",{"en":"Instance ID","it":"ID Istanza"}); $MWGUI.RegisterLanguageString("Id",{"en":"Id","it":"Id"}); $MWGUI.RegisterLanguageString("Name",{"en":"Name","it":"Nome"}); $MWGUI.RegisterLanguageString("Type",{"en":"Type","it":"Tipo"}); $MWGUI.RegisterLanguageString("System",{"en":"System","it":"Sistema"}); $MWGUI.RegisterLanguageString("Connect",{"en":"Connect","it":"Collegati"}); $MWGUI.RegisterLanguageString("Download",{"en":"Download","it":"Scarica"}); $MWGUI.RegisterLanguageString("NotAviable",{"en":"Not aviable","it":"Non disponibile"}); $MWGUI.RegisterLanguageString("Associate",{"en":"Associate","it":"Associa"}); var Me = this; var ListKeyDescriptonRealObject=["matricola","marca","modello","produttore"]; var PropertyObjectDescr=[]; var RealObjDesc = []; RealObjDesc["NewDescription"] = {}; RealObjDesc["NewDescription"][$MWGUI.LanguageCode] = $MWGUI.GetLanguageString("NewDescription"); var EnumDayOfWeek = []; var DictionaryLanguages = {}; var selectListSettings; for (var i = 0; i < 123; i++) DictionaryLanguages[i] = {}; DictionaryLanguages[0]["Code"] = "af"; DictionaryLanguages[0]["Description"] = "Afrikaans "; DictionaryLanguages[1]["Code"] = "sq"; DictionaryLanguages[1]["Description"] = "Albanian "; DictionaryLanguages[2]["Code"] = "ar-dz"; DictionaryLanguages[2]["Description"] = "Arabic (Algeria)"; DictionaryLanguages[3]["Code"] = "ar-bh"; DictionaryLanguages[3]["Description"] = "Arabic (Bahrain)"; DictionaryLanguages[4]["Code"] = "ar-eg"; DictionaryLanguages[4]["Description"] = "Arabic (Egypt)"; DictionaryLanguages[5]["Code"] = "ar-iq"; DictionaryLanguages[5]["Description"] = "Arabic (Iraq)"; DictionaryLanguages[6]["Code"] = "ar-jo"; DictionaryLanguages[6]["Description"] = "Arabic (Jordan)"; DictionaryLanguages[7]["Code"] = "ar-kw"; DictionaryLanguages[7]["Description"] = "Arabic (Kuwait)"; DictionaryLanguages[8]["Code"] = "ar-lb"; DictionaryLanguages[8]["Description"] = "Arabic (Lebanon)"; DictionaryLanguages[9]["Code"] = "ar-ly"; DictionaryLanguages[9]["Description"] = "Arabic (Libya)"; DictionaryLanguages[10]["Code"] = "ar-ma"; DictionaryLanguages[10]["Description"] = "Arabic (Morocco)"; DictionaryLanguages[11]["Code"] = "ar-om"; DictionaryLanguages[11]["Description"] = "Arabic (Oman)"; DictionaryLanguages[12]["Code"] = "ar-qa"; DictionaryLanguages[12]["Description"] = "Arabic (Qatar)"; DictionaryLanguages[13]["Code"] = "ar-sa"; DictionaryLanguages[13]["Description"] = "Arabic (Saudi Arabia)"; DictionaryLanguages[14]["Code"] = "ar-sy"; DictionaryLanguages[14]["Description"] = "Arabic (Syria)"; DictionaryLanguages[15]["Code"] = "ar-tn"; DictionaryLanguages[15]["Description"] = "Arabic (Tunisia)"; DictionaryLanguages[16]["Code"] = "ar-ae"; DictionaryLanguages[16]["Description"] = "Arabic (U.A.E.)"; DictionaryLanguages[17]["Code"] = "ar-ye"; DictionaryLanguages[17]["Description"] = "Arabic (Yemen)"; DictionaryLanguages[18]["Code"] = "eu"; DictionaryLanguages[18]["Description"] = "Basque "; DictionaryLanguages[19]["Code"] = "be"; DictionaryLanguages[19]["Description"] = "Belarusian "; DictionaryLanguages[20]["Code"] = "bg"; DictionaryLanguages[20]["Description"] = "Bulgarian "; DictionaryLanguages[21]["Code"] = "ca"; DictionaryLanguages[21]["Description"] = "Catalan "; DictionaryLanguages[22]["Code"] = "zh-hk"; DictionaryLanguages[22]["Description"] = "Chinese (Hong Kong SAR)"; DictionaryLanguages[23]["Code"] = "zh-cn"; DictionaryLanguages[23]["Description"] = "Chinese (PRC)"; DictionaryLanguages[24]["Code"] = "zh-sg"; DictionaryLanguages[24]["Description"] = "Chinese (Singapore)"; DictionaryLanguages[25]["Code"] = "zh-tw"; DictionaryLanguages[25]["Description"] = "Chinese (Taiwan)"; DictionaryLanguages[26]["Code"] = "hr"; DictionaryLanguages[26]["Description"] = "Croatian "; DictionaryLanguages[27]["Code"] = "cs"; DictionaryLanguages[27]["Description"] = "Czech "; DictionaryLanguages[28]["Code"] = "da"; DictionaryLanguages[28]["Description"] = "Danish "; DictionaryLanguages[29]["Code"] = "nl-be"; DictionaryLanguages[29]["Description"] = "Dutch (Belgium)"; DictionaryLanguages[30]["Code"] = "nl"; DictionaryLanguages[30]["Description"] = "Dutch (Standard)"; DictionaryLanguages[31]["Code"] = "en"; DictionaryLanguages[31]["Description"] = "English "; DictionaryLanguages[32]["Code"] = "en-au"; DictionaryLanguages[32]["Description"] = "English (Australia)"; DictionaryLanguages[33]["Code"] = "en-bz"; DictionaryLanguages[33]["Description"] = "English (Belize)"; DictionaryLanguages[34]["Code"] = "en-ca"; DictionaryLanguages[34]["Description"] = "English (Canada)"; DictionaryLanguages[35]["Code"] = "en-ie"; DictionaryLanguages[35]["Description"] = "English (Ireland)"; DictionaryLanguages[36]["Code"] = "en-jm"; DictionaryLanguages[36]["Description"] = "English (Jamaica)"; DictionaryLanguages[37]["Code"] = "en-nz"; DictionaryLanguages[37]["Description"] = "English (New Zealand)"; DictionaryLanguages[38]["Code"] = "en-za"; DictionaryLanguages[38]["Description"] = "English (South Africa)"; DictionaryLanguages[39]["Code"] = "en-tt"; DictionaryLanguages[39]["Description"] = "English (Trinidad)"; DictionaryLanguages[40]["Code"] = "en-gb"; DictionaryLanguages[40]["Description"] = "English (United Kingdom)"; DictionaryLanguages[41]["Code"] = "en-us"; DictionaryLanguages[41]["Description"] = "English (United States)"; DictionaryLanguages[42]["Code"] = "et"; DictionaryLanguages[42]["Description"] = "Estonian "; DictionaryLanguages[43]["Code"] = "fo"; DictionaryLanguages[43]["Description"] = "Faeroese "; DictionaryLanguages[44]["Code"] = "fa"; DictionaryLanguages[44]["Description"] = "Farsi "; DictionaryLanguages[45]["Code"] = "fi"; DictionaryLanguages[45]["Description"] = "Finnish "; DictionaryLanguages[46]["Code"] = "fr-be"; DictionaryLanguages[46]["Description"] = "French (Belgium)"; DictionaryLanguages[47]["Code"] = "fr-ca"; DictionaryLanguages[47]["Description"] = "French (Canada)"; DictionaryLanguages[48]["Code"] = "fr-lu"; DictionaryLanguages[48]["Description"] = "French (Luxembourg)"; DictionaryLanguages[49]["Code"] = "fr"; DictionaryLanguages[49]["Description"] = "French (Standard)"; DictionaryLanguages[50]["Code"] = "fr-ch"; DictionaryLanguages[50]["Description"] = "French (Switzerland)"; DictionaryLanguages[51]["Code"] = "gd"; DictionaryLanguages[51]["Description"] = "Gaelic (Scotland)"; DictionaryLanguages[52]["Code"] = "de-at"; DictionaryLanguages[52]["Description"] = "German (Austria)"; DictionaryLanguages[53]["Code"] = "de-li"; DictionaryLanguages[53]["Description"] = "German (Liechtenstein)"; DictionaryLanguages[54]["Code"] = "de-lu"; DictionaryLanguages[54]["Description"] = "German (Luxembourg)"; DictionaryLanguages[55]["Code"] = "de"; DictionaryLanguages[55]["Description"] = "German (Standard)"; DictionaryLanguages[56]["Code"] = "de-ch"; DictionaryLanguages[56]["Description"] = "German (Switzerland)"; DictionaryLanguages[57]["Code"] = "el"; DictionaryLanguages[57]["Description"] = "Greek "; DictionaryLanguages[58]["Code"] = "he"; DictionaryLanguages[58]["Description"] = "Hebrew "; DictionaryLanguages[59]["Code"] = "hi"; DictionaryLanguages[59]["Description"] = "Hindi "; DictionaryLanguages[60]["Code"] = "hu"; DictionaryLanguages[60]["Description"] = "Hungarian "; DictionaryLanguages[61]["Code"] = "is"; DictionaryLanguages[61]["Description"] = "Icelandic "; DictionaryLanguages[62]["Code"] = "id"; DictionaryLanguages[62]["Description"] = "Indonesian "; DictionaryLanguages[63]["Code"] = "ga"; DictionaryLanguages[63]["Description"] = "Irish "; DictionaryLanguages[64]["Code"] = "it"; DictionaryLanguages[64]["Description"] = "Italian (Standard)"; DictionaryLanguages[65]["Code"] = "it-ch"; DictionaryLanguages[65]["Description"] = "Italian (Switzerland)"; DictionaryLanguages[66]["Code"] = "ja"; DictionaryLanguages[66]["Description"] = "Japanese "; DictionaryLanguages[67]["Code"] = "ko"; DictionaryLanguages[67]["Description"] = "Korean "; DictionaryLanguages[69]["Code"] = "lv"; DictionaryLanguages[69]["Description"] = "Latvian "; DictionaryLanguages[70]["Code"] = "lt"; DictionaryLanguages[70]["Description"] = "Lithuanian "; DictionaryLanguages[71]["Code"] = "mk"; DictionaryLanguages[71]["Description"] = "Macedonian (FYROM)"; DictionaryLanguages[72]["Code"] = "ms"; DictionaryLanguages[72]["Description"] = "Malaysian "; DictionaryLanguages[73]["Code"] = "mt"; DictionaryLanguages[73]["Description"] = "Maltese "; DictionaryLanguages[74]["Code"] = "no"; DictionaryLanguages[74]["Description"] = "Norwegian (Bokmal)"; DictionaryLanguages[76]["Code"] = "pl"; DictionaryLanguages[76]["Description"] = "Polish "; DictionaryLanguages[77]["Code"] = "pt-br"; DictionaryLanguages[77]["Description"] = "Portuguese (Brazil)"; DictionaryLanguages[78]["Code"] = "pt"; DictionaryLanguages[78]["Description"] = "Portuguese (Portugal)"; DictionaryLanguages[79]["Code"] = "rm"; DictionaryLanguages[79]["Description"] = "Rhaeto-Romanic "; DictionaryLanguages[80]["Code"] = "ro"; DictionaryLanguages[80]["Description"] = "Romanian "; DictionaryLanguages[81]["Code"] = "ro-mo"; DictionaryLanguages[81]["Description"] = "Romanian (Republic of Moldova)"; DictionaryLanguages[82]["Code"] = "ru"; DictionaryLanguages[82]["Description"] = "Russian "; DictionaryLanguages[83]["Code"] = "ru-mo"; DictionaryLanguages[83]["Description"] = "Russian (Republic of Moldova)"; DictionaryLanguages[84]["Code"] = "sz"; DictionaryLanguages[84]["Description"] = "Sami (Lappish)"; DictionaryLanguages[85]["Code"] = "sr"; DictionaryLanguages[85]["Description"] = "Serbian (Cyrillic)"; DictionaryLanguages[87]["Code"] = "sk"; DictionaryLanguages[87]["Description"] = "Slovak "; DictionaryLanguages[88]["Code"] = "sl"; DictionaryLanguages[88]["Description"] = "Slovenian "; DictionaryLanguages[89]["Code"] = "sb"; DictionaryLanguages[89]["Description"] = "Sorbian "; DictionaryLanguages[90]["Code"] = "es-ar"; DictionaryLanguages[90]["Description"] = "Spanish (Argentina)"; DictionaryLanguages[91]["Code"] = "es-bo"; DictionaryLanguages[91]["Description"] = "Spanish (Bolivia)"; DictionaryLanguages[92]["Code"] = "es-cl"; DictionaryLanguages[92]["Description"] = "Spanish (Chile)"; DictionaryLanguages[93]["Code"] = "es-co"; DictionaryLanguages[93]["Description"] = "Spanish (Colombia)"; DictionaryLanguages[94]["Code"] = "es-cr"; DictionaryLanguages[94]["Description"] = "Spanish (Costa Rica)"; DictionaryLanguages[95]["Code"] = "es-do"; DictionaryLanguages[95]["Description"] = "Spanish (Dominican Republic)"; DictionaryLanguages[96]["Code"] = "es-ec"; DictionaryLanguages[96]["Description"] = "Spanish (Ecuador)"; DictionaryLanguages[97]["Code"] = "es-sv"; DictionaryLanguages[97]["Description"] = "Spanish (El Salvador)"; DictionaryLanguages[98]["Code"] = "es-gt"; DictionaryLanguages[98]["Description"] = "Spanish (Guatemala)"; DictionaryLanguages[99]["Code"] = "es-hn"; DictionaryLanguages[99]["Description"] = "Spanish (Honduras)"; DictionaryLanguages[100]["Code"] = "es-mx"; DictionaryLanguages[100]["Description"] = "Spanish (Mexico)"; DictionaryLanguages[101]["Code"] = "es-ni"; DictionaryLanguages[101]["Description"] = "Spanish (Nicaragua)"; DictionaryLanguages[102]["Code"] = "es-pa"; DictionaryLanguages[102]["Description"] = "Spanish (Panama)"; DictionaryLanguages[103]["Code"] = "es-py"; DictionaryLanguages[103]["Description"] = "Spanish (Paraguay)"; DictionaryLanguages[104]["Code"] = "es-pe"; DictionaryLanguages[104]["Description"] = "Spanish (Peru)"; DictionaryLanguages[105]["Code"] = "es-pr"; DictionaryLanguages[105]["Description"] = "Spanish (Puerto Rico)"; DictionaryLanguages[106]["Code"] = "es"; DictionaryLanguages[106]["Description"] = "Spanish (Spain)"; DictionaryLanguages[107]["Code"] = "es-uy"; DictionaryLanguages[107]["Description"] = "Spanish (Uruguay)"; DictionaryLanguages[108]["Code"] = "es-ve"; DictionaryLanguages[108]["Description"] = "Spanish (Venezuela)"; DictionaryLanguages[109]["Code"] = "sx"; DictionaryLanguages[109]["Description"] = "Sutu "; DictionaryLanguages[110]["Code"] = "sv"; DictionaryLanguages[110]["Description"] = "Swedish "; DictionaryLanguages[111]["Code"] = "sv-fi"; DictionaryLanguages[111]["Description"] = "Swedish (Finland)"; DictionaryLanguages[112]["Code"] = "th"; DictionaryLanguages[112]["Description"] = "Thai "; DictionaryLanguages[113]["Code"] = "ts"; DictionaryLanguages[113]["Description"] = "Tsonga "; DictionaryLanguages[114]["Code"] = "tn"; DictionaryLanguages[114]["Description"] = "Tswana "; DictionaryLanguages[115]["Code"] = "tr"; DictionaryLanguages[115]["Description"] = "Turkish "; DictionaryLanguages[116]["Code"] = "uk"; DictionaryLanguages[116]["Description"] = "Ukrainian "; DictionaryLanguages[117]["Code"] = "ur"; DictionaryLanguages[117]["Description"] = "Urdu "; DictionaryLanguages[118]["Code"] = "ve"; DictionaryLanguages[118]["Description"] = "Venda "; DictionaryLanguages[119]["Code"] = "vi"; DictionaryLanguages[119]["Description"] = "Vietnamese "; DictionaryLanguages[120]["Code"] = "xh"; DictionaryLanguages[120]["Description"] = "Xhosa "; DictionaryLanguages[121]["Code"] = "ji"; DictionaryLanguages[121]["Description"] = "Yiddish "; DictionaryLanguages[122]["Code"] = "zu"; DictionaryLanguages[122]["Description"] = "Zulu "; var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.HTMLFormInterface { width:100%; height:100%; flex-direction:column;}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divCommandRow {width:100%; height:var(--resgui-1row); display:flex; flex-direction:row; justify-content:space-evenly; align-items:center; background:var(--secondary-toolbar-background); border-box; -moz-box-sizing: border-box;-webkit-box-sizing: border-box; border-bottom: 1px solid var(--main-gb-color); }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divGroup {width:100%; display:flex; flex-direction: column; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divHeader { background:var(--group-header-background); height:var(--resgui-1row); width:100%; display:flex; flex-direction: row; align-items:center; cursor:pointer; border-box; -moz-box-sizing: border-box;-webkit-box-sizing: border-box; border-bottom: 1px solid var(--group-header-border-color); }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divHeader:hover { background: var(--group-header-background-hover); transition: background-color 0.3s linear; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divRow { background: var(--group-row-background); width:100%; display:flex; flex-direction: row; align-items:center; border-box; -moz-box-sizing: border-box;-webkit-box-sizing: border-box; border-bottom: 1px solid var(--main-gb-color)}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divColDescription { width:var(--resgui-6column); display:flex; flex-direction: row; align-items:center; justify-content:flex-end; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divColValue { width:var(--resgui-14column); display:flex; flex-direction: row; align-items:center; justify-content:flex-start; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.spanDescription { margin-right: 0.5vmin; font-size:var(--resgui-font-height-s); text-align:right; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.spanbreak { margin-right: 0.5vmin; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.TextReadOnly { display:block; 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);max-width:var(--resgui-7column); line-height:var(--resgui-input-text-height) }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divNumberListAdd { display:flex; height:var(--resgui-1row); width:var(--resgui-14column); flex-direction: row; align-items:center;}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divNumberListValue{ display:flex; flex-direction: row; align-items:center;}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divDictionaryLanguageListValue{ display:flex; flex-direction: column; align-items:flex-start;}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divDictionaryLanguageValue{ display:flex; flex-direction: row; align-items:center;}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.imgNumberListAdd{ height: 3vmin; margin-left:0.5vmin; margin-right:0.5vmin; cursor:pointer; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.imgNumberListValue{ height: 3vmin; margin-left:0.5vmin; margin-right:0.5vmin; cursor:pointer; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.ErrorMark{ background:var(--red) !important; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.DivContainerListUser{ position: relative; display: flex; flex-direction: row; justify-content: space-around; align-items: flex-start; width: 31vmin; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.DivContainerListUserUnselected{ position: relative; display: flex; width: 47.5%; flex-direction: column; align-items: flex-start; margin-right: 3%; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.TitleUnselectedItems{ position: relative; display: flex; font-size: 1.7vmin; color: #404040; width: 100%; border-bottom: 1px solid #404040; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.DivContainerListUserSelected{ position: relative; display: flex; width: 47.5%; flex-direction: column; align-items: flex-start; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.TitleSelectedItems{ position: relative; display: flex; font-size: 1.7vmin; color: #404040; width: 100%; border-bottom: 1px solid #404040; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.DivContainerItem{ position: relative; display: flex; background-color: rgba(0,0,0,0.2); margin-top: 1.5%; margin-bottom: 1.5%; width: 100%; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.DivContainerItem:hover{ background-color: rgba(0,0,0,0.4); cursor:pointer; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.SpanUserName{ position: relative; display: flex; padding-left: 2.5%; padding-bottom: 1%; padding-top: 1%; font-size: 1.7vmin; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divContainerUserSelectBox{ position: relative; display: flex; align-items: center; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.selectBoxCheckAccount{ position: relative; display: flex; margin-right: 1%; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.imgPencil{ position: relative; display: flex; width: 8%; cursor:pointer;}'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divDoc{ display:flex;flex-direction:row;align-items: center;justify-content: flex-start; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divDate{ display:flex;flex-direction:row;align-items: center;justify-content: flex-start; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divActions{ display:flex;flex-direction:row;align-items: center;justify-content: flex-start; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.iDaysWeekList{ position: relative; display: flex; flex-direction: row; justify - content: space - around; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divDayContainer{ position: relative; display: flex; flex-direction: column; justify-content: flex-start; background-color:rgba(0,0,0,0.2); margin-right:0.3vmin; padding:0.2vmin }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.spanDayDescription{ position: relative; display: flex; justify-content: center; margin-bottom: 1vmin; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.inputCheckDay{ position: relative; display: flex; width: 12vmin; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divContainerNewDescr{ position: relative; display: flex; align-items: center;flex-direction: row; justify-content: center; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.divContainerNewDescrConfirmed{position: relative; width: 50%; display: flex; align-items: center;flex-direction: row; justify-content: center; }'; document.getElementsByTagName('head')[0].appendChild(style); style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.imginput{ min-width:50px; height:var(--resgui-1row); margin-top:var(--resgui-halfrow); margin-bottom:var(--resgui-halfrow); margin-left:var(--resgui-quartercolumn); cursor:pointer; }'; document.getElementsByTagName('head')[0].appendChild(style); var SomethingIsSelected = false; var LanguageCodePrimeGUI = ""; var INPUTListUser; var TextMultilanguageInput; var divContainerListTextMultilanguage; var SelectDeviceDesc = []; SelectDeviceDesc["SelectDevice"] = {}; var AddressDesc = []; AddressDesc["Address"] = {}; var DownloadDesc = []; DownloadDesc["DownloadCSV"] = {}; var UploadDesc = []; UploadDesc["UploadCSV"] = {}; // Options un oggetto JSON con campi uguali al nome della proprietà e 2 valori ammessi "ReadOnly" (sola lettura del campo) oppure "Hidden" nasconde la riga. this.CreateForm = function (DataStructure, OriginalObj, LanguageCode, LanguageTexts , CallbackDelete, CallbackEdit, Options, CheckboxLink, SelectLink) { LanguageCodePrimeGUI = LanguageCode; if (Options == null) { Options = {}; Options.IsAllReadOnly = false; Options.IsResourceGroupInstance = false; Options.IsRuleInstance = false; Options.ResourceGroupResourceType = false; if(Options.CustomButtons == null || Options.CustomButtons == undefined) Options.CustomButtons = null; } this.Options = Options; var DeleteText = LanguageTexts[0]; var EditText = LanguageTexts[1]; var currentPWS = LanguageTexts[2]; var newPWS = LanguageTexts[3]; var confirmPWS = LanguageTexts[4]; var cancelButtonPWS = LanguageTexts[5]; var saveButtonPWS = LanguageTexts[6]; var changeButtonPWS = LanguageTexts[7]; var CurrentPasswordNotValid = LanguageTexts[8]; SelectDeviceDesc["SelectDevice"][LanguageCode] = LanguageTexts[9];//$MWGUI.GetLanguageString("SelectDevice"); AddressDesc["Address"][LanguageCode] = LanguageTexts[10];//$MWGUI.GetLanguageString("Address"); DownloadDesc["DownloadCSV"][LanguageCode] = LanguageTexts[11];//$MWGUI.GetLanguageString("DownloadCSV"); UploadDesc["UploadCSV"][LanguageCode] = LanguageTexts[12];//$MWGUI.GetLanguageString("UploadCSV"); EnumDayOfWeek[0] = {}; EnumDayOfWeek[0][LanguageCode] = LanguageTexts[13];//$MWGUI.GetLanguageString("Monday"); EnumDayOfWeek[1] = {}; EnumDayOfWeek[1][LanguageCode] = LanguageTexts[14]; //$MWGUI.GetLanguageString("Tuesday"); EnumDayOfWeek[2] = {}; EnumDayOfWeek[2][LanguageCode] = LanguageTexts[15]; //$MWGUI.GetLanguageString("Wednesday"); EnumDayOfWeek[3] = {}; EnumDayOfWeek[3][LanguageCode] = LanguageTexts[16]; //$MWGUI.GetLanguageString("Thursday"); EnumDayOfWeek[4] = {}; EnumDayOfWeek[4][LanguageCode] = LanguageTexts[17]; //$MWGUI.GetLanguageString("Friday"); EnumDayOfWeek[5] = {}; EnumDayOfWeek[5][LanguageCode] = LanguageTexts[18];//$MWGUI.GetLanguageString("Saturday"); EnumDayOfWeek[6] = {}; EnumDayOfWeek[6][LanguageCode] = LanguageTexts[19];//$MWGUI.GetLanguageString("Sunday"); var Result = new Object(); try { Result["OriginalObject"] = OriginalObj; var InputDictionary = []; var Properties = []; var PropertiesOrder = new Array(); if (DataStructure["StructureDescriptor"] != null) { for (var Descriptor in DataStructure["StructureDescriptor"]) { if (DataStructure["StructureDescriptor"][Descriptor].Category == "" || DataStructure["StructureDescriptor"][Descriptor].Category == null) continue; var propFields = DataStructure["StructureDescriptor"][Descriptor].Category.toString().split('@'); if (propFields.length == 2) { if (PropertiesOrder.indexOf(propFields[1]) == -1) { PropertiesOrder.push(propFields[1]); Properties[propFields[1]] = []; } DataStructure["StructureDescriptor"][Descriptor]["_PropertyName"] = Descriptor; Properties[propFields[1]][DataStructure["StructureDescriptor"][Descriptor].ShowIndex] = DataStructure["StructureDescriptor"][Descriptor]; } } } PropertiesOrder.sort(); Result["Structure"] = Properties; var Form = document.createElement("form"); Form.className = "HTMLFormInterface"; Form.InputDictionary = InputDictionary; Result["Form"] = Form; var CategoryDictionary = []; var TypeProp = []; if (CallbackDelete != null || CallbackEdit != null) { var divCommandRow = document.createElement("div"); divCommandRow.className = "divCommandRow"; Form.RowButtons = divCommandRow; Form.appendChild(divCommandRow); if (CallbackDelete != null) { var divDeleteButton = document.createElement("div"); divDeleteButton.className = " button-application"; divDeleteButton.OriginalObj = Result["OriginalObject"]; divDeleteButton.addEventListener("click", function () { CallbackDelete(this.OriginalObj) }); divCommandRow.appendChild(divDeleteButton); Form.DeleteButton = divDeleteButton; var spanDeleteButton = document.createElement("span"); spanDeleteButton.innerHTML = DeleteText; divDeleteButton.appendChild(spanDeleteButton); } if (CallbackEdit != null) { var divEditButton = document.createElement("div"); divEditButton.className = "button-application"; divEditButton.OriginalObj = Result["OriginalObject"]; divEditButton.InputDictionary = InputDictionary; divEditButton.FormObjInstance = Result; divEditButton.FormObjInstance = Result; divEditButton.isSaveRequest = false; Result.EditButton = divEditButton; Result.GetEditedObject = function(sender) { var NewObject = new Object(); for (var Property in this.EditButton.OriginalObj) { if (this.EditButton.InputDictionary[Property] != null) { if (this.EditButton.InputDictionary[Property].Variable != "Description") { NewObject[Property] = OriginalObj[Property]; } } } for (var Property in this.EditButton.OriginalObj) { if (this.EditButton.InputDictionary[Property] != null) if (this.EditButton.InputDictionary[Property].GetValue != null) { var NewValue = this.EditButton.InputDictionary[Property].GetValue(); console.log(PropertiesDictionary); var PropertyRoleAttribute = PropertiesDictionary[PropertiesDictionary.findIndex((PropertyFetched)=> {if(PropertyFetched) return PropertyFetched._PropertyName == Property})]; //if(PropertyRoleAttribute.IsRequired && (NewValue=="" || NewValue==null || NewValue["ID"] == "" || NewValue["ID"] == null || NewValue==[])) if(PropertyRoleAttribute == null) continue; if(PropertyRoleAttribute.IsRequired && (NewValue=="" || NewValue==null || NewValue==[])) { if(Array.isArray(NewValue)) { if(NewValue["ID"] == "" || NewValue["ID"] == null) { if(sender) if(sender.isSaveRequest) $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("TMWGUIFormErrorMsgTitle"),$MWGUI.GetLanguageString("TMWGUIFormErrorMsgBody") + DataStructure["GUIDescriptor"]["Content"]["Properties"][Property][LanguageCode],"error",[{"text":$MWGUI.GetLanguageString("TMWGUIFormMessageButtonOK"),"Callback":function(){}}]); } } else { if(sender) if(sender.isSaveRequest) $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("TMWGUIFormErrorMsgTitle"),$MWGUI.GetLanguageString("TMWGUIFormErrorMsgBody") + DataStructure["GUIDescriptor"]["Content"]["Properties"][Property][LanguageCode],"error",[{"text":$MWGUI.GetLanguageString("TMWGUIFormMessageButtonOK"),"Callback":function(){}}]); } return; } if (NewValue != null) { if(Property != "ResourceType" && Property != "Parent" && Property != "Creator") { if(Options[Property]) { if((Options[Property] == "hidden" || Options[Property] == "readonly")) { if(PropertyRoleAttribute.IsRequired) NewObject[Property] = NewValue else NewObject[Property] = this.EditButton.OriginalObj[Property]; } else NewObject[Property] = NewValue; } else { NewObject[Property] = NewValue; } } else { NewObject[Property] = NewValue; } } else { NewObject = null; break; } } } return NewObject; } divEditButton.addEventListener("click", function (Ev) { this.isSaveRequest = true; if(Ev.target.tagName == "SPAN") var NewObject = Ev.target.parentNode.FormObjInstance.GetEditedObject(this); else var NewObject = Ev.target.FormObjInstance.GetEditedObject(this); /*new Object(); for (var Property in this.OriginalObj) { if (this.InputDictionary[Property] != null) { if (this.InputDictionary[Property].Variable != "Description") { NewObject[Property] = OriginalObj[Property]; } } } for (var Property in this.OriginalObj) { if (this.InputDictionary[Property] != null) if (this.InputDictionary[Property].GetValue != null) { var NewValue = this.InputDictionary[Property].GetValue(); var PropertyRoleAttribute = PropertiesDictionary[PropertiesDictionary.findIndex((PropertyFetched)=> {if(PropertyFetched) return PropertyFetched._PropertyName==Property})]; if(PropertyRoleAttribute.IsRequired && (NewValue=="" || NewValue==null)) { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("TMWGUIFormErrorMsgTitle"),$MWGUI.GetLanguageString("TMWGUIFormErrorMsgBody") + DataStructure["GUIDescriptor"]["Content"]["Properties"][Property][LanguageCode],"error",[{"text":$MWGUI.GetLanguageString("TMWGUIFormMessageButtonOK"),"Callback":function(){}}]); return; } if (NewValue != null) NewObject[Property] = NewValue; else { NewObject = null; break; } } } console.log(NewObject);*/ CallbackEdit(NewObject, this.OriginalObj); }); divCommandRow.appendChild(divEditButton); var spanEditButton = document.createElement("span"); spanEditButton.innerHTML = EditText; divEditButton.appendChild(spanEditButton); } if(this.Options) { if(this.Options.CustomButtons) { for(var i = 0; i < this.Options.CustomButtons.length; i++) { if(this.Options.CustomButtons[i].ButtonDescription != null && this.Options.CustomButtons[i].CallbackClick != null) { var divCommandButton = document.createElement("div"); divCommandButton.className = "button-application"; divCommandButton.obj = this.Options.CustomButtons[i]; divCommandButton.CallbackClick = this.Options.CustomButtons[i].CallbackClick; divCommandButton.addEventListener("click", function(){ this.CallbackClick(); }); divCommandRow.appendChild(divCommandButton); var spanCommandButton = document.createElement("span"); spanCommandButton.innerHTML = this.Options.CustomButtons[i].ButtonDescription; divCommandButton.appendChild(spanCommandButton); } } } } } for (var PropertyIndex in PropertiesOrder) { var Property = Properties[PropertiesOrder[PropertyIndex]]; for (var FieldIndex in Property) { if (CategoryDictionary[Property[FieldIndex].Category] == null) { if(DataStructure["GUIDescriptor"]["Content"]["Categories"][Property[FieldIndex].Category]) { TypeProp.push(Property[FieldIndex]["_PropertyName"]); var divGroup = document.createElement("div"); divGroup.className = "divGroup"; divGroup.style.display = "none"; Form.appendChild(divGroup); CategoryDictionary[Property[FieldIndex].Category] = divGroup; divGroup.PropertiesList = new Array(); var divHeader = document.createElement("div"); divHeader.className = "divHeader"; divGroup.appendChild(divHeader); var divArrow = document.createElement("div"); divHeader.appendChild(divArrow); var imgArrow = document.createElement("img"); imgArrow.alt = "arrow"; imgArrow.src = "../../../../../../../../../images/icons/ArrowIcon.png" imgArrow.style.transform = "rotate(-90deg)"; imgArrow.className = "icon-image"; divArrow.appendChild(imgArrow); var divTitle = document.createElement("div"); divHeader.appendChild(divTitle); var spanTitle = document.createElement("span"); spanTitle.className="letter-spacing-xl text-transform-uppercase"; spanTitle.innerHTML = DataStructure["GUIDescriptor"]["Content"]["Categories"][Property[FieldIndex].Category][LanguageCode]; divTitle.appendChild(spanTitle); var divContainerProperty = document.createElement("div"); divContainerProperty.className="column-direction"; divGroup.appendChild(divContainerProperty); divHeader.divContainerProperty = divContainerProperty; divHeader.imgArrow = imgArrow; divHeader.addEventListener("click", function () { if (this.divContainerProperty.style.display == "none") { this.divContainerProperty.style.display = ""; this.imgArrow.style.transform = "rotate(-90deg)"; } else { this.divContainerProperty.style.display = "none"; this.imgArrow.style.transform = "rotate(180deg)"; } }); } } if (CategoryDictionary[Property[FieldIndex].Category]) if(CategoryDictionary[Property[FieldIndex].Category] != null) CategoryDictionary[Property[FieldIndex].Category].PropertiesList.push(Property[FieldIndex]); } } var PropertiesDictionary = []; for (var CategoryKey in CategoryDictionary) { var PropertiesOrder = new Array(); for (var Property in CategoryDictionary[CategoryKey].PropertiesList) { PropertiesOrder.push(parseInt(CategoryDictionary[CategoryKey].PropertiesList[Property].ShowIndex)); PropertiesDictionary[CategoryDictionary[CategoryKey].PropertiesList[Property].ShowIndex] = CategoryDictionary[CategoryKey].PropertiesList[Property]; } for (var PropertyIndex in PropertiesOrder) { var PropertyToDraw = PropertiesDictionary[PropertiesOrder[PropertyIndex]]; if (Options[PropertyToDraw._PropertyName] != null) if (Options[PropertyToDraw._PropertyName].toLowerCase() == "hidden") continue; if(DataStructure["GUIDescriptor"]["Content"]["Properties"][PropertyToDraw._PropertyName] == null) continue; var divRowWrapper =document.createElement("div"); divRowWrapper.className="relative-full-width"; divRowWrapper.style.minHeight="var(--resgui-1row)"; CategoryDictionary[CategoryKey].childNodes[1].appendChild(divRowWrapper); var divRow = document.createElement("div"); divRow.className = "divRow"; divRowWrapper.appendChild(divRow); var divColDescription = document.createElement("div"); divColDescription.className = "divColDescription"; divRow.appendChild(divColDescription); var spanDescription = document.createElement("span"); spanDescription.className = "spanDescription"; spanDescription.innerHTML = DataStructure["GUIDescriptor"]["Content"]["Properties"][PropertyToDraw._PropertyName][LanguageCode]; divColDescription.appendChild(spanDescription); var spanbreak = document.createElement("span"); spanbreak.className = "spanbreak"; spanbreak.innerHTML = ":"; divColDescription.appendChild(spanbreak); var divColValue = document.createElement("div"); divColValue.className = "divColValue"; divRow.appendChild(divColValue); switch(PropertyToDraw.Appaerance) { case(0): PropertyToDraw.Appaerance = "Nothing"; break; case(1): PropertyToDraw.Appaerance = "Text"; break; case(2): PropertyToDraw.Appaerance = "Checkbox"; break; case(3): PropertyToDraw.Appaerance = "Number"; break; case(4): PropertyToDraw.Appaerance = "NumberList"; break; case(5): PropertyToDraw.Appaerance = "Enumerator"; break; case(6): PropertyToDraw.Appaerance = "Password"; break; case(7): PropertyToDraw.Appaerance = "Email"; break; case(8): PropertyToDraw.Appaerance = "TextReadOnly"; break; case(9): PropertyToDraw.Appaerance = "TimeSpan"; break; case(10): PropertyToDraw.Appaerance = "TextMultilanguage"; break; //case(11): PropertyToDraw.Appaerance = "ListSettings"; break; case(13): PropertyToDraw.Appaerance = "EmailList"; break; case(14): PropertyToDraw.Appaerance = "TextList"; break; //case(15): PropertyToDraw.Appaerance = "ListDocument"; break; case(16): PropertyToDraw.Appaerance = "ListRealObject"; break; case(17): PropertyToDraw.Appaerance = "ListUser"; break; case(18): PropertyToDraw.Appaerance = "Date"; break; case(19): PropertyToDraw.Appaerance = "UserSelectBox"; break; //case(20): PropertyToDraw.Appaerance = "ListManuntentieeActions"; break; //case(21): PropertyToDraw.Appaerance = "ListOldManuntentieeActions"; break; case(22): PropertyToDraw.Appaerance = "DaysWeekList"; break; case(23): PropertyToDraw.Appaerance = "DayHour"; break; //case(24): PropertyToDraw.Appaerance = "DescriptionRealObject"; break; //case(25): PropertyToDraw.Appaerance = "DateNextMaintenance"; break; case(26): PropertyToDraw.Appaerance = "TextArea"; break; case(27): PropertyToDraw.Appaerance = "File"; break; case(28): PropertyToDraw.Appaerance = "Color"; break; //case(29): PropertyToDraw.Appaerance = "CriptoPassword"; break; case(30): PropertyToDraw.Appaerance = "IPAddress"; break; case(31): PropertyToDraw.Appaerance = "Image"; break; //case(32): PropertyToDraw.Appaerance = "SettingIndex"; break; //case(33): PropertyToDraw.Appaerance = "Plant"; break; //case(34): PropertyToDraw.Appaerance = "PlantGroup"; break; //case(35): PropertyToDraw.Appaerance = "SettingIndexCarel"; break; //case(36): PropertyToDraw.Appaerance = "SlaveDevices"; break; case(37): PropertyToDraw.Appaerance = "ImageUserPool"; break; case(38): PropertyToDraw.Appaerance = "MailList"; break; //case(39): PropertyToDraw.Appaerance = "MaskValue"; break; case(40): PropertyToDraw.Appaerance = "PhoneNumber"; break; case(41): PropertyToDraw.Appaerance = "CognitoUsername"; break; case(42): PropertyToDraw.Appaerance = "ResourceGroupLinkedToMyUserPool"; break; case(43): PropertyToDraw.Appaerance = "GenericDictionary"; break; case(44): PropertyToDraw.Appaerance = "EnumeratorSelectOnlyOnCreation"; break; case(45): PropertyToDraw.Appaerance = "RulesLinkedToMyUserPool"; break; case(46): PropertyToDraw.Appaerance = "ResourceType"; break; case(47): PropertyToDraw.Appaerance = "PhoneNumberList"; break; case(48): PropertyToDraw.Appaerance = "ImageIconUser"; break; case(49): PropertyToDraw.Appaerance = "ListArgoKeys"; break; case(50): PropertyToDraw.Appaerance = "RulesArgoEvent"; break; //case(48): PropertyToDraw.Appaerance = "File"; break; case(51): PropertyToDraw.Appaerance = "SteKeys"; break; case(52): PropertyToDraw.Appaerance = "ArgoDateTimeNoSpaces"; break; case(53): PropertyToDraw.Appaerance = "ArgoDateTime"; break; case(54): PropertyToDraw.Appaerance = "ArgoAssetType"; break; case(55): PropertyToDraw.Appaerance = "ArgoAggregationTScope"; break; case(56): PropertyToDraw.Appaerance = "ArgoAggregationTSite"; break; case(57): PropertyToDraw.Appaerance = "ArgoAggregationTSource"; break; case(58): PropertyToDraw.Appaerance = "ArgoAggregationTAsset"; break; case(59): PropertyToDraw.Appaerance = "ArgoAggregationTDataType"; break; case(60): PropertyToDraw.Appaerance = "ArgoDownloadEmailEvent"; break; case(61): PropertyToDraw.Appaerance = "TimeReadOnly"; break; } var input = null; switch (PropertyToDraw.Appaerance) { case "Nothing":{ divRowWrapper.style.minHeight = "var(--resgui-0row)"; divRow.style.display = "none"; input = document.createElement("span"); input.Variable = PropertyToDraw._PropertyName; break; } case "Text":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("input"); input.type ="text"; input.GetValue = function () { return this.value; }; if(Options.IsAllReadOnly) { input.disabled = true; } break; } case "Checkbox":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("input"); if (CheckboxLink != null) if (CheckboxLink[PropertyToDraw._PropertyName] != null) { input.Link = CheckboxLink[PropertyToDraw._PropertyName]; input.InputDictionary = InputDictionary; input.Changed = function(sender) { try { if (sender.input.Link != null) { if (sender.input.Link.length >= 1) { for (var ID in sender.input.Link[0]) { var target =sender.input.InputDictionary[sender.input.Link[0][ID]]; if (target != null && target != undefined) sender.input.InputDictionary[sender.input.Link[0][ID]].parentNode.parentNode.parentNode.style.display = sender.input.checked ? "flex" : "none"; } } if (sender.input.Link.length >= 2) { for (var ID in sender.input.Link[1]) { var target =sender.input.InputDictionary[sender.input.Link[1][ID]]; if (target != null && target != undefined) sender.input.InputDictionary[sender.input.Link[1][ID]].parentNode.parentNode.parentNode.style.display = sender.input.checked ? "none" : "flex"; } } } } catch(err) {alert(err)} }; } input.type = "checkbox"; input.GetValue = function () { return this.checked; } if(Options.IsAllReadOnly) { input.readOnly = true; } break; } case "Number":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("input"); input.type = "number"; input.min = PropertyToDraw.MinValue; input.max = PropertyToDraw.MaxValue; input.step = PropertyToDraw.step; input.CheckValue = function () { var Result = true; Result = !(isNaN(this.value) || parseFloat(this.value) < parseFloat(this.min) || parseFloat(this.value) > parseFloat(this.max) || this.value == "" || (this.step == 1 && this.value != (parseInt(this.value)))); if (Result) { this.className = this.className.replace(" ErrorMark", ""); } else { if (this.className.indexOf("ErrorMark") == -1) this.className += " ErrorMark"; } return Result; } input.addEventListener("input", function () { this.CheckValue(); }); input.GetValue = function () { if (this.className.indexOf("ErrorMark") == -1) return this.value; else { this.focus(); return null; } } if(Options.IsAllReadOnly) { input.disabled = true; } break; } case "NumberList":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("div"); input.className = "column-direction"; var divContent = document.createElement("div"); divContent.className = "column-direction"; input.appendChild(divContent); var divEdit = document.createElement("div"); divEdit.className = "divNumberListAdd "; input.appendChild(divEdit); var inputValue = document.createElement("input"); inputValue.type = "number"; inputValue.min = PropertyToDraw.MinValue; inputValue.max = PropertyToDraw.MaxValue; inputValue.step = PropertyToDraw.step; inputValue.CheckValue = function () { var Result = true; Result = !(isNaN(this.value) || parseFloat(this.value) < parseFloat(this.min) || parseFloat(this.value) > parseFloat(this.max) || this.value == "" || (this.step == 1 && this.value != (parseInt(this.value)))); if (Result) { this.className = this.className.replace(" ErrorMark", ""); } else { if (this.className.indexOf("ErrorMark") == -1) this.className += " ErrorMark"; } return Result; } divEdit.appendChild(inputValue); var addButton = document.createElement("div"); divEdit.appendChild(addButton); var img = document.createElement("img"); img.divContent = divContent; img.inputValue = inputValue; img.className = "icon-image-button"; img.addEventListener("click", function () { if (this.inputValue.CheckValue()) CreateNumberListValue(this.divContent, this.inputValue.value); }); img.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; addButton.appendChild(img); input.GetValue = function () { var Result = new Array(); for (var i = 0; i < this.childNodes[0].childNodes.length; i++) { var ObjToSave = new Object; ObjToSave["Int32"] = this.childNodes[0].childNodes[i].childNodes[0].value; Result.push(ObjToSave); } return Result; } if(Options.IsAllReadOnly) { console.log("ATTENZIONE: DA GESTIRE 'NumberList' READONLY"); } break; } case "Enumerator":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("select"); input.InputDictionary = InputDictionary; if (PropertyToDraw.ValuesString != "") { var ValsOpz = PropertyToDraw.ValuesString; for (var ValOpz in ValsOpz) { var Opz = document.createElement("option"); Opz.innerHTML = ValsOpz[ValOpz]; Opz.value = ValsOpz[ValOpz]; input.appendChild(Opz); } } if (PropertyToDraw.JSONStructure != "") { var ValsOpz = JSON.parse(PropertyToDraw.JSONStructure); for (var ValOpz in ValsOpz) { for(var field in ValsOpz[ValOpz]) { var Opz = document.createElement("option"); Opz.innerHTML = field; Opz.value = ValsOpz[ValOpz][field]; input.appendChild(Opz); } } } if (SelectLink != null) if (SelectLink[PropertyToDraw._PropertyName] != null) { input.SelectLink = SelectLink[PropertyToDraw._PropertyName]; } input.addEventListener("change", function(){ this.changeSelection(this) }); input.changeSelection = function(sender) { if(sender.SelectLink != undefined && sender.SelectLink != null) { for(var PropertyName in sender.InputDictionary) if(sender.SelectLink[sender.children[sender.selectedIndex].value].findIndex((str) => str == PropertyName) > -1) sender.InputDictionary[PropertyName].parentNode.parentNode.parentNode.style.display = "flex"; else sender.InputDictionary[PropertyName].parentNode.parentNode.parentNode.style.display = "none"; for(var PropertyName in sender.InputDictionary) if(sender.InputDictionary[PropertyName].Changed != null && sender.InputDictionary[PropertyName].Changed != undefined && sender.InputDictionary[PropertyName].parentNode.parentNode.parentNode.style.display == "flex") sender.InputDictionary[PropertyName].Changed({"input":sender.InputDictionary[PropertyName]}); } } input.GetValue = function () { return this.options[this.selectedIndex].value; } if(Options.IsAllReadOnly) { input.disabled = true; } break; } case "Password":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("div"); var Password = document.createElement("input"); Password.placeholder = "password" Password.type = "password"; Password.autocomplete="new-password"; input.appendChild(Password); var CheckPassword = document.createElement("input"); CheckPassword.placeholder = "confirm password" CheckPassword.type = "password"; CheckPassword.autocomplete="new-password"; input.appendChild(CheckPassword); input.GetValue = function () { if (this.childNodes[0].value == this.childNodes[1].value ) { this.childNodes[0].className = this.childNodes[0].className.replace(" ErrorMark", ""); this.childNodes[1].className = this.childNodes[1].className.replace(" ErrorMark", ""); return btoa(this.childNodes[0].value).split("").reverse().join(""); } else { this.childNodes[0].className += " ErrorMark"; this.childNodes[1].className += " ErrorMark"; return null; } } if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'Password' READONLY"); break; } /*case "CriptoPassword":{ console.log("Da adattare 'CriptoPassword' MW.GUI.FormObj.js!"); console.error("Da adattare 'CriptoPassword' MW.GUI.FormObj.js!"); CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("div"); input.className="column-direction relative-full-width"; var divRow1 = document.createElement("div"); divRow1.className="resgui-1row align-items-center display-none"; var spanRow1 = document.createElement("span"); spanRow1.innerHTML =currentPWS + " :"; spanRow1.className ="resgui-4column resgui-font-height-xs"; spanRow1.style.textAlign ="right"; divRow1.appendChild(spanRow1); var inputOld = document.createElement("input"); inputOld.type ="password"; divRow1.appendChild(inputOld); input.appendChild(divRow1); var divRow2 = document.createElement("div"); divRow2.className="resgui-1row align-items-center display-none" var spanRow2 = document.createElement("span"); spanRow2.innerHTML =newPWS + " :"; spanRow2.className ="resgui-4column resgui-font-height-xs"; spanRow2.style.textAlign ="right"; divRow2.appendChild(spanRow2); var inputNew = document.createElement("input"); inputNew.type ="password"; divRow2.appendChild(inputNew); input.appendChild(divRow2); var divRow3 = document.createElement("div"); divRow3.className="resgui-1row align-items-center display-none"; var spanRow3 = document.createElement("span"); spanRow3.innerHTML =confirmPWS + " :"; spanRow3.className ="resgui-4column resgui-font-height-xs"; spanRow3.style.textAlign ="right"; divRow3.appendChild(spanRow3); var inputConfirm = document.createElement("input"); inputConfirm.type ="password"; divRow3.appendChild(inputConfirm); input.appendChild(divRow3); var divRow4 = document.createElement("div"); divRow4.className="resgui-1row resgui-12column align-items-center justify-content-space-evenly display-none"; var divDeleteButton = document.createElement("div"); divDeleteButton.Rows = new Array(); divDeleteButton.Rows.push(divRow1); divDeleteButton.Rows.push(divRow2); divDeleteButton.Rows.push(divRow3); divDeleteButton.Rows.push(divRow4); divDeleteButton.className = "button-application"; divDeleteButton.addEventListener("click",function(){ for(var i in this.Rows) { this.Rows[i].className += " display-none"; } this.Row.className = this.Row.className.replace(" display-none", ""); }); var spanDeleteButton = document.createElement("span"); spanDeleteButton.innerHTML = cancelButtonPWS; divDeleteButton.appendChild(spanDeleteButton); divRow4.appendChild(divDeleteButton); var divSaveButton = document.createElement("div"); divSaveButton.input = input; divSaveButton.inputOld = inputOld; divSaveButton.inputNew = inputNew; divSaveButton.inputConfirm = inputConfirm; divSaveButton.Rows = new Array(); divSaveButton.Rows.push(divRow1); divSaveButton.Rows.push(divRow2); divSaveButton.Rows.push(divRow3); divSaveButton.Rows.push(divRow4); divSaveButton.addEventListener("click",function(){ if (this.inputNew.value != this.inputConfirm.value) { if (this.inputNew.className.indexOf(" ErrorMark") == -1) this.inputNew.className += " ErrorMark"; if (this.inputConfirm.className.indexOf(" ErrorMark") == -1) this.inputConfirm.className += " ErrorMark"; } else { if (this.inputNew.className.indexOf(" ErrorMark") != -1) this.inputNew.className = this.inputNew.className.replace(" ErrorMark",""); if (this.inputConfirm.className.indexOf(" ErrorMark") != -1) this.inputConfirm.className = this.inputConfirm.className.replace(" ErrorMark",""); var Request = new Object(); Request["Key"] = this.input.Key; Request["Current"] = btoa(this.inputOld.value); Request["New"] = btoa(this.inputNew.value); $Prime.PostMessage("PrimeConvalidCriptoPassword",Request,function(Answer,Sender){ if (Answer.MessageResult == "OK") { Sender.input.NewKey = Answer.Content; Sender.inputOld.value = ""; Sender.inputNew.value = ""; Sender.inputConfirm.value =""; Sender.inputOld.className = Sender.inputOld.className.replace(" ErrorMark",""); Sender.inputNew.className = Sender.inputNew.className.replace(" ErrorMark",""); Sender.inputConfirm.className = Sender.inputConfirm.className.replace(" ErrorMark",""); for(var i in Sender.Rows) { Sender.Rows[i].className += " display-none"; } Sender.Row.className = Sender.Row.className.replace(" display-none", ""); } else if (Answer.MessageResult == "Failure") { Sender.inputOld.className += " ErrorMark"; } }, this); } }); divSaveButton.className = " button-application"; var spanSaveButton = document.createElement("span"); spanSaveButton.innerHTML = saveButtonPWS; divSaveButton.appendChild(spanSaveButton); divRow4.appendChild(divSaveButton); input.appendChild(divRow4); var divRow5 = document.createElement("div"); divDeleteButton.Row = divRow5; divSaveButton.Row = divRow5; divRow5.className="resgui-1row align-items-center"; var divChangeButton = document.createElement("div"); divChangeButton.Rows = new Array(); divChangeButton.Rows.push(divRow1); divChangeButton.Rows.push(divRow2); divChangeButton.Rows.push(divRow3); divChangeButton.Rows.push(divRow4); divChangeButton.inputOld = inputOld; divChangeButton.inputNew = inputNew; divChangeButton.inputConfirm = inputConfirm; divChangeButton.input = input; var OptionsResult = true; if (Options[PropertyToDraw._PropertyName] != null) OptionsResult = Options[PropertyToDraw._PropertyName].toLowerCase() != "readonly"; if (PropertyToDraw.ReadOnly == "False" && OptionsResult == true) divChangeButton.addEventListener("click",function(){ for(var i in this.Rows) { this.Rows[i].className = this.Rows[i].className.replace(" display-none", ""); } this.parentNode.className +=" display-none"; this.inputOld.value = ""; this.inputNew.value = ""; this.inputConfirm.value =""; this.inputOld.className = this.inputOld.className.replace(" ErrorMark",""); this.inputNew.className = this.inputNew.className.replace(" ErrorMark",""); this.inputConfirm.className = this.inputConfirm.className.replace(" ErrorMark",""); this.input.NewKey = this.input.Key; }); divChangeButton.className = " button-application"; divChangeButton.style.marginLeft = "var(--resgui-1vw)"; var spanChangeButton = document.createElement("span"); spanChangeButton.innerHTML = changeButtonPWS; divChangeButton.appendChild(spanChangeButton); divRow5.appendChild(divChangeButton); input.appendChild(divRow5); input.GetValue = function() { return this.NewKey; } break; }*/ case "Email":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("input"); input.placeholder = "example@domain.com" input.type = "email"; input.CheckValue = 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", ""); } } } input.addEventListener("input", function () { this.CheckValue(); }) input.GetValue = function () { if (this.className.indexOf(" ErrorMark", "") > -1) { this.focus(); return null; } else { return this.value; } }; if(Options.IsAllReadOnly) { input.disabled = true; } break; } case "EmailList": { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("div"); input.className = "column-direction"; var divContent = document.createElement("div"); divContent.className = "column-direction"; input.appendChild(divContent); var divEditMail = document.createElement("div"); divEditMail.className = "divNumberListAdd"; input.appendChild(divEditMail); var inputValueMail = document.createElement("input"); inputValueMail.type = "email"; inputValueMail.CheckValue = function () { var Result = true; Result = inputValueMail.checkValidity() && this.value != ""; if (Result) { this.className = this.className.replace(" ErrorMark", ""); } else { if (this.className.indexOf("ErrorMark") == -1) this.className += " ErrorMark"; } return Result; } divEditMail.appendChild(inputValueMail); var addButton = document.createElement("div"); divEditMail.appendChild(addButton); var img = document.createElement("img"); img.divContent = divContent; img.inputValueMail = inputValueMail; img.className = "icon-image-button"; img.addEventListener("click", function () { if (this.inputValueMail.CheckValue()) CreateNumberListValue(this.divContent, this.inputValueMail.value); this.inputValueMail.value = ""; }); img.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; addButton.appendChild(img); input.GetValue = function () { var Result = new Array(); for (var i = 0; i < this.childNodes[0].childNodes.length; i++) { Result.push(this.childNodes[0].childNodes[i].childNodes[0].value); } return Result; } if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'EmailList' READONLY"); break; } case "Image":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("img"); input.addEventListener("click",function(event){ var formData = new FormData(); // Crea un form per il carico dei dati var FileControl = document.createElement("input"); // Crea il controllo input FileControl.type = "file"; FileControl.style.display ="none"; FileControl.onchange = function(e) { var FileError = 0; // variabile di gestione errore var AlertMessage = ""; if (FileControl.files.length < 1) // controllo presenza di un file selezionato { //AlertMessage = ($Prime.UploadFileNotFoundMessage + " '*." + $Prime.FileExtension + "' !"); FileError = 1; } if (FileError == 0) { var FR = new FileReader(); FR.addEventListener("load", function(FRevent){ var binary = ''; var bytes = new Uint8Array( FRevent.target.result ); for (var i = 0; i < bytes.byteLength; i++) { binary += String.fromCharCode( bytes[ i ] ); } window.btoa( binary ); event.target.Value = window.btoa( binary ); event.target.setAttribute("src","data:image/png;base64,"+event.target.Value); }); FR.readAsArrayBuffer(FileControl.files[0]); } else // file error { alert(AlertMessage); } } document.body.appendChild(FileControl); FileControl.click(); }); input.className=" imginput "; input.GetValue = function () { return (this.Value!=null) ? this.Value : ""; }; break; } case "TextList": { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("div"); var divContent = document.createElement("div"); input.appendChild(divContent); var divEditTextList = document.createElement("div"); divEditTextList.className = "divNumberListAdd"; input.appendChild(divEditTextList); var inputValueTextList = document.createElement("input"); inputValueTextList.CheckValue = function () { return true; } divEditTextList.appendChild(inputValueTextList); var addButton = document.createElement("div"); divEditTextList.appendChild(addButton); var img = document.createElement("img"); img.divContent = divContent; img.inputValueTextList = inputValueTextList; img.className = "icon-image-button"; img.addEventListener("click", function () { if (img.inputValueTextList.CheckValue()) CreateNumberListValue(this.divContent, this.inputValueTextList.value); }); img.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; addButton.appendChild(img); input.GetValue = function () { var Result = new Array(); for (var i = 0; i < this.childNodes[0].childNodes.length; i++) { Result.push(this.childNodes[0].childNodes[i].childNodes[0].value); } return Result; } if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'TextList' READONLY"); break; } case "TextReadOnly":{ CategoryDictionary[CategoryKey].style.display =""; var input = document.createElement("span"); input.className ="TextReadOnly"; input.innerHTML = ""; input.Variable = PropertyToDraw._PropertyName; break; } case "TimeSpan":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("input"); input.placeholder = "0.00:00:00"; input.CheckValue = function () { var Result = false; var Patt = /^([0-9]*\.)?([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])/ if (Patt.test(this.value)) { var originalValue = this.value; Result = Patt.exec(this.value)[0] == originalValue; } if (Result) { this.className = this.className.replace(" ErrorMark", ""); } else { if (this.className.indexOf("ErrorMark") == -1) this.className += " ErrorMark"; } return Result; } input.addEventListener("input", function () { this.CheckValue(); }); input.GetValue = function () { if (this.className.indexOf(" ErrorMark") > -1) { this.focus(); return null; } else { return this.value; } } if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'TimeSpan' READONLY"); break; } case "TextMultilanguage":{ CategoryDictionary[CategoryKey].style.display =""; var input = document.createElement("div"); input.className="column-direction"; divContainerListTextMultilanguage = document.createElement("div"); divContainerListTextMultilanguage.className = "column-direction"; divContainerListTextMultilanguage.CollectList = true; input.appendChild(divContainerListTextMultilanguage); var divContainer = document.createElement("div"); divContainer.className = "resgui-1row align-items-center"; input.appendChild(divContainer); var divselect = document.createElement("div"); divselect.className ="resgui-8column"; divContainer.appendChild(divselect); var select = document.createElement("select"); divselect.appendChild(select); for (var index in DictionaryLanguages) { var option = document.createElement("option"); option.innerHTML = DictionaryLanguages[index]["Code"] + " - " + DictionaryLanguages[index]["Description"]; option.language = DictionaryLanguages[index]; select.appendChild(option); } var TextValue = document.createElement("input"); divContainer.appendChild(TextValue); TextValue.type = "text"; var img = document.createElement("img"); img.divContent = divContent; img.inputValue = inputValue; img.className = "icon-image-button"; img.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; img.divContainerListTextMultilanguage = divContainerListTextMultilanguage img.select = select; img.TextValue = TextValue; img.addEventListener("click", function () { CreateDictionaryLanguageListValue(this.select.children[this.select.selectedIndex], this.TextValue.value, this.divContainerListTextMultilanguage); }); divContainer.appendChild(img); input.GetValue = null; TextMultilanguageInput = input; input.divContainerListTextMultilanguage = divContainerListTextMultilanguage; input.GetValue = function () { var Result = new Array(); for (var i = 0; i < this.divContainerListTextMultilanguage.children.length; i++) { var Record = new Object(); Record["Code"] = this.divContainerListTextMultilanguage.children[i].LangClass["Code"]; Record["Description"] = this.divContainerListTextMultilanguage.children[i].children[1].value; Result.push(Record); } if(Result.length == 0) Result = ""; return Result; } if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'TextMultilanguage' READONLY"); break; } /*case ("ListSettings"):{ CategoryDictionary[CategoryKey].style.display =""; var input = document.createElement('div'); input.className = "column-direction"; var divContainerList = document.createElement("div"); divContainerList.className = "divDictionaryLanguageListValue justify-content-center";//divDictionaryLanguageListValue divContainerList.CollectList = true; input.appendChild(divContainerList); var divContainer = document.createElement("div"); divContainer.className = "divNumberListAdd"; input.appendChild(divContainer); selectListSettings = document.createElement("select"); selectListSettings.id = "ListSelect"; divContainer.appendChild(selectListSettings); selectListSettings.divContainer = selectListSettings; $Prime.Post("PrimeGetAllTroubleSettings", null, function (Answer, mySelect) { var SettingList = JSON.parse(atob(Answer)); for (var Setting in SettingList) { var optionSetting = document.createElement("option"); optionSetting.innerHTML = SettingList[Setting]["Description"]; optionSetting.SettingObject = SettingList[Setting]; mySelect.appendChild(optionSetting); } var imgg = document.createElement("img"); imgg.divContent = divContent; imgg.inputValue = inputValue; imgg.className = "icon-image-button"; imgg.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; imgg.select = mySelect; imgg.addEventListener("click", function () { CreateNewSetting(divContainerList, this.select.children[this.select.selectedIndex].SettingObject, this.select.children[this.select.selectedIndex], mySelect); }); mySelect.parentNode.appendChild(imgg); var img1 = document.createElement("img"); img1.style.display = "none"; img1.divContent = divContent; img1.inputValue = inputValue; img1.className = "icon-image-button"; img1.src = "../../../../../../../../../images/icons/search_icon256.png"; img1.select = mySelect; img1.addEventListener("click", function () { if (ShowDetails != null) ShowDetails(this.select.children[this.select.selectedIndex].SettingObject); }); mySelect.parentNode.appendChild(img1); var inputContainer = mySelect.parentNode.parentNode; mySelect.parentNode.parentNode.GetValue = function () { var Result = []; var container = inputContainer.children[0]; for (var i = 0; i < inputContainer.children[0].children.length; i++) { Result.push(inputContainer.children[0].children[i].SettingObject["Id"]); } return JSON.stringify(Result); } SetValue(InputDictionary["TroubleSettings"], OriginalObj["TroubleSettings"]); }, selectListSettings); break; }*/ case ("ListUser"):{ console.log("Da adattare 'ListUser' MW.GUI.FormObj.js!"); console.error("Da adattare 'ListUser' MW.GUI.FormObj.js!"); var input = document.createElement('div'); input.id = "ListUser"; input.Checkboxes = new Array(); input.className = "column-direction"; var UsersList = JSON.parse(OriginalObj["UserList"]); for(var user in UsersList) { var DivRow = document.createElement("div"); DivRow.className = "row-direction resgui-1row align-items-center justify-content-flex-start"; input.appendChild(DivRow); var Checkbox = document.createElement("input"); Checkbox.User = UsersList[user]; Checkbox.type = "checkbox"; Checkbox.onchange = function() { this.User.Checked = this.checked; } DivRow.appendChild(Checkbox); input.Checkboxes.push(Checkbox); var SpanUserName = document.createElement("span"); SpanUserName.innerHTML = UsersList[user]["UserName"]; DivRow.appendChild(SpanUserName); } INPUTListUser = input; input.GetValue = function () { var result = new Array(); for(var Checkbox in this.Checkboxes) { result.push(this.Checkboxes[Checkbox].User); } return result; }; if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'ListUser' READONLY"); break; } /*case "ListDocument": { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement('div'); var divContainer = document.createElement('div'); divContainer.className = "divDoc"; input.appendChild(divContainer); var Values = document.createElement("select"); divContainer.appendChild(Values); $Prime.Post("PrimeEAMGetDocRealObject", OriginalObj["Id"], function (Answer) { var Options = JSON.parse(Answer); for (var Option in Options) { var optionSetting = document.createElement("option"); optionSetting.innerHTML = Options[Option].Name; optionSetting.ObjectDocId = Options[Option].Id; optionSetting.RealObject = OriginalObj["Id"]; Values.appendChild(optionSetting); } }); var imgDelete = document.createElement("img"); imgDelete.divContainer = divContainer; imgDelete.inputValue = inputValue; imgDelete.className = "icon-image-button"; imgDelete.src = "../../../../../../../../../images/icons/DeleteIcon.png"; imgDelete.addEventListener("click", function () { Values.remove(Values.selectedIndex); }); divContainer.appendChild(imgDelete); input.GetValue = function () { var Result = []; for (var i = 0; i < divContainer.children[0].children.length; i++) { Result.push(divContainer.children[0].children[i].ObjectDocId); } return Result; } break; } case "ListRealObject": { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement('div'); var divContainer = document.createElement('div'); divContainer.className = "divDoc"; input.appendChild(divContainer); var Values = document.createElement("select"); divContainer.appendChild(Values); for (var realObject in OriginalObj["RealObjects"]) { $Prime.Post("PrimeEAMGetObjectEAM", OriginalObj["RealObjects"][realObject], function (Answer){ var optionSetting = document.createElement("option"); var RealObject= JSON.parse(Answer); optionSetting.innerHTML =RealObject.Name ; optionSetting.IdObj = OriginalObj["Id"]; optionSetting.RealObject=RealObject; Values.appendChild(optionSetting); }); } var imgDelete = document.createElement("img"); imgDelete.divContainer = divContainer; imgDelete.inputValue = inputValue; imgDelete.className = "icon-image-button"; imgDelete.src = "../../../../../../../../../images/icons/DeleteIcon.png"; imgDelete.addEventListener("click", function () { if(parent.removeReferenceRealObject!=null) parent.removeReferenceRealObject(Values[Values.selectedIndex].RealObject.Id,OriginalObj["Id"]) //Values.remove(Values.selectedIndex); }); divContainer.appendChild(imgDelete); input.GetValue = function () { var Result = []; for (var i = 0; i < divContainer.children[0].children.length; i++) { Result.push(divContainer.children[0].children[i].RealObject.Id); } return Result; } break; }*/ case "UserSelectBox":{ console.log("Da adattare 'UserSelectBox' MW.GUI.FormObj.js!"); console.error("Da adattare 'UserSelectBox' MW.GUI.FormObj.js!"); CategoryDictionary[CategoryKey].style.display =""; input = document.createElement('div'); var divContainer = document.createElement('div'); divContainer.className = "divContainerUserSelectBox"; input.appendChild(divContainer); var selectBoxCheckAccount = document.createElement('select'); selectBoxCheckAccount.className = "selectBoxCheckAccount"; divContainer.appendChild(selectBoxCheckAccount); Users = JSON.parse(OriginalObj['AutomaticAcknowledgeUser']); for (var user in Users) { var optionUser = document.createElement('option'); optionUser.innerHTML = Users[user]['UserName']; optionUser.value = Users[user]['UserName']; selectBoxCheckAccount.appendChild(optionUser); if (Users[user]['Selected']) { optionUser.selected = true; SomethingIsSelected = true; } } var imgPencil = document.createElement('img'); imgPencil.className = "icon-image-button"; imgPencil.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; imgPencil.SelectBox = selectBoxCheckAccount; imgPencil.isSelect = true; imgPencil.MyInput = input; divContainer.appendChild(imgPencil); input.UserSelected = null; imgPencil.addEventListener('click', function () { if (this.isSelect) { this.SelectBox.style.display = "none"; var inputSelected = document.createElement('input'); this.inputSelected = inputSelected; this.inputSelected.disabled = true; this.inputSelected.value = this.SelectBox.children[this.SelectBox.selectedIndex].value; if (input != null) this.MyInput.UserSelected = this.SelectBox.children[this.SelectBox.selectedIndex].value; this.parentNode.insertBefore(inputSelected, this); this.src = "../../../../../../../../../images/icons/EditIcon.png" this.isSelect = false; /*this.style.width = "5%"; this.style.marginLeft = "2%"; this.inputSelected.style.padding = "0.75%";*/ } else { this.inputSelected.remove(); this.SelectBox.style.display = "flex"; this.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; this.style.width = ""; this.style.marginLeft = ""; this.isSelect = true; this.MyInput.UserSelected = null; } }); input.GetValue = function () { var Result = ""; if (input != null) if (input.UserSelected != null) { Result = input.UserSelected; } return Result; } if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'UserSelectBox' READONLY"); break; } case "DaysWeekList":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement('div'); input.DayWeeksValue = 0; input.className = "column-direction justify-content-flex-start align-items-center"; for (var i = 0; i < 7; i++) { var divDayContainer = document.createElement("div"); divDayContainer.className = "resgui-1row resgui-7column justify-content-flex-start align-items-center"; input.appendChild(divDayContainer); var inputCheckDay = document.createElement("input"); inputCheckDay.className = "" inputCheckDay.type = "checkbox"; inputCheckDay.InputIndex = i; inputCheckDay.onchange = function () { var Bits = []; for (var i = 0; i < 7; i++) { Bits[i] = (this.parentNode.parentNode.DayWeeksValue >> i) & 1; } Bits[this.InputIndex] = (this.checked == true) ? 1 : 0; this.parentNode.parentNode.DayWeeksValue = 0; for (var j = 0; j < 7; j++) { this.parentNode.parentNode.DayWeeksValue += Bits[j] * Math.pow(2, j); } }; divDayContainer.appendChild(inputCheckDay); var spanDescription = document.createElement("span"); spanDescription.innerHTML = EnumDayOfWeek[i][LanguageCode]; divDayContainer.appendChild(spanDescription); /* var spanDayDescription = document.createElement("span"); //spanDayDescription.className = "spanDayDescription" spanDayDescription.innerHTML = EnumDayOfWeek[i][LanguageCode]; divDayContainer.appendChild(spanDayDescription); console.log(EnumDayOfWeek[i][LanguageCode]);*/ } input.GetValue = function () { return this.DayWeeksValue; } if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'DaysWeekList' READONLY"); break; } case "DayHour": { CategoryDictionary[CategoryKey].style.display =""; var input = document.createElement("div"); input.className = "column-direction" divContainerListTimeSlot = document.createElement("div"); divContainerListTimeSlot.className = "divDictionaryLanguageListValue"; divContainerListTimeSlot.CollectList = true; input.appendChild(divContainerListTimeSlot); var divContainer = document.createElement("div"); divContainer.className = "divNumberListAdd"; input.appendChild(divContainer); var InputStart = document.createElement("input"); InputStart.type = "text"; divContainer.appendChild(InputStart); InputStart.placeholder = "Start Date: 00:00:00"; InputStart.value = "00:00:00" var InputStop = document.createElement("input"); InputStop.type = "text"; divContainer.appendChild(InputStop); InputStop.placeholder = "Stop Date: 00:00:00"; InputStop.value = "00:00:00"; var img = document.createElement("img"); img.divContent = divContent; img.ListContainer = divContainerListTimeSlot; img.inputStart = InputStart; img.inputStop = InputStop; img.className = "icon-image-button"; img.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; img.addEventListener("click", function () { CreateNewTimeSlot(this.inputStart.value, this.inputStop.value); }); divContainer.appendChild(img); //divDayContainer.appendChild(inputCheckDay); input.GetValue = function () { var Result = []; for (var i = 0; i < divContainerListTimeSlot.children.length; i++) { Result.push(JSON.parse('{"' + divContainerListTimeSlot.children[i].children[0].value + '":"' + divContainerListTimeSlot.children[i].children[1].value + '"}')); } return JSON.stringify(Result); } if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'DayHour' READONLY"); break; } case "Date": { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement('input'); input.type = "date"; input.GetValue = function () { return this.value; }; if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'Date' READONLY"); break; } case "Color": { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement('input'); input.type = "color"; input.GetValue = function () { return this.value; }; if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'Color' READONLY"); break; } case "TextArea":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("textarea"); input.GetValue = function () { return this.value; }; if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'TextArea' READONLY"); break; } /*case "ListManuntentieeActions": { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement('div'); var divContainerActions = document.createElement('div'); divContainerActions.className = "divActions"; input.appendChild(divContainerActions); var Select = document.createElement("select"); divContainerActions.appendChild(Select); $Prime.Post("PrimeEAMGetActionsRealObject", OriginalObj["Id"], function (Answer) { var Options = JSON.parse(Answer); for (var Option in Options) { var optionSetting = document.createElement("option"); optionSetting.innerHTML = Options[Option].Name; optionSetting.ObjectDocIdAction = Options[Option].Id; optionSetting.RealObject = OriginalObj["Id"]; Select.appendChild(optionSetting); } }); var imgDelete = document.createElement("img"); imgDelete.divContainer = divContainerActions; imgDelete.inputValue = inputValue; imgDelete.className = "icon-image-button"; imgDelete.src = "../../../../../../../../../images/icons/DeleteIcon.png"; imgDelete.addEventListener("click", function () { Select.remove(Select.selectedIndex); }); divContainerActions.appendChild(imgDelete); input.GetValue = function () { var Result = []; for (var i = 0; i < divContainerActions.children[0].children.length; i++) { Result.push(divContainerActions.children[0].children[i].ObjectDocIdAction); } return Result; } break; } */ /*case "ListOldManuntentieeActions":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement('div'); var divContainerActions = document.createElement('div'); divContainerActions.className="divOldActions"; divRow.style.justifyContent="flex-start"; divColDescription.style.width="66vw"; var Select = document.createElement("select"); divContainerActions.appendChild(Select); Select.style.width="25vw"; Select.style.marginRight ="2vw"; Select.style.display="flex"; for(var OldAction in OriginalObj["OldMAnuntentieeActions"]){ $Prime.Post("PrimeEAMGetObjectEAM",OriginalObj["OldMAnuntentieeActions"][OldAction],function(Answer){ var ObjReturned=JSON.parse(atob(Answer)); if(ObjReturned.MessageResult=="OK"){ var optionSetting = document.createElement("option"); var Content= JSON.parse(ObjReturned.Content); if(Content.Title=="Altro") optionSetting.innerHTML = Content.SubTitle; else optionSetting.innerHTML = Content.Title; optionSetting.style.color="black"; optionSetting.Id=OriginalObj["OldMAnuntentieeActions"][OldAction]; Select.appendChild(optionSetting); } }); } var img= document.createElement("img"); img.divContent = divContainerActions; img.inputValue = inputValue; img.className = "icon-image-button"; img.src = "../../../../../../../../../images/icons/search_icon256.png"; img.addEventListener("click",function(){ if(Select.children.length >0) if(parent.ShowOldAction!=null) parent.ShowOldAction(Select[Select.selectedIndex].Id); }); divContainerActions.appendChild(img); input.appendChild(divContainerActions); input.GetValue=function(){ var Result=[]; for(var i=0; i 0) { var MainRow = this.MainRow; var File = this.files[0]; console.log(File); //var Reader = new FileReader(); MainRow.Value = {"Blob":File, "FileName" : File.name} //Reader.addEventListener('load', function(event){ MainRow.Value = {"Blob":File, "FileName" : File.name}}); //Reader.readAsArrayBuffer(File); //console.log(File); this.SpanName.value = File.name } } Button.InputFile = InputFile; var SpanName = document.createElement("input"); SpanName.setAttribute("readonly", true) SpanName.type = "text"; SpanName.addEventListener("input", function(){ this.value = this.value; }) SpanName.addEventListener("keypress", function(){ this.value = this.value; }) SpanName.InputFile = InputFile; SpanName.onpaste = function(ev) { console.log("SpanName"); console.log(ev); console.log(this.InputFile.files); const items = (ev.clipboardData || ev.originalEvent.clipboardData).items; this.InputFile.files = ev.clipboardData.files ; this.InputFile.onchange(); /*for (let index in items) { const item = items[index]; if (item.kind === 'file') { this.InputFile.files = [item.getAsFile()] ; break; } }*/ }; InputFile.SpanName = SpanName; DivContainer.appendChild(SpanName); if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'File' READONLY"); break; } /*case "DateNextMaintenance":{ CategoryDictionary[CategoryKey].style.display =""; input=document.createElement("div"); var divContainer=document.createElement("div"); divContainer.className="divContainerNewDescr"; input.appendChild(divContainer); var dateNextMaintenance=document.createElement('span'); dateNextMaintenance.Variable = PropertyToDraw._PropertyName; divContainer.appendChild(dateNextMaintenance); var ButtonBackToLastMaintenance=document.createElement("div"); ButtonBackToLastMaintenance.className="divDeleteButton"; var spanButtonDecline=document.createElement("span"); spanButtonDecline.innerHTML="back to last backUp"; ButtonBackToLastMaintenance.appendChild(spanButtonDecline); ButtonBackToLastMaintenance.addEventListener("click",function(){ $Prime.Post("PrimeEAMGetbackUpNextMaintenance",OriginalObj["Id"],function(Answer){ if(Answer!=""){ if(dateNextMaintenance.inneerHTML!=Answer) dateNextMaintenance.innerHTML=Answer; } }); }); var ButtonPrenotation=document.createElement("div"); ButtonPrenotation.className="divDeleteButton"; var spanButtonPrenotation=document.createElement("span"); spanButtonPrenotation.innerHTML="Prenota"; dateNextMaintenance.style.width="10vmin"; ButtonPrenotation.appendChild(spanButtonPrenotation); ButtonPrenotation.addEventListener("click",function(){ if(spanButtonPrenotation.innerHTML=="Prenota"){ ButtonBackToLastMaintenance.style.display="none"; spanButtonPrenotation.innerHTML="annulla"; var span=dateNextMaintenance; var Value=dateNextMaintenance.innerHTML; dateNextMaintenance.remove(); dateNextMaintenance=document.createElement("input"); dateNextMaintenance.type="date"; dateNextMaintenance.value=Value; dateNextMaintenance.onchange=function(){ var OldDate=new Date(Value); var NewDate=new Date(dateNextMaintenance.value); if(NewDate.getDate()>OldDate.getDate()) dateNextMaintenance.value=Value; }; divContainer.insertBefore(dateNextMaintenance,divContainer.firstChild); }else if(spanButtonPrenotation.innerHTML=="annulla"){ ButtonBackToLastMaintenance.style.display="flex"; spanButtonPrenotation.innerHTML="Prenota"; var span=dateNextMaintenance; var Value=OriginalObj["NextMaintenance"]; dateNextMaintenance.remove(); dateNextMaintenance=dateNextMaintenance=document.createElement('span'); dateNextMaintenance.Variable = PropertyToDraw._PropertyName; dateNextMaintenance.innerHTML=Value; dateNextMaintenance.style.width="10vmin"; dateNextMaintenance.value=Value; divContainer.insertBefore(dateNextMaintenance,divContainer.firstChild); } }); divContainer.appendChild(ButtonPrenotation); divContainer.appendChild(ButtonBackToLastMaintenance); input.GetValue=function(){ if(dateNextMaintenance.tagName.toLowerCase()=="span") return dateNextMaintenance.innerHTML; else if(dateNextMaintenance.tagName.toLowerCase()=="input") return dateNextMaintenance.value; } break; } */ case "IPAddress":{ input = document.createElement('input'); input.placeholder = "xxx.xxx.xxx.xxx"; input.addEventListener("input", function(){ var Patt = /\b((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\b/; if (Patt.test(this.value)) { this.className = this.className.replace(" ErrorMark", ""); } else { if (this.className.indexOf("ErrorMark") == -1) this.className += " ErrorMark"; } }); input.GetValue = function () { if (this.className.indexOf(" ErrorMark") > -1) { this.focus(); return null; } else { return this.value; } } if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'IPAddress' READONLY"); break; } /*case "ComPort": { input = document.createElement('select'); input.ComSelected = OriginalObj[PropertyToDraw._PropertyName]; $Prime.Post("PrimeGetSerialPorts", null, function (Answer, Select) { var SerialPorts = JSON.parse(Answer)["SerialPorts"]; for (var Port in SerialPorts) { var OptionPort = document.createElement("option"); OptionPort.value = SerialPorts[Port]; OptionPort.innerHTML = SerialPorts[Port]; if(Select.ComSelected == SerialPorts[Port] || Select.ComSelected == SerialPorts[Port].replace("COM", "")) OptionPort.selected = true; Select.appendChild(OptionPort); } }, input) input.GetValue = function () { if(this.children[this.selectedIndex]) return this.children[this.selectedIndex].value; else return "COM256"; } break; } */ /*case "SettingIndex": { //solo per Prime Config / Device Modbus input = document.createElement('select'); input.id = "SettingIndexInput"; input.GetValue = function () { //console.log(this.children); if(this.children[this.selectedIndex] != null) return this.children[this.selectedIndex].value; else return ""; } break; } */ /*case "SettingIndexCarel": { //solo per Prime Config / Device Carel input = document.createElement('select'); input.id = "SettingIndexInput"; input.GetValue = function () { return parseInt(this.value);//.children[this.selectedIndex] } break; }*/ /*case "Plant": {//solo per Prime Config / Device Modbus input = document.createElement('select'); var PlantInput = input; input.ListPlants = []; $Prime.PostMessage("PrimeGetPlants", null, function (Answer, inputRepository) { inputRepository.ListPlants = Answer["Content"]; }, input); input.loadPlant = function (Callback) { this.CB = Callback; $Prime.PostMessage("PrimeGetPlants", null, function (Answer, inputRepository) { var ListPlant = Answer["Content"]; console.log(ListPlant); console.log(inputRepository.ValueSetted); for (var Plant in ListPlant) { for (var LanguageCodeIndex in ListPlant[Plant]["Descriptions"]) { if (ListPlant[Plant]["Descriptions"][LanguageCodeIndex]["Code"] == LanguageCode) { var Option = document.createElement("option"); Option.innerHTML = ListPlant[Plant]["Descriptions"][LanguageCodeIndex]["Description"]; Option.value = ListPlant[Plant]["ID"]; inputRepository.appendChild(Option); //console.log( //if (ListPlant[Plant]["Descriptions"][LanguageCodeIndex]["Description"] == inputRepository.ValueSetted) { // Option.selected = true; //} if (ListPlant[Plant]["ID"] == inputRepository.ValueSetted) { Option.selected = true; } break; } } } if(inputRepository.CB!=null) inputRepository.CB(); }, this); } input.GetValue = function () { return this.children[this.selectedIndex].value; } break; }*/ /*case "PlantGroup": { input = document.createElement('select'); input.id = "PlantGroupInput"; input.PlantInput = PlantInput; var MyPlantGroupInput = input; PlantInput.PlantGroupInput = input; PlantInput.onchange = function () { if (this.PlantGroupInput != null) { this.PlantGroupInput.LoadPlantGroups(this.PlantGroupInput) } } input.LoadPlantGroups = function () { for (var i = this.children.length - 1; i > -1; i--) this.children[i].remove(); $Prime.PostMessage("PrimeGetPlantGroups", null, function (Answer, inputRepository) { var ListPlantGroup = Answer["Content"]; for (var Plant in ListPlantGroup) { for (var PlantGroupID in ListPlantGroup[Plant]["PlantAssociate"]) { if (ListPlantGroup[Plant]["PlantAssociate"][PlantGroupID] == inputRepository.PlantInput.children[inputRepository.PlantInput.selectedIndex].value) { for (var LanguageCodeIndex in ListPlantGroup[Plant]["Descriptions"]) { if (ListPlantGroup[Plant]["Descriptions"][LanguageCodeIndex]["Code"] == LanguageCode) { var Option = document.createElement("option"); Option.innerHTML = ListPlantGroup[Plant]["Descriptions"][LanguageCodeIndex]["Description"]; Option.value = ListPlantGroup[Plant]["ID"]; inputRepository.appendChild(Option); //if (ListPlantGroup[Plant]["Descriptions"][LanguageCodeIndex]["Description"] == inputRepository.ValueSetted) { if (ListPlantGroup[Plant]["ID"] == inputRepository.ValueSetted) { Option.selected = true; } } } } } } }, this); } //input.LoadPlantGroups(input); input.GetValue = function () { return this.children[this.selectedIndex].value; } break; }*/ /*case "SlaveDevices": { input = document.createElement('div'); input.className = " resgui-18column justify-content-center column-direction"; var divRow = document.createElement("div"); divRow.className += " resgui-1row align-items-center row-direction"; var divContainer = document.createElement("div"); divContainer.className = "resgui-14column justify-content-center column-direction"; console.log(SelectDeviceDesc["SelectDevice"]); var selectDeviceList = document.createElement("select"); var optionDevice = document.createElement("option"); optionDevice.innerHTML = SelectDeviceDesc["SelectDevice"][LanguageCode]; selectDeviceList.appendChild(optionDevice); selectDeviceList.Initialize = function(DeviceLinked) { this.DeviceLinked = DeviceLinked; $Prime.PostMessage("PrimeGetDevicesList",null,function(Answer, selectList){ var DeviceList = Answer["Content"]; for(var DeviceIndex in DeviceList) { var optionDevice = document.createElement("option"); var continueFor = false; for(var LinkedDev in DeviceLinked) { if(DeviceLinked[LinkedDev]["DevicePTD"] == DeviceList[DeviceIndex]["IDPTD"]) { continueFor = true; SelectDevice(DeviceLinked[LinkedDev]["DevicePTD"], selectList.divContainer, DeviceLinked[LinkedDev], optionDevice); } } optionDevice.innerHTML = DeviceList[DeviceIndex]["Description"]; optionDevice.Device = DeviceList[DeviceIndex]; if(continueFor) optionDevice.style.display = "none"; selectList.appendChild(optionDevice); } }, selectDeviceList); } var imgAddDevice = document.createElement("img"); imgAddDevice.src = "../../../../../../../../../../images/icons/PlusIcon.png" imgAddDevice.className = "icon-image-button"; imgAddDevice.selectList = selectDeviceList; imgAddDevice.onclick = function() { if(this.selectList.children[this.selectList.selectedIndex]["Device"]) { var NewObjectToPush = new Object; NewObjectToPush["DevicePTD"] = this.selectList.children[this.selectList.selectedIndex]["Device"]["IDPTD"]; NewObjectToPush["HoldingRegister"] = []; NewObjectToPush["InputRegister"] = []; NewObjectToPush["SlaveAddress"] = 1; this.selectList.children[this.selectList.selectedIndex].style.display = "none"; SelectDevice(this.selectList.children[this.selectList.selectedIndex]["Device"]["IDPTD"], this.divContainer, NewObjectToPush, this.selectList.children[this.selectList.selectedIndex]); this.selectList.selectedIndex = 0; } } divRow.appendChild(selectDeviceList); divRow.appendChild(imgAddDevice); input.appendChild(divRow); input.appendChild(divContainer); var buttonDownloadCSV = document.createElement("div"); buttonDownloadCSV.className = "button-application" buttonDownloadCSV.style.marginLeft = "var(--resgui-quartercolumn)"; buttonDownloadCSV.innerHTML = DownloadDesc["DownloadCSV"][LanguageCode]; divRow.appendChild(buttonDownloadCSV); buttonDownloadCSV.ListObjects = divContainer.ListObjects; buttonDownloadCSV.onclick = function() { if(divContainer.ListObjects.length > 0) { var StringToWrite = "Modbus Slave Address;Modbus Register Address;Description;Variable Type;Read/Write;\n"; ForGetCSV(0, divContainer.ListObjects.length, divContainer.ListObjects, StringToWrite); } } input.selectList = selectDeviceList; divContainer.ListObjects = []; imgAddDevice.divContainer = divContainer; selectDeviceList.divContainer = divContainer; input.divContainer = divContainer; input.GetValue = function () { return this.divContainer.ListObjects; } break; }*/ case "ImageUserPool":{ CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("img"); if(!Options.IsAllReadOnly) { input.addEventListener("click",function(event){ var formData = new FormData(); var FileControl = document.createElement("input"); FileControl.type = "file"; FileControl.style.display ="none"; FileControl.onchange = function(e) { var FileError = 0; var AlertMessage = ""; if (FileControl.files.length < 1) { FileError = 1; } if (FileError == 0) { var FR = new FileReader(); FR.addEventListener("load", function(FRevent){ var newFilePath = ""; var newSRCPath = ""; if(event.target.DefaultValue == undefined) event.target.DefaultValue = event.target.Value; if(event.target.DefaultValue.indexOf($MW.User["UserPoolID"] + ".png") == -1) { newFilePath = "Site/images/logos/CustomerLogos/" + $MW.User["UserPoolID"] + ".png"; newSRCPath = "../../../../../../../../../../images/logos/CustomerLogos/" + $MW.User["UserPoolID"] + ".png"; } else { newFilePath = "Site/images/logos/CustomerLogos/" + $MW.User["UserPoolID"] + "_1.png"; newSRCPath = "../../../../../../../../../../images/logos/CustomerLogos/" + $MW.User["UserPoolID"] + "_1.png"; } var Params = {Bucket:$MW.Bucket, Key:newFilePath, Body:FileControl.files[0]}; $MW.S3.putObject(Params,function(err,data){ if(err) console.log("err") else { console.log("done"); event.target.Value = newSRCPath; event.target.setAttribute("src", newSRCPath + "?" + new Date().getTime()); event.target.style.width = null; } }); }); FR.readAsArrayBuffer(FileControl.files[0]); } else { alert(AlertMessage); } } document.body.appendChild(FileControl); FileControl.click(); }); input.className = "relative-full-width relative-full-height" } input.style.width = "var(--resgui-5column)" input.className=" imginput "; input.GetValue = function () { return (this.Value!=null) ? this.Value : ""; }; break; } /*case "MaskValue": { input = document.createElement("div"); input.className = "column-direction align-items-flex-start justify-content-flex-start"; input.style.minHeight = "var(--resgui-1row)"; var divValueContainer = document.createElement("div"); divValueContainer.className = "resgui-1row row-direction align-items-center justify-content-flex-start"; input.appendChild(divValueContainer); var inputValue = document.createElement("input"); inputValue.className = "resgui-7column align-items-flex-start justify-content-flex-start"; inputValue.placeholder = "Value"; inputValue.addEventListener("keydown", function(ev){ if(ev.keyCode == 13) { this.imgAddValue.click(); } }) divValueContainer.appendChild(inputValue); var imgAddValue = document.createElement("img"); imgAddValue.className = "icon-image-button"; imgAddValue.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; divValueContainer.appendChild(imgAddValue); inputValue.imgAddValue = imgAddValue; imgAddValue.addEventListener("click", function(){ for(var i = 0; i < this.divMaskList.children.length; i++) { if(this.divMaskList.children[i].children[1].children[1].innerHTML == this.parentNode.children[0].value) { this.parentNode.children[0].value = ""; return; } } this.divMaskList.AddMaskValue(this.parentNode.children[0].value); this.parentNode.children[0].value = ""; }); var divMaskList = document.createElement("div"); divMaskList.className = "resgui-18column column-direction align-items-flex-start justify-content-flex-start"; divMaskList.AddMaskValue = function(Value){ var divContainer = document.createElement("div"); divContainer.className = "relative-full-width align-items-center justify-content-flex-start decor-solid-border-bottom-wallpaper-color"; divContainer.style.minHeight = "var(--resgui-1row)"; this.appendChild(divContainer); var imgDeleteValue = document.createElement("img"); imgDeleteValue.className = "icon-image-button"; imgDeleteValue.src = "../../../../../../../../../../../../images/icons/DeleteIcon.png"; imgDeleteValue.style.marginLeft = "var(--resgui-1vw)"; imgDeleteValue.addEventListener("click", function(){this.parentNode.remove();}) divContainer.appendChild(imgDeleteValue); var divValueMask = document.createElement("div"); divValueMask.className = "resgui-3column align-items-center justify-content-flex-start"; divContainer.appendChild(divValueMask); var spanValueDescription = document.createElement("span"); spanValueDescription.className = "resgui-font-height-s"; spanValueDescription.innerHTML = "Value:"; divValueMask.appendChild(spanValueDescription); var spanValueMask = document.createElement("span"); spanValueMask.className = ""; spanValueMask.innerHTML = Value; divValueMask.appendChild(spanValueMask); var divContainerRight = document.createElement("div"); divContainerRight.className = "column-direction align-items-flex-start justify-content-center resgui-13column ";//decor-solid-border-left-wallpaper-color decor-solid-border-bottom-wallpaper-color divContainerRight.style.minHeight = "var(--resgui-1row)"; divContainer.appendChild(divContainerRight); var divSettingRightContainer = document.createElement("div"); divSettingRightContainer.className = "resgui-1row align-items-center"; divContainerRight.appendChild(divSettingRightContainer); var selectLanguage = document.createElement("select"); selectLanguage.className = "resgui-font-height-s"; selectLanguage.style.minWidth = "calc(var(--resgui-3column) + var(--resgui-1vw))"; selectLanguage.style.maxWidth = "calc(var(--resgui-3column) + var(--resgui-1vw))"; selectLanguage.style.width = "calc(var(--resgui-3column) + var(--resgui-1vw))"; divSettingRightContainer.appendChild(selectLanguage); for(var Lang in DictionaryLanguages) { if(DictionaryLanguages[Lang]["Code"] != null) { var optionLanguage = document.createElement("option"); optionLanguage.innerHTML = DictionaryLanguages[Lang]["Code"] + " - " + DictionaryLanguages[Lang]["Description"]; optionLanguage.Code = DictionaryLanguages[Lang]["Code"];// + "-" + DictionaryLanguages[Lang]["Description"]; optionLanguage.className = "resgui-font-height-s"; selectLanguage.appendChild(optionLanguage); } } var inputDescriptionMultilanguage = document.createElement("input"); inputDescriptionMultilanguage.className = "resgui-6-halfcolumn"; inputDescriptionMultilanguage.style.marginLeft = "0"; inputDescriptionMultilanguage.addEventListener("keydown", function(ev){ if(ev.keyCode == 13) { this.imgAddValue.click(); } }); divSettingRightContainer.appendChild(inputDescriptionMultilanguage); var imgAddValue = document.createElement("img"); imgAddValue.className = "icon-image-button"; imgAddValue.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; imgAddValue.divContainerRight = divContainerRight; inputDescriptionMultilanguage.imgAddValue = imgAddValue; divSettingRightContainer.appendChild(imgAddValue); imgAddValue.addEventListener("click", function(){ this.divContainerRight.AddMultilanguageDescription(this.parentNode.children[0].children[this.parentNode.children[0].selectedIndex].Code, this.parentNode.children[1].value); this.parentNode.children[1].value = ""; }); divContainerRight.AddMultilanguageDescription = function(LanguageCode, Value){ if(LanguageCode == null) return; var selectedoption = false; for(var i = 0; i < this.children[0].children[0].children.length; i++) { if(this.children[0].children[0].children[i].Code == LanguageCode) { this.LangOption = this.children[0].children[0].children[i]; this.children[0].children[0].children[i].style.display = "none"; this.children[0].children[0].children[i].selected = false; } if(this.children[0].children[0].children[i].style.display != "none" && !selectedoption) { this.children[0].children[0].children[i].selected = true; selectedoption = true; } } if(selectedoption == false) { var OptionNull = document.createElement("option"); OptionNull.innerHTML = "---"; OptionNull.selected = true; this.children[0].children[0].appendChild(OptionNull); } var divMLDescription = document.createElement("div"); divMLDescription.className = "resgui-1row align-items-center"; this.appendChild(divMLDescription); var spanValueDescription = document.createElement("span"); spanValueDescription.className = "resgui-3column resgui-font-height-s"; spanValueDescription.style.marginLeft = "calc(var(--resgui-1vw) + var(--resgui-05vw))"; spanValueDescription.style.marginRight = "calc(var(--resgui-1vw) + var(--resgui-05vw))"; spanValueDescription.innerHTML = "Mask (" + LanguageCode + ")"; spanValueDescription.MessageCode = LanguageCode; divMLDescription.appendChild(spanValueDescription); var inputValue = document.createElement("input"); inputValue.className = "resgui-6-halfcolumn"; inputValue.style.marginLeft = "0"; inputValue.value = Value; divMLDescription.appendChild(inputValue); var imgDelete = document.createElement("img"); imgDelete.className = "icon-image-button"; imgDelete.LangOption = this.LangOption; imgDelete.src = "../../../../../../../../../../../../images/icons/DeleteIcon.png"; imgDelete.addEventListener("click", function(){ this.LangOption.style.display = "flex"; this.parentNode.remove(); }); divMLDescription.appendChild(imgDelete); }; }; input.appendChild(divMaskList); imgAddValue.divMaskList = divMaskList; input.GetValue = function () { var Result = {}; for(var i = 0; i < this.children[1].children.length; i++) { Result[this.children[1].children[i].children[1].children[1].innerHTML] = {}; for(var j = 1; j < this.children[1].children[i].children[2].children.length; j++) Result[this.children[1].children[i].children[1].children[1].innerHTML][this.children[1].children[i].children[2].children[j].children[0].MessageCode] = this.children[1].children[i].children[2].children[j].children[1].value; } return Result; }; break; }*/ case "PhoneNumber": { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("input"); input.placeholder = "Ex. +390000000000" input.type = "phone"; input.CheckValue = function () { var Patt = /^\+(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\d{1,14}$/ if (Patt.test(this.value)) { if (this.className.indexOf(" ErrorMark", "") > -1) this.className = this.className.replace(" ErrorMark", ""); } else { if(this.value != null) { if (this.className.indexOf(" ErrorMark", "") == -1) { this.className += " ErrorMark"; } } else { if (this.className.indexOf(" ErrorMark", "") > -1) this.className = this.className.replace(" ErrorMark", ""); } } } input.addEventListener("input", function () { this.CheckValue(); }) input.addEventListener("keypress",function(ev) { //console.log(ev); if(ev.key==" ") ev.preventDefault(); //else{ // console.log("aaaaaaaa"); //} }); input.GetValue = function () { if (this.className.indexOf(" ErrorMark", "") > -1) { this.focus(); return null; } else { return this.value; } }; if(Options.IsAllReadOnly) { input.disabled = true; } break; } case "CognitoUsername": { input = document.createElement("div"); CategoryDictionary[CategoryKey].style.display =""; var inputText = document.createElement("input"); inputText.type ="text"; inputText.addEventListener("keypress",function(ev) { if(ev.key==" ") { ev.preventDefault(); ev.target.value += "_"; } }); input.appendChild(inputText); input.GetValue = function () { return this.children[0].value; }; if(Options.IsAllReadOnly) { input.children[0].disabled = true; } break; } case "ResourceGroupLinkedToMyUserPool": { input = document.createElement("div"); if(Options.IsResourceGroupInstance) { Result.ResourceGroupLinkedToMyUserPool = input; if(Result.ResourceTypeSelect.children.length > 0) switch(Result.ResourceTypeSelect.children[Result.ResourceTypeSelect.selectedIndex].value) { case("Prime Gate"): { if($MW.User.UserPool.IAmMainCustomer == true && $MW.User.UserPool.PrimeGate_ClientKey != "") divRowWrapper.style.display = "none";//divRow.style.display = "none"; else divRowWrapper.style.display = "flex";//divRow.style.display = "flex"; break; } case("Anywhere"): { if($MW.User.UserPool.IAmMainCustomer == true && $MW.User.UserPool.Anywhere_ClientKey != "") divRowWrapper.style.display = "none";//divRow.style.display = "none"; else divRowWrapper.style.display = "flex";//divRow.style.display = "flex"; break; } } } input.ValueToSave = {"ID" : ""}; input.GetValue = function() { return this.ValueToSave; } if($MW.User.UserPool.Parent.ID) { if($MW.User.UserPool.Parent.ID != "") { var ButtonDiv = document.createElement("div"); ButtonDiv.className = "button-application"; ButtonDiv.style.marginLeft = "var(--resgui-1vw)"; ButtonDiv.Input = input; if(Result) if(Result.EditButton) if(Result.EditButton.InputDictionary) if(Result.EditButton.InputDictionary.ResourceType) ButtonDiv.ResurceTypeProperty = Result.EditButton.InputDictionary.ResourceType; //Result.EditButton.InputDictionary.ResourceType ButtonDiv.addEventListener("click",function(Ev) { var ButtonEv = this; var CustomBox = new TMWGUICustomBox(19, 30); var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("ResourcesBoxLinked"); 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.onclick = function (ev) { CustomBox.Close(); }; CustomBox.Title.className += " justify-content-space-between"; CustomBox.Title.appendChild(spanTitle); CustomBox.Title.appendChild(spanClose); var Database = "MosaicoWorld"; var Assembly = "BaseElement"; var ClassReference = "BaseElement.Kernel.TResourceGroup"; var Options = {}; Options.DisableCache = true; Options.DisableDelete = true; Options.DisableAddButton = true; Options.IsChild = true; Options.CheckOnlyOneCheckBox = true; Options.InstancesReadOnly = true; Options.Buttons = [{"Description":null, "SourceIcon":"../../../../../../../../images/icons/linkIcon.png", "Tag":"AddParent"}]; if($MW.User.UserPool.ResourceGroupToRule.length > 0) { Options.Query = { "Type" : "Or", "Children" : [] }; for(var Index in $MW.User.UserPool.ResourceGroupToRule) { Options.Query.Children.push({"Type":"Eq", "Field":"ID", "Value":$MW.User.UserPool.ResourceGroupToRule[Index].ResourceID.ID}) } } else { Options.Query = { "Type" : "Eq", "Field" : "ID", "Value" : "" }; } if(ButtonEv.ResurceTypeProperty && ButtonEv.ResurceTypeProperty != undefined) { if(Options.Query.Type == "Or") { var OldQuery = { ...Options.Query }; Options.Query = { "Type":"And", "Children":[] }; Options.Query.Children.push(OldQuery); Options.Query.Children.push( { "Type" : "Eq", "Field" : "ResourceType", "Value" : ButtonEv.ResurceTypeProperty.GetValue() }); } else { Options.Query = { "Type" : "Eq", "Field" : "ResourceType", "Value" : ButtonEv.ResurceTypeProperty.GetValue() }; } } var IframeAssociatedResourceGroup = document.createElement("iframe"); IframeAssociatedResourceGroup.className = "resgui-18row resgui-30column"; IframeAssociatedResourceGroup.src = "../../../../../../../../../../../../../../../../../../../../../commons/ResourcesGroup/ResourcesGroupList.html?" + $MW.Base64Encode(JSON.stringify(Options)); IframeAssociatedResourceGroup.addEventListener("load", function(Ev) { var IFRAMEEvent = Ev; var IFtarget = Ev.target; IFRAMEEvent.target.contentWindow.ActionCallback = function(Event, Elements, ButtonTag) { switch(ButtonTag) { case("AddParent"): { ButtonDiv.Input.ValueToSave.ID = Elements[0].Object.ID; if(ButtonDiv.parentNode.children.length == 2) { ButtonDiv.parentNode.children[0].innerHTML = Elements[0].Object.Name; } else { var spanDescription = document.createElement("span"); spanDescription.innerHTML = Elements[0].Object.Name; spanDescription.className = "TextReadOnly"; ButtonDiv.parentNode.insertBefore(spanDescription, ButtonDiv); } CustomBox.Close(); break; } } } }); CustomBox.Body.appendChild(IframeAssociatedResourceGroup); CustomBox.Open(); }); var ButtonSpan = document.createElement("span"); ButtonSpan.innerHTML = $MWGUI.GetLanguageString("TMWGUIFromSelectParentButtonText"); ButtonDiv.appendChild(ButtonSpan); input.appendChild(ButtonDiv); } else { divRow.style.display = "none"; } } else { divRow.style.display = "none"; } if(Options.IsAllReadOnly) { //todo bottone readonly nel caso servisse //console.log("ATTENZIONE: DA GESTIRE 'ResourceGroupLinkedToMyUserPool' READONLY"); } break; } case ("ResourceType"): { if(Options.IsResourceGroupInstance && (Options.ResourceGroupResourceType!= null && Options.ResourceGroupResourceType!= undefined && Options.ResourceGroupResourceType!= "")) { //ResourceGroupResourceType input = document.createElement("div"); input.style.display = "none"; divColValue.parentNode.parentNode.style.display = "none"; console.log(Options.ResourceGroupResourceType); input.ReturnValue = Options.ResourceGroupResourceType; input.GetValue = function () { return this.ReturnValue; } } else { input = document.createElement("div"); selectOptions = document.createElement("select"); CategoryDictionary[CategoryKey].style.display =""; if (PropertyToDraw.ValuesString != "") { var ValsOpz = PropertyToDraw.ValuesString; for (var ValOpz in ValsOpz) { var Opz = document.createElement("option"); Opz.innerHTML = ValsOpz[ValOpz]; Opz.value = ValsOpz[ValOpz]; selectOptions.appendChild(Opz); } } if (PropertyToDraw.JSONStructure != "") { var ValsOpz = JSON.parse(PropertyToDraw.JSONStructure); for (var ValOpz in ValsOpz) { for(var field in ValsOpz[ValOpz]) { var Opz = document.createElement("option"); Opz.innerHTML = field; Opz.value = ValsOpz[ValOpz][field]; selectOptions.appendChild(Opz); } } } selectOptions.addEventListener("change", function(){ if(Options.IsResourceGroupInstance) { switch(this.children[this.selectedIndex].value) { /*case("Prime Gate"): { if($MW.User.UserPool.IAmMainCustomer == true && $MW.User.UserPool.PrimeGate_ClientKey != "") Result.ResourceGroupLinkedToMyUserPool.parentNode.parentNode.style.display = "none"; else Result.ResourceGroupLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; } case("Anywhere"): { if($MW.User.UserPool.IAmMainCustomer == true && $MW.User.UserPool.Anywhere_ClientKey != "") Result.ResourceGroupLinkedToMyUserPool.parentNode.parentNode.style.display = "none"; else Result.ResourceGroupLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; }*/ case("User"): { Result.ResourceGroupLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; } case("User pool"): { Result.ResourceGroupLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; } case("Resource group"): { Result.ResourceGroupLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; } case("Rule"): { Result.ResourceGroupLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; } } } if(Options.IsRuleInstance) { switch(this.children[this.selectedIndex].value) { /*case("Prime Gate"): { if($MW.User.UserPool.IAmMainCustomer == true && $MW.User.UserPool.PrimeGate_ClientKey != "") Result.RuleLinkedToMyUserPool.parentNode.parentNode.style.display = "none"; else Result.RuleLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; } case("Anywhere"): { if($MW.User.UserPool.IAmMainCustomer == true && $MW.User.UserPool.Anywhere_ClientKey != "") Result.RuleLinkedToMyUserPool.parentNode.parentNode.style.display = "none"; else Result.RuleLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; }*/ case("User"): { Result.RuleLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; } case("User pool"): { Result.RuleLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; } case("Resource group"): { Result.RuleLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; } case("Rule"): { Result.RuleLinkedToMyUserPool.parentNode.parentNode.style.display = "flex"; break; } } } }); selectOptions.GetValue = function() { if(this.options.length > 0) return this.options[this.selectedIndex].value; else return null } input.appendChild(selectOptions); input.GetValue = function () { let res = this.children[0].GetValue(); if(res != null) { if(this.children[0].className.indexOf(" ErrorMark") > -1) this.children[0].className = this.children[0].className.replace(/ ErrorMark/gi, ""); return res; } else { this.children[0].className = this.children[0].className + " ErrorMark"; this.children[0].focus(); } } if(Options.IsResourceGroupInstance || Options.IsRuleInstance) { Result.ResourceTypeSelect = selectOptions; } if(Options.IsAllReadOnly) { selectOptions.disabled = true; } } break; } case("GenericDictionary"): { input = document.createElement("div"); input.className += " column-direction" var divFirstRowContainer = document.createElement("div"); divFirstRowContainer.className = "resgui-14column resgui-1row row-direction align-items-center justify-content-flex-start"; input.appendChild(divFirstRowContainer); var inputKey = document.createElement("input"); inputKey.style.width = "var(--resgui-5column)"; inputKey.style.minWidth = "var(--resgui-5column)"; inputKey.style.maxWidth = "var(--resgui-5column)"; inputKey.type = "text"; inputKey.addEventListener("input", function(){ if(this.className.indexOf(" ErrorMark") > -1) this.className = this.className.replace(" ErrorMark", ""); }); divFirstRowContainer.appendChild(inputKey); var inputValue = document.createElement("input"); inputValue.style.width = "var(--resgui-5column)"; inputValue.style.minWidth = "var(--resgui-5column)"; inputValue.style.maxWidth = "var(--resgui-5column)"; inputValue.type = "text"; divFirstRowContainer.appendChild(inputValue); var imgAddKeyPair = document.createElement("img"); imgAddKeyPair.className = "icon-image-button"; imgAddKeyPair.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/addIcon.png"; imgAddKeyPair.inputKey = inputKey; imgAddKeyPair.inputValue = inputValue; divFirstRowContainer.appendChild(imgAddKeyPair); imgAddKeyPair.addEventListener("click", function(){ if(this.inputKey.value == "") { this.inputKey.className = this.inputKey.className.indexOf(" ErrorMark") > -1 ? "" : " ErrorMark"; return; } this.divKeyValuePairContainer.AddElementToDictionary(this.inputKey.value, this.inputValue.value); this.inputKey.value = ""; this.inputValue.value = ""; }); var divKeyValuePairContainer = document.createElement("div"); imgAddKeyPair.divKeyValuePairContainer = divKeyValuePairContainer; input.divKeyValuePairContainer = divKeyValuePairContainer; divKeyValuePairContainer.className = "resgui-14column column-direction align-items-center justify-content-flex-start"; divKeyValuePairContainer.AddElementToDictionary = function(KeyValue, ObjectValue) { for(var i = 0; i < this.children.length; i++) { if(this.children[i].children[0].value == KeyValue) { this.children[i].children[1].value = ObjectValue; return; } } var RowKeyValuePair = document.createElement("div") RowKeyValuePair.className = "resgui-14column resgui-1row row-direction align-items-center justify-content-flex-start decor-solid-border-top-wallpaper-color"; this.appendChild(RowKeyValuePair); var inputKey = document.createElement("input"); inputKey.style.width = "var(--resgui-5column)"; inputKey.style.maxWidth = "var(--resgui-5column)"; inputKey.style.minWidth = "var(--resgui-5column)"; inputKey.value = KeyValue; RowKeyValuePair.appendChild(inputKey); var inputValue = document.createElement("input"); inputValue.style.width = "var(--resgui-5column)"; inputValue.style.maxWidth = "var(--resgui-5column)"; inputValue.style.minWidth = "var(--resgui-5column)"; inputValue.value = ObjectValue; RowKeyValuePair.appendChild(inputValue); var imgDeleteRow = document.createElement("img"); imgDeleteRow.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/deleteIcon.png"; imgDeleteRow.className = "icon-image-button"; RowKeyValuePair.appendChild(imgDeleteRow); imgDeleteRow.addEventListener("click", function(){ this.parentNode.remove(); }); }; input.appendChild(divKeyValuePairContainer); input.GetValue = function() { var returnObj = {}; if(this.divKeyValuePairContainer.children.length > 0) for(var i = 0; i < this.divKeyValuePairContainer.children.length; i++) returnObj[this.divKeyValuePairContainer.children[i].children[0].value] = this.divKeyValuePairContainer.children[i].children[1].value; return returnObj; } if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'GenericDictionary' READONLY"); break; } case ("EnumeratorSelectOnlyOnCreation"): { input = document.createElement("div"); selectOptions = document.createElement("select"); CategoryDictionary[CategoryKey].style.display =""; if (PropertyToDraw.ValuesString != "") { var ValsOpz = PropertyToDraw.ValuesString; for (var ValOpz in ValsOpz) { var Opz = document.createElement("option"); Opz.innerHTML = ValsOpz[ValOpz]; Opz.value = ValsOpz[ValOpz]; selectOptions.appendChild(Opz); } } if (PropertyToDraw.JSONStructure != "") { var ValsOpz = JSON.parse(PropertyToDraw.JSONStructure); for (var ValOpz in ValsOpz) { for(var field in ValsOpz[ValOpz]) { var Opz = document.createElement("option"); Opz.innerHTML = field; Opz.value = ValsOpz[ValOpz][field]; selectOptions.appendChild(Opz); } } } selectOptions.GetValue = function() { return this.options[this.selectedIndex].value; } input.appendChild(selectOptions); input.GetValue = function () { return this.children[0].GetValue(); } if(Options.IsAllReadOnly) { selectOptions.disabled = true; } break; } case ("RulesLinkedToMyUserPool"): { input = document.createElement("div"); if(Options.IsRuleInstance) { Result.RuleLinkedToMyUserPool = input; /*if(Result.ResourceTypeSelect.children.length > 0) { switch(Result.ResourceTypeSelect.children[Result.ResourceTypeSelect.selectedIndex].value) { case("Prime Gate"): { if($MW.User.UserPool.IAmMainCustomer == true && $MW.User.UserPool.PrimeGate_ClientKey != "") divRowWrapper.style.display = "flex"; else divRowWrapper.style.display = "none"; break; } case("Anywhere"): { if($MW.User.UserPool.IAmMainCustomer == true && $MW.User.UserPool.Anywhere_ClientKey != "") divRowWrapper.style.display = "flex"; else divRowWrapper.style.display = "none"; break; } } }*/ } input.ValueToSave = {"ID" : ""}; input.GetValue = function() { if($MW.User.UserPool.Parent.ID != "") if(this.ValueToSave.ID == "") return null; return this.ValueToSave; } /*if($MW.User.UserPool.Parent.ID) { if($MW.User.UserPool.Parent.ID != "") {*/ var ButtonDiv = document.createElement("div"); ButtonDiv.className = "button-application"; ButtonDiv.style.marginLeft = "var(--resgui-1vw)"; ButtonDiv.Input = input; if(Result) if(Result.EditButton) if(Result.EditButton.InputDictionary) if(Result.EditButton.InputDictionary.ResourceType) ButtonDiv.ResurceTypeProperty = Result.EditButton.InputDictionary.ResourceType; ButtonDiv.addEventListener("click",function(Ev) { var ButtonEv = this; var CustomBox = new TMWGUICustomBox(19, 30); var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("ResourcesBoxLinked"); 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.onclick = function (ev) { CustomBox.Close(); }; CustomBox.Title.className += " justify-content-space-between"; CustomBox.Title.appendChild(spanTitle); CustomBox.Title.appendChild(spanClose); var Options = {}; Options.DisableCache = true; Options.DisableDelete = true; Options.DisableAddButton = true; Options.IsChild = true; Options.CheckOnlyOneCheckBox = true; Options.InstancesReadOnly = true; Options.Buttons = [{"Description":null, "SourceIcon":"../../../../../../../../images/icons/linkIcon.png", "Tag":"AddParent"}]; if($MW.User.UserPool.ResourceGroupToRule.length > 0) { Options.Query = { "Type" : "Or", "Children" : [] }; for(var Index in $MW.User.UserPool.ResourceGroupToRule) { console.log($MW.User.UserPool.ResourceGroupToRule); Options.Query.Children.push({"Type":"Eq", "Field":"ID", "Value":$MW.User.UserPool.ResourceGroupToRule[Index].RuleID.ID}) } } else { Options.Query = { "Type" : "Eq", "Field" : "ID", "Value" : "" }; } if(ButtonEv.ResurceTypeProperty && ButtonEv.ResurceTypeProperty != undefined) { if(Options.Query.Type == "Or") { var OldQuery = { ...Options.Query }; Options.Query = { "Type":"And", "Children":[] }; Options.Query.Children.push(OldQuery); Options.Query.Children.push( { "Type" : "Eq", "Field" : "ResourceType", "Value" : ButtonEv.ResurceTypeProperty.GetValue() }); } else { Options.Query = { "Type" : "Eq", "Field" : "ResourceType", "Value" : ButtonEv.ResurceTypeProperty.GetValue() }; } } var IframeAssociatedResourceGroup = document.createElement("iframe"); IframeAssociatedResourceGroup.className = "resgui-18row resgui-30column"; IframeAssociatedResourceGroup.src = "../../../../../../../../../../../../../../../../../../../../../commons/Rule/RuleList.html?" + $MW.Base64Encode(JSON.stringify(Options)); IframeAssociatedResourceGroup.addEventListener("load", function(Ev) { var IFRAMEEvent = Ev; var IFtarget = Ev.target; IFRAMEEvent.target.contentWindow.ActionCallback = function(Event, Elements, ButtonTag) { switch(ButtonTag) { case("AddParent"): { ButtonDiv.Input.ValueToSave.ID = Elements[0].Object.ID; if(ButtonDiv.parentNode.children.length == 2) { ButtonDiv.parentNode.children[0].innerHTML = Elements[0].Object.Name; } else { var spanDescription = document.createElement("span"); spanDescription.innerHTML = Elements[0].Object.Name; spanDescription.className = "TextReadOnly"; ButtonDiv.parentNode.insertBefore(spanDescription, ButtonDiv); } CustomBox.Close(); break; } } } }); CustomBox.Body.appendChild(IframeAssociatedResourceGroup); CustomBox.Open(); }); var ButtonSpan = document.createElement("span"); ButtonSpan.innerHTML = $MWGUI.GetLanguageString("Associate"); ButtonDiv.appendChild(ButtonSpan); input.appendChild(ButtonDiv); /*} else { divRowWrapper.style.display = "none"; } } else { divRowWrapper.style.display = "none"; }*/ if(Options.IsAllReadOnly) console.log("ATTENZIONE: DA GESTIRE 'RulesLinkedToMyUserPool' READONLY"); break; } case("PhoneNumberList"): { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("div"); input.className = "column-direction"; var divContent = document.createElement("div"); divContent.className = "column-direction"; input.appendChild(divContent); var divEdit = document.createElement("div"); divEdit.className = "divNumberListAdd "; input.appendChild(divEdit); var inputValue = document.createElement("input"); inputValue.type = "Text"; inputValue.CheckValue = function () { var Result = false; var Patt = /^\+(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\d{1,14}$/ if (Patt.test(this.value)) { if (this.className.indexOf(" ErrorMark", "") > -1) { this.className = this.className.replace(" ErrorMark", ""); } Result = true; } else { if(this.value != null) { if (this.className.indexOf(" ErrorMark", "") == -1) { this.className += " ErrorMark"; } } else { if (this.className.indexOf(" ErrorMark", "") > -1) { this.className = this.className.replace(" ErrorMark", ""); } Result = true; } } return Result; } inputValue.addEventListener("input", function () { this.CheckValue(); }); inputValue.addEventListener("keypress",function(ev) { if(ev.key==" ") ev.preventDefault(); }); divEdit.appendChild(inputValue); var addButton = document.createElement("div"); divEdit.appendChild(addButton); var img = document.createElement("img"); img.divContent = divContent; img.inputValue = inputValue; img.className = "icon-image-button"; img.addEventListener("click", function () { if (this.inputValue.CheckValue()) { CreatePhoneNumberListValue(this.divContent, this.inputValue.value); this.inputValue.value = ""; } }); img.src = "../../../../../../../../../images/icons/addIcon.png"; addButton.appendChild(img); input.GetValue = function () { var Result = []; for (var i = 0; i < this.childNodes[0].childNodes.length; i++) { Result.push(this.childNodes[0].childNodes[i].childNodes[0].value); } console.log(Result) return Result; } if(Options.IsAllReadOnly) { console.log("ATTENZIONE: DA GESTIRE 'NumberList' READONLY"); } break; } case ("ImageIconUser"): { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("img"); if(!Options.IsAllReadOnly) { input.addEventListener("click",function(event){ var formData = new FormData(); var FileControl = document.createElement("input"); FileControl.type = "file"; FileControl.style.display ="none"; FileControl.onchange = function(e) { var FileError = 0; var AlertMessage = ""; if (FileControl.files.length < 1) { FileError = 1; } if (FileError == 0) { var FR = new FileReader(); FR.addEventListener("load", function(FRevent){ var newFilePath = ""; var newSRCPath = ""; if(event.target.DefaultValue == undefined) event.target.DefaultValue = event.target.Value; console.log($MW.User); if(event.target.DefaultValue.indexOf($MW.User["sub"] + ".png") == -1) { newFilePath = "Site/images/avatar/CustomerAvatar/" + $MW.User["sub"] + ".png"; newSRCPath = "../../../../../../../../../../images/avatar/CustomerAvatar/" + $MW.User["sub"] + ".png"; } else { newFilePath = "Site/images/avatar/CustomerAvatar/" + $MW.User["sub"] + "_1.png"; newSRCPath = "../../../../../../../../../../images/avatar/CustomerAvatar/" + $MW.User["sub"] + "_1.png"; } var Params = {Bucket:$MW.Bucket, Key:newFilePath, Body:FileControl.files[0]}; $MW.S3.putObject(Params,function(err,data){ if(err) console.log("err") else { console.log("done"); event.target.Value = newSRCPath; event.target.setAttribute("src", newSRCPath + "?" + new Date().getTime()); } }); }); FR.readAsArrayBuffer(FileControl.files[0]); } else { alert(AlertMessage); } } document.body.appendChild(FileControl); FileControl.click(); }); } input.style.width = "var(--resgui-5column)" input.className=" imginput "; input.GetValue = function () { return (this.Value!=null) ? this.Value : ""; }; break; } case ("ListArgoKeys"): { CategoryDictionary[CategoryKey].style.display =""; input = document.createElement("div"); input.className = "column-direction"; input.GetValue = function() { var Result = []; for(var Index in this.children) { if(this.children[Index].nodeName == "DIV") { var Object = this.children[Index].GetObject(); if(Object.PrimaryKey != "") Result.push(Object); } } console.log(Result); return Result; } CreateRowArgoKeys(input); break; } case ("RulesArgoEvent"): { input = document.createElement("div"); input.className = "column-direction resgui-9column resgui-2row align-items-center"; input.style.marginLeft = "var(--resgui-quartercolumn)"; input.Value = {}; var Header = document.createElement("div"); Header.className = "row-direction resgui-9column resgui-1row"; //Header.style.backgroundColor = "var(--table-header-column-background)"; input.appendChild(Header); var DelayHeader = document.createElement("div"); DelayHeader.className = "resgui-3column resgui-1row align-items-center justify-content-center"; Header.appendChild(DelayHeader); var SpanDelay = document.createElement("div"); SpanDelay.innerHTML = "Delay"; DelayHeader.appendChild(SpanDelay); var HeaderPriorityStart = document.createElement("div"); HeaderPriorityStart.className = "resgui-3column resgui-1row align-items-center justify-content-center decor-solid-border-left-wallpaper-color decor-solid-border-right-wallpaper-color"; Header.appendChild(HeaderPriorityStart); var SpanPriority = document.createElement("div"); SpanPriority.innerHTML = "Priority"; HeaderPriorityStart.appendChild(SpanPriority); var HeaderEscalation = document.createElement("div"); HeaderEscalation.className = "resgui-3column resgui-1row align-items-center justify-content-center"; Header.appendChild(HeaderEscalation); var SpanEscalation = document.createElement("div"); SpanEscalation.innerHTML = "Escalation"; HeaderEscalation.appendChild(SpanEscalation); var Body = document.createElement("div"); Body.className = "row-direction resgui-9column resgui-1row"; input.appendChild(Body); input.Body = Body; var DelayBody = document.createElement("div"); DelayBody.className = "resgui-3column resgui-1row align-items-center justify-content-center"; Body.DelayBody = DelayBody; Body.appendChild(DelayBody); var BodyPriorityStart = document.createElement("div"); BodyPriorityStart.className = "resgui-3column resgui-1row align-items-center justify-content-center decor-solid-border-left-wallpaper-color decor-solid-border-right-wallpaper-color"; Body.BodyPriorityStart = BodyPriorityStart; Body.appendChild(BodyPriorityStart); var BodyEscalation = document.createElement("div"); BodyEscalation.className = "resgui-3column resgui-1row align-items-center justify-content-center"; Body.BodyEscalation = BodyEscalation; Body.appendChild(BodyEscalation); input.GetValue = function() { return this.Value; } break; } case ("SteKeys") : { input = document.createElement("div"); input.className = "column-direction"; input.GetValue = function() { var Result = []; for(var Index in this.children) { if(this.children[Index].nodeName == "DIV") { var Object = this.children[Index].GetObject(); if(Object.InstanceID) Result.push(Object); } } //console.log(Result) ; return Result; } CreateSTEKeys(input); break; } case ("ArgoDateTimeNoSpaces"): { CategoryDictionary[CategoryKey].style.display =""; var input = document.createElement("span"); input.className ="TextReadOnly"; input.innerHTML = ""; input.Variable = PropertyToDraw._PropertyName; break; } case ("ArgoDateTime"): { CategoryDictionary[CategoryKey].style.display =""; var input = document.createElement("span"); input.className ="TextReadOnly"; input.innerHTML = ""; input.Variable = PropertyToDraw._PropertyName; break; } case ("ArgoAssetType"): { CategoryDictionary[CategoryKey].style.display =""; var input = document.createElement("span"); input.className ="TextReadOnly"; input.innerHTML = ""; input.Variable = PropertyToDraw._PropertyName; break; } case ("ArgoAggregationTScope"): { input = document.createElement("div"); input.className = "row-direction"; var SpanTypeString = document.createElement("span"); SpanTypeString.className = "TextReadOnly"; input.appendChild(SpanTypeString); input.SpanTypeString = SpanTypeString; //TODO fare bottone break; } case ("ArgoAggregationTSite"): { input = document.createElement("div"); input.className = "row-direction resgui-2row relative-full-width justify-content-flex-start align-items-center"; var DivContainerProps = document.createElement("div"); DivContainerProps.className = "column-direction resgui-12column relative-full-height"; input.appendChild(DivContainerProps) var ContainerId = document.createElement("div"); ContainerId.className = "resgui-1row resgui-10column"; DivContainerProps.appendChild(ContainerId); var DivContainerPropertyNameId = document.createElement("div"); DivContainerPropertyNameId.className = "resgui-2column resgui-1row justify-content-flex-end align-items-center"; ContainerId.appendChild(DivContainerPropertyNameId); var SpanPropertyNameId = document.createElement("span"); SpanPropertyNameId.className = " resgui-font-height-s"; SpanPropertyNameId.innerHTML = $MWGUI.GetLanguageString("Id") + " :"; DivContainerPropertyNameId.appendChild(SpanPropertyNameId); var DivContainerPropertyValueId = document.createElement("div"); DivContainerPropertyValueId.className = "resgui-8column resgui-1row justify-content-flex-start align-items-center"; ContainerId.appendChild(DivContainerPropertyValueId); var SpanPropertyValueId = document.createElement("span"); SpanPropertyValueId.className = "TextReadOnly"; SpanPropertyValueId.innerHTML = ""; input.SpanPropertyValueId = SpanPropertyValueId; DivContainerPropertyValueId.appendChild(SpanPropertyValueId); var ContainerName = document.createElement("div"); ContainerName.className = "resgui-1row resgui-10column"; DivContainerProps.appendChild(ContainerName); var DivContainerPropertyNameName = document.createElement("div"); DivContainerPropertyNameName.className = "resgui-2column resgui-1row justify-content-flex-end align-items-center"; ContainerName.appendChild(DivContainerPropertyNameName); var SpanPropertyNameName = document.createElement("span"); SpanPropertyNameName.className = " resgui-font-height-s"; SpanPropertyNameName.innerHTML = $MWGUI.GetLanguageString("Name") + " :"; DivContainerPropertyNameName.appendChild(SpanPropertyNameName); var DivContainerPropertyValueName = document.createElement("div"); DivContainerPropertyValueName.className = "resgui-8column resgui-1row justify-content-flex-start align-items-center"; ContainerName.appendChild(DivContainerPropertyValueName); var SpanPropertyValueName = document.createElement("span"); SpanPropertyValueName.className = "TextReadOnly"; SpanPropertyValueName.innerHTML = ""; input.SpanPropertyValueName = SpanPropertyValueName; DivContainerPropertyValueName.appendChild(SpanPropertyValueName); break; } case ("ArgoAggregationTSource"): { input = document.createElement("div"); input.className = "row-direction resgui-2row relative-full-width justify-content-flex-start align-items-center"; input.EnableNavigateTo = function(LinkUrls) { var ButtonLinking = document.createElement("div"); ButtonLinking.className = "button-application"; ButtonLinking.LinkUrls = LinkUrls; ButtonLinking.addEventListener("click", function(){ $MWArgo.Navigation.OpenPopupNavigation(this.LinkUrls); }); var imgNavigateTo = document.createElement("img"); imgNavigateTo.src = "../../../../../../../../../../../../../../../../../../../../../../../../images/icons/totalIntegrationIcon.png"; imgNavigateTo.className = " icon-image-button "; ButtonLinking.appendChild(imgNavigateTo); var Span = document.createElement("span"); Span.innerHTML = $MWGUI.GetLanguageString("Connect"); ButtonLinking.appendChild(Span); this.appendChild(ButtonLinking); } var DivContainerProps = document.createElement("div"); DivContainerProps.className = "column-direction resgui-10column relative-full-height"; input.appendChild(DivContainerProps) var ContainerType = document.createElement("div"); ContainerType.className = "resgui-1row resgui-10column"; DivContainerProps.appendChild(ContainerType); var DivContainerPropertyNameType = document.createElement("div"); DivContainerPropertyNameType.className = "resgui-2column resgui-1row justify-content-flex-end align-items-center"; ContainerType.appendChild(DivContainerPropertyNameType); var SpanPropertyNameType = document.createElement("span"); SpanPropertyNameType.className = " resgui-font-height-s"; SpanPropertyNameType.innerHTML = $MWGUI.GetLanguageString("Type") + " :"; DivContainerPropertyNameType.appendChild(SpanPropertyNameType); var DivContainerPropertyValueType = document.createElement("div"); DivContainerPropertyValueType.className = "resgui-8column resgui-1row justify-content-flex-start align-items-center"; ContainerType.appendChild(DivContainerPropertyValueType); var SpanPropertyValueType = document.createElement("span"); SpanPropertyValueType.className = "TextReadOnly"; SpanPropertyValueType.innerHTML = ""; input.SpanPropertyValueType = SpanPropertyValueType; DivContainerPropertyValueType.appendChild(SpanPropertyValueType); var ContainerSystem = document.createElement("div"); ContainerSystem.className = "resgui-1row resgui-10column"; DivContainerProps.appendChild(ContainerSystem); var DivContainerPropertyNameSystem = document.createElement("div"); DivContainerPropertyNameSystem.className = "resgui-2column resgui-1row justify-content-flex-end align-items-center"; ContainerSystem.appendChild(DivContainerPropertyNameSystem); var SpanPropertyNameSystem = document.createElement("span"); SpanPropertyNameSystem.className = " resgui-font-height-s"; SpanPropertyNameSystem.innerHTML = $MWGUI.GetLanguageString("System") + " :"; DivContainerPropertyNameSystem.appendChild(SpanPropertyNameSystem); var DivContainerPropertyValueSystem = document.createElement("div"); DivContainerPropertyValueSystem.className = "resgui-8column resgui-1row justify-content-flex-start align-items-center"; ContainerSystem.appendChild(DivContainerPropertyValueSystem); var SpanPropertyValueSystem = document.createElement("span"); SpanPropertyValueSystem.className = "TextReadOnly"; SpanPropertyValueSystem.innerHTML = ""; input.SpanPropertyValueSystem = SpanPropertyValueSystem; DivContainerPropertyValueSystem.appendChild(SpanPropertyValueSystem); break; } case "ArgoAggregationTAsset": { input = document.createElement("div"); input.className = "row-direction resgui-2row relative-full-width justify-content-flex-start align-items-center"; var DivContainerProps = document.createElement("div"); DivContainerProps.className = "column-direction resgui-10column relative-full-height"; input.appendChild(DivContainerProps) var ContainerName = document.createElement("div"); ContainerName.className = "resgui-1row resgui-10column"; DivContainerProps.appendChild(ContainerName); var DivContainerPropertyNameName = document.createElement("div"); DivContainerPropertyNameName.className = "resgui-2column resgui-1row justify-content-flex-end align-items-center"; ContainerName.appendChild(DivContainerPropertyNameName); var SpanPropertyNameName = document.createElement("span"); SpanPropertyNameName.className = " resgui-font-height-s"; SpanPropertyNameName.innerHTML = $MWGUI.GetLanguageString("Name") + " :"; DivContainerPropertyNameName.appendChild(SpanPropertyNameName); var DivContainerPropertyValueName = document.createElement("div"); DivContainerPropertyValueName.className = "resgui-8column resgui-1row justify-content-flex-start align-items-center"; ContainerName.appendChild(DivContainerPropertyValueName); var SpanPropertyValueName = document.createElement("span"); SpanPropertyValueName.className = "TextReadOnly"; SpanPropertyValueName.innerHTML = ""; input.SpanPropertyValueName = SpanPropertyValueName; DivContainerPropertyValueName.appendChild(SpanPropertyValueName); var ContainerAssetType = document.createElement("div"); ContainerAssetType.className = "resgui-1row resgui-10column"; DivContainerProps.appendChild(ContainerAssetType); var DivContainerPropertyNameAssetType = document.createElement("div"); DivContainerPropertyNameAssetType.className = "resgui-2column resgui-1row justify-content-flex-end align-items-center"; ContainerAssetType.appendChild(DivContainerPropertyNameAssetType); var SpanPropertyNameAssetType = document.createElement("span"); SpanPropertyNameAssetType.className = " resgui-font-height-s"; SpanPropertyNameAssetType.innerHTML = $MWGUI.GetLanguageString("Type") + " :"; DivContainerPropertyNameAssetType.appendChild(SpanPropertyNameAssetType); var DivContainerPropertyValueAssetType= document.createElement("div"); DivContainerPropertyValueAssetType.className = "resgui-8column resgui-1row justify-content-flex-start align-items-center"; ContainerAssetType.appendChild(DivContainerPropertyValueAssetType); var SpanPropertyValueAssetType = document.createElement("span"); SpanPropertyValueAssetType.className = "TextReadOnly"; SpanPropertyValueAssetType.innerHTML = ""; input.SpanPropertyValueAssetType = SpanPropertyValueAssetType; DivContainerPropertyValueAssetType.appendChild(SpanPropertyValueAssetType); break; } case "ArgoAggregationTDataType": { input = document.createElement("div"); input.className = "row-direction"; var Span = document.createElement("span"); Span.className = "TextReadOnly"; input.appendChild(Span); input.Span = Span; //TODO fare bottone break; } case "ArgoDownloadEmailEvent": { input = document.createElement("div"); input.style.marginLeft = "var(--resgui-quartercolumn)"; input.className = "button-application"; if(Me.Options.EndPoint) input.EndPoint = Me.Options.EndPoint; input.addEventListener("click", function() { if(this.LinkOrigin && this.EndPoint) { if($MWArgo) { var dummy = this.LinkOrigin.split('/'); var FileName = dummy[dummy.length -1] + ".eml"; var Params = { Bucket: $MWArgo.S3Bucket[this.EndPoint], Key: this.LinkOrigin }; $MW.S3.getObject(Params,function(err, data) { if (err) console.log(err, err.stack); // an error occurred else { var blob= new Blob([data.Body], {type: data.ContentType}); var link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); var fileName = FileName; link.download = fileName; link.click(); } }); } } }); var Img = document.createElement("img"); Img.src = "../../../../../../../../../images/icons/downloadIcon.png"; input.appendChild(Img); var Span = document.createElement("span"); Span.innerHTML = $MWGUI.GetLanguageString("Download"); input.appendChild(Span); break; } case ("TimeReadOnly"): { CategoryDictionary[CategoryKey].style.display =""; var input = document.createElement("span"); input.className ="TextReadOnly"; input.innerHTML = "01/01/01 00:00:00"; break; } } if (input != null) { if(PropertyToDraw.ReadOnly == "True") { input.readOnly = true; input.disabled = true; } if (Options[PropertyToDraw._PropertyName] != null) if(Options[PropertyToDraw._PropertyName].toLowerCase() == "readonly") { input.readOnly = true; input.disabled = true; } divColValue.appendChild(input); input.PropertyToDraw = PropertyToDraw; InputDictionary[PropertyToDraw._PropertyName] = input; } } } for (var PropertyObjIndex in OriginalObj) { if (InputDictionary[PropertyObjIndex] != null) { SetValue(InputDictionary[PropertyObjIndex], OriginalObj[PropertyObjIndex]); } } } catch (err) { console.log(err); Result = null; } return Result; } function ForGetCSV(Index, End, Object, StringToWrite) { if(Index < End) { var StartAddress = 0; $Prime.Post("PVCGetDevicesPropertiesJSON", Object[Index]["DevicePTD"] + '=Description;Plant;PlantGroup;IDPTD;Enable;PageURL;DeviceMainImage;Description2;Note;', function (Answer) { $Prime.Post("PrimeDeviceGetResources", Object[Index]["DevicePTD"], function(Answer, Device){ var Variables = JSON.parse(Answer); var Obj = {}; Obj["Device"] = Device; Obj["Variables"] = Variables; $Prime.Post("PVCGetTemplatesPensFromGuid", Device["TemplateGuid"], function(Answer, Obj) { Obj["Variables"]["Dataloggers"] = JSON.parse(Answer); for(var VarType in Obj["Variables"]) { for(var Variable in Obj["Variables"][VarType]["Values"]) { for(var VariableName in Object[Index]["HoldingRegister"]) { if(Object[Index]["HoldingRegister"][VariableName] == Obj["Variables"][VarType]["Values"][Variable]["Name"]) { var Description = JSON.parse(Obj["Variables"][VarType]["Values"][Variable]["MultiLanguageDescription"]); StringToWrite += Object[Index]["SlaveAddress"] + ";" + StartAddress + ";" + Obj["Device"][Object[Index]["DevicePTD"]]["Description"] + " - " + ((Description[LanguageCodePrimeGUI] == "") ? Obj["Variables"][VarType]["Values"][Variable]["Description"] : Description[LanguageCodePrimeGUI]) + ";Holding Registers;" + ((VarType == "ContinuosReads") ? "Read\n" : (VarType == "Commands" ? "Write\n" : "Read/Write\n")); StartAddress = StartAddress + 1; break; } } for(var VariableName in Object[Index]["InputRegister"]) { if(Object[Index]["InputRegister"][VariableName] == Obj["Variables"][VarType]["Values"][Variable]["Name"]) { var Description = JSON.parse(Obj["Variables"][VarType]["Values"][Variable]["MultiLanguageDescription"]); StringToWrite += Object[Index]["SlaveAddress"] + ";" + StartAddress + ";" + Obj["Device"][Object[Index]["DevicePTD"]]["Description"] + " - " + ((Description[LanguageCodePrimeGUI] == "") ? Obj["Variables"][VarType]["Values"][Variable]["Description"] : Description[LanguageCodePrimeGUI]) + ";Input Registers;" + ((VarType == "ContinuosReads") ? "Read\n" : (VarType == "Commands" ? "Write\n" : "Read/Write\n")); StartAddress = StartAddress + 1; break; } } } } ForGetCSV(parseInt(Index) + 1, End, Object, StringToWrite); }, Obj); }, JSON.parse(Answer)); }); } else { var aElement = document.createElement('a'); aElement.type = "download"; aElement.style.innerHTML = ''; aElement.download = 'Prime_Modbus_Slave_Configuration.csv'; var EncodedUri = encodeURI("data:text/csv;charset=base64," + StringToWrite); aElement.href = EncodedUri; document.body.appendChild(aElement); aElement.click(); aElement.remove(); } } function CreateRowFile(input,IdFile){ if(IdFile!=null && IdFile!=""){ var button=document.createElement("div"); button.className="divDeleteButton"; var varspanButton=document.createElement("span"); varspanButton.innerHTML="Download"; varspanButton.className = "spanEditButton"; button.appendChild(varspanButton); button.addEventListener("click",function(){ $Prime.Post("PrimeEAMDownloadFile",IdFile,function(Answer){ if(Answer.MessageResult!=""){ var ObjDeserialized=JSON.parse(Answer); var buffer=_base64ToArrayBuffer(ObjDeserialized.Value); var blob= new Blob([buffer]); var link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); var fileName = ObjDeserialized.Key; link.download = fileName; link.click(); } }); }); input.value=IdFile; input.appendChild(button); }else return; } function SelectDevice(stringPTD, inputContainer, DeviceToLoad, optionDevice) { inputContainer.ListObjects.push(DeviceToLoad); $Prime.Post("PVCGetDevicesPropertiesJSON", stringPTD + '=Description;Plant;PlantGroup;IDPTD;Enable;PageURL;DeviceMainImage;Description2;Note;', function (Answer) { var Device = JSON.parse(Answer)[stringPTD]; var divContainer = document.createElement("div"); divContainer.className = "resgui-1row resgui-19column row-direction"; inputContainer.appendChild(divContainer); var DeviceAddress = document.createElement("div"); DeviceAddress.className = "resgui-1row resgui-4column row-direction align-items-center justify-content-flex-start"; DeviceAddress.style.marginLeft = "var(--resgui-quartercolumn)"; divContainer.appendChild(DeviceAddress); //AddressDesc var sDeviceAddress = document.createElement("span"); sDeviceAddress.innerHTML = AddressDesc["Address"][LanguageCodePrimeGUI]; DeviceAddress.appendChild(sDeviceAddress); var inputAddress = document.createElement("input"); inputAddress.min = 1; inputAddress.max = 240; inputAddress.step = 1; inputAddress.placeholder = DeviceToLoad["SlaveAddress"]; inputAddress.type = "number"; inputAddress.Device = DeviceToLoad; inputAddress.onchange = function(){ var Result = true; Result = !(isNaN(this.value) || parseFloat(this.value) < parseFloat(this.min) || parseFloat(this.value) > parseFloat(this.max) || this.value == "" || (this.step == 1 && this.value != (parseInt(this.value)))); if (Result) { this.className = this.className.replace(" ErrorMark", ""); this.Device["SlaveAddress"] = this.value;} else { if (this.className.indexOf("ErrorMark") == -1) this.className += " ErrorMark"; } } DeviceAddress.appendChild(inputAddress); inputAddress.style.width = "var(--resgui-1column)"; inputAddress.style.minWidth="var(--resgui-1column)"; var DeviceNameDiv = document.createElement("div"); DeviceNameDiv.className = "resgui-1row resgui-5column row-direction align-items-center justify-content-flex-start"; DeviceNameDiv.style.marginLeft = "var(--resgui-quartercolumn)"; divContainer.appendChild(DeviceNameDiv); var spanDeviceName = document.createElement("span"); spanDeviceName.innerHTML = Device["Description"]; DeviceNameDiv.appendChild(spanDeviceName); var DeviceSelectRegisterDiv = document.createElement("div"); DeviceSelectRegisterDiv.className = "resgui-1row resgui-7column row-direction align-items-center justify-content-space-evenly"; divContainer.appendChild(DeviceSelectRegisterDiv); var buttonHoldingRegister = document.createElement("div"); buttonHoldingRegister.className = "button-application" buttonHoldingRegister.innerHTML = "Holding registers"; buttonHoldingRegister.IDPTD = stringPTD; DeviceSelectRegisterDiv.appendChild(buttonHoldingRegister); buttonHoldingRegister.Device = Device; buttonHoldingRegister.VarLoaded = DeviceToLoad; buttonHoldingRegister.DeviceToLoad = DeviceToLoad; buttonHoldingRegister.onclick = function() { var Settings = new Object; Settings["LoadSrcIframe"] = false; Settings["SelectedDevice"] = this.Device; Settings["LoadDeviceContinuosRead"] = true; Settings["LoadDeviceParams"] = true; Settings["LoadDeviceCommands"] = true; Settings["LoadDeviceVirtualVariables"] = false; Settings["LoadDeviceAlarms"] = false; Settings["LoadDeviceWarnings"] = false; Settings["LoadDeviceDatalogger"] = false; Settings["ShowConfirmButton"] = true; Settings["VarLoaded"] = this.VarLoaded["HoldingRegister"]; Settings["SubpageWidth"] = 30; var CustomBox = new TPrimeGUICustomBox(18,30); var Title = document.createElement("span"); Title.style.marginLeft = "var(--resgui-quartercolumn)"; Title.innerHTML = "Holding Registers"; CustomBox.Title.className += " justify-content-space-between" CustomBox.Title.appendChild(Title); CustomBox.Title.addEventListener("click", function(){ }); 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.onclick = function () { CustomBox.Close() }; CustomBox.Title.appendChild(spanClose); var iframe = document.createElement("iframe"); iframe.className = "resgui-17row resgui-30column decor-solid-border-bottom-group-header-color"; iframe.style.overflow = "hidden"; iframe.src = "../../../../../../../../../../../../../Commons/ResourceExplorer/ResourceExplorer.html?Setting=" + btoa(JSON.stringify(Settings)); iframe.buttonLinked = this; CustomBox.Body.appendChild(iframe); iframe.onload = function() { var Iframe = this; this.contentWindow.ConfirmCart = function() { DeviceToLoad["HoldingRegister"] = []; for(var Device in Iframe.contentWindow.VariablesOnCart) { for(var Variable in Iframe.contentWindow.VariablesOnCart[Device]) { DeviceToLoad["HoldingRegister"].push(Iframe.contentWindow.VariablesOnCart[Device][Variable]["Name"]); } } CustomBox.Close(); }; }; CustomBox.Open(function(sender, result) {}); } var buttonReadInput = document.createElement("div"); buttonReadInput.className = "button-application" buttonReadInput.innerHTML = "Input registers"; buttonReadInput.Device = Device; buttonReadInput.VarLoaded = DeviceToLoad; buttonReadInput.DeviceToLoad = DeviceToLoad; buttonReadInput.onclick = function() { var Settings = new Object; Settings["LoadSrcIframe"] = false; Settings["SelectedDevice"] = this.Device; Settings["LoadDeviceContinuosRead"] = true; Settings["LoadDeviceParams"] = true; Settings["LoadDeviceCommands"] = true; Settings["LoadDeviceVirtualVariables"] = false; Settings["LoadDeviceAlarms"] = false; Settings["LoadDeviceWarnings"] = false; Settings["LoadDeviceDatalogger"] = false; Settings["ShowConfirmButton"] = true; Settings["VarLoaded"] = this.VarLoaded["InputRegister"]; Settings["SubpageWidth"] = 30; var CustomBox = new TPrimeGUICustomBox(18,30); var Title = document.createElement("span"); Title.style.marginLeft = "var(--resgui-quartercolumn)"; Title.innerHTML = "Input Registers"; CustomBox.Title.className += " justify-content-space-between" CustomBox.Title.appendChild(Title); CustomBox.Title.addEventListener("click", function(){ }); 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.onclick = function () { CustomBox.Close() }; CustomBox.Title.appendChild(spanClose); var iframe = document.createElement("iframe"); iframe.className = "resgui-17row resgui-30column decor-solid-border-bottom-group-header-color"; iframe.style.overflow = "hidden"; iframe.src = "../../../../../../../../../../../../../Commons/ResourceExplorer/ResourceExplorer.html?Setting=" + btoa(JSON.stringify(Settings)); iframe.buttonLinked = this; CustomBox.Body.appendChild(iframe); iframe.onload = function() { var Iframe = this; this.contentWindow.ConfirmCart = function() { DeviceToLoad["InputRegister"] = []; for(var Device in Iframe.contentWindow.VariablesOnCart) { for(var Variable in Iframe.contentWindow.VariablesOnCart[Device]) { DeviceToLoad["InputRegister"].push(Iframe.contentWindow.VariablesOnCart[Device][Variable]["Name"]); } } CustomBox.Close(); }; }; CustomBox.Open(function(sender, result) {}); } DeviceSelectRegisterDiv.appendChild(buttonReadInput); var DeviceDeleteDiv = document.createElement("div"); DeviceDeleteDiv.className = "resgui-1row resgui-1column row-direction align-items-center justify-content-center"; divContainer.appendChild(DeviceDeleteDiv); var imgDeleteDevice = document.createElement("img"); imgDeleteDevice.src = "../../../../../../../../../../images/icons/closeIcon.png" imgDeleteDevice.className = "icon-image-button"; imgDeleteDevice.DeviceToLoad = DeviceToLoad; imgDeleteDevice.inputContainer = inputContainer; DeviceDeleteDiv.appendChild(imgDeleteDevice); imgDeleteDevice.optionDevice = optionDevice; imgDeleteDevice.divContainer = divContainer; imgDeleteDevice.onclick = function(){ this.inputContainer.ListObjects.splice(this.inputContainer.ListObjects.indexOf(this.DeviceToLoad), 1); this.optionDevice.style.display = "flex"; this.divContainer.remove(); } }); } function _base64ToArrayBuffer(base64) { var binary_string = window.atob(base64); var len = binary_string.length; var bytes = new Uint8Array( len ); for (var i = 0; i < len; i++) { bytes[i] = binary_string.charCodeAt(i); } return bytes.buffer; } function CreateNewRowDescription(SelectKey,TextValue,divContainer){ var VALUE=TextValue; if(VALUE==undefined) VALUE=""; PropertyObjectDescr.push(SelectKey); var divNewDescription=document.createElement("div"); //divNewDescription.style.marginTop="1vmin"; divNewDescription.DescriptionKey=SelectKey; divNewDescription.DescriptionValue=VALUE; divNewDescription.className="divContainerNewDescr"; divContainer.children[1].appendChild(divNewDescription); var divKeyContainer=document.createElement("div"); divKeyContainer.className="divContainerNewDescrConfirmed"; var spanKeyContainer=document.createElement("span"); spanKeyContainer.innerHTML=SelectKey; divKeyContainer.appendChild(spanKeyContainer); divNewDescription.appendChild(divKeyContainer); divKeyContainer.style.width="59%"; var divValueContainer=document.createElement("div"); divValueContainer.className="divContainerNewDescrConfirmed"; var inputValueContainer=document.createElement("input"); inputValueContainer.className="inputValueContainerDRO"; inputValueContainer.type="text"; inputValueContainer.value=VALUE; divValueContainer.appendChild(inputValueContainer); divNewDescription.appendChild(divValueContainer); var Confirm=document.createElement("img"); Confirm.className="icon-image-button"; Confirm.style.display="none"; Confirm.src="../../../../../../../../../images/icons/confirmIcon.png"; Confirm.addEventListener("click",function(){ divNewDescription.DescriptionValue=inputValueContainer.value; }); inputValueContainer.onchange=function(){ Confirm.click(); }; divNewDescription.appendChild(Confirm); var imgDelete=document.createElement("img"); imgDelete.className="icon-image-button"; imgDelete.src="../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/deleteIcon.png"; var select=divContainer.children[0].children[0].children[0]; imgDelete.addEventListener("click",function(){ divNewDescription.remove(); }); if(SelectKey!="ProductID" && SelectKey!="Brand" && SelectKey!="Model" && SelectKey!="Producer") divNewDescription.appendChild(imgDelete); for(var i in select.children){ if(select.children[i].tagName=="OPTION") if(select.children[i].value!=undefined){ if(select.children[i].value==SelectKey && !SelectKey.includes("Altro")){ select.children[i].remove(); } } } } function CreateNewSetting(divContent, NewValue, HtmlOption, SelectParent) { var divNumberListValue = document.createElement("div"); divNumberListValue.className = "divNumberListValue resgui-1row"; divNumberListValue.SettingObject = NewValue; var inputValue = document.createElement("input"); inputValue.value = NewValue["Description"]; inputValue.setAttribute("readonly", ""); inputValue.SettingObject = NewValue; divNumberListValue.appendChild(inputValue); var imgNumberListUp = document.createElement("img"); imgNumberListUp.src = "../../../../../../../../../images/icons/ArrowIcon.png"; imgNumberListUp.style.transform = "rotate(90deg)"; imgNumberListUp.className = "icon-image-button"; imgNumberListUp.divNumberListValue = divNumberListValue; imgNumberListUp.addEventListener("click", function () { var Content = this.parentNode.parentNode; var Row = this.parentNode; var previousElement = Row.previousElementSibling; if (previousElement != null) { Content.insertBefore(Row, previousElement); } }); divNumberListValue.appendChild(imgNumberListUp); var imgNumberListDown = document.createElement("img"); imgNumberListDown.src = "../../../../../../../../../images/icons/ArrowIcon.png"; imgNumberListDown.style.transform = "rotate(-90deg)"; imgNumberListDown.className = "icon-image-button"; imgNumberListDown.divNumberListValue = divNumberListValue; imgNumberListDown.addEventListener("click", function () { var Content = this.parentNode.parentNode; var Row = this.parentNode; var nextElement = Row.nextElementSibling; if (nextElement != null) { Content.insertBefore(Row, nextElement.nextElementSibling); } }); divNumberListValue.appendChild(imgNumberListDown); var imgNumberListRemove = document.createElement("img"); imgNumberListRemove.src = "../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../images/icons/deleteIcon.png"; imgNumberListRemove.className = "icon-image-button"; imgNumberListRemove.divNumberListValue = divNumberListValue; imgNumberListRemove.HtmlOption = HtmlOption; imgNumberListRemove.SelectParent = SelectParent; imgNumberListRemove.addEventListener("click", function () { this.divNumberListValue.parentNode.removeChild(this.divNumberListValue); this.HtmlOption.style.display = "block" this.SelectParent.appendChild(this.HtmlOption); }); divNumberListValue.appendChild(imgNumberListRemove); HtmlOption.remove(); divContent.appendChild(divNumberListValue); } function CreateDictionaryLanguageListValue(langClass, NewValue, container) { var divDictionaryLanguageValue = document.createElement("div"); divDictionaryLanguageValue.className = "resgui-1row align-items-center"; langClass.language["Value"] = NewValue; if (langClass.style != null) { langClass.style.display = "none"; for (var i = 0; i < langClass.parentNode.children.length; i++) { if (langClass.parentNode.children[i].style.display != "none") { langClass.parentNode.children[i].selected = true; break; } } divDictionaryLanguageValue.HtmlParent = langClass.parentNode; divDictionaryLanguageValue.Htmlthis = langClass; } else { var select = container.parentNode.children[1].children[0]; for (var i = 0; i < select.children.length; i++) { if (select.children[i].language != undefined) { if (select.children[i].language["Code"] == langClass.language["Code"]) { select.children[i].style.display = "none"; divDictionaryLanguageValue.HtmlParent = select.children[i].parent; divDictionaryLanguageValue.Htmlthis = select.children[i]; for (var i = 0; i < select.children[i].parentNode.children.length; i++) { if (select.children[i].parentNode.children[i].style.display != "none") { select.children[i].parentNode.children[i].selected = true; break; } } break; } } } } divDictionaryLanguageValue.LangClass = langClass.language; var inputValue = document.createElement("input"); inputValue.value = langClass.language["Code"] + " - " + langClass.language["Description"]; inputValue.setAttribute("readonly", ""); divDictionaryLanguageValue.appendChild(inputValue); var inputValueText = document.createElement("input"); inputValueText.value = NewValue; divDictionaryLanguageValue.appendChild(inputValueText); var imgNumberListUp = document.createElement("img"); imgNumberListUp.src = "../../../../../../../../../images/icons/ArrowIcon.png"; imgNumberListUp.style.transform = "rotate(90deg)"; imgNumberListUp.className = "icon-image-button"; imgNumberListUp.divDictionaryLanguageValue = divDictionaryLanguageValue; imgNumberListUp.addEventListener("click", function () { var Content = this.parentNode.parentNode; var Row = this.parentNode; var previousElement = Row.previousElementSibling; if (previousElement != null) { Content.insertBefore(Row, previousElement); } }); divDictionaryLanguageValue.appendChild(imgNumberListUp); var imgNumberListDown = document.createElement("img"); imgNumberListDown.src = "../../../../../../../../../images/icons/ArrowIcon.png"; imgNumberListDown.className = "icon-image-button"; imgNumberListDown.style.transform = "rotate(-90deg)"; imgNumberListDown.divDictionaryLanguageValue = divDictionaryLanguageValue; imgNumberListDown.addEventListener("click", function () { var Content = this.parentNode.parentNode; var Row = this.parentNode; var nextElement = Row.nextElementSibling; if (nextElement != null) { Content.insertBefore(Row, nextElement.nextElementSibling); } }); divDictionaryLanguageValue.appendChild(imgNumberListDown); var imgNumberListRemove = document.createElement("img"); imgNumberListRemove.src = "../../../../../../../../../../../../../../../../../../../../../../../images/icons/deleteIcon.png"; imgNumberListRemove.className = "icon-image-button"; imgNumberListRemove.divDictionaryLanguageValue = divDictionaryLanguageValue; imgNumberListRemove.onclick = function() { this.divDictionaryLanguageValue.parentNode.removeChild(this.divDictionaryLanguageValue); }; divDictionaryLanguageValue.appendChild(imgNumberListRemove); container.appendChild(divDictionaryLanguageValue); } function CreateNumberListValue(divContent, NewValue) { var divNumberListValue = document.createElement("div"); divNumberListValue.className = "divNumberListValue resgui-1row"; var inputValue = document.createElement("input"); inputValue.value = NewValue; inputValue.setAttribute("readonly", ""); divNumberListValue.appendChild(inputValue); var imgNumberListUp = document.createElement("img"); imgNumberListUp.src = "../../../../../../../../../images/icons/ArrowIcon.png"; imgNumberListUp.style.transform = "rotate(90deg)"; imgNumberListUp.className = "icon-image-button"; imgNumberListUp.divNumberListValue = divNumberListValue; imgNumberListUp.addEventListener("click", function () { var Content = this.parentNode.parentNode; var Row = this.parentNode; var previousElement = Row.previousElementSibling; if (previousElement != null) { Content.insertBefore(Row, previousElement); } }); divNumberListValue.appendChild(imgNumberListUp); var imgNumberListDown = document.createElement("img"); imgNumberListDown.src = "../../../../../../../../../images/icons/ArrowIcon.png"; imgNumberListDown.style.transform = "rotate(-90deg)"; imgNumberListDown.className = "icon-image-button"; imgNumberListDown.divNumberListValue = divNumberListValue; imgNumberListDown.addEventListener("click", function () { var Content = this.parentNode.parentNode; var Row = this.parentNode; var nextElement = Row.nextElementSibling; if (nextElement != null) { Content.insertBefore(Row, nextElement.nextElementSibling); } }); divNumberListValue.appendChild(imgNumberListDown); var imgNumberListRemove = document.createElement("img"); imgNumberListRemove.src = "../../../../../../../../../../../../../../../../../../../../../../../images/icons/deleteIcon.png"; imgNumberListRemove.className = "icon-image-button"; imgNumberListRemove.divNumberListValue = divNumberListValue; imgNumberListRemove.addEventListener("click", function () { this.divNumberListValue.parentNode.removeChild(this.divNumberListValue); }); divNumberListValue.appendChild(imgNumberListRemove); divContent.appendChild(divNumberListValue); } function CreatePhoneNumberListValue(divContent, NewValue) { var divNumberListValue = document.createElement("div"); divNumberListValue.className = "divNumberListValue resgui-1row"; var inputValue = document.createElement("input"); inputValue.value = NewValue; divNumberListValue.appendChild(inputValue); var imgNumberListRemove = document.createElement("img"); imgNumberListRemove.src = "../../../../../../../../../../../../../../../../../../../../../../../images/icons/deleteIcon.png"; imgNumberListRemove.className = "icon-image-button"; imgNumberListRemove.divNumberListValue = divNumberListValue; imgNumberListRemove.addEventListener("click", function () { this.divNumberListValue.parentNode.removeChild(this.divNumberListValue); }); divNumberListValue.appendChild(imgNumberListRemove); divContent.appendChild(divNumberListValue); } function CreateNewTimeSlot(StartValue, StopValue) { if (divContainerListTimeSlot == null) return; var Result = false; var Patt = /^([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])/; if (Patt.test(StartValue)) { if (Patt.test(StopValue)) { var divTimeSlotContainer = document.createElement("div"); divContainerListTimeSlot.appendChild(divTimeSlotContainer); divTimeSlotContainer.className = "divNumberListValue resgui-1row"; var inputValueStartTime = document.createElement("input"); divTimeSlotContainer.appendChild(inputValueStartTime); inputValueStartTime.disabled = true; inputValueStartTime.value = StartValue; var inputValueStopTime = document.createElement("input"); divTimeSlotContainer.appendChild(inputValueStopTime); inputValueStopTime.disabled = true; inputValueStopTime.value = StopValue; var imgNumberListUp = document.createElement("img"); imgNumberListUp.src = "../../../../../../../../../images/icons/ArrowIcon.png"; imgNumberListUp.style.transform = "rotate(90deg)"; imgNumberListUp.className = "icon-image-button"; imgNumberListUp.addEventListener("click", function () { var Content = this.parentNode.parentNode; var Row = this.parentNode; var previousElement = Row.previousElementSibling; if (previousElement != null) { Content.insertBefore(Row, previousElement); } }); divTimeSlotContainer.appendChild(imgNumberListUp); var imgNumberListDown = document.createElement("img"); imgNumberListDown.src = "../../../../../../../../../images/icons/ArrowIcon.png"; imgNumberListDown.style.transform = "rotate(-90deg)"; imgNumberListDown.className = "icon-image-button"; imgNumberListDown.addEventListener("click", function () { var Content = this.parentNode.parentNode; var Row = this.parentNode; var nextElement = Row.nextElementSibling; if (nextElement != null) { Content.insertBefore(Row, nextElement.nextElementSibling); } }); divTimeSlotContainer.appendChild(imgNumberListDown); var imgNumberListRemove = document.createElement("img"); imgNumberListRemove.src = "../../../../../../../../../../../../../../../../../../../../../../../images/icons/deleteIcon.png"; imgNumberListRemove.className = "icon-image-button"; imgNumberListRemove.addEventListener("click", function () { this.parentNode.remove(); }); divTimeSlotContainer.appendChild(imgNumberListRemove); } } } function SetValue(input, value) { switch (input.PropertyToDraw.Appaerance) { case "Text": input.value = value; break; case "Checkbox": input.checked = (value.toString().toLowerCase() == "true"); //per bug configurazione email, il valore che riceve è "True" o "False" break; case "Number": input.value = value; break; case "NumberList": for (var valueIndex in value) for (var Type in value[valueIndex]) CreateNumberListValue(input.childNodes[0], value[valueIndex][Type]); break; case "Enumerator": var justSelected = false; for (var opzIndex = 0; opzIndex < input.childNodes.length; opzIndex++) { if (input.childNodes[opzIndex].value == value/* && !justSelected*/) { input.childNodes[opzIndex].setAttribute("selected", ""); justSelected = true; } } if(!justSelected) { if(input.PropertyToDraw["Category"] == "CarelSettings@1" && input.PropertyToDraw["_PropertyName"] == "Baudrate") //solo per baudrate carel per compatibiltà con l'enumeratore da server { if(input.childNodes[parseInt(value)-1] != null) input.childNodes[parseInt(value)-1].setAttribute("selected", ""); } else { if(input.childNodes[parseInt(value)] != null) input.childNodes[parseInt(value)].setAttribute("selected", ""); } } input.changeSelection(input); break; case "Password": try { value = atob(value.split("").reverse().join("")); } catch(er){ } input.childNodes[0].value = value; input.childNodes[1].value = value; break; case "CriptoPassword": { input.Key = value; input.NewKey = value; break; } case "Email": input.value = value; break; case "TextReadOnly": input.innerHTML = value; break; case "TimeSpan": var TimeSpanObject = {"Days":"","Hours":"","Minutes":"","Seconds":""}; var fields = value.split(":"); if(fields.length == 3) { TimeSpanObject.Seconds = parseInt(fields[2]); TimeSpanObject.Minutes = parseInt(fields[1]); var dayHourFields = fields[0].split("."); if(dayHourFields.length == 2) { TimeSpanObject.Days = parseInt(dayHourFields[0]); TimeSpanObject.Hours = parseInt(dayHourFields[1]); } else { TimeSpanObject.Days = 0; TimeSpanObject.Hours = parseInt(dayHourFields[0]); } } var Val = TimeSpanObject.Days.toString(); Val += '.'; if (TimeSpanObject.Hours < 10) Val += '0'; Val += TimeSpanObject.Hours.toString(); Val += ':'; if (TimeSpanObject.Minutes < 10) Val += '0'; Val += TimeSpanObject.Minutes.toString(); input.value = Val; Val += ':'; if (TimeSpanObject.Seconds < 10) Val += '0'; Val += TimeSpanObject.Seconds.toString(); input.value = Val; break; case "TextMultilanguage": try { if(typeof(value) == "object") { var NewValue = value; for (var valueIndex in NewValue) { for (var i in DictionaryLanguages) { if (DictionaryLanguages[i]["Code"] == NewValue[valueIndex]["Code"] && DictionaryLanguages[i]["Code"] != null) { var classObj = {}; classObj.language = DictionaryLanguages[i]; CreateDictionaryLanguageListValue(classObj, NewValue[valueIndex]["Description"], input.childNodes[0]); break; } } } } else { if(value != "" && value != "System.Collections.ArrayList") { var NewValue = JSON.parse(value); for (var valueIndex in NewValue) { for (var i in DictionaryLanguages) { if (DictionaryLanguages[i]["Code"] == valueIndex && DictionaryLanguages[i]["Code"] != null) { var classObj = {}; classObj.language = DictionaryLanguages[i]; CreateDictionaryLanguageListValue(classObj, NewValue[valueIndex], input.childNodes[0]); break; } } } } } } catch(err){ console.log(err); } break; /*case "ListSettings": var ListSettingsJSON = JSON.parse(value); if (selectListSettings.children.length > 0) { for (var i = 0; i < ListSettingsJSON.length; i++) { for (var k = 0; k < selectListSettings.children.length; k++) { if (selectListSettings.children[k].SettingObject["Id"] == ListSettingsJSON[i]) { CreateNewSetting(selectListSettings.parentNode.parentNode.children[0], selectListSettings.children[k].SettingObject, selectListSettings.children[k], selectListSettings); break; } } } } break;*/ case ("ListUser"): JsonValue = JSON.parse(value); for(var val in JsonValue) { for(var Checkbox in INPUTListUser.Checkboxes) { if(typeof(INPUTListUser.Checkboxes[Checkbox]) == "object") { if(INPUTListUser.Checkboxes[Checkbox].User["Id"] == JsonValue[val]["Id"] && INPUTListUser.Checkboxes[Checkbox].User["Checked"]) { INPUTListUser.Checkboxes[Checkbox].checked = true; break; } } } } break; case ("EmailList"): for (var valueIndex in value) { CreateNumberListValue(input.childNodes[0], value[valueIndex]); } break; case ("TextList"): for (var valueIndex in value) { CreateNumberListValue(input.childNodes[0], value[valueIndex]); } break; case ("UserSelectBox"): if (SomethingIsSelected) input.getElementsByTagName('img')[0].click(); break; case "DaysWeekList": var inputs = input.getElementsByTagName("input"); for (var i = 0; i < 7; i++) { if ((value >> i) & 1) if (inputs[i] != null) { inputs[i].checked = true; inputs[i].onchange(); } } break; case "DayHour": valueObj = JSON.parse(value); for (var TimeSlot in valueObj) { for (var objKey in valueObj[TimeSlot]) { CreateNewTimeSlot(objKey, valueObj[TimeSlot][objKey]); } } break; case "Date": /*console.log(value);*/ input.value = value; break; case "Color": input.value = value; break; case "Nothing": input.innerHTML = value; break; /*case "DescriptionRealObject": for (var keyIndex in value) { CreateNewRowDescription(keyIndex, value[keyIndex], input.childNodes[0]); } break;*/ //case "DateNextMaintenance":{ input.children[0].children[0].innerHTML=value; break}; case "TextArea":input.value = value; break; case "File": CreateRowFile(input,value); break; case "IPAddress": input.value = value; break; //case "Plant": input.ValueSetted = value; input.loadPlant(function(){ this.PlantGroupInput.LoadPlantGroups(); }); break; //case "PlantGroup": input.ValueSetted = value; break; //case "SlaveDevices": input.selectList.Initialize(value); break; //case "SettingIndex": input.value = value; break; //case "SettingIndexCarel": input.value = value; break; case "ImageIconUser": case "ImageUserPool": { input.Value = value; input.setAttribute("src",value); if(value != "" ) input.style.width = null; break; } /* case "MaskValue": { try { var MaskParsed = JSON.parse(value); for(var Key in MaskParsed) { input.children[0].children[0].value = Key; input.children[0].children[1].click(); for(var i = 0; i < input.children[1].children[input.children[1].children.length - 1].children[2].children[0].children[0].children.length; i++) { if(MaskParsed[Key][input.children[1].children[input.children[1].children.length - 1].children[2].children[0].children[0].children[i].Code] != null) { input.children[1].children[input.children[1].children.length - 1].children[2].children[0].children[0].children[i].selected = true; input.children[1].children[input.children[1].children.length - 1].children[2].children[0].children[1].value = MaskParsed[Key][input.children[1].children[input.children[1].children.length - 1].children[2].children[0].children[0].children[i].Code]; input.children[1].children[input.children[1].children.length - 1].children[2].children[0].children[2].click(); } } } } catch {} break; }*/ case "PhoneNumber": input.value = value; break; case "CognitoUsername": { if(value != "") { var spanReadOnly = document.createElement("span"); spanReadOnly.className = "TextReadOnly"; spanReadOnly.innerHTML = value; spanReadOnly.value = value; /*spanReadOnly.GetValue = function(){ return this.ValueToReturn; }*/ input.children[0].remove(); input.appendChild(spanReadOnly); } break; } case "ResourceGroupLinkedToMyUserPool": { if(value) { var ResourceGroupLinkedToMyUserPoolInput = input; if(value.ID) { var ParentId = value.ID; $MW.GetInstances("MosaicoWorld", "BaseElement", "BaseElement.Kernel.TResourceGroup", function(Answer, OriginalMessage) { if(Answer) { if(Answer.Instances.length > 0) { var spanDescription = document.createElement("span"); spanDescription.innerHTML = Answer.Instances[0].Name; spanDescription.className = "TextReadOnly"; ResourceGroupLinkedToMyUserPoolInput.ValueToSave = {"ID":ParentId}; ResourceGroupLinkedToMyUserPoolInput.parentNode.insertBefore(spanDescription, ResourceGroupLinkedToMyUserPoolInput); ResourceGroupLinkedToMyUserPoolInput.innerHTML = ""; } } }, function(Error, ErrorStack) { }, {"Type":"Eq", "Field":"ID", "Value":value.ID}); } else { ResourceGroupLinkedToMyUserPoolInput.parentNode.parentNode.parentNode.style.display = "none"; } } break; } case "GenericDictionary": { for(var Key in value) { input.divKeyValuePairContainer.AddElementToDictionary(Key, value[Key]); } break; } case ("ResourceType"): { if(input.childNodes.length > 0) { var justSelected = false; for (var opzIndex = 0; opzIndex < input.childNodes[0].childNodes.length; opzIndex++) { if (input.childNodes[0].childNodes[opzIndex].value == value) { input.childNodes[0].childNodes[opzIndex].setAttribute("selected", ""); justSelected = true; } } if(!justSelected) { if(input.childNodes[0].childNodes[parseInt(value)-1] != null) { input.childNodes[0].childNodes[parseInt(value)-1].setAttribute("selected", ""); justSelected = true; } else { if(value == "User" || value == "User pool" || value == "Resource group" || value == "Rule") { var spanReadOnly = document.createElement("span"); spanReadOnly.className = "TextReadOnly"; spanReadOnly.innerHTML = value; spanReadOnly.ValueToReturn = value; spanReadOnly.GetValue = function(){ return this.ValueToReturn; } input.children[0].remove(); input.appendChild(spanReadOnly); } } } if(justSelected) { var spanReadOnly = document.createElement("span"); spanReadOnly.className = "TextReadOnly"; spanReadOnly.innerHTML = input.childNodes[0].childNodes[input.childNodes[0].selectedIndex].innerHTML; spanReadOnly.ValueToReturn = input.childNodes[0].childNodes[input.childNodes[0].selectedIndex].innerHTML; spanReadOnly.GetValue = function(){ return this.ValueToReturn; } input.children[0].remove(); input.appendChild(spanReadOnly); } } else { if(value != "") input.ReturnValue = value; } break; } case ("EnumeratorSelectOnlyOnCreation"): { var justSelected = false; for (var opzIndex = 0; opzIndex < input.childNodes[0].childNodes.length; opzIndex++) { if (input.childNodes[0].childNodes[opzIndex].value == value) { input.childNodes[0].childNodes[opzIndex].setAttribute("selected", ""); justSelected = true; } } if(!justSelected) { if(input.childNodes[0].childNodes[parseInt(value)-1] != null) { input.childNodes[0].childNodes[parseInt(value)-1].setAttribute("selected", ""); justSelected = true; } } if(justSelected) { var spanReadOnly = document.createElement("span"); spanReadOnly.className = "TextReadOnly"; spanReadOnly.innerHTML = input.childNodes[0].childNodes[input.childNodes[0].selectedIndex].innerHTML; spanReadOnly.ValueToReturn = input.childNodes[0].childNodes[input.childNodes[0].selectedIndex].innerHTML; spanReadOnly.GetValue = function(){ return this.ValueToReturn; } input.children[0].remove(); input.appendChild(spanReadOnly); } break; } case ("RulesLinkedToMyUserPool"): { if(value) { var RuleLinkedToMyUserPoolInput = input; if(value.ID) { $MW.GetInstances("MosaicoWorld", "BaseElement", "BaseElement.Kernel.TRule", function(Answer, OriginalMessage) { if(Answer) { if(Answer.Instances.length > 0) { var spanDescription = document.createElement("span"); spanDescription.innerHTML = Answer.Instances[0].Name; RuleLinkedToMyUserPoolInput.ValueToSave = {"ID":Answer.Instances[0].ID}; spanDescription.className = "TextReadOnly"; RuleLinkedToMyUserPoolInput.parentNode.insertBefore(spanDescription, RuleLinkedToMyUserPoolInput); RuleLinkedToMyUserPoolInput.innerHTML = ""; } } }, function(Error, ErrorStack) { }, {"Type":"Eq", "Field":"ID", "Value":value.ID}); } /*else { RuleLinkedToMyUserPoolInput.parentNode.parentNode.parentNode.style.display = "none"; }*/ } break; } case "PhoneNumberList": for (var valueIndex in value) CreatePhoneNumberListValue(input.childNodes[0], value[valueIndex]); break; case "ListArgoKeys":{ if(value.length > 0) { if(input.children.length > 0) input.removeChild(input.children[0]); for(var Index in value) { if(parseInt(Index) == 0) { CreateRowArgoKeys(input, false, value[Index]); } else { CreateRowArgoKeys(input, true, value[Index]); } } } break; } case "RulesArgoEvent": { console.log(value); var SpanDelay = document.createElement("div"); if(value["_v"]) SpanDelay.innerHTML = value["_v"][0]; else SpanDelay.innerHTML = value["0"]; input.Body.DelayBody.appendChild(SpanDelay); var SpanPriority = document.createElement("div"); if(value["_v"]) SpanPriority.innerHTML = value["_v"][1]; else SpanPriority.innerHTML = value["1"]; input.Body.BodyPriorityStart.appendChild(SpanPriority); var SpanEscalation = document.createElement("div"); if(value["_v"]) SpanEscalation.innerHTML = value["_v"][2]; else SpanEscalation.innerHTML = value["2"]; input.Body.BodyEscalation.appendChild(SpanEscalation); input.Value = value; break; } case "SteKeys": { if(value.length > 0) { if(input.children.length > 0) input.removeChild(input.children[0]); for(var Index in value) { if(parseInt(Index) == 0) { CreateSTEKeys(input, false, value[Index]); } else { CreateSTEKeys(input, true, value[Index]); } } } break; } case "ArgoDateTimeNoSpaces": { if($MWArgo) { if(value != "") { /*var DateParsed = $MWArgo.ConvertStringToDate(value, "yyyyMMdd'T'HHmmsszzzzz"); var Offset = new Date().getTimezoneOffset(); DateParsed.setHours(DateParsed.getHours() + ((Offset / 60) * -1 )); input.innerHTML = (DateParsed.getDate() < 10 ? "0" + DateParsed.getDate() : DateParsed.getDate()) + "/" + (DateParsed.getMonth() < 9 ? "0" + parseInt(DateParsed.getMonth()) + 1 : parseInt(DateParsed.getMonth()) + 1) + "/" + DateParsed.getFullYear() + " " + (DateParsed.getHours() < 10 ? "0" + DateParsed.getHours() : DateParsed.getHours()) + ":" + (DateParsed.getMinutes() < 10 ? "0" + DateParsed.getMinutes() : DateParsed.getMinutes()) + ":" + (DateParsed.getSeconds() < 10 ? "0" + DateParsed.getSeconds() : DateParsed.getSeconds()); input.title = input.innerHTML;*/ input.innerHTML = value; input.title = input.innerHTML; } else { input.innerHTML = ""; input.title = ""; } } break; } case "ArgoDateTime": { if($MWArgo) { if(value != "") { var DateParsed = $MWArgo.ConvertStringToDate(value, "yyyy-MM-dd'T'HH:mm:ss.zzzzz"); var Offset = new Date().getTimezoneOffset(); DateParsed.setHours(DateParsed.getHours() + ((Offset / 60) * -1 )); input.innerHTML = (DateParsed.getDate() < 10 ? "0" + DateParsed.getDate() : DateParsed.getDate()) + "/" + (DateParsed.getMonth() < 9 ? "0" + parseInt(DateParsed.getMonth()) + 1 : parseInt(DateParsed.getMonth()) + 1) + "/" + DateParsed.getFullYear() + " " + (DateParsed.getHours() < 10 ? "0" + DateParsed.getHours() : DateParsed.getHours()) + ":" + (DateParsed.getMinutes() < 10 ? "0" + DateParsed.getMinutes() : DateParsed.getMinutes()) + ":" + (DateParsed.getSeconds() < 10 ? "0" + DateParsed.getSeconds() : DateParsed.getSeconds()); input.title = input.innerHTML; } else { input.innerHTML = ""; input.title = ""; } } break; } case "ArgoAssetType": { if(Me.Options.EndPoint && $MWArgo) { if($MWArgo.AssetTypes) { var Index = $MWArgo.AssetTypes[Me.Options.EndPoint].findIndex(x => x["_id"] == value); if(Index > -1) { input.innerHTML = $MWArgo.AssetTypes[Me.Options.EndPoint][Index]["Name"]; input.title = $MWArgo.AssetTypes[Me.Options.EndPoint][Index]["Name"]; } } } break; } case "ArgoAggregationTScope": { if(value.Type && $MWArgo) { if(input.SpanTypeString) { input.SpanTypeString.innerHTML = $MWArgo.ScopesType[value.Type]; input.SpanTypeString.title = $MWArgo.ScopesType[value.Type]; } } break; } case "ArgoAggregationTSite": { if(value["_id"] && value["Name"] && $MWArgo) { input.SpanPropertyValueId.innerHTML = value["_id"]; //TODO ENABLE TITLE //input.SpanPropertyValueId.title = value["_id"]; input.SpanPropertyValueName.innerHTML = value["Name"]; //TODO ENABLE TITLE //input.SpanPropertyValueName.title = value["Name"]; } break; } case "ArgoAggregationTSource": { if($MWArgo) { if(value["SourceType"] != undefined) { input.SpanPropertyValueType.innerHTML = $MWArgo.SourcesType[value["SourceType"]]; input.SpanPropertyValueType.title = $MWArgo.SourcesType[value["SourceType"]]; } if(value["SystemName"]) { input.SpanPropertyValueSystem.innerHTML = value["SystemName"]; input.SpanPropertyValueSystem.title = value["SystemName"]; } if(value.LinkUrls) { input.EnableNavigateTo(value.LinkUrls); } } } case "ArgoAggregationTAsset": { if($MWArgo) { if(value["Name"]) { input.SpanPropertyValueName.innerHTML = value["Name"]; input.SpanPropertyValueName.title = value["Name"]; } if(value["IdAssetType"]) { var Index = $MWArgo.AssetTypes[Me.Options.EndPoint].findIndex(x => x["_id"] == value["IdAssetType"].split('#')[0]); if(Index > -1) { input.SpanPropertyValueAssetType.innerHTML = $MWArgo.AssetTypes[Me.Options.EndPoint][Index]["Name"]; input.SpanPropertyValueAssetType.title = $MWArgo.AssetTypes[Me.Options.EndPoint][Index]["Name"]; } } } break; } case "ArgoAggregationTDataType": { if($MWArgo) { if(value["Description"]) { input.Span.innerHTML = value["Description"]; input.Span.title = value["Description"]; } } break; } case "ArgoDownloadEmailEvent": { if(value) { if(value == null) { var SpanNotAviable = document.createElement("span"); SpanNotAviable.className = "TextReadOnly"; SpanNotAviable.innerHTML = $MWGUI.GetLanguageString("NotAviable"); SpanNotAviable.title = $MWGUI.GetLanguageString("NotAviable"); input.parentNode.appendChild(SpanNotAviable); input.parentNode.removeChild(input); } else input.LinkOrigin = value; } else { var SpanNotAviable = document.createElement("span"); SpanNotAviable.className = "TextReadOnly"; SpanNotAviable.innerHTML = $MWGUI.GetLanguageString("NotAviable"); SpanNotAviable.title = $MWGUI.GetLanguageString("NotAviable"); input.parentNode.appendChild(SpanNotAviable); input.parentNode.removeChild(input); } break; } case "TimeReadOnly": { if(value != "") { var DateParsed = new Date(value.replace(/\+0000/gi, "Z")); /*SpanValueProperties.innerHTML = (DateParsed.getMonth() < 9 ? "0" + parseInt(DateParsed.getMonth()) + 1 : parseInt(DateParsed.getMonth()) + 1) + "/" + (DateParsed.getDate() < 10 ? "0" + DateParsed.getDate() : DateParsed.getDate()) + "/" + DateParsed.getFullYear() + " " + (DateParsed.getHours() < 10 ? "0" + DateParsed.getHours() : DateParsed.getHours()) + ":" + (DateParsed.getMinutes() < 10 ? "0" + DateParsed.getMinutes() : DateParsed.getMinutes()) + ":" + (DateParsed.getSeconds() < 10 ? "0" + DateParsed.getSeconds() : DateParsed.getSeconds());*/ input.innerHTML = (DateParsed.getDate() < 10 ? "0" + DateParsed.getDate() : DateParsed.getDate()) + "/" + (DateParsed.getMonth() < 9 ? "0" + (parseInt(DateParsed.getMonth()) + 1) : (parseInt(DateParsed.getMonth()) + 1)) + "/" + DateParsed.getFullYear() + " " + (DateParsed.getHours() < 10 ? "0" + DateParsed.getHours() : DateParsed.getHours()) + ":" + (DateParsed.getMinutes() < 10 ? "0" + DateParsed.getMinutes() : DateParsed.getMinutes()) + ":" + (DateParsed.getSeconds() < 10 ? "0" + DateParsed.getSeconds() : DateParsed.getSeconds()); input.title = input.innerHTML; } } case "Image": { input.Value = value; input.setAttribute("src","data:image/png;base64,"+ value); break; } } } function CreateRowArgoKeys(DivToAppend, EnableDelete, Value) { var DivRow = document.createElement("div"); DivRow.className = "row-direction resgui-9column resgui-4row align-items-center"; DivToAppend.appendChild(DivRow); DivRow.ObjectToGet = { PrimaryKey : "", SecondaryKey : [] }; DivRow.GetObject = function() { if(this.InputPrimaryKey.value != "") this.ObjectToGet.PrimaryKey = this.InputPrimaryKey.value; for(var Index in this.DivInputs.children) { if(this.DivInputs.children[Index].nodeName == "DIV") { if(this.DivInputs.children[Index].Input.value != "") this.ObjectToGet.SecondaryKey.push(this.DivInputs.children[Index].Input.value); } } return this.ObjectToGet; } var DivContainerRow = document.createElement("div"); DivContainerRow.className = "column-direction resgui-8column resgui-4row"; DivRow.appendChild(DivContainerRow); var DivSpanPrimaryKey = document.createElement("div"); DivSpanPrimaryKey.className = "resgui-1row relativ-full-width justify-content-flex-start align-items-center"; DivContainerRow.appendChild(DivSpanPrimaryKey); var SpanPrimaryKey = document.createElement("span"); SpanPrimaryKey.innerHTML = $MWGUI.GetLanguageString("PrimaryKeyArgo"); SpanPrimaryKey.style.marginLeft = "var(--resgui-quartercolumn)"; DivSpanPrimaryKey.appendChild(SpanPrimaryKey); var InputPrimaryKey = document.createElement("input"); InputPrimaryKey.type = "text"; if(Value) { InputPrimaryKey.value = Value.PrimaryKey; } DivRow.InputPrimaryKey = InputPrimaryKey; DivContainerRow.appendChild(InputPrimaryKey); var DivSpanSecondaryKey = document.createElement("div"); DivSpanSecondaryKey.className = "resgui-1row relativ-full-width justify-content-flex-start align-items-center"; DivContainerRow.appendChild(DivSpanSecondaryKey); var SpanSecondaryKey = document.createElement("span"); SpanSecondaryKey.innerHTML = $MWGUI.GetLanguageString("SecondaryKeyArgo"); SpanSecondaryKey.style.marginLeft = "var(--resgui-quartercolumn)"; DivSpanSecondaryKey.appendChild(SpanSecondaryKey); var DivInputsAndAdd = document.createElement("div"); DivInputsAndAdd.className = "relativ-full-width justify-content-flex-start align-items-center row-direction"; DivContainerRow.appendChild(DivInputsAndAdd); var DivInputs = document.createElement("div"); DivInputs.className = "resgui-7column justify-content-flex-start align-items-center column-direction"; DivRow.DivInputs = DivInputs; DivInputsAndAdd.appendChild(DivInputs); var DivContainerInput = document.createElement("div"); DivContainerInput.className = "resgui-1row relative-full-width justify-content-flex-start align-items-center"; DivInputs.appendChild(DivContainerInput); var Input = document.createElement("input"); Input.type = "text"; Input.style.width = "var(--resgui-6column)"; Input.style.maxWidth = "var(--resgui-6column)"; Input.style.minWidth = "var(--resgui-6column)"; DivContainerInput.Input = Input; var CloneValue = []; if(Value) { if(Value.SecondaryKey) { if(Value.SecondaryKey.length > 0) { Input.value = Value.SecondaryKey[0]; CloneValue = [...Value.SecondaryKey]; CloneValue.splice(0,1) } } } DivContainerInput.appendChild(Input); var ImgAdd = document.createElement("img"); ImgAdd.src = "../../../../../../../../images/icons/addIcon.png"; ImgAdd.className = "icon-image-button"; ImgAdd.DivInputs = DivInputs; ImgAdd.DivRow = DivRow; ImgAdd.DivContainerRow = DivContainerRow; ImgAdd.addEventListener("click", function(){ var DivContainerInput = document.createElement("div"); DivContainerInput.className = "resgui-1row relative-full-width justify-content-flex-start align-items-center"; this.DivInputs.appendChild(DivContainerInput); var Input = document.createElement("input"); Input.type = "text"; Input.style.width = "var(--resgui-6column)"; Input.style.maxWidth = "var(--resgui-6column)"; Input.style.minWidth = "var(--resgui-6column)"; DivContainerInput.appendChild(Input); DivContainerInput.Input = Input; var ImgDeleteRow = document.createElement("img"); ImgDeleteRow.src = "../../../../../../../../images/icons/deleteIcon.png"; ImgDeleteRow.className = "icon-image-button"; ImgDeleteRow.DivContainerInput = DivContainerInput; ImgDeleteRow.DivInputs = this.DivInputs; ImgDeleteRow.DivRow = this.DivRow; ImgDeleteRow.DivContainerRow = this.DivContainerRow; ImgDeleteRow.addEventListener("click", function(){ this.DivInputs.removeChild(this.DivContainerInput); this.DivRow.style.height = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivRow.style.minHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivRow.style.maxHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivContainerRow.style.height = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivContainerRow.style.minHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivContainerRow.style.maxHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; }); DivContainerInput.appendChild(ImgDeleteRow); this.DivRow.style.height = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivRow.style.minHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivRow.style.maxHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivContainerRow.style.height = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivContainerRow.style.minHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivContainerRow.style.maxHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; }); DivContainerInput.appendChild(ImgAdd); var ImgAddRow = document.createElement("img"); ImgAddRow.src = "../../../../../../../../images/icons/addIcon.png"; ImgAddRow.className = "icon-image-button"; ImgAddRow.DivToAppend = DivToAppend; ImgAddRow.addEventListener("click", function() { CreateRowArgoKeys(this.DivToAppend, true); }) DivRow.appendChild(ImgAddRow); if(EnableDelete) { var ImgDeleteRow = document.createElement("img"); ImgDeleteRow.src = "../../../../../../../../images/icons/deleteIcon.png"; ImgDeleteRow.className = "icon-image-button"; ImgDeleteRow.DivToAppend = DivToAppend; ImgDeleteRow.Row = DivRow; ImgDeleteRow.addEventListener("click", function(){ this.DivToAppend.removeChild(this.Row); }); DivRow.appendChild(ImgDeleteRow); } if(Value) { if(Value.SecondaryKey) { if(CloneValue.length > 0) { for(var Index in CloneValue) { var DivContainerInputWithValue = document.createElement("div"); DivContainerInputWithValue.className = "resgui-1row relative-full-width justify-content-flex-start align-items-center"; DivInputs.appendChild(DivContainerInputWithValue); var InputWithValue = document.createElement("input"); InpuInputWithValuet.type = "text"; InputWithValue.style.width = "var(--resgui-6column)"; InputWithValue.style.maxWidth = "var(--resgui-6column)"; InputWithValue.style.minWidth = "var(--resgui-6column)"; InputWithValue.value = CloneValue[Index]; DivContainerInputWithValue.appendChild(InputWithValue); DivContainerInputWithValue.Input = IInputWithValuenput; var ImgDeleteRow = document.createElement("img"); ImgDeleteRow.src = "../../../../../../../../images/icons/deleteIcon.png"; ImgDeleteRow.className = "icon-image-button"; ImgDeleteRow.DivContainerInput = DivContainerInputWithValue; ImgDeleteRow.DivInputs = DivInputs; ImgDeleteRow.DivRow = DivRow; ImgDeleteRow.DivContainerRow = DivContainerRow; ImgDeleteRow.addEventListener("click", function(){ this.DivInputs.removeChild(this.DivContainerInput); this.DivRow.style.height = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivRow.style.minHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivRow.style.maxHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivContainerRow.style.height = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivContainerRow.style.minHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; this.DivContainerRow.style.maxHeight = "var(--resgui-" + (this.DivInputs.children.length + 3) + "row)"; }); DivContainerInput.appendChild(ImgDeleteRow); DivRow.style.height = "var(--resgui-" + (DivInputs.children.length + 3) + "row)"; DivRow.style.minHeight = "var(--resgui-" + (DivInputs.children.length + 3) + "row)"; DivRow.style.maxHeight = "var(--resgui-" + (DivInputs.children.length + 3) + "row)"; DivContainerRow.style.height = "var(--resgui-" + (DivInputs.children.length + 3) + "row)"; DivContainerRow.style.minHeight = "var(--resgui-" + (DivInputs.children.length + 3) + "row)"; DivContainerRow.style.maxHeight = "var(--resgui-" + (DivInputs.children.length + 3) + "row)"; } } } } return DivRow; } function CreateSTEKeys(DivToAppend,EnableDelete,Value) { var DivRow = document.createElement("div"); DivRow.className = "row-direction resgui-9column resgui-11row align-items-center"; DivToAppend.appendChild(DivRow); DivRow.ObjectToGet = []; DivRow.GetObject = function() { var resultObj = {}; for(var Index in this.DivInputs) { if(this.DivInputs[Index].type == "text") resultObj[this.DivInputs[Index].NameProperty] = this.DivInputs[Index].value; if(this.DivInputs[Index].type == "checkbox") resultObj[this.DivInputs[Index].NameProperty] = this.DivInputs[Index].checked; } //console.log(this.ObjectToGet); return resultObj; } var DivContainerRow = document.createElement("div"); DivContainerRow.className = "column-direction resgui-8column resgui-11row"; DivRow.appendChild(DivContainerRow); DivRow.DivInputs = []; if(Value) { DivRow.ObjectToGet.push(Value); } DivRow.AddRow = function(NameProp,STEKey,type,value) { //var DivContainerInput = document.createElement("div"); //DivContainerInput.className = "resgui-1row relative-full-width justify-content-flex-start align-items-center column-direction"; var Input = document.createElement("input"); Input.type = type; Input.NameProperty = NameProp; if(type=="checkbox") Input.checked = value; else Input.value = value; DivRow.Input = Input; //DivContainerInput.appendChild(Input); DivRow.DivInputs.push(Input); var DivSpanName = document.createElement("div"); DivSpanName.className = "resgui-1row relative-full-width justify-content-flex-start align-items-center"; var SpanName = document.createElement("span"); SpanName.innerHTML = STEKey; SpanName.style.marginLeft = "var(--resgui-quartercolumn)"; DivSpanName.appendChild(SpanName); DivContainerRow.appendChild(DivSpanName); DivContainerRow.appendChild(Input); } if(!Value) { DivRow.AddRow("Name",$MWGUI.GetLanguageString("STEKeyName"),"text",""); DivRow.AddRow("ClusterInstance",$MWGUI.GetLanguageString("STEKeyClusterInstance"),"text",""); DivRow.AddRow("IsAdConnectionType",$MWGUI.GetLanguageString("STEKeyIsAdConnectionType"),"checkbox",""); DivRow.AddRow("ConnectsLink",$MWGUI.GetLanguageString("STEKeyConnectsLink"),"text",""); DivRow.AddRow("ActiveDirectoryLink",$MWGUI.GetLanguageString("STEKeyADLink"),"text",""); DivRow.AddRow("InstanceID",$MWGUI.GetLanguageString("STEInstanceID"),"text",""); }else{ DivRow.AddRow("Name",$MWGUI.GetLanguageString("STEKeyName"),"text",Value.Name); DivRow.AddRow("ClusterInstance",$MWGUI.GetLanguageString("STEKeyClusterInstance"),"text",Value.ClusterInstance); DivRow.AddRow("IsAdConnectionType",$MWGUI.GetLanguageString("STEKeyIsAdConnectionType"),"checkbox",Value.IsAdConnectionType); DivRow.AddRow("ConnectsLink",$MWGUI.GetLanguageString("STEKeyConnectsLink"),"text",Value.ConnectsLink); DivRow.AddRow("ActiveDirectoryLink",$MWGUI.GetLanguageString("STEKeyADLink"),"text",Value.ActiveDirectoryLink); DivRow.AddRow("InstanceID",$MWGUI.GetLanguageString("STEInstanceID"),"text",Value.InstanceID); } if(!EnableDelete) { var ImgAddRow = document.createElement("img"); ImgAddRow.src = "../../../../../../../../images/icons/addIcon.png"; ImgAddRow.className = "icon-image-button"; ImgAddRow.DivToAppend = DivToAppend; ImgAddRow.DivInputs = DivRow.DivInputs; ImgAddRow.addEventListener("click", function() { //DivToAppend.GetValue(); CreateSTEKeys(this.DivToAppend, true); }) DivRow.appendChild(ImgAddRow); } if(EnableDelete) { var ImgDeleteRow = document.createElement("img"); ImgDeleteRow.src = "../../../../../../../../images/icons/deleteIcon.png"; ImgDeleteRow.className = "icon-image-button"; ImgDeleteRow.DivToAppend = DivToAppend; ImgDeleteRow.Row = DivRow; ImgDeleteRow.addEventListener("click", function(){ this.DivToAppend.removeChild(this.Row); }); DivRow.appendChild(ImgDeleteRow); } return DivRow; } } var $TMWGUIForm = new TMWGUIForm();