Type=Class Version=5 ModulesStructureVersion=1 B4J=true @EndOfDesignText@ 'Class module Sub Class_Globals Private smtp as SMTP Private ws As WebSocket 'ignore ' will hold our page information Public page As ABMPage ' page theme Private theme As ABMTheme ' to access the constants Private ABM As ABMaterial 'ignore ' name of the page, must be the same as the class name (case sensitive!) Public Name As String = "frmEmailAccounts" '<-------------------------------------------------------- IMPORTANT Private ABMPageId As String = "" ' your own variables Dim Origin As String = "http://localhost:51045" '<--- IMPORTANT for youtube videos. Set here your website address ' the download folder Public DownloadFolder As String = "/www/" & ABMShared.AppName & "/uploads/" Public DownloadMaxSize As String = 100*1024 Private myToastId As Int Private dbAction As Map Private ActiveID As Int private IsNew As Boolean Private Filter As String Private LastSort As String Private FilterCount As String Private OldValue As String Public MaxRows As Int = 10 End Sub 'Initializes the object. You can add parameters to this method if needed. Public Sub Initialize() ' build the local structure IMPORTANT! BuildPage End Sub Private Sub WebSocket_Connected (WebSocket1 As WebSocket) '----------------------MODIFICATION------------------------------- Log("Connected") ws = WebSocket1 ABMPageId = ABM.GetPageID(page, Name,ws) Dim session As HttpSession = ABM.GetSession(ws, ABMShared.SessionMaxInactiveIntervalSeconds) If ABMShared.NeedsAuthorization Then If session.GetAttribute2("IsAuthorized", "") = "" Then ABMShared.NavigateToPage(ws, ABMPageId, "../") Return End If End If ABM.UpdateFromCache(Me, ABMShared.CachedPages, ABMPageId, ws) If page.ComesFromPageCache Then ' when we have a page that is cached it doesn't matter if it comes or not from a new connection we serve the cached version. Log("Comes from cache") page.Refresh page.FinishedLoading Else If page.WebsocketReconnected Then Log("Websocket reconnected") ' when we have a client that doesn't have the page in cache and it's websocket reconnected and also it's session is new - basically when the client ' had internet problems and it's session (and also cache) expired before he reconnected so the user has content in the browser but we don't have ' any on the server. So we need to reload the page. ' when a client that doesn't have the page in cache and it's websocket reconnected but it's session is not new - when the client had internet ' problems and when he reconnected it's session was valid but he had no cache for this page we need to reload the page as the user browser has ' content, reconnected but we have no content in cache ABMShared.NavigateToPage (ws, ABMPageId, "./" & page.PageHTMLName) Else ' when the client did not reconnected it doesn't matter if the session was new or not because this is the websockets first connection so no dynamic ' content in the browser ... we are going to serve the dynamic content... Log("Websocket first connection") page.Prepare ConnectPage End If End If Log(ABMPageId) '----------------------MODIFICATION------------------------------- End Sub Private Sub WebSocket_Disconnected() Log("Disconnected") Try ws.Session.RemoveAttribute("abmcallback") ws.Session.RemoveAttribute("abmdownloadfolder") ws.Session.RemoveAttribute("abmmaxsize") Catch Log(LastException.Message) End Try End Sub Sub Page_ParseEvent(Params As Map) Dim eventName As String = Params.Get("eventname") Dim eventParams() As String = Regex.Split(",",Params.Get("eventparams")) If eventName = "beforeunload" Then Log("preparing for url refresh") ABM.RemoveMeFromCache(ABMShared.CachedPages, ABMPageId) Return End If If SubExists(Me, eventName) Then Params.Remove("eventname") Params.Remove("eventparams") Select Case Params.Size Case 0 CallSub(Me, eventName) Case 1 CallSub2(Me, eventName, Params.Get(eventParams(0))) Case 2 If Params.get(eventParams(0)) = "abmistable" Then Dim PassedTables As List = ABM.ProcessTablesFromTargetName(Params.get(eventParams(1))) CallSub2(Me, eventName, PassedTables) Else CallSub3(Me, eventName, Params.Get(eventParams(0)), Params.Get(eventParams(1))) End If Case Else ' cannot be called diretly, to many param CallSub2(Me, eventName, Params) End Select End If End Sub public Sub BuildTheme() ' start with the base theme defined in ABMShared theme.Initialize("pagetheme") theme.AddABMTheme(ABMShared.MyTheme) ' add additional themes specific for this page theme.Page.BackColor = ABM.COLOR_TRANSPARENT theme.Page.BackColorIntensity = ABM.INTENSITY_NORMAL theme.Page.ConnectedIndicatorColor = ABM.COLOR_GREEN theme.Page.ConnectedIndicatorColorIntensity = ABM.INTENSITY_NORMAL theme.Page.DisconnectedIndicatorColor = ABM.COLOR_RED theme.Page.DisconnectedIndicatorColorIntensity = ABM.INTENSITY_NORMAL theme.Page.PlaceHolderColor = ABM.COLOR_GREY theme.Page.PlaceHolderColorIntensity = ABM.INTENSITY_NORMAL End Sub public Sub BuildPage() ' initialize the theme BuildTheme ' initialize this page using our theme page.InitializeWithTheme(Name, "/ws/" & ABMShared.AppName & "/" & Name, False, ABMShared.SessionMaxInactiveIntervalSeconds, theme) page.ShowLoader=True page.ShowLoaderType=ABM.LOADER_TYPE_MANUAL page.SetLoaderDEVICESWITCH page.PageHTMLName = "frmEmailAccounts.html" page.PageTitle = "DRPW" page.PageDescription = "" page.PageKeywords = "" page.PageSiteMapPriority = "0.50" page.PageSiteMapFrequency = ABM.SITEMAP_FREQ_MONTHLY 'page.UseFontAwesome = False page.DisableBackButton = False page.UseGoogleAnalytics(ABMShared.TrackingID, Null) ' IMPORTANT Change this to your own TrackingID !!!!!!! page.GoogleMapsAPIExtras = ABMShared.GoogleMapsAPIExtras page.IsFixedFooter = False page.DisablePageReloadOnSwipeDown = True page.ShowConnectedIndicator = True page.PageLanguage = "en" page.SetFontStack("arial,sans-serif") page.AlwaysShowVerticalScrollBar = False ' adding a navigation bar Dim sbtopimg As ABMImage sbtopimg.Initialize(page, "sbtopimg", "../images/drpwlogo.png", 1) sbtopimg.IsCircular = False sbtopimg.SetFixedSize(279, 79) page.NavigationBar.Initialize(page, "navBar", ABM.SIDEBAR_MANUAL_HIDEMEDIUMSMALL, "Email Accounts", True, True, 400, 49, sbtopimg, ABM.COLLAPSE_ACCORDION, "drpw") page.NavigationBar.ActiveSideReturnName = "frmUserAdministration" page.NavigationBar.ActiveSideSubReturnName = "frmEmailAccounts" page.NavigationBar.SideBarLogoHeight = 79 page.NavigationBar.TopBarDropDownConstrainWidth = True ' you must add at least ONE dummy item if you want to add items to the topbar in ConnectNaviagationBar page.NavigationBar.AddTopItem("DUMMY", " ", "", "", False) ' you must add at least ONE dummy item if you want to add items to the sidebar page.NavigationBar.AddSideBarItem("DUMMY", " ", "", "") page.ShowGridInfo = False ' create the page grid page.AddRows(1, True, "").AddCells12(1, "") page.AddRows(1, True, "").AddCells12(1, "") page.AddRows(1, True, "").AddCellsOS(1, 0, 0, 0, 10, 10, 11, "").AddCellsOSMP(1, 0, 0, 0, 2, 2, 1, 14, 0, 0, 0, "") page.AddRows(2, True, "").AddCells12(1, "") page.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components ' add a error box template if the name is not entered page.AddModalSheetTemplate(ABMShared.BuildWrongInputModalSheet(page)) ' add a modal sheet template for a yes no msgbox page.AddModalSheetTemplate(ABMShared.BuildMsgBoxYesNo(page)) ' add a modal sheet template for a msgbox page.AddModalSheetTemplate(ABMShared.BuildMsgBox(page)) page.AddModalSheetTemplate(BuildModalSheetmsEmailAccounts) End Sub Private Sub BuildModalSheetmsEmailAccounts() As ABMModalSheet Dim msEmailAccounts As ABMModalSheet msEmailAccounts.Initialize(page, "msEmailAccounts", True, ABM.MODALSHEET_TYPE_NORMAL, "") msEmailAccounts.Size = ABM.MODALSHEET_SIZE_NORMAL msEmailAccounts.IsDismissible = False msEmailAccounts.IsTextSelectable = True msEmailAccounts.Footer.AddRowsM(1, True, 0, 0, "").AddCellsOS(1, 0, 0, 0, 12, 12, 12, "") msEmailAccounts.Header.AddRowsM(1, True, 0, 0, "").AddCellsOS(1, 0, 0, 0, 12, 12, 12, "") msEmailAccounts.Content.AddRowsM(1, True, 0, 0, "").AddCells12(1, "") msEmailAccounts.Content.AddRowsM(1, True, 0, 0, "").AddCellsOSMP(1, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, "").AddCellsOSMP(1, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, "") msEmailAccounts.Content.AddRowsM(1, True, 0, 0, "").AddCellsOSMP(1, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, "").AddCellsOSMP(1, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, "") msEmailAccounts.Content.AddRowsM(1, True, 0, 0, "").AddCellsOSMP(1, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, "").AddCellsOSMP(1, 0, 0, 0, 6, 6, 6, 0, 0, 0, 0, "") msEmailAccounts.Content.AddRowsM(1, True, 0, 0, "").AddCellsOSMP(1, 0, 0, 0, 6, 6, 6, 14, 0, 10, 0, "").AddCellsOSMP(1, 0, 0, 0, 6, 6, 6, 14, 0, 10, 0, "") msEmailAccounts.Header.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components msEmailAccounts.Content.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components msEmailAccounts.Footer.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components 'Add components to ModalSheet Dim lblEmailAccounts As ABMLabel lblEmailAccounts.Initialize(page, "lblEmailAccounts", "{NBSP}Add / Edit Email Account", ABM.SIZE_H5, False, "whitefc") msEmailAccounts.Header.Cell(1,1).AddComponent(lblEmailAccounts) Dim txtEmailAccountsaccount As ABMInput txtEmailAccountsaccount.Initialize(page, "txtEmailAccountsaccount", ABM.INPUT_TEXT, "Account", False, "") txtEmailAccountsaccount.inputMask = "" txtEmailAccountsaccount.Visibility = ABM.VISIBILITY_ALL msEmailAccounts.Content.Cell(2,1).AddComponent(txtEmailAccountsaccount) Dim txtEmailAccountsadministrator As ABMInput txtEmailAccountsadministrator.Initialize(page, "txtEmailAccountsadministrator", ABM.INPUT_EMAIL, "Administrator Email", False, "") txtEmailAccountsadministrator.inputMask = "" txtEmailAccountsadministrator.Visibility = ABM.VISIBILITY_ALL msEmailAccounts.Content.Cell(2,2).AddComponent(txtEmailAccountsadministrator) Dim txtEmailAccountsserver As ABMInput txtEmailAccountsserver.Initialize(page, "txtEmailAccountsserver", ABM.INPUT_TEXT, "SMTP Server", False, "") txtEmailAccountsserver.inputMask = "" txtEmailAccountsserver.Visibility = ABM.VISIBILITY_ALL msEmailAccounts.Content.Cell(3,1).AddComponent(txtEmailAccountsserver) Dim txtEmailAccountsport As ABMInput txtEmailAccountsport.Initialize(page, "txtEmailAccountsport", ABM.INPUT_TEL, "Port", False, "") txtEmailAccountsport.inputMask = "" txtEmailAccountsport.Visibility = ABM.VISIBILITY_ALL msEmailAccounts.Content.Cell(3,2).AddComponent(txtEmailAccountsport) Dim txtEmailAccountsusername As ABMInput txtEmailAccountsusername.Initialize(page, "txtEmailAccountsusername", ABM.INPUT_TEXT, "User Name", False, "") txtEmailAccountsusername.inputMask = "" txtEmailAccountsusername.Visibility = ABM.VISIBILITY_ALL msEmailAccounts.Content.Cell(4,1).AddComponent(txtEmailAccountsusername) Dim txtEmailAccountspassword As ABMInput txtEmailAccountspassword.Initialize(page, "txtEmailAccountspassword", ABM.INPUT_TEXT, "Password", False, "") txtEmailAccountspassword.inputMask = "" txtEmailAccountspassword.Visibility = ABM.VISIBILITY_ALL msEmailAccounts.Content.Cell(4,2).AddComponent(txtEmailAccountspassword) Dim chkEmailAccountsStartTLSMode As ABMCheckbox chkEmailAccountsStartTLSMode.Initialize(page, "chkEmailAccountsStartTLSMode", "Start TLS Mode", False, "") chkEmailAccountsStartTLSMode.Visibility = ABM.VISIBILITY_ALL msEmailAccounts.Content.Cell(5,1).AddComponent(chkEmailAccountsStartTLSMode) Dim chkEmailAccountsUseSSL As ABMCheckbox chkEmailAccountsUseSSL.Initialize(page, "chkEmailAccountsUseSSL", "Use SSL", False, "") chkEmailAccountsUseSSL.Visibility = ABM.VISIBILITY_ALL msEmailAccounts.Content.Cell(5,2).AddComponent(chkEmailAccountsUseSSL) Dim btnApplyEmailAccounts As ABMButton btnApplyEmailAccounts.InitializeFlat(page, "btnApplyEmailAccounts", "", "", "Save", "transparent") btnApplyEmailAccounts.Size = ABM.BUTTONSIZE_NORMAL msEmailAccounts.Footer.Cell(1,1).AddComponent(btnApplyEmailAccounts) Dim btnCancelEmailAccounts As ABMButton btnCancelEmailAccounts.InitializeFlat(page, "btnCancelEmailAccounts", "", "", "Cancel", "transparent") btnCancelEmailAccounts.Size = ABM.BUTTONSIZE_NORMAL msEmailAccounts.Footer.Cell(1,1).AddComponent(btnCancelEmailAccounts) Return msEmailAccounts End Sub Sub msEmailAccountsClear() Dim msEmailAccounts As ABMModalSheet msEmailAccounts = page.ModalSheet("msEmailAccounts") Dim txtEmailAccountsaccount As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsaccount") Dim txtEmailAccountsadministrator As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsadministrator") Dim txtEmailAccountsserver As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsserver") Dim txtEmailAccountsport As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsport") Dim txtEmailAccountsusername As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsusername") Dim txtEmailAccountspassword As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountspassword") Dim chkEmailAccountsStartTLSMode As ABMCheckbox = msEmailAccounts.Content.Component("chkEmailAccountsStartTLSMode") Dim chkEmailAccountsUseSSL As ABMCheckbox = msEmailAccounts.Content.Component("chkEmailAccountsUseSSL") txtEmailAccountsaccount.Text = "" txtEmailAccountsaccount.Refresh txtEmailAccountsadministrator.Text = "" txtEmailAccountsadministrator.Refresh txtEmailAccountsserver.Text = "" txtEmailAccountsserver.Refresh txtEmailAccountsport.Text = "" txtEmailAccountsport.Refresh txtEmailAccountsusername.Text = "" txtEmailAccountsusername.Refresh txtEmailAccountspassword.Text = "" txtEmailAccountspassword.Refresh chkEmailAccountsStartTLSMode.State = False chkEmailAccountsStartTLSMode.Refresh chkEmailAccountsUseSSL.State = False chkEmailAccountsUseSSL.Refresh End Sub Sub msgyes_Clicked(Target As String) Dim msg As ABMModalSheet = page.ModalSheet("confirm") Dim msgyes As ABMButton = msg.Footer.Component("msgyes") dim strTag As String strTag = msgyes.Tag YesNoProcess(strTag) page.CloseModalSheet("confirm") End Sub Sub msgok_Clicked(Target As String) page.CloseModalSheet("msgbox") End Sub Sub msgno_Clicked(Target As String) page.CloseModalSheet("confirm") End Sub ' clicked on the navigation bar Sub Page_NavigationbarClicked(Action As String, Value As String) page.SaveNavigationBarPosition If Action = "LogOff" Then ABMShared.LogOff(page) Return End If Select Case Action.ToLowerCase Case "newrecord" ExecuteNewRecord Return Case "goback" ExecuteGoBack Return Case "logoff" ExecuteLogOff Return End Select ABMShared.NavigateToPage(ws, ABMPageId, Value) End Sub Sub Page_FileUploaded(FileName As String, success As Boolean) page.ws.Flush ' IMPORTANT End Sub Sub Page_ToastClicked(ToastId As String, Action As String) page.DismissToast(ToastId) End Sub Sub Page_ToastDismissed(ToastId As String) End Sub Public Sub ConnectPage() 'connect navigation bar ConnectNavigationBar Dim NowWH As String = ABM.GetBrowserWidthHeight(page) If NowWH <> "" And NowWH <> ";" Then Dim split() As String = Regex.Split(";", NowWH) Dim NewH As Int = split(1) - 350 NewH = NewH / 50 NewH = NewH / 5 NewH = NewH * 5 If NewH >= 10 Then MaxRows = NewH End If End If 'add components for the page Dim EmailAccountsPager As ABMPagination EmailAccountsPager.Initialize(page, "EmailAccountsPager", 10, True, True, "") EmailAccountsPager.SetTotalNumberOfPages(10) page.Cell(4,1).AddComponent(EmailAccountsPager) Dim tblAccounts As ABMTable tblAccounts.Initialize(page, "tblAccounts", False, False, True, "tblTheme") tblAccounts.IsBordered = True tblAccounts.IsResponsive = True tblAccounts.IgnoreFormattingCodes = False tblAccounts.IsTextSelectable = True tblAccounts.SetHeaders(Array As String("ID", "Account", "Administrator Email", "SMTP Server", "Port", "User Name", "Password", "Start TLS Mode", "Use SSL", "Edit", "Test", "Delete")) tblAccounts.SetHeaderThemes(Array As String("bg", "bg", "bg", "bg", "bg", "bg", "bg", "bg", "bg", "bgc", "bgc", "bgc")) tblAccounts.SetHeaderHeights(Array As Int(0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 48)) tblAccounts.SetColumnVisible(Array As Boolean(False, True, True, True, True, True, False, True, True, True, True, True)) tblAccounts.SetColumnSortable(Array As Boolean(False, True, False, False, False, False, False, False, False, False, False, False)) tblAccounts.SetColumnDataFields(Array As String("id", "account", "administrator", "server", "port", "username", "password", "StartTLSMode", "UseSSL", "", "", "")) page.Cell(5,1).AddComponent(tblAccounts) Dim frmEmailAccountsNewRecord As ABMActionButton frmEmailAccountsNewRecord.Initialize(page, "frmEmailAccountsNewRecord", "mdi-content-add", "", "bigblue") frmEmailAccountsNewRecord.MainButton.Size = ABM.BUTTONSIZE_LARGE page.AddActionButton(frmEmailAccountsNewRecord) AdminAccess ' this page uses uploads, so needs some settings page.ws.session.SetAttribute("abmcallback", Me) page.ws.session.SetAttribute("abmdownloadfolder", DownloadFolder) page.ws.session.SetAttribute("abmmaxsize", DownloadMaxSize) page.Refresh ' IMPORTANT ' NEW, because we use ShowLoaderType=ABM.LOADER_TYPE_MANUAL page.FinishedLoading 'IMPORTANT page.RestoreNavigationBarPosition Filter = "" LastSort = "ORDER BY account" LoadEmailAccounts(1) End Sub Sub Page_SignedOffSocialNetwork(Network As String, Extra As String) page.ws.Session.SetAttribute("UserID", "") page.ws.Session.SetAttribute("UserEmail", "") page.ws.Session.SetAttribute("authType", "") page.ws.Session.SetAttribute("authName", "") page.ws.Session.SetAttribute("IsAuthorized", "") ABMShared.NavigateToPage(ws,ABMPageId, "../") End Sub Sub ExecuteNewRecord() 'Prepare page for new record If ABMShared.HasPermission("frmEmailAccounts","cancreate") = False Then Return ABMShared.SessionStorageSave(page, "action", "new") ABMShared.SessionStorageSave(page, "id", "-1") msEmailAccountsClear page.ShowModalSheet("msEmailAccounts") End Sub 'An ABMPagination event has been fired Sub EmailAccountsPager_PageChanged(OldPage As Int, NewPage As Int) Filter = "" LastSort = "ORDER BY account" LoadEmailAccounts(NewPage) End Sub Sub ExecuteGoBack() ABMShared.NavigateToPage(ws, ABMPageId, "../frmUserGroups/frmUserGroups.html") End Sub Sub ExecuteLogOff() ABMShared.NavigateToPage(ws, ABMPageId, "../frmSignIn/frmSignIn.html") End Sub 'An ABMActionButton has been clicked Sub frmEmailAccountsNewRecord_Clicked(Target As String, SubTarget As String) If SubTarget = "" Then Select Case Target.tolowercase End Select If ABMShared.HasPermission("frmEmailAccounts","cancreate") = False Then Return abmshared.SessionStorageSave(page, "action", "new") abmshared.SessionStorageSave(page, "EmailAccountsid", "-1") msEmailAccountsAddEditRecord msEmailAccountsClear page.ShowModalSheet("msEmailAccounts") Return End If End Sub 'An ABMButton has been clicked Sub btnApplyEmailAccounts_Clicked(Target As String) msEmailAccountsCreateUpdate page.CloseModalSheet("msEmailAccounts") End Sub 'An ABMButton has been clicked Sub btnCancelEmailAccounts_Clicked(Target As String) page.CloseModalSheet("msEmailAccounts") End Sub Private Sub LoadEmailAccounts(fromPage As Int) 'Lets get the component from the page. Dim tblAccounts As ABMTable = page.Component("tblAccounts") 'Define list to store the results of the query Dim results As List Dim resCnt As Int Dim resTot As Int Dim resMap As Map Dim sqlQry As String 'Read arguments from LocalStorage (if any) 'Let's define the qry string sqlQry = "SELECT * FROM EmailAccounts " & Filter & " " & LastSort & " LIMIT " & ((fromPage - 1) * MaxRows) & ", " & MaxRows 'Get connection from current pool if MySQL/MSSQL Dim jSQL As SQL = ABMShared.SQLGet 'Get the number of records Dim SQL_str As String SQL_str = "Select Count(id) As IDS FROM EmailAccounts " & Filter Dim NumRecords As Int = ABMShared.SQLSelectSingleResult(jSQL, SQL_str, Null) 'Get the records as a list of maps from the db results = ABMShared.SQLExecuteMaps(jSQL, sqlQry, Null) 'Close the connection to the database ABMShared.SQLClose(jSQL) If results.Size = 0 And fromPage > 1 Then 'we are on a page without any lines fromPage = fromPage - 1 LoadEmailAccounts(fromPage) Return End If tblAccounts.Clear 'Loop throught each record read and process it resTot = results.size - 1 For resCnt = 0 to resTot 'Get the record map resMap = results.get(resCnt) 'Update each table row Dim rCellValues As List Dim rCellThemes As List rCellValues.Initialize rCellThemes.Initialize Dim primKey As String = resMap.get("id") Dim id As String = resMap.GetDefault("id", "") If id = "" Then rCellValues.Add("{NBSP}") Else rCellValues.Add(id) End If 'Add theme to the cell rCellThemes.Add("nocolor") Dim account As String = resMap.GetDefault("account", "") If account = "" Then rCellValues.Add("{NBSP}") Else rCellValues.Add(account) End If 'Add theme to the cell rCellThemes.Add("nocolor") Dim administrator As String = resMap.GetDefault("administrator", "") If administrator = "" Then rCellValues.Add("{NBSP}") Else rCellValues.Add(administrator) End If 'Add theme to the cell rCellThemes.Add("nocolor") Dim server As String = resMap.GetDefault("server", "") If server = "" Then rCellValues.Add("{NBSP}") Else rCellValues.Add(server) End If 'Add theme to the cell rCellThemes.Add("nocolor") Dim port As String = resMap.GetDefault("port", "") If port = "" Then rCellValues.Add("{NBSP}") Else rCellValues.Add(port) End If 'Add theme to the cell rCellThemes.Add("nocolor") Dim username As String = resMap.GetDefault("username", "") If username = "" Then rCellValues.Add("{NBSP}") Else rCellValues.Add(username) End If 'Add theme to the cell rCellThemes.Add("nocolor") Dim password As String = resMap.GetDefault("password", "") If password = "" Then rCellValues.Add("{NBSP}") Else rCellValues.Add(password) End If 'Add theme to the cell rCellThemes.Add("nocolor") Dim StartTLSMode As String = resMap.GetDefault("starttlsmode", "") If StartTLSMode = "" Then rCellValues.Add("{NBSP}") Else Dim chkStartTLSMode As ABMCheckBox chkStartTLSMode.Initialize(page, "chkStartTLSMode", "", False, "") If StartTLSMode = 1 Then chkStartTLSMode.State = True Else chkStartTLSMode.State = False End If chkStartTLSMode.Tag = primKey chkStartTLSMode.Enabled = False rCellValues.Add(chkStartTLSMode) End If 'Add theme to the cell rCellThemes.Add("nocolor") Dim UseSSL As String = resMap.GetDefault("usessl", "") If UseSSL = "" Then rCellValues.Add("{NBSP}") Else Dim chkUseSSL As ABMCheckBox chkUseSSL.Initialize(page, "chkUseSSL", "", False, "") If UseSSL = 1 Then chkUseSSL.State = True Else chkUseSSL.State = False End If chkUseSSL.Tag = primKey chkUseSSL.Enabled = False rCellValues.Add(chkUseSSL) End If 'Add theme to the cell rCellThemes.Add("nocolor") Dim btnEditEmailAccounts As ABMButton btnEditEmailAccounts.InitializeFloating(page, "btnEditEmailAccounts", "mdi-action-visibility", "") btnEditEmailAccounts.Enabled = ABMShared.HasPermission("frmEmailAccounts","canupdate") rCellValues.Add(btnEditEmailAccounts) rCellThemes.Add("openedit") Dim btnTestEmailAccounts As ABMButton btnTestEmailAccounts.InitializeFloating(page, "btnTestEmailAccounts", "mdi-content-mail", "") btnTestEmailAccounts.Enabled = ABMShared.HasPermission("frmEmailAccounts","canread") rCellValues.Add(btnTestEmailAccounts) rCellThemes.Add("openedit") Dim btnDeleteEmailAccounts As ABMButton btnDeleteEmailAccounts.InitializeFloating(page, "btnDeleteEmailAccounts", "mdi-action-delete", "") btnDeleteEmailAccounts.Enabled = ABMShared.HasPermission("frmEmailAccounts","candelete") rCellValues.Add(btnDeleteEmailAccounts) rCellThemes.Add("openedit") 'Add the row to the table tblAccounts.AddRow("id" & resCnt, rCellValues) tblAccounts.SetRowThemes(rCellThemes) Next tblAccounts.Refresh 'Update the paginating component Dim pager As ABMPagination = page.Component("EmailAccountsPager") If (NumRecords Mod MaxRows > 0) Or (NumRecords = 0) Then NumRecords = NumRecords/MaxRows + 1 Else NumRecords = NumRecords/MaxRows End If pager.SetTotalNumberOfPages(NumRecords) pager.SetActivePage(fromPage) pager.Refresh End Sub 'Code to handle the sorting of the table Sub tblAccounts_SortChanged(DataField As String, Order As String) Select Case DataField Case "account" LastSort = " ORDER BY " & DataField & " " & Order & ", id " Case Else LastSort = " ORDER BY account " End Select Filter = "" Dim pager As ABMPagination = page.Component("EmailAccountsPager") LoadEmailAccounts(pager.GetActivePage()) End Sub 'Code to handle the search on the data Sub DoSearchEmailAccounts Dim txtSearch As ABMInput = page.Component("txtSearchEmailAccounts") Filter = txtSearch.Text If Filter <> "" Then Filter = " WHERE " Else Filter = "" End If 'reload the table LoadEmailAccounts(1) End Sub 'Code to handle the search enter press event Sub txtSearchEmailAccounts_EnterPressed(value As String) DoSearchEmailAccounts End Sub 'Code to handle button clicks on table for edit/delete Sub tblAccounts_Clicked(PassedRowsAndColumns As List) 'Get the details of the cell being selected Dim tblCellInfo As ABMTableCell = PassedRowsAndColumns.Get(0) 'Get the table being processed. Dim tblAccounts As ABMTable = page.Component(tblCellInfo.TableName) 'Read the first column in the current row and assign value to ActiveID ActiveId = tblAccounts.GetString(tblCellInfo.Row, 0) Select Case tblCellInfo.Column Case 9 'Edit a record If ABMShared.HasPermission("frmEmailAccounts","canupdate") = False Then Return ABMShared.SessionStorageSave(page, "action", "edit") ABMShared.SessionStorageSave(page, "EmailAccountsid", ActiveId) msEmailAccountsAddEditRecord Case 10 If ABMShared.HasPermission("frmEmailAccounts","canread") = False Then Return 'test email sending for email settings 'read the record from the database. 'Get connection from current pool if MySQL/MSSQL Dim jSQL As SQL = ABMShared.SQLGet 'get first available account, there should be 1 Dim id As String = ABMShared.SQLSelectSingleResult(jSQL, "select id from EmailAccounts Limit 1", Null) 'read the email settings first Dim es As Map es = ABMShared.SQLRecordRead(jSQL,"EmailAccounts", "id", id) Dim admin As String = es.GetDefault("administrator","") Dim sbody As String = "Hello||This email serves as a test email for the email account settings.||If you are reading this email, your app is ready to send emails." sbody = ABMShared.Replace(sbody,"|",CRLF) SendEmail(jSQL,smtp,admin, "DRPW: Test Email", sbody) 'Close the connection to the database ABMShared.SQLClose(jSQL) Case 0 If ABMShared.HasPermission("frmEmailAccounts","cancreate") = False Then Return 'Clone a record ABMShared.SessionStorageSave(page, "action", "copy") ABMShared.SessionStorageSave(page, "EmailAccountsid", ActiveId) msEmailAccountsCopyRecord Case 11 'Delete a record If ABMShared.HasPermission("frmEmailAccounts","candelete") = False Then Return ABMShared.ShowYesNo(page,"Are you sure that you want to delete this record? You will not be able to undo your action. Continue to delete", "DeleteEmailAccounts", "CancelDeleteRecord") End Select End Sub Public Sub msEmailAccountsCopyRecord() If ABMShared.HasPermission("frmEmailAccounts","cancreate") = False Then Return 'Show progress dialog... Filter = "" LastSort = "ORDER BY account" Dim EmailAccountsid As String 'Read the ID from localstorage... EmailAccountsid = ABMShared.SessionStorageRead(page, "emailaccountsid") 'read the record from the database. Dim jSQL As SQL = ABMShared.SQLGet Dim m As Map m = ABMShared.SQLRecordRead(jSQL,"EmailAccounts", "id", EmailAccountsid) 'remove the primary key column m.Remove("id") 'save the record to the database and get new primary key value EmailAccountsid = ABMShared.SQLRecordInsert(jSQL, "EmailAccounts", m) ' the new key has been added 'Close the database connection... ABMShared.SQLClose(jSQL) 'Refresh the table Dim pager As ABMPagination = page.Component("EmailAccountsPager") LoadEmailAccounts(pager.GetActivePage()) If EmailAccountsid > 0 Then ABMShared.SessionStorageSave(page, "action", "edit") ABMShared.SessionStorageSave(page, "EmailAccountsid", EmailAccountsid) myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastgreen", "Record copied successfully.", 3000) ' open the record for editing msEmailAccountsAddEditRecord Else myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastred", "Record could not be copied, please try again.", 3000) End If End Sub Public Sub msEmailAccountsAddEditRecord() 'Show progress dialog... Filter = "" LastSort = "ORDER BY account" Dim strAction As String Dim EmailAccountsid As String OldValue = "" 'Read action from localstorage... strAction = ABMShared.SessionStorageRead(page, "action") 'Read the ID from localstorage... EmailAccountsid = ABMShared.SessionStorageRead(page, "emailaccountsid") Select Case strAction Case "new" If ABMShared.HasPermission("frmEmailAccounts","cancreate") = False Then Return 'clear the contents of the modal sheet component msEmailAccountsClear page.ShowModalSheet("msEmailAccounts") Case "edit" If ABMShared.HasPermission("frmEmailAccounts","canupdate") = False Then Return 'clear the controls of the page msEmailAccountsClear 'read the record from the database. Dim jSQL As SQL = ABMShared.SQLGet Dim m As Map m = ABMShared.SQLRecordRead(jSQL,"EmailAccounts", "id", EmailAccountsid) 'Close the database connection... ABMShared.SQLClose(jSQL) If m.IsInitialized = True Then 'The record has been found, update the modal sheet controls... msEmailAccountsSetContents(m) page.ShowModalSheet("msEmailAccounts") End If End Select End Sub Private Sub msEmailAccountsCreateUpdate() Filter = "" LastSort = "ORDER BY account" 'define a map to hold the form contents Dim m As Map 'read the modal sheet contents to a map m = msEmailAccountsGetContents 'validate the form contents where required If msEmailAccountsValidate(m) = False Then Return End If 'the form contents are ok, continue with the save Dim strAction As String Dim EmailAccountsid As String 'determine the action we have been performing strAction = ABMShared.SessionStorageRead(page, "action") EmailAccountsid = ABMShared.SessionStorageRead(page, "emailaccountsid") Select Case strAction Case "new" If ABMShared.HasPermission("frmEmailAccounts","cancreate") = False Then Return Dim fk As String = "" If fk.Length > 0 Then fk = ABMShared.SessionStorageRead(page, fk.tolowercase) m.put("", fk) End If 'get the database connection Dim jSQL As SQL = ABMShared.SQLGet 'insert the record EmailAccountsid = ABMShared.SQLRecordInsert(jSQL, "EmailAccounts", m) If EmailAccountsid > 0 Then ABMShared.SessionStorageSave(page, "action", "edit") ABMShared.SessionStorageSave(page, "EmailAccountsid", EmailAccountsid) myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastgreen", "Record added successfully.", 3000) 'Refresh the table Dim pager As ABMPagination = page.Component("EmailAccountsPager") LoadEmailAccounts(pager.GetActivePage()) Else myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastred", "Record could not be added, please try again.", 3000) End If 'Close the connection to the database ABMShared.SQLClose(jSQL) Case "edit" If ABMShared.HasPermission("frmEmailAccounts","canupdate") = False Then Return Dim fk As String = "" If fk.Length > 0 Then fk = ABMShared.SessionStorageRead(page, fk.tolowercase) m.put("", fk) End If 'get the database connection Dim jSQL As SQL = ABMShared.SQLGet If ABMShared.SQLRecordUpdate(jSQL,"EmailAccounts", m, "id", EmailAccountsid) = True Then myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastgreen", "Record updated successfully.", 3000) 'Refresh the table Dim pager As ABMPagination = page.Component("EmailAccountsPager") LoadEmailAccounts(pager.GetActivePage()) Else myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastred", "Record could not be updated, please try again.", 3000) End If 'Close the connection to the database ABMShared.SQLClose(jSQL) End Select End Sub 'Get the contents of the modal sheet input components and save to a map Sub msEmailAccountsGetContents() As Map Dim pMap As Map pMap.Initialize Dim msEmailAccounts As ABMModalSheet msEmailAccounts = page.ModalSheet("msEmailAccounts") Dim txtEmailAccountsaccount As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsaccount") Dim txtEmailAccountsadministrator As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsadministrator") Dim txtEmailAccountsserver As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsserver") Dim txtEmailAccountsport As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsport") Dim txtEmailAccountsusername As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsusername") Dim txtEmailAccountspassword As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountspassword") Dim chkEmailAccountsStartTLSMode As ABMCheckbox = msEmailAccounts.Content.Component("chkEmailAccountsStartTLSMode") Dim chkEmailAccountsUseSSL As ABMCheckbox = msEmailAccounts.Content.Component("chkEmailAccountsUseSSL") pMap.put("account", txtEmailAccountsaccount.Text) pMap.put("administrator", txtEmailAccountsadministrator.Text) pMap.put("server", txtEmailAccountsserver.Text) pMap.put("port", txtEmailAccountsport.Text) pMap.put("username", txtEmailAccountsusername.Text) pMap.put("password", txtEmailAccountspassword.Text) Dim chkEmailAccountsStartTLSModeContents As String If chkEmailAccountsStartTLSMode.State Then chkEmailAccountsStartTLSModeContents = 1 Else chkEmailAccountsStartTLSModeContents = 0 End If pMap.put("starttlsmode", chkEmailAccountsStartTLSModeContents) Dim chkEmailAccountsUseSSLContents As String If chkEmailAccountsUseSSL.State Then chkEmailAccountsUseSSLContents = 1 Else chkEmailAccountsUseSSLContents = 0 End If pMap.put("usessl", chkEmailAccountsUseSSLContents) Return pMap End Sub 'Get the contents of the modal sheet from GetContents and check validity Sub msEmailAccountsValidate(gMap As Map) As Boolean Dim msEmailAccounts As ABMModalSheet msEmailAccounts = page.ModalSheet("msEmailAccounts") Return True End Sub 'Set the contents of the modal page input components from map Sub msEmailAccountsSetContents(pMap As Map) Dim msEmailAccounts As ABMModalSheet msEmailAccounts = page.ModalSheet("msEmailAccounts") 'Get the page components to update Dim txtEmailAccountsaccount As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsaccount") Dim txtEmailAccountsadministrator As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsadministrator") Dim txtEmailAccountsserver As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsserver") Dim txtEmailAccountsport As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsport") Dim txtEmailAccountsusername As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountsusername") Dim txtEmailAccountspassword As ABMInput = msEmailAccounts.Content.Component("txtEmailAccountspassword") Dim chkEmailAccountsStartTLSMode As ABMCheckbox = msEmailAccounts.Content.Component("chkEmailAccountsStartTLSMode") Dim chkEmailAccountsUseSSL As ABMCheckbox = msEmailAccounts.Content.Component("chkEmailAccountsUseSSL") 'Update computations 'Assign content to component values Dim txtEmailAccountsaccountContents As String If pMap.GetDefault("account",null) = null Then txtEmailAccountsaccount.Text = "" Else txtEmailAccountsaccountContents = pMap.get("account") End If txtEmailAccountsaccount.Text = txtEmailAccountsaccountContents txtEmailAccountsaccount.Refresh Dim txtEmailAccountsadministratorContents As String If pMap.GetDefault("administrator",null) = null Then txtEmailAccountsadministrator.Text = "" Else txtEmailAccountsadministratorContents = pMap.get("administrator") End If txtEmailAccountsadministrator.Text = txtEmailAccountsadministratorContents txtEmailAccountsadministrator.Refresh Dim txtEmailAccountsserverContents As String If pMap.GetDefault("server",null) = null Then txtEmailAccountsserver.Text = "" Else txtEmailAccountsserverContents = pMap.get("server") End If txtEmailAccountsserver.Text = txtEmailAccountsserverContents txtEmailAccountsserver.Refresh Dim txtEmailAccountsportContents As String If pMap.GetDefault("port",null) = null Then txtEmailAccountsport.Text = "" Else txtEmailAccountsportContents = pMap.get("port") End If txtEmailAccountsport.Text = txtEmailAccountsportContents txtEmailAccountsport.Refresh Dim txtEmailAccountsusernameContents As String If pMap.GetDefault("username",null) = null Then txtEmailAccountsusername.Text = "" Else txtEmailAccountsusernameContents = pMap.get("username") End If txtEmailAccountsusername.Text = txtEmailAccountsusernameContents txtEmailAccountsusername.Refresh Dim txtEmailAccountspasswordContents As String If pMap.GetDefault("password",null) = null Then txtEmailAccountspassword.Text = "" Else txtEmailAccountspasswordContents = pMap.get("password") End If txtEmailAccountspassword.Text = txtEmailAccountspasswordContents txtEmailAccountspassword.Refresh If pMap.GetDefault("starttlsmode",null) = null Then chkEmailAccountsStartTLSMode.State = False Else Dim chkEmailAccountsStartTLSModeContents As String chkEmailAccountsStartTLSModeContents = pMap.get("starttlsmode") If chkEmailAccountsStartTLSModeContents = 1 Then chkEmailAccountsStartTLSMode.State = True Else chkEmailAccountsStartTLSMode.State = False End If End If chkEmailAccountsStartTLSMode.Refresh If pMap.GetDefault("usessl",null) = null Then chkEmailAccountsUseSSL.State = False Else Dim chkEmailAccountsUseSSLContents As String chkEmailAccountsUseSSLContents = pMap.get("usessl") If chkEmailAccountsUseSSLContents = 1 Then chkEmailAccountsUseSSL.State = True Else chkEmailAccountsUseSSL.State = False End If End If chkEmailAccountsUseSSL.Refresh End Sub Sub AdminAccess() 'Get the usertype Dim UserType As String = ws.Session.GetAttribute2("UserType", "0") End Sub Sub smtp_MessageSent(Success As Boolean) If Success = False Then myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastred", "Email could not be sent, please try again.", 3000) Else myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastgreen", "Email sent successfully.", 3000) End If End Sub Sub SendEmail(jSQL As SQL, esmtp As SMTP, toEmail As String, subject As String, msg As String) 'get first available account, there should be 1 Dim id As String = ABMShared.SQLSelectSingleResult(jSQL, "select id from EmailAccounts Limit 1", Null) 'read the email settings first Dim es As Map es = ABMShared.SQLRecordRead(jSQL,"EmailAccounts", "id", id) Dim sserver As String = es.GetDefault("server","") Dim sport As String = es.GetDefault("port","25") Dim susername As String = es.GetDefault("username","") Dim spassword As String = es.GetDefault("password","") Dim sStartTLSMode As String = es.GetDefault("starttlsmode","0") Dim sUseSSL As String = es.GetDefault("usessl","0") Dim sadministrator As String = es.GetDefault("administrator","") 'start sending the email esmtp.Initialize(sserver, sport, susername, spassword, "smtp") esmtp.To.Add(toEmail) esmtp.Body = msg esmtp.Subject = subject If sStartTLSMode = "1" Then esmtp.StartTLSMode = True Else esmtp.StartTLSMode = False End If If sUseSSL = "1" Then esmtp.UseSSL = True Else esmtp.UseSSL = False End if esmtp.Send End Sub Private Sub YesNoProcess(Tag As String) Select case Tag Case "DeleteEmailAccounts" Filter = "" LastSort = "" 'get the database connection Dim jSQL As SQL = ABMShared.SQLGet Dim bDeleted As Boolean = ABMShared.SQLRecordDelete(jSQL, "EmailAccounts", "id", ActiveID) ABMShared.SQLClose(jSQL) If bDeleted = True Then myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastgreen", "Record deleted successfully.", 3000) 'Refresh the table Dim pager As ABMPagination = page.Component("EmailAccountsPager") LoadEmailAccounts(pager.GetActivePage()) Else myToastId = myToastId + 1 page.ShowToast("toast" & myToastId, "toastred", "Record could not be deleted, please try again.", 3000) End If End Select End Sub Sub ConnectNavigationBar() ' Clear the dummies we created in BuildNavigationBar page.NavigationBar.Clear 'connect the items in the navigation bar page.NavigationBar.AddTopItemEx("NewRecord", "", "mdi-content-add", "", True, ABM.COLOR_WHITE, ABM.INTENSITY_NORMAL, ABM.ICONALIGN_CENTER) page.NavigationBar.AddTopItem("GoBack", "", "mdi-image-navigate-before", "../frmUserGroups/frmUserGroups.html", False) page.NavigationBar.AddTopItemEx("LogOff", "", "fa fa-sign-out", "../frmSignIn/frmSignIn.html", True, ABM.COLOR_WHITE, ABM.INTENSITY_NORMAL, ABM.ICONALIGN_CENTER) If ABMShared.HasPermission("frmAdministration","canread") = True Then page.NavigationBar.AddSideBarItem("frmAdministration", "Administration", "mdi-action-work", "../frmAdministration/frmAdministration.html") End If If ABMShared.HasPermission("frmAdministration","canread") = True Then page.NavigationBar.AddSideBarDivider End If If ABMShared.HasPermission("frmIYMUpdate","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmAdministration", "frmIYMUpdate", "IYM Update", "mdi-action-bookmark", "../frmIYMUpdate/frmIYMUpdate.html") End If If ABMShared.HasPermission("frmAdministration","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmAdministration") End If If ABMShared.HasPermission("frmProgrammes","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmAdministration", "frmProgrammes", "IYM vs Procurement Plan", "mdi-action-bookmark", "../frmProgrammes/frmProgrammes.html") End If If ABMShared.HasPermission("frmAdministration","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmAdministration") End If If ABMShared.HasPermission("frmProcPlan","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmAdministration", "frmProcPlan", "Procurement Plan", "mdi-action-bookmark", "../frmProcPlan/frmProcPlan.html") End If If ABMShared.HasPermission("frmAdministration","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmAdministration") End If If ABMShared.HasPermission("frmAddProgrammes","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmAdministration", "frmAddProgrammes", "Programmes", "mdi-action-bookmark", "../frmAddProgrammes/frmAddProgrammes.html") End If If ABMShared.HasPermission("frmAdministration","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmAdministration") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarItem("frmReporting", "Reporting", "mdi-av-my-library-books", "../frmReporting/frmReporting.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarDivider End If If ABMShared.HasPermission("frmIYMTYD","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMTYD", "Chart: YTD IYM", "mdi-action-bookmark", "../frmIYMTYD/frmIYMTYD.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmIYMMonthly","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMMonthly", "Chart: Monthly IYM", "mdi-action-bookmark", "../frmIYMMonthly/frmIYMMonthly.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmIYMPercentageExpenditure","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMPercentageExpenditure", "Chart: Percentage Expenditure", "mdi-action-bookmark", "../frmIYMPercentageExpenditure/frmIYMPercentageExpenditure.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmIYMPercentageChange","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMPercentageChange", "Chart: Percentage Change", "mdi-action-bookmark", "../frmIYMPercentageChange/frmIYMPercentageChange.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmIYMProjectionsPerProgramme","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMProjectionsPerProgramme", "Chart: Monthly Projections Analysis", "mdi-action-bookmark", "../frmIYMProjectionsPerProgramme/frmIYMProjectionsPerProgramme.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmIYMExpenditurePerProgramme","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMExpenditurePerProgramme", "Chart: Actual Monthly Expenditure Analysis", "mdi-action-bookmark", "../frmIYMExpenditurePerProgramme/frmIYMExpenditurePerProgramme.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmIYMPercentageExpenditurePerProgramme","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMPercentageExpenditurePerProgramme", "Chart: Monthly Percentage Expenditure Analysis", "mdi-action-bookmark", "../frmIYMPercentageExpenditurePerProgramme/frmIYMPercentageExpenditurePerProgramme.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmIYMVariancesPerProgramme","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMVariancesPerProgramme", "Chart: Monthly Variance Analysis", "mdi-action-bookmark", "../frmIYMVariancesPerProgramme/frmIYMVariancesPerProgramme.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmIYMYTDExpenditurePerProgramme","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMYTDExpenditurePerProgramme", "Chart: YTD Expenditure Analysis", "mdi-action-bookmark", "../frmIYMYTDExpenditurePerProgramme/frmIYMYTDExpenditurePerProgramme.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmIYMYTDProjectionsPerProgramme","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMYTDProjectionsPerProgramme", "Chart: YTD Projections Analysis", "mdi-action-bookmark", "../frmIYMYTDProjectionsPerProgramme/frmIYMYTDProjectionsPerProgramme.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmIYMYTDPercentageExpenditure","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmIYMYTDPercentageExpenditure", "Chart: YTD Percentage Expenditure Analysis", "mdi-action-bookmark", "../frmIYMYTDPercentageExpenditure/frmIYMYTDPercentageExpenditure.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmProcPlanCalendar","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmProcPlanCalendar", "Procurement Plan Calendar", "mdi-action-bookmark", "../frmProcPlanCalendar/frmProcPlanCalendar.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmProcPlanGantt","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReporting", "frmProcPlanGantt", "Procurement Project Plan", "mdi-action-bookmark", "../frmProcPlanGantt/frmProcPlanGantt.html") End If If ABMShared.HasPermission("frmReporting","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReporting") End If If ABMShared.HasPermission("frmReferences","canread") = True Then page.NavigationBar.AddSideBarItem("frmReferences", "References", "mdi-content-link", "../frmReferences/frmReferences.html") End If If ABMShared.HasPermission("frmReferences","canread") = True Then page.NavigationBar.AddSideBarDivider End If If ABMShared.HasPermission("frmResources","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReferences", "frmResources", "Resources", "mdi-action-bookmark", "../frmResources/frmResources.html") End If If ABMShared.HasPermission("frmReferences","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReferences") End If If ABMShared.HasPermission("frmHolidays","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReferences", "frmHolidays", "Holidays", "mdi-action-bookmark", "../frmHolidays/frmHolidays.html") End If If ABMShared.HasPermission("frmReferences","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReferences") End If If ABMShared.HasPermission("frmClassOfGoods","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReferences", "frmClassOfGoods", "Class of Goods", "mdi-action-bookmark", "../frmClassOfGoods/frmClassOfGoods.html") End If If ABMShared.HasPermission("frmReferences","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReferences") End If If ABMShared.HasPermission("frmProcStatus","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmReferences", "frmProcStatus", "Procurement Status", "mdi-action-bookmark", "../frmProcStatus/frmProcStatus.html") End If If ABMShared.HasPermission("frmReferences","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmReferences") End If If ABMShared.HasPermission("frmUserAdministration","canread") = True Then page.NavigationBar.AddSideBarItem("frmUserAdministration", "User Administration", "mdi-action-account-circle", "../frmUserAdministration/frmUserAdministration.html") End If If ABMShared.HasPermission("frmUserAdministration","canread") = True Then page.NavigationBar.AddSideBarDivider End If If ABMShared.HasPermission("frmUserGroups","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmUserAdministration", "frmUserGroups", "User Groups", "mdi-action-bookmark", "../frmUserGroups/frmUserGroups.html") End If If ABMShared.HasPermission("frmUserAdministration","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmUserAdministration") End If If ABMShared.HasPermission("frmEmailAccounts","canread") = True Then page.NavigationBar.AddSideBarSubItem("frmUserAdministration", "frmEmailAccounts", "Email Accounts", "mdi-action-bookmark", "../frmEmailAccounts/frmEmailAccounts.html") End If If ABMShared.HasPermission("frmUserAdministration","canread") = True Then page.NavigationBar.AddSideBarSubDivider("frmUserAdministration") End If 'refresh the navigation bar page.NavigationBar.Refresh ' IMPORTANT End Sub