B4J=true Group=Default Group ModulesStructureVersion=1 Type=Class Version=6.8 @EndOfDesignText@ 'Class module Sub Class_Globals 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 = "frmJobListe" '<-------------------------------------------------------- IMPORTANT ' will hold the unique browsers window id Private ABMPageId As String = "" ' your own variables 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) Log("Connected") ws = WebSocket1 ABMPageId = ABM.GetPageID(page, Name,ws) Dim session As HttpSession = ABM.GetSession(ws, ABMShared.SessionMaxInactiveIntervalSeconds) ABMShared.RegisterStation( session, ws.UpgradeRequest.RemoteAddress ) If session.IsNew Then session.Invalidate ABMShared.NavigateToPage(ws, "", "./") Return End If 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) End Sub Private Sub WebSocket_Disconnected Log("Disconnected") 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 Dim caller As Object = page.GetEventHandler(Me, eventName) If caller = Me Then If SubExists(Me, eventName) Then Params.Remove("eventname") Params.Remove("eventparams") ' BEGIN NEW DRAGDROP If eventName = "page_dropped" Then page.ProcessDroppedEvent(Params) End If ' END NEW DRAGDROP 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 directly, to many param CallSub2(Me, eventName, Params) End Select End If Else CallSubDelayed2(caller, "ParseEvent", Params) 'ignore End If End Sub public Sub BuildTheme() ' start with the base theme defined in ABMShared theme.Initialize("pagetheme") theme.AddABMTheme(ABMShared.MyTheme) theme.AddInputTheme("inputauto") theme.Input("inputauto").AutoCompleteZDepth = ABM.ZDEPTH_1 ' add additional themes specific for this page theme.AddTableTheme("tbl1theme") theme.Table("tbl1theme").ZDepth = ABM.ZDEPTH_1 theme.Table("tbl1theme").BackColor = ABM.COLOR_WHITE theme.Table("tbl1theme").AddCellTheme("headerfooter") theme.Table("tbl1theme").Cell("headerfooter").BackColor = "dragonflygreen" theme.Table("tbl1theme").Cell("headerfooter").ForeColor = ABM.COLOR_WHITE theme.Table("tbl1theme").AddCellTheme("headerfooterright") theme.Table("tbl1theme").Cell("headerfooterright").BackColor = "dragonflygreen" theme.Table("tbl1theme").Cell("headerfooterright").ForeColor = ABM.COLOR_WHITE theme.Table("tbl1theme").Cell("headerfooterright").Align = ABM.TABLECELL_HORIZONTALALIGN_RIGHT theme.Table("tbl1theme").AddCellTheme("nocolor") theme.Table("tbl1theme").Cell("nocolor").BackColor = ABM.COLOR_WHITE theme.Table("tbl1theme").Cell("nocolor").ActiveBackColor = "dragonfly" theme.Table("tbl1theme").Cell("nocolor").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN2 theme.Table("tbl1theme").AddCellTheme("nocoloredit") theme.Table("tbl1theme").Cell("nocoloredit").BackColor = ABM.COLOR_WHITE theme.Table("tbl1theme").Cell("nocoloredit").ActiveBackColor = "dragonfly" theme.Table("tbl1theme").Cell("nocoloredit").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN2 theme.Table("tbl1theme").Cell("nocoloredit").IsEditable = True theme.Table("tbl1theme").Cell("nocoloredit").InputMask = "'alias':'decimal', 'digits': 2" theme.Table("tbl1theme").Cell("nocoloredit").AllowEnterKey = False theme.Table("tbl1theme").AddCellTheme("positive") theme.Table("tbl1theme").Cell("positive").BackColor = ABM.COLOR_GREEN theme.Table("tbl1theme").Cell("positive").BackColorIntensity = ABM.INTENSITY_LIGHTEN3 theme.Table("tbl1theme").Cell("positive").ActiveBackColor = ABM.COLOR_GREEN theme.Table("tbl1theme").Cell("positive").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN1 theme.Table("tbl1theme").Cell("positive").Align = ABM.TABLECELL_HORIZONTALALIGN_RIGHT theme.Table("tbl1theme").AddCellTheme("negative") theme.Table("tbl1theme").Cell("negative").BackColor = ABM.COLOR_RED theme.Table("tbl1theme").Cell("negative").BackColorIntensity = ABM.INTENSITY_LIGHTEN3 theme.Table("tbl1theme").Cell("negative").ActiveBackColor = ABM.COLOR_RED theme.Table("tbl1theme").Cell("negative").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN1 theme.Table("tbl1theme").Cell("negative").Align = ABM.TABLECELL_HORIZONTALALIGN_RIGHT theme.Table("tbl1theme").AddCellTheme("aligntop") theme.Table("tbl1theme").Cell("aligntop").VerticalAlign = ABM.TABLECELL_VERTICALALIGN_TOP theme.Table("tbl1theme").Cell("aligntop").ActiveBackColor = "dragonfly" theme.Table("tbl1theme").Cell("aligntop").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN2 theme.AddCardTheme("whitetitle") theme.Card("whitetitle").TitleForeColor = ABM.COLOR_WHITE 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.PageHTMLName = "index.html" page.PageTitle = "frmJobListe" page.PageDescription = "frmJobListe" page.PageKeywords = "" page.PageSiteMapPriority = "" page.PageSiteMapFrequency = ABM.SITEMAP_FREQ_YEARLY page.ShowConnectedIndicator = True ' adding a navigation bar ABMShared.BuildNavigationBar( page, "Laufende Projekte","../images/logo.png", "", "", "" ) #Region NOT SAVED: 2018-12-10T11:19:01 ' create the page grid 'PHONE '╔═══════════════════════════════════════════════════════════════════════════════════╗ '║ 1,1 | 1,2 ║ '╠═══════════════════════════════════════════════════════════════════════════════════╣ '║ 2,1 ║ '╚═══════════════════════════════════════════════════════════════════════════════════╝ page.AddRows( 1, True, "" ).AddCellsOS( 2, 0, 0, 0, 6, 6, 6, "" ) page.AddRows( 1, True, "" ).AddCells12( 1, "" ) page.BuildGrid #End Region End Sub public Sub ConnectPage() ' connecting the navigation bar ABMShared.ConnectNavigationBar(page) '------------------------------------------------------------------------------------------------------ page.AddModalSheetTemplate(BuildModalSheet) '------------------------------------------------------------------------------------------------------ Dim tbl1 As ABMTable tbl1.Initialize( page, "tbl1", True, False, True, "tbl1theme" ) tbl1.SetHeaders( Array As String( "", "Projekt", "Personal", "Stundentyp", "Startzeit", "Dauer" ) ) tbl1.SetColumnDataFields( Array As String( "", "INTERNNR", "STRPERS", "ZEICHEN2", "ZEIT", "DAUER" ) ) tbl1.SetHeaderThemes( Array As String( "headerfooter", "headerfooter", "headerfooter", "headerfooter", "headerfooter", "headerfooter") ) page.Cell(2,1).AddComponent( tbl1 ) '------------------------------------------------------------------------------------------------------ Dim sSQL As String = $"Select Q.[ROWID],Q.[INTERNNR],P.[PROJEKT],P.[NAME1],Q.[PERSONAL],N.[SUCHE],Q.[STUNDENTYP],K.[BEZEICHNUNG], FORMAT( Q.[STARTZEIT], N'hh\:mm' ) AS ZEIT, DATEDIFF( n, Q.[STARTZEIT], CAST( GetDate() AS time ) ) AS DAUER FROM [QCKPROJEKTZEITEN] Q, [KATPERSONAL] N, [TBLPROJEKT] P, [KATSTUNDENTYP] K WHERE Q.[PERSONAL] = N.[STRPERSID] And Q.[INTERNNR] = P.[INTERNNR] And P.[MANDANT] = 'Gerber GmbH' AND Q.[STUNDENTYP] = K.[ZEICHEN2] AND K.[MANDANT] = 'Gerber GmbH' AND Q.[STATION]=?"$ Dim oCursor As ResultSet = Main.oSQL.ExecQuery2( sSQL, Array As Object( ws.UpgradeRequest.RemoteAddress ) ) Do While oCursor.NextRow Dim oList As List Dim oThemes As List Dim oACB As ABMButton oList.Initialize oThemes.Initialize oACB.InitializeFlat( page, "acb", "", "" , oCursor.GetString("INTERNNR"), "" ) oACB.Tag = oCursor.GetString("ROWID") oList.Add(oACB) oThemes.Add( "nocolor" ) oList.Add( oCursor.GetString("PROJEKT") & "{BR}" & oCursor.GetString("NAME1") ) oThemes.Add( "nocolor" ) oList.Add(oCursor.GetString("PERSONAL") & "{BR}" & oCursor.GetString("SUCHE") ) oThemes.Add( "nocolor" ) oList.Add(oCursor.GetString("STUNDENTYP") & "{BR}" & oCursor.GetString("BEZEICHNUNG")) oThemes.Add( "nocolor" ) oList.Add(oCursor.GetString("ZEIT")) oThemes.Add( "nocolor" ) Dim iMinutes As Int = oCursor.GetString("DAUER") Dim iAnz As Int = iMinutes Mod 60 Dim iHours As Int = (iMinutes - iAnz) / 60 oList.Add( NumberFormat( iHours, 2, 0 ) & ":" & NumberFormat( iAnz, 2, 0 ) ) oThemes.Add( "nocolor" ) tbl1.AddRow( oCursor.GetString("ROWID"), oList ) tbl1.SetRowThemes( oThemes ) Loop '------------------------------------------------------------------------------------------------------ page.Refresh page.FinishedLoading page.RestoreNavigationBarPosition End Sub Sub tbl1_Clicked(PassedRowsAndColumns As List) ' is the root table Dim tblCellInfo As ABMTableCell = PassedRowsAndColumns.Get(0) Dim tbl As ABMTable = page.Component("tbl1") ' Pushed the button If tblCellInfo.Column = 0 Then Dim oButton As ABMButton = tbl.GetComponent( tblCellInfo.Row, "acb" ) If oButton <> Null Then ws.Session.SetAttribute( "ROWID", oButton.Tag ) page.ShowModalSheet("TimeSheet") Dim mymodal As ABMModalSheet = page.ModalSheet("TimeSheet") Dim oSTART As ABMDateTimeScroller = mymodal.Content.Cell(3,2).Component("oSTART") Dim oLB11 As ABMLabel = mymodal.Content.Cell(1,1).Component("oLB11") Dim oLB12 As ABMLabel = mymodal.Content.Cell(1,2).Component("oLB12") Dim oLB13 As ABMLabel = mymodal.Content.Cell(1,3).Component("oLB13") oLB11.Text = oButton.Text oLB11.Refresh oLB12.Text = tbl.GetString(tblCellInfo.Row,1) oLB12.Refresh oLB13.Text = tbl.GetString(tblCellInfo.Row,3) oLB13.Refresh Dim lDT As Long = DateTime.TimeParse( tbl.GetString( tblCellInfo.Row, 4 ) & ":00" ) oSTART.SetDate( lDT ) 'oSTART.Refresh mymodal.Refresh CalcDauer End If End If End Sub Sub BuildModalSheet() As ABMModalSheet Dim myModal As ABMModalSheet myModal.Initialize(page, "TimeSheet", False, ABM.MODALSHEET_TYPE_NORMAL, "") myModal.Content.UseTheme("modalcontent") myModal.IsDismissible = False #Region NOT SAVED: 2019-01-05T09:21:18 '╔═══════════════════════════════════════════════════════════════════════════════════╗ '║ 1,1 oLB11 | x,2 oLB12 | x,3 oLB13 ║ '╠═══════════════════════════════════════════════════════════════════════════════════╣ '║ 2,1 oTXT ║ '╠═══════════════════════════════════════════════════════════════════════════════════╣ '║ 3,1 oLBL1 | x,2 oSTART | x,3 oLBL2 | x,4 oEND | x,5 oLBL3 | x,6 oLBL4 ║ '╠═══════════════════════════════════════════════════════════════════════════════════╣ '║ 4,1 msbtn2 | x,4 msbtn3 ║ '╚═══════════════════════════════════════════════════════════════════════════════════╝ myModal.Content.AddRows(1,True,"TopLine").AddCellsOS(3,0,0,0,4,4,4,"TopCell") myModal.Content.AddRows(1,True,"").AddCells12(1,"") myModal.Content.AddRows(1,True,"").AddCellsOS(6,0,0,0,2,2,2,"") myModal.Content.AddRows(1,True,"").AddCellsOS(2,0,0,0,6,6,6,"") myModal.Content.BuildGrid ' IMPORTANT! #End Region '------------------------------------------------------------------------------------------------------ Dim oLB11 As ABMLabel oLB11.Initialize( page, "oLB11", "", ABM.SIZE_PARAGRAPH, False, "" ) myModal.Content.Cell(1,1).AddComponent( oLB11 ) Dim oLB12 As ABMLabel oLB12.Initialize( page, "oLB12", "", ABM.SIZE_SMALL, True, "" ) myModal.Content.Cell(1,2).AddComponent( oLB12 ) Dim oLB13 As ABMLabel oLB13.Initialize( page, "oLB13", "", ABM.SIZE_SMALL, True, "" ) myModal.Content.Cell(1,3).AddComponent( oLB13 ) '------------------------------------------------------------------------------------------------------ Dim oTXT As ABMInput oTXT.Initialize( page, "oTXT", ABM.INPUT_TEXT, "Bemerkung", True, "" ) myModal.Content.Cell(2,1).AddComponent(oTXT) '------------------------------------------------------------------------------------------------------ Dim oLBL1 As ABMLabel oLBL1.Initialize( page, "oLBL1", "Startzeit:", ABM.SIZE_PARAGRAPH, False, "" ) myModal.Content.Cell(3,1).AddComponent( oLBL1 ) Dim oSTART As ABMDateTimeScroller oSTART.Initialize( page, "oSTART", ABM.DATETIMESCROLLER_TYPE_TIME, ABM.DATETIMESCROLLER_MODE_MIXED, DateTime.Now, "", "" ) oSTART.CancelText = "Abbrechen" oSTART.PickText = "Speichern" oSTART.TitleTimeFormat = "HH:ii" oSTART.ReturnTimeFormat = "HH:ii" oSTART.TimeShowAMPM = False myModal.Content.Cell(3,2).AddComponent( oSTART ) Dim oLBL2 As ABMLabel oLBL2.Initialize( page, "oLBL2", "Endezeit:", ABM.SIZE_PARAGRAPH, False, "" ) myModal.Content.Cell(3,3).AddComponent( oLBL2 ) Dim oEND As ABMDateTimeScroller oEND.Initialize( page, "oEND", ABM.DATETIMESCROLLER_TYPE_TIME, ABM.DATETIMESCROLLER_MODE_CLICKPICK, DateTime.Now, "", "" ) oEND.CancelText = "Abbrechen" oEND.PickText = "Speichern" oEND.TitleTimeFormat = "HH:ii" oEND.ReturnTimeFormat = "HH:ii" oEND.TimeShowAMPM = False myModal.Content.Cell(3,4).AddComponent( oEND ) Dim oLBL3 As ABMLabel oLBL3.Initialize( page, "oLBL3", "Dauer:", ABM.SIZE_PARAGRAPH, False, "" ) myModal.Content.Cell(3,5).AddComponent( oLBL3 ) Dim oLBL4 As ABMLabel oLBL4.Initialize( page, "oLBL4", "5,80 h", ABM.SIZE_PARAGRAPH, False, "" ) myModal.Content.Cell(3,6).AddComponent( oLBL4 ) '------------------------------------------------------------------------------------------------------ Dim msbtn2 As ABMButton msbtn2.InitializeRaised(page, "msbtn2", "", "", "Abbrechen", "transparent") myModal.Content.Cell(4,1).AddComponent(msbtn2) Dim msbtn3 As ABMButton msbtn3.InitializeRaised(page, "msbtn3", "", "", "Speichern", "transparent") myModal.Content.Cell(4,2).AddComponent(msbtn3) Return myModal End Sub Sub msbtn2_Clicked(Target As String) page.CloseModalSheet("TimeSheet") End Sub Sub msbtn3_Clicked(Target As String) page.CloseModalSheet("TimeSheet") End Sub Sub oSTART_Changed(dateMilliseconds As String) CalcDauer End Sub Sub CalcDauer() Dim mymodal As ABMModalSheet = page.ModalSheet("TimeSheet") Dim oSTART As ABMDateTimeScroller = mymodal.Content.Cell(3,2).Component("oSTART") Dim oEND As ABMDateTimeScroller = mymodal.Content.Cell(3,4).Component("oEND") Dim oLBL4 As ABMLabel= mymodal.Content.Cell(3,6).Component("oLBL4") Dim lEnd As Long = DateTime.TimeParse( oEND.GetDateISO.SubString( oEND.GetDateISO.Length - 8 ) ) Dim lStart As Long = DateTime.TimeParse( oSTART.GetDateISO.SubString( oSTART.GetDateISO.Length - 8 ) ) Dim iMinutes As Int = (lEnd - lStart) / 60000 Dim iAnz As Int = iMinutes Mod 60 Dim iHours As Int = (iMinutes - iAnz) / 60 oLBL4.Text = NumberFormat( iHours, 2, 0 ) & ":" & NumberFormat( iAnz, 2, 0 ) oLBL4.Refresh End Sub '===================================================================================================================================== Sub Page_Dropped(Params As Map) If Params.Get("before") = "" Then Log("'" & Params.Get("component") & "' moved from " & Params.Get("source") & " to " & Params.Get("target")) Else Log("'" & Params.Get("component") & "' moved from " & Params.Get("source") & " to " & Params.Get("target") & " before component " & Params.Get("before")) End If End Sub 'clicked on the navigation bar Sub Page_NavigationbarClicked(Action As String, Value As String) ' saving the navigation bar position page.SaveNavigationBarPosition If Action = "LogOff" Then ABMShared.LogOff(page) Return End If ABMShared.NavigateToPage(ws, ABMPageId, Value) End Sub Sub Page_MsgboxResult(returnName As String, result As String) End Sub Sub Page_InputboxResult(returnName As String, result As String) End Sub Sub Page_DebugConsole(message As String) Log("---> " & message) End Sub Sub Page_FileUploaded(FileName As String, success As Boolean) End Sub Sub Page_ToastClicked(toastID As String, Action As String) End Sub Sub Page_ToastDismissed(ToastId As String) End Sub Sub Page_Authenticated(Params As Map) End Sub Sub Page_FirebaseAuthError(extra As String) End Sub Sub Page_FirebaseAuthStateChanged(IsLoggedIn As Boolean) End Sub Sub Page_FirebaseStorageError(jobID As String, extra As String) End Sub Sub Page_FirebaseStorageResult(jobID As String, extra As String) End Sub Sub Page_ModalSheetDismissed(ModalSheetName As String) End Sub Sub Page_NextContent(TriggerComponent As String) End Sub Sub Page_SignedOffSocialNetwork(Network As String, Extra As String) End Sub Sub page_CellClicked(Target As String, RowCell As String) End Sub Sub page_RowClicked(Target As String, Row As String) End Sub Sub Page_NativeResponse(jsonMessage As String) End Sub Sub Page_NavigationbarSearch(search As String) End Sub