$MWGUI.RegisterLanguageString("MainPageTitle", {"en":"Main page", "it":"Pagina principale"}); $MWGUI.RegisterLanguageString("Home", {"en":"Main page", "it":"Pagina principale"}); $MWGUI.RegisterLanguageString("TitleEditUser", {"en":"Edit User", "it":"Edita l'utente"}); $MWGUI.RegisterLanguageString("ArgoMainPage", {"en":"Argo", "it":"Argo"}); $MWGUI.RegisterLanguageString("HomePage", {"en":"Home page", "it":"Pagina iniziale"}); $MWGUI.RegisterLanguageString("LogOut", {"en":"Logout", "it":"Disconnettiti"}); $MWGUI.RegisterLanguageString("StartSplashTitle", {"en":"Mosaico World", "it":"Mosaico World"}); $MWGUI.RegisterLanguageString("StartSplashSpan", {"en":"Loading work environment...", "it":"Caricamento ambiente di lavoro in corso..."}); $MWGUI.RegisterLanguageString("DeviceList", {"en":"Device list", "it":"Lista dispositivi"}); $MWGUI.RegisterLanguageString("DeviceConfiguration", {"en":"Device configuration", "it":"Configurazione dispositivi"}); var cookies; function HideShowAllCustomBoxesContestual(ev){ ev.stopPropagation(); let Icon = document.getElementById("HIdeShowContestualCustomBoxes"); if(!Icon.hasOwnProperty("OnHideFunction")) { Icon.OnHideFunction = false; } let BackGrounds = document.getElementsByClassName("CustomBoxMain"); if(BackGrounds.length > 0) { let CanContinue = false; for(let Index in BackGrounds) { if (BackGrounds[Index].hasOwnProperty("Me")) { if (BackGrounds[Index].Me.hasOwnProperty("EnabledHide")){ if(BackGrounds[Index].Me.EnabledHide == true) { if(BackGrounds[Index].Me.document == document) CanContinue = true; } } } } if(CanContinue) { if(Icon.OnHideFunction == true) { Icon.OnHideFunction = false; Icon.className += " InternalAnimationPulse" Icon.src = "../../../../../../../../../../../../../images/icons/windowsClose.png" if(BackGrounds.length > 0) { for(let index in BackGrounds) { if(BackGrounds[index].hasOwnProperty("Me")) { BackGrounds[index].Me.HideAllCustomBoxesByParent(document); } } } } else { Icon.OnHideFunction = true; Icon.className = "icon-image-button"; Icon.src = "../../../../../../../../../../../../../images/icons/windowsOpen.png" if(BackGrounds.length > 0) { for(let index in BackGrounds) { if(BackGrounds[index].hasOwnProperty("Me")) { BackGrounds[index].Me.ShowAllCustomBoxesByParent(document); } } } } } } else { Icon.OnHideFunction = true; Icon.className = "icon-image-button"; Icon.src = "../../../../../../../../../../../../../images/icons/windowsOpen.png" if(BackGrounds.length > 0) { for(let index in BackGrounds) { if(BackGrounds[index].hasOwnProperty("Me")) { BackGrounds[index].Me.ShowAllCustomBoxesByParent(document); } } } } } function Load() { localStorage.removeItem("connectPopupManager::connect::loginPopup") ; localStorage.clear(); $MW.IndexManager(function(){ $MWGUI.LoadDictionary(function(){ }); },true); $MW.InitializeBroadcastChannel(); } function Close() { if($MW) if($MW.MWChildren) if($MW.MWChildren.MWChildren) if($MW.MWChildren.MWChildren.SaveCache != undefined) $MW.MWChildren.MWChildren.SaveCache(null, function(Answer){}); return "closing"; } function LoadUser() { var CustomBox = new TMWGUICustomBox(18, 30); var spanTitle = document.createElement("span"); spanTitle.style.marginLeft = "var(--resgui-halfcolumn)"; spanTitle.innerHTML = $MWGUI.GetLanguageString("TitleEditUser"); 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.className += " justify-content-space-between"; CustomBox.Title.appendChild(spanTitle); CustomBox.Title.appendChild(spanClose); var Request={ "AssemblyName": "BaseElement", "ClassReference": "BaseElement.Kernel.TUser" }; $MW.ExeLambda("MosaicoWorldApplication-GetRoleStructure-1L1MAW6O8BZML",Request, function(Answer,OriginalMessage) { var RoleStructure = Answer; var RoleStructureSorted = []; var HTMLGUIFormObject = {}; HTMLGUIFormObject["GUIDescriptor"] = {}; HTMLGUIFormObject["GUIDescriptor"]["Content"] = {}; HTMLGUIFormObject["GUIDescriptor"]["Content"]["Categories"] = {}; HTMLGUIFormObject["GUIDescriptor"]["Content"]["Properties"] = {}; HTMLGUIFormObject["GUIDescriptor"]["Id"] = "BaseElement.Kernel.TUser"; HTMLGUIFormObject["StructureDescriptor"] = RoleStructure; for(var Key in RoleStructure) { if(Key == "Class") continue; if(RoleStructure[Key].InstancesManagerColumnPosition>-1) { RoleStructureSorted[RoleStructure[Key].InstancesManagerColumnPosition] = Key; $MWGUI.RegisterLanguageString(Key,{"en":Key,"it":Key}); if(RoleStructure[Key].Appaerance != 0) { $MWGUI.RegisterLanguageString(RoleStructure[Key].Category,{"en":RoleStructure[Key].Category,"it":RoleStructure[Key].Category}); HTMLGUIFormObject["GUIDescriptor"]["Content"]["Categories"][RoleStructure[Key].Category] = {}; HTMLGUIFormObject["GUIDescriptor"]["Content"]["Properties"][Key] = {}; } } else if(RoleStructure[Key].Appaerance != 0) { $MWGUI.RegisterLanguageString(Key,{"en":Key,"it":Key}); if(RoleStructure[Key].Appaerance != 0) { $MWGUI.RegisterLanguageString(RoleStructure[Key].Category,{"en":RoleStructure[Key].Category,"it":RoleStructure[Key].Category}); HTMLGUIFormObject["GUIDescriptor"]["Content"]["Categories"][RoleStructure[Key].Category] = {}; HTMLGUIFormObject["GUIDescriptor"]["Content"]["Properties"][Key] = {}; } } } for(var Key in RoleStructure.Class) { if(RoleStructure.Class[Key].InstancesManagerColumnPosition>-1) { RoleStructureSorted[RoleStructure.Class[Key].InstancesManagerColumnPosition] = Key; $MWGUI.RegisterLanguageString(RoleStructure.Class[Key].DisplayedName,{"en":RoleStructure.Class[Key].DisplayedName,"it":RoleStructure.Class[Key].DisplayedName}); } } $MWGUI.LoadDictionary(()=>{ for(var Key in HTMLGUIFormObject["GUIDescriptor"]["Content"]["Categories"]) { HTMLGUIFormObject["GUIDescriptor"]["Content"]["Categories"][Key] = $MWGUI.DictionaryLanguage[Key]; } for(var Key in HTMLGUIFormObject["GUIDescriptor"]["Content"]["Properties"]) { HTMLGUIFormObject["GUIDescriptor"]["Content"]["Properties"][Key] = $MWGUI.DictionaryLanguage[Key]; } var SaveUser = function(NewObject,OriginalObject) { var EditedProperties = {}; for(var Property in OriginalObject) { if(NewObject[Property] == null) NewObject[Property] = OriginalObject[Property]; if(NewObject[Property] != OriginalObject[Property]) EditedProperties[Property] = NewObject[Property]; } $MW.StoreProcedureUpdate("MosaicoWorld", "BaseElement", "BaseElement.Kernel.TUser", NewObject["ID"], EditedProperties, function(Answer,OriginalMessage) { if(Answer != null) { $MW.User = NewObject; CustomBox.Close(); } else { $MWGUI.MessageBoxShow($MWGUI.GetLanguageString("ErrorMsgTitle"),$MWGUI.GetLanguageString("ErrorMsgBody"),"error",[{"text":$MWGUI.GetLanguageString("MessageButtonOK"),"Callback":function(){}}]); CustomBox.Close(); } }, function(Error,ErrorStack) { console.error(Error); CustomBox.Close(); }); } var LanguageDescriptions = new Array(); LanguageDescriptions.push(""); LanguageDescriptions.push($MWGUI.GetLanguageString("SaveButton")); var GUIObject = $TMWGUIForm.CreateForm(HTMLGUIFormObject, $MW.User, $MWGUI.CurrentLanguage, LanguageDescriptions, null, SaveUser, null, null); spanClose.GUIObject = GUIObject; if (GUIObject["Form"] != null) { CustomBox.Body.innerHTML = ""; CustomBox.Body.appendChild(GUIObject["Form"]); } CustomBox.Open(); }); }, function(Error,ErrorStack) { console.error(Error); } ); //document.getElementById("MainIframe").src = "commons/user/PagesContainer.html?" + btoa(JSON.stringify({"IframeSrc":"/commons/user/userList.html?" + $MW.Base64Encode('{"Query":{"Type":"Eq", "Field":"_id", "Value":"' + $MW.User.sub + '"}, "DisableCache":true}')})); } function LoadArgo() { $MW.ContextMenu.Enable(); $MWArgo.LoadMenu(); $MWGUI.ChangePage($MWGUI.GetLanguageString("Home"), "../../../../../../../../../../Argo/Home/Home.html"); //$MWGUI.ChangePage($MWGUI.GetLanguageString("StatisticsGeneralPage"), "../../../../../../../../../../Argo/Statistics/General/StatisticsGeneral.html"); //document.getElementById("MainIframe").src = "../../../../../../../../../../Argo/Landing.html"; } function LoadSTE() { //$MWSTE.CreateManagerCCPs(); $MW.ContextMenu.Enable(); $MWSTE.LoadMenu(); $MWGUI.ChangePage("STE Info", "../../../../../../../../../../STE/Site/index.html"); } function LoadPrimeGate() { var MainMenuOptions = {}; MainMenuOptions.Pages = {}; MainMenuOptions.Pages["DeviceList"] = {"Location":"../../../../../../../../../../PrimeGate/MosaicoworldPage/DeviceList/index.html", "Icon":"../../../../../../../../../../../../../../images/icons/anywhereIcon.png", "Label":$MWGUI.GetLanguageString("DeviceList"), "PageTitle":$MWGUI.GetLanguageString("DeviceList")}; MainMenuOptions.Pages["DeviceConfiguration"] = {"Location":"../../../../../../../../../../../../../../../PrimeGate/MosaicoworldPage/DeviceConfiguration/index.html", "Icon":"../../../../../../../../../../images/icons/folderIcon.png", "Label": $MWGUI.GetLanguageString("DeviceConfiguration"), "PageTitle":$MWGUI.GetLanguageString("DeviceConfiguration")}; $MWGUI.InitMainMenu(MainMenuOptions); $MWGUI.ChangePage($MWGUI.GetLanguageString("DeviceList"), "../../../../../../../../../../PrimeGate/MosaicoworldPage/DeviceList/index.html"); $MW.ContextMenu.Enable(); /* $MW.ContextMenu.Disable(); $MW.OpenLoading(); var HttpAjax = new XMLHttpRequest(); HttpAjax.onreadystatechange = function (answer) { if (HttpAjax.readyState == 4 || HttpAjax.readyState == "complete") { $MW.CloseLoading(); var jsonDevice = JSON.parse($MW.Base64Decode(HttpAjax.responseText.replace(/"/g,""))); jsonDevice["Devices"] = $MW.Base64Encode(JSON.stringify(["xvdmmds15t"]));//"xvdmmds15t","0nkmcm3fti","aqgddpzn40" jsonDevice["Note"] = "CTxkaXY+CgkJPG9sPgoJCQk8bGk+SlMgU29jLiBVbmlwZXJzb25hbGU8L2xpPgoJCQk8bGk+SVIzM0MgZGkgVGVzdDwvbGk+CgkJCTxsaT5WaWEgQWxlc3NhbmRybyBWb2x0YSwgNTAsIDMwMDIwLCBOb3ZlbnRhIGRpIFBpYXZlIFZFLCBJdGFseTwvbGk+CgkJPC9vbD4KCTwvZGl2Pg=="; jsonDevice["Level"] = "ADMIN"; jsonDevice["Username"] = $MW.User.Username; window.open("https://testmosaicoworld.com/PrimeGate/index.html?" + $MW.Base64Encode(JSON.stringify(jsonDevice))); } }; HttpAjax.open("POST", "https://icyilb7662.execute-api.eu-west-1.amazonaws.com/Prod/loginfromexternalsource", true); HttpAjax.setRequestHeader("Content-Type", "application/json"); HttpAjax.send('{"Message":"eyJVc2VybmFtZSI6ImlyaXNfYXBwbGljYXRpb24iLCJQYXNzd29yZCI6IlBXQ1Bhc3MyMDIxKioifQ=="}');*/ //JSON.stringify({"Message":btoa(JSON.stringify({"Username":"iris_application","Password":"PWCPass2021**"}))})); } function LogOut() { $MW.Logout(); }