diff --git a/cubesql-webadmin.xojo_project b/cubesql-webadmin.xojo_project index 4306d98..fab0d9a 100644 --- a/cubesql-webadmin.xojo_project +++ b/cubesql-webadmin.xojo_project @@ -44,13 +44,13 @@ WebContainer=cntLog;webapp/containers/information/cntLog.xojo_code;&h000000002B1 DefaultWindow=LoginPage MajorVersion=0 MinorVersion=0 -SubVersion=2 +SubVersion=3 NonRelease=0 Release=0 InfoVersion=cubeSQL Web Admin LongVersion=jo-tools.ch -ShortVersion=0.0.2 -WinCompanyName=example.com +ShortVersion=0.0.3 +WinCompanyName=jo-tools.ch WinInternalName=cubesqlwebadmin WinProductName=cubeSQL Web Admin WinFileDescription=cubeSQL Web Admin diff --git a/webapp/containers/base/cntBase.xojo_code b/webapp/containers/base/cntBase.xojo_code index 84dc3fa..402444c 100644 --- a/webapp/containers/base/cntBase.xojo_code +++ b/webapp/containers/base/cntBase.xojo_code @@ -14,11 +14,16 @@ Inherits WebContainer #tag Method, Flags = &h0 Sub Search(SearchValue As String) + #Pragma unused SearchValue End Sub #tag EndMethod + #tag Property, Flags = &h0 + Area As String = "Home" + #tag EndProperty + #tag Property, Flags = &h0 SearchAvailable As Boolean = False #tag EndProperty @@ -273,6 +278,22 @@ Inherits WebContainer Type="String" EditorType="MultiLineEditor" #tag EndViewProperty + #tag ViewProperty + Name="SearchAvailable" + Visible=false + Group="Behavior" + InitialValue="False" + Type="Boolean" + EditorType="" + #tag EndViewProperty + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty #tag EndViewBehavior End Class #tag EndClass diff --git a/webapp/containers/base/cntDatasourceBase.xojo_code b/webapp/containers/base/cntDatasourceBase.xojo_code index 44c4594..3c7919f 100644 --- a/webapp/containers/base/cntDatasourceBase.xojo_code +++ b/webapp/containers/base/cntDatasourceBase.xojo_code @@ -8,6 +8,11 @@ Implements WebDataSource If cntrl IsA WebListBox Then WebListBox(cntrl).DataSource = Nil Next + If (timRefresh <> Nil) Then + timRefresh.RunMode = WebTimer.RunModes.Off + timRefresh.Enabled = False + End If + Super.Close() End Sub @@ -39,7 +44,7 @@ Implements WebDataSource timRefresh.Enabled = False Me.AddControl(timRefresh) - AddHandler timRefresh.Run, AddressOf WebTimer_RowDataLoaded + AddHandler timRefresh.Run, WeakAddressOf WebTimer_RowDataLoaded End Sub #tag EndMethod @@ -388,6 +393,14 @@ Implements WebDataSource #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty #tag ViewProperty Name="SearchAvailable" Visible=false diff --git a/webapp/containers/cntStatus.xojo_code b/webapp/containers/cntStatus.xojo_code index d48af24..544ce42 100644 --- a/webapp/containers/cntStatus.xojo_code +++ b/webapp/containers/cntStatus.xojo_code @@ -134,7 +134,8 @@ End Sub Constructor() Super.Constructor - me.Title = "Status" + Me.Area = "cubeSQL" + Me.Title = "Status" End Sub #tag EndMethod @@ -240,6 +241,22 @@ End #tag EndEvent #tag EndEvents #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty + #tag ViewProperty + Name="SearchAvailable" + Visible=false + Group="Behavior" + InitialValue="False" + Type="Boolean" + EditorType="" + #tag EndViewProperty #tag ViewProperty Name="_mPanelIndex" Visible=false diff --git a/webapp/containers/information/cntClients.xojo_code b/webapp/containers/information/cntClients.xojo_code index e559096..1c6049e 100644 --- a/webapp/containers/information/cntClients.xojo_code +++ b/webapp/containers/information/cntClients.xojo_code @@ -142,7 +142,6 @@ End #tag WindowCode #tag Event Sub Opening() - Self.RefreshButtons() Self.ShowInfos() End Sub @@ -203,6 +202,7 @@ End Sub Constructor() Super.Constructor + Me.Area = "Information" Me.Title = "Clients" Me.SearchAvailable = True @@ -298,9 +298,11 @@ End Private Function GetSelectedClientId(ByRef username As String) As Integer username = "" If (lstInfos.SelectedRowIndex < 0) Then Return -1 - If (lstInfos.RowTagAt(lstInfos.SelectedRowIndex) IsA Dictionary) Then - username = Dictionary(lstInfos.RowTagAt(lstInfos.SelectedRowIndex)).Lookup("username", "").StringValue - Return Dictionary(lstInfos.RowTagAt(lstInfos.SelectedRowIndex)).Lookup("id", "").IntegerValue + + Var selectedRowTag As Variant = lstInfos.RowTagAt(lstInfos.SelectedRowIndex) + If (selectedRowTag IsA Dictionary) Then + username = Dictionary(selectedRowTag).Lookup("username", "").StringValue + Return Dictionary(selectedRowTag).Lookup("id", "").IntegerValue End If Return -1 @@ -317,8 +319,8 @@ End If (clientId > 0) Then bDisconnect = (clientId <> Session.ClientId) - bRefresh = True End If + bRefresh = True If (btnRefresh.Enabled <> bRefresh) Then btnRefresh.Enabled = bRefresh If (btnDisconnect.Enabled <> bDisconnect) Then btnDisconnect.Enabled = bDisconnect @@ -354,6 +356,8 @@ End #tag Method, Flags = &h21 Private Sub ShowInfos() + Me.UpdateNoRowsMessage() + Me.LoadDatasource(Session.DB.SelectSQL("SHOW CONNECTIONS")) If (lstInfos.DataSource = Nil) Then @@ -365,11 +369,27 @@ End End Sub #tag EndMethod + #tag Method, Flags = &h21 + Private Sub UpdateNoRowsMessage() + Var sInfo As String = "No Clients" + + If (Me.SearchValue <> "") Then + sInfo = sInfo + " matching '" + Me.SearchValue + "'" + End If + + lstInfos.NoRowsMessage = sInfo + + End Sub + #tag EndMethod + #tag Method, Flags = &h1 Protected Sub WebTimer_RowDataLoaded(obj As WebTimer) Super.WebTimer_RowDataLoaded(obj) - If (eiSelectAfterReload <= 0) Then Return + If (eiSelectAfterReload <= 0) Then + Me.RefreshButtons() + Return + End If Var iSelectAfterReload As Integer = eiSelectAfterReload eiSelectAfterReload = -1 @@ -445,6 +465,14 @@ End #tag EndEvent #tag EndEvents #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty #tag ViewProperty Name="SearchAvailable" Visible=false diff --git a/webapp/containers/information/cntCommands.xojo_code b/webapp/containers/information/cntCommands.xojo_code index ec6c2e9..9ba3a1f 100644 --- a/webapp/containers/information/cntCommands.xojo_code +++ b/webapp/containers/information/cntCommands.xojo_code @@ -76,6 +76,7 @@ End Sub Constructor() Super.Constructor + Me.Area = "Information" Me.Title = "Commands" Me.SearchAvailable = True @@ -125,6 +126,8 @@ End #tag Method, Flags = &h21 Private Sub ShowInfos() + Me.UpdateNoRowsMessage() + Me.LoadDatasource(Session.DB.SelectSQL("SHOW COMMANDS")) If (lstInfos.DataSource = Nil) Then @@ -136,10 +139,31 @@ End End Sub #tag EndMethod + #tag Method, Flags = &h21 + Private Sub UpdateNoRowsMessage() + Var sInfo As String = "No Commands" + + If (Me.SearchValue <> "") Then + sInfo = sInfo + " matching '" + Me.SearchValue + "'" + End If + + lstInfos.NoRowsMessage = sInfo + + End Sub + #tag EndMethod + #tag EndWindowCode #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty #tag ViewProperty Name="SearchAvailable" Visible=false diff --git a/webapp/containers/information/cntLog.xojo_code b/webapp/containers/information/cntLog.xojo_code index aab3cd3..7a76553 100644 --- a/webapp/containers/information/cntLog.xojo_code +++ b/webapp/containers/information/cntLog.xojo_code @@ -152,6 +152,19 @@ Begin cntDatasourceBase cntLog Width = 120 _mPanelIndex = -1 End + Begin WebTimer timRefresh + ControlID = "" + Enabled = False + Index = -2147483648 + Location = 0 + LockedInPosition= False + Period = 1 + RunMode = 0 + Scope = 2 + TabIndex = 4 + TabStop = True + _mPanelIndex = -1 + End End #tag EndWebContainerControl @@ -169,6 +182,7 @@ End Sub Constructor() Super.Constructor + Me.Area = "Information" Me.Title = "Log" Me.SearchAvailable = True @@ -241,6 +255,19 @@ End End Sub #tag EndMethod + #tag Method, Flags = &h21 + Private Sub RefreshSchedule(pbImmediately As Boolean) + 'if already running, stop + timRefresh.RunMode = WebTimer.RunModes.Off + timRefresh.Enabled = False + + timRefresh.Period = If(pbImmediately, 1, 800) + timRefresh.RunMode = WebTimer.RunModes.Single + timRefresh.Enabled = True + + End Sub + #tag EndMethod + #tag Method, Flags = &h0 Sub Search(SearchValue As String) Super.Search(SearchValue) @@ -257,6 +284,8 @@ End Return End If + Me.UpdateNoRowsMessage() + Me.LoadDatasource(Session.DB.SelectSQL("SHOW LAST " + numLogEntries.ToString + " ROWS FROM Log ORDER DESC")) If (lstInfos.DataSource = Nil) Then @@ -268,6 +297,19 @@ End End Sub #tag EndMethod + #tag Method, Flags = &h21 + Private Sub UpdateNoRowsMessage() + Var sInfo As String = "No Log entries" + + If (Me.SearchValue <> "") Then + sInfo = sInfo + " matching '" + Me.SearchValue + "'" + End If + + lstInfos.NoRowsMessage = sInfo + + End Sub + #tag EndMethod + #tag Constant, Name = constLogEntriesDefault, Type = String, Dynamic = False, Default = \"50", Scope = Private #tag EndConstant @@ -278,7 +320,7 @@ End #tag Events btnRefresh #tag Event Sub Pressed() - Self.ShowInfos() + Self.RefreshSchedule(True) End Sub #tag EndEvent @@ -286,7 +328,8 @@ End #tag Events edtLogNumberOfEntries #tag Event Sub TextChanged() - self.ShowInfos() + Self.RefreshSchedule(False) + End Sub #tag EndEvent #tag Event @@ -298,7 +341,26 @@ End End Sub #tag EndEvent #tag EndEvents +#tag Events timRefresh + #tag Event + Sub Run() + Me.RunMode = WebTimer.RunModes.Off + Me.Enabled = False + + Self.ShowInfos() + + End Sub + #tag EndEvent +#tag EndEvents #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty #tag ViewProperty Name="SearchAvailable" Visible=false diff --git a/webapp/containers/security/cntGroups.xojo_code b/webapp/containers/security/cntGroups.xojo_code index 0fed237..4b16971 100644 --- a/webapp/containers/security/cntGroups.xojo_code +++ b/webapp/containers/security/cntGroups.xojo_code @@ -144,64 +144,6 @@ Begin cntDatasourceBase cntGroups Width = 100 _mPanelIndex = -1 End - Begin dlgCommonName dlgCreate - ControlCount = 0 - ControlID = "" - Enabled = True - Height = 314 - Index = -2147483648 - Indicator = 0 - LayoutDirection = 0 - LayoutType = 0 - Left = 20 - LockBottom = False - LockedInPosition= True - LockHorizontal = False - LockLeft = False - LockRight = False - LockTop = False - LockVertical = False - PanelIndex = "0" - Scope = 2 - TabIndex = 5 - TabStop = True - Tooltip = "" - Top = 20 - Visible = True - Width = 600 - _mDesignHeight = 0 - _mDesignWidth = 0 - _mPanelIndex = -1 - End - Begin dlgCommonName dlgRename - ControlCount = 0 - ControlID = "" - Enabled = True - Height = 314 - Index = -2147483648 - Indicator = 0 - LayoutDirection = 0 - LayoutType = 0 - Left = 40 - LockBottom = False - LockedInPosition= True - LockHorizontal = False - LockLeft = False - LockRight = False - LockTop = False - LockVertical = False - PanelIndex = "0" - Scope = 2 - TabIndex = 6 - TabStop = True - Tooltip = "" - Top = 40 - Visible = True - Width = 600 - _mDesignHeight = 0 - _mDesignWidth = 0 - _mPanelIndex = -1 - End Begin WebThread thrDetails DebugIdentifier = "" Index = -2147483648 @@ -244,13 +186,17 @@ End #tag Method, Flags = &h21 Private Sub ActionCreate() + Var dlgCreate As New dlgCommonName + AddHandler dlgCreate.NameAction, WeakAddressOf ActionCreateButtonPressed dlgCreate.Show("Create Group", "Name", "Create") End Sub #tag EndMethod #tag Method, Flags = &h21 - Private Function ActionCreateButtonPressed(Name As String) As Boolean + Private Function ActionCreateButtonPressed(obj As dlgCommonName, Name As String) As Boolean + #Pragma unused obj + If (Name = "") Then Return False Try @@ -332,13 +278,17 @@ End esActionGroupname = groupname + Var dlgRename As New dlgCommonName + AddHandler dlgRename.NameAction, WeakAddressOf ActionRenameButtonPressed dlgRename.Show("Rename Group", "Name", "Rename", Indicators.Primary, groupname) End Sub #tag EndMethod #tag Method, Flags = &h21 - Private Function ActionRenameButtonPressed(Name As String) As Boolean + Private Function ActionRenameButtonPressed(obj As dlgCommonName, Name As String) As Boolean + #Pragma unused obj + If (esActionGroupname = "") Then Return False If (Name = "") Then Return False If (esActionGroupname = Name) Then Return False @@ -384,6 +334,7 @@ End Sub Constructor() Super.Constructor + Me.Area = "Security" Me.Title = "Groups" Me.SearchAvailable = True @@ -456,8 +407,10 @@ End #tag Method, Flags = &h21 Private Function GetSelectedGroupname() As String If (lstInfos.SelectedRowIndex < 0) Then Return "" - If (lstInfos.RowTagAt(lstInfos.SelectedRowIndex) IsA Dictionary) Then - Return Dictionary(lstInfos.RowTagAt(lstInfos.SelectedRowIndex)).Lookup("groupname", "").StringValue + + Var selectedRowTag As Variant = lstInfos.RowTagAt(lstInfos.SelectedRowIndex) + If (selectedRowTag IsA Dictionary) Then + Return Dictionary(selectedRowTag).Lookup("groupname", "").StringValue End If Return "" @@ -546,6 +499,8 @@ End #tag Method, Flags = &h21 Private Sub ShowInfos() + Me.UpdateNoRowsMessage() + Me.LoadDatasource(Session.DB.SelectSQL("SHOW GROUPS")) If (lstInfos.DataSource = Nil) Then @@ -566,11 +521,27 @@ End End Sub #tag EndMethod + #tag Method, Flags = &h21 + Private Sub UpdateNoRowsMessage() + Var sInfo As String = "No Groups" + + If (Me.SearchValue <> "") Then + sInfo = sInfo + " matching '" + Me.SearchValue + "'" + End If + + lstInfos.NoRowsMessage = sInfo + + End Sub + #tag EndMethod + #tag Method, Flags = &h1 Protected Sub WebTimer_RowDataLoaded(obj As WebTimer) Super.WebTimer_RowDataLoaded(obj) - If (esSelectAfterReload = "") Then Return + If (esSelectAfterReload = "") Then + Me.RefreshButtons() + Return + End If Var sSelectAfterReload As String = esSelectAfterReload esSelectAfterReload = "" @@ -649,22 +620,6 @@ End End Sub #tag EndEvent #tag EndEvents -#tag Events dlgCreate - #tag Event - Function NameAction(Name As String) As Boolean - Return Self.ActionCreateButtonPressed(Name) - - End Function - #tag EndEvent -#tag EndEvents -#tag Events dlgRename - #tag Event - Function NameAction(Name As String) As Boolean - Return Self.ActionRenameButtonPressed(Name) - - End Function - #tag EndEvent -#tag EndEvents #tag Events thrDetails #tag Event Sub Run() @@ -688,6 +643,14 @@ End #tag EndEvent #tag EndEvents #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty #tag ViewProperty Name="SearchAvailable" Visible=false diff --git a/webapp/containers/security/cntPrivileges.xojo_code b/webapp/containers/security/cntPrivileges.xojo_code index ec0ecbc..4de16bd 100644 --- a/webapp/containers/security/cntPrivileges.xojo_code +++ b/webapp/containers/security/cntPrivileges.xojo_code @@ -116,36 +116,6 @@ Begin cntDatasourceBase cntPrivileges Width = 100 _mPanelIndex = -1 End - Begin dlgPrivilegeGrant dlgGrant - ControlCount = 0 - ControlID = "" - Enabled = True - esPreSelectGroup= "" - Height = 314 - Index = -2147483648 - Indicator = 0 - LayoutDirection = 0 - LayoutType = 0 - Left = 20 - LockBottom = False - LockedInPosition= True - LockHorizontal = False - LockLeft = False - LockRight = False - LockTop = False - LockVertical = False - PanelIndex = "0" - Scope = 2 - TabIndex = 5 - TabStop = True - Tooltip = "" - Top = 20 - Visible = True - Width = 600 - _mDesignHeight = 0 - _mDesignWidth = 0 - _mPanelIndex = -1 - End Begin WebRectangle rctFilter BackgroundColor = &cFFFFFF ControlCount = 0 @@ -236,7 +206,7 @@ Begin cntDatasourceBase cntPrivileges TabIndex = 1 TabPanelIndex = 0 TabStop = True - Text = "Group(s):" + Text = "Group:" TextAlignment = 0 TextColor = &c000000FF Tooltip = "" @@ -272,7 +242,7 @@ Begin cntDatasourceBase cntPrivileges TabIndex = 3 TabPanelIndex = 0 TabStop = True - Text = "Database(s):" + Text = "Database:" TextAlignment = 0 TextColor = &c000000FF Tooltip = "" @@ -376,7 +346,6 @@ End Self.Load() Self.ShowInfos() - Self.RefreshButtons() ebOpened = True @@ -386,13 +355,17 @@ End #tag Method, Flags = &h21 Private Sub ActionGrant() + Var dlgGrant As New dlgPrivilegeGrant + AddHandler dlgGrant.PrivilegeGrantAction, WeakAddressOf ActionGrantButtonPressed dlgGrant.Show(lstFilterGroup.SelectedRowText) End Sub #tag EndMethod #tag Method, Flags = &h21 - Private Function ActionGrantButtonPressed(Group As String, Privilege As String, Database As String, Table As String) As Boolean + Private Function ActionGrantButtonPressed(obj As dlgPrivilegeGrant, Group As String, Privilege As String, Database As String, Table As String) As Boolean + #Pragma unused obj + If (Group = "") Or (Group = "*") Or (Group = "admin") Then Return False If (Privilege = "") Or (Privilege = "*") Then Return False If (Database = "") Then Return False @@ -419,6 +392,21 @@ End End Try + + Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex) + If (filterGroupname <> "") Then + ebOpened = False + lstFilterGroup.SelectRowWithTag(Group) + ebOpened = True + End If + Var filterDatabasename As String = lstFilterDatabase.RowTagAt(lstFilterDatabase.SelectedRowIndex) + If (filterDatabasename <> "") Then + ebOpened = False + lstFilterDatabase.SelectRowWithTag(Database) + ebOpened = True + End If + + 'Success - no dialog Var selectRowTag As New Dictionary selectRowTag.Value("groupname") = Group @@ -507,6 +495,7 @@ End Sub Constructor() Super.Constructor + Me.Area = "Security" Me.Title = "Privileges" Me.SearchAvailable = True @@ -726,6 +715,8 @@ End #tag Method, Flags = &h21 Private Sub ShowInfos() + Me.UpdateNoRowsMessage() + Me.Filters = New Dictionary Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex) @@ -750,11 +741,27 @@ End End Sub #tag EndMethod + #tag Method, Flags = &h21 + Private Sub UpdateNoRowsMessage() + Var sInfo As String = "No Privileges" + + If (Me.SearchValue <> "") Then + sInfo = sInfo + " matching '" + Me.SearchValue + "'" + End If + + lstInfos.NoRowsMessage = sInfo + + End Sub + #tag EndMethod + #tag Method, Flags = &h1 Protected Sub WebTimer_RowDataLoaded(obj As WebTimer) Super.WebTimer_RowDataLoaded(obj) - If (esSelectAfterReload = Nil) Then Return + If (esSelectAfterReload = Nil) Then + Me.RefreshButtons() + Return + End If Var sSelectAfterReload As Dictionary = esSelectAfterReload esSelectAfterReload = Nil @@ -844,14 +851,6 @@ End End Sub #tag EndEvent #tag EndEvents -#tag Events dlgGrant - #tag Event - Function PrivilegeGrantAction(Group As String, Privilege As String, Database As String, Table As String) As Boolean - Return Self.ActionGrantButtonPressed(Group, Privilege, Database, Table) - - End Function - #tag EndEvent -#tag EndEvents #tag Events lstFilterGroup #tag Event Sub SelectionChanged(item As WebMenuItem) @@ -885,6 +884,14 @@ End #tag EndEvent #tag EndEvents #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty #tag ViewProperty Name="SearchAvailable" Visible=false diff --git a/webapp/containers/security/cntUsers.xojo_code b/webapp/containers/security/cntUsers.xojo_code index f629347..2ac17a5 100644 --- a/webapp/containers/security/cntUsers.xojo_code +++ b/webapp/containers/security/cntUsers.xojo_code @@ -29,7 +29,7 @@ Begin cntDatasourceBase cntUsers ControlID = "" Enabled = True HasHeader = True - Height = 422 + Height = 342 HighlightSortedColumn= True Index = -2147483648 Indicator = 0 @@ -80,7 +80,7 @@ Begin cntDatasourceBase cntUsers LockTop = False LockVertical = False Scope = 2 - TabIndex = 4 + TabIndex = 6 TabStop = True Tooltip = "" Top = 442 @@ -108,7 +108,7 @@ Begin cntDatasourceBase cntUsers LockVertical = False PanelIndex = "0" Scope = 2 - TabIndex = 3 + TabIndex = 5 TabStop = True Tooltip = "" Top = 442 @@ -136,7 +136,7 @@ Begin cntDatasourceBase cntUsers LockVertical = False PanelIndex = "0" Scope = 2 - TabIndex = 1 + TabIndex = 2 TabStop = True Tooltip = "" Top = 442 @@ -144,64 +144,6 @@ Begin cntDatasourceBase cntUsers Width = 100 _mPanelIndex = -1 End - Begin dlgUserCreate dlgCreate - ControlCount = 0 - ControlID = "" - Enabled = True - Height = 314 - Index = -2147483648 - Indicator = 0 - LayoutDirection = 0 - LayoutType = 0 - Left = 20 - LockBottom = False - LockedInPosition= True - LockHorizontal = False - LockLeft = False - LockRight = False - LockTop = False - LockVertical = False - PanelIndex = "0" - Scope = 2 - TabIndex = 5 - TabStop = True - Tooltip = "" - Top = 20 - Visible = True - Width = 600 - _mDesignHeight = 0 - _mDesignWidth = 0 - _mPanelIndex = -1 - End - Begin dlgCommonName dlgRename - ControlCount = 0 - ControlID = "" - Enabled = True - Height = 314 - Index = -2147483648 - Indicator = 0 - LayoutDirection = 0 - LayoutType = 0 - Left = 40 - LockBottom = False - LockedInPosition= True - LockHorizontal = False - LockLeft = False - LockRight = False - LockTop = False - LockVertical = False - PanelIndex = "0" - Scope = 2 - TabIndex = 6 - TabStop = True - Tooltip = "" - Top = 40 - Visible = True - Width = 600 - _mDesignHeight = 0 - _mDesignWidth = 0 - _mPanelIndex = -1 - End Begin WebThread thrDetails DebugIdentifier = "" Index = -2147483648 @@ -232,7 +174,7 @@ Begin cntDatasourceBase cntUsers LockVertical = False PanelIndex = "0" Scope = 2 - TabIndex = 2 + TabIndex = 4 TabStop = True Tooltip = "" Top = 442 @@ -240,35 +182,6 @@ Begin cntDatasourceBase cntUsers Width = 140 _mPanelIndex = -1 End - Begin dlgUserCreate dlgPassword - ControlCount = 0 - ControlID = "" - Enabled = True - Height = 314 - Index = -2147483648 - Indicator = 0 - LayoutDirection = 0 - LayoutType = 0 - Left = 40 - LockBottom = False - LockedInPosition= False - LockHorizontal = False - LockLeft = False - LockRight = False - LockTop = False - LockVertical = False - PanelIndex = "0" - Scope = 2 - TabIndex = 7 - TabStop = True - Tooltip = "" - Top = 40 - Visible = True - Width = 600 - _mDesignHeight = 0 - _mDesignWidth = 0 - _mPanelIndex = -1 - End Begin WebButton btnGroups AllowAutoDisable= False Cancel = False @@ -281,7 +194,7 @@ Begin cntDatasourceBase cntUsers Indicator = 6 Left = 266 LockBottom = True - LockedInPosition= False + LockedInPosition= True LockHorizontal = False LockLeft = False LockRight = True @@ -289,7 +202,7 @@ Begin cntDatasourceBase cntUsers LockVertical = False PanelIndex = "0" Scope = 2 - TabIndex = 8 + TabIndex = 3 TabStop = True Tooltip = "" Top = 442 @@ -297,53 +210,157 @@ Begin cntDatasourceBase cntUsers Width = 100 _mPanelIndex = -1 End - Begin dlgUserGroups dlgGroups - ControlCount = 0 + Begin WebMessageDialog dlgDrop ControlID = "" Enabled = True - Height = 314 + Explanation = "" Index = -2147483648 Indicator = 0 - LayoutDirection = 0 - LayoutType = 0 - Left = 40 LockBottom = False - LockedInPosition= False + LockedInPosition= True LockHorizontal = False - LockLeft = False + LockLeft = True LockRight = False - LockTop = False + LockTop = True LockVertical = False - PanelIndex = "0" + Message = "" Scope = 2 - TabIndex = 9 - TabStop = True + Title = "" Tooltip = "" - Top = 40 - Visible = True - Width = 600 - _mDesignHeight = 0 - _mDesignWidth = 0 _mPanelIndex = -1 End - Begin WebMessageDialog dlgDrop + Begin WebRectangle rctFilter + BackgroundColor = &cFFFFFF + ControlCount = 0 ControlID = "" Enabled = True - Explanation = "" + HasBackgroundColor= False + Height = 75 Index = -2147483648 Indicator = 0 - LockBottom = False - LockedInPosition= False + LayoutDirection = 0 + LayoutType = 0 + Left = 0 + LockBottom = True + LockedInPosition= True LockHorizontal = False LockLeft = True - LockRight = False - LockTop = True + LockRight = True + LockTop = False LockVertical = False - Message = "" + PanelIndex = "0" Scope = 2 - Title = "" + TabIndex = 1 + TabStop = True Tooltip = "" + Top = 350 + Visible = True + Width = 750 + _mDesignHeight = 0 + _mDesignWidth = 0 _mPanelIndex = -1 + Begin WebLabel labFilter + Bold = True + ControlID = "" + Enabled = True + FontName = "" + FontSize = 0.0 + Height = 38 + Index = -2147483648 + Indicator = 0 + Italic = False + Left = 20 + LockBottom = False + LockedInPosition= True + LockHorizontal = False + LockLeft = True + LockRight = False + LockTop = True + LockVertical = False + Multiline = False + PanelIndex = "0" + Parent = "rctFilter" + Scope = 2 + TabIndex = 0 + TabPanelIndex = -1 + TabStop = True + Text = "Filter" + TextAlignment = 0 + TextColor = &c000000FF + Tooltip = "" + Top = 370 + Underline = False + Visible = True + Width = 60 + _mPanelIndex = -1 + End + Begin WebLabel labFilterGroup + Bold = False + ControlID = "" + Enabled = True + FontName = "" + FontSize = 0.0 + Height = 38 + Index = -2147483648 + Indicator = 0 + Italic = False + Left = 151 + LockBottom = False + LockedInPosition= True + LockHorizontal = False + LockLeft = True + LockRight = False + LockTop = True + LockVertical = False + Multiline = False + PanelIndex = "0" + Parent = "rctFilter" + Scope = 2 + TabIndex = 1 + TabPanelIndex = -1 + TabStop = True + Text = "Group:" + TextAlignment = 0 + TextColor = &c000000FF + Tooltip = "" + Top = 370 + Underline = False + Visible = True + Width = 140 + _mPanelIndex = -1 + End + Begin WebPopupMenu lstFilterGroup + ControlID = "" + Enabled = True + Height = 38 + Index = -2147483648 + Indicator = 0 + InitialValue = "" + LastAddedRowIndex= 0 + LastRowIndex = 0 + Left = 299 + LockBottom = False + LockedInPosition= True + LockHorizontal = False + LockLeft = True + LockRight = False + LockTop = True + LockVertical = False + PanelIndex = "0" + Parent = "rctFilter" + RowCount = 0 + Scope = 2 + SelectedRowIndex= 0 + SelectedRowText = "" + TabIndex = 2 + TabPanelIndex = -1 + TabStop = True + Tooltip = "" + Top = 370 + Visible = True + Width = 400 + _mPanelIndex = -1 + End End End #tag EndWebContainerControl @@ -351,26 +368,39 @@ End #tag WindowCode #tag Event Sub Opening() + Self.Load() + Self.ShowInfos() + + ebOpened = True + End Sub #tag EndEvent #tag Method, Flags = &h21 Private Sub ActionCreate() - dlgCreate.Show() + Var dlgCreate As New dlgUserCreate + AddHandler dlgCreate.UserCreateAction, WeakAddressOf ActionCreateButtonPressed + dlgCreate.Show(lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex)) End Sub #tag EndMethod #tag Method, Flags = &h21 - Private Function ActionCreateButtonPressed(Name As String, Password As String) As Boolean + Private Function ActionCreateButtonPressed(obj As dlgUserCreate, Name As String, Password As String, Group As String) As Boolean + #Pragma unused obj + If (Name = "") Then Return False Try Session.DB.ExecuteSQL("CREATE USER " + "'" + Name + "' WITH PASSWORD '" + Password + "'") + If (Group <> "") Then + Session.DB.ExecuteSQL("ADD USER " + "'" + Name + "' TO GROUP '" + Group + "'") + End If + Catch err As DatabaseException Var dialog As New WebMessageDialog dialog.Title = "Create User" @@ -384,6 +414,22 @@ End End Try + Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex) + + If (filterGroupname <> "") Then + ebOpened = False + If (Group = "") Then + 'Added user doesn't have a group yet + If (filterGroupname <> kGroupTagUnassigned) Then + lstFilterGroup.SelectedRowIndex = 0 + End If + Else + 'Added user to a group + lstFilterGroup.SelectRowWithTag(Group) + End If + ebOpened = True + End If + 'Success - no dialog Self.RefreshInfos(Name) Return True @@ -446,12 +492,16 @@ End esActionUsername = username + Var dlgGroups As New dlgUserGroups + AddHandler dlgGroups.NeedsRefresh, WeakAddressOf ActionGroupsButtonPressed dlgGroups.Show(username) End Sub #tag EndMethod #tag Method, Flags = &h21 - Private Sub ActionGroupsButtonPressed() + Private Sub ActionGroupsButtonPressed(obj As dlgUserGroups) + #Pragma unused obj + Var sUsername As String = esActionUsername esActionUsername = "" @@ -465,13 +515,18 @@ End Var username As String = Me.GetSelectedUsername() If (username = "") Then Return + Var dlgPassword As New dlgUserCreate + AddHandler dlgPassword.UserCreateAction, WeakAddressOf ActionPasswordButtonPressed dlgPassword.ShowSetPassword(username) End Sub #tag EndMethod #tag Method, Flags = &h21 - Private Function ActionPasswordButtonPressed(Name As String, Password As String) As Boolean + Private Function ActionPasswordButtonPressed(obj As dlgUserCreate, Name As String, Password As String, Group As String) As Boolean + #Pragma unused obj + #Pragma unused Group + If (Name = "") Then Return False Try @@ -505,13 +560,17 @@ End esActionUsername = username + Var dlgRename As New dlgCommonName + AddHandler dlgRename.NameAction, WeakAddressOf ActionRenameButtonPressed dlgRename.Show("Rename User", "Name", "Rename", Indicators.Primary, username) End Sub #tag EndMethod #tag Method, Flags = &h21 - Private Function ActionRenameButtonPressed(Name As String) As Boolean + Private Function ActionRenameButtonPressed(obj As dlgCommonName, Name As String) As Boolean + #Pragma unused obj + If (esActionUsername = "") Then Return False If (Name = "") Then Return False If (esActionUsername = Name) Then Return False @@ -557,6 +616,7 @@ End Sub Constructor() Super.Constructor + Me.Area = "Security" Me.Title = "Users" Me.SearchAvailable = True @@ -629,8 +689,10 @@ End #tag Method, Flags = &h21 Private Function GetSelectedUsername() As String If (lstInfos.SelectedRowIndex < 0) Then Return "" - If (lstInfos.RowTagAt(lstInfos.SelectedRowIndex) IsA Dictionary) Then - Return Dictionary(lstInfos.RowTagAt(lstInfos.SelectedRowIndex)).Lookup("username", "").StringValue + + Var selectedRowTag As Variant = lstInfos.RowTagAt(lstInfos.SelectedRowIndex) + If (selectedRowTag IsA Dictionary) Then + Return Dictionary(selectedRowTag).Lookup("username", "").StringValue End If Return "" @@ -638,6 +700,50 @@ End End Function #tag EndMethod + #tag Method, Flags = &h21 + Private Sub Load() + Me.LoadGroups() + + End Sub + #tag EndMethod + + #tag Method, Flags = &h21 + Private Sub LoadGroups() + lstFilterGroup.RemoveAllRows + lstFilterGroup.AddRow("(ALL)", "") + lstFilterGroup.AddRow("-", "") + + Try + Var rs As RowSet = Session.DB.SelectSQL("SHOW GROUPS") + If (rs = Nil) Then Return + + If (rs.RowCount > 0) Then + rs.MoveToFirstRow + While (Not rs.AfterLastRow) + + If (rs.Column("groupname").StringValue <> "admin") Then + lstFilterGroup.AddRow(rs.Column("groupname").StringValue, rs.Column("groupname").StringValue) + End If + + rs.MoveToNextRow + Wend + End If + + rs.Close + + Catch DatabaseException + + Finally + If (lstFilterGroup.RowCount > 0) Then lstFilterGroup.SelectedRowIndex = 0 + + End Try + + lstFilterGroup.AddRow("-", "") + lstFilterGroup.AddRow("(UNASSIGNED)", kGroupTagUnassigned) + + End Sub + #tag EndMethod + #tag Method, Flags = &h21 Private Sub RefreshButtons() Var bGroups, bPassword, bRename, bDrop As Boolean @@ -723,7 +829,20 @@ End #tag Method, Flags = &h21 Private Sub ShowInfos() - Me.LoadDatasource(Session.DB.SelectSQL("SHOW USERS")) + Me.UpdateNoRowsMessage() + + Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex) + + If (filterGroupname <> "") Then + If (filterGroupname = kGroupTagUnassigned) Then + Me.LoadDatasource(Session.DB.SelectSQL("SHOW USERS IN GROUP ''")) + Else + Me.LoadDatasource(Session.DB.SelectSQL("SHOW USERS IN GROUP '" + filterGroupname + "'")) + End If + Else + Me.LoadDatasource(Session.DB.SelectSQL("SHOW USERS")) + End If + If (lstInfos.DataSource = Nil) Then lstInfos.DataSource = Self @@ -743,11 +862,35 @@ End End Sub #tag EndMethod + #tag Method, Flags = &h21 + Private Sub UpdateNoRowsMessage() + Var sInfo As String = "No Users" + + Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex) + If (filterGroupname <> "") Then + sInfo = sInfo + " in Group " + filterGroupname + If (filterGroupname = kGroupTagUnassigned) Then + sInfo = "No Users unassigned to a Group" + End If + End If + + If (Me.SearchValue <> "") Then + sInfo = sInfo + " matching '" + Me.SearchValue + "'" + End If + + lstInfos.NoRowsMessage = sInfo + + End Sub + #tag EndMethod + #tag Method, Flags = &h1 Protected Sub WebTimer_RowDataLoaded(obj As WebTimer) Super.WebTimer_RowDataLoaded(obj) - If (esSelectAfterReload = "") Then Return + If (esSelectAfterReload = "") Then + Me.RefreshButtons() + Return + End If Var sSelectAfterReload As String = esSelectAfterReload esSelectAfterReload = "" @@ -771,6 +914,10 @@ End #tag EndMethod + #tag Property, Flags = &h21 + Private ebOpened As Boolean + #tag EndProperty + #tag Property, Flags = &h21 Private ebShowDetails As Boolean #tag EndProperty @@ -784,6 +931,10 @@ End #tag EndProperty + #tag Constant, Name = kGroupTagUnassigned, Type = , Dynamic = False, Default = \"-----", Scope = Private + #tag EndConstant + + #tag EndWindowCode #tag Events lstInfos @@ -826,22 +977,6 @@ End End Sub #tag EndEvent #tag EndEvents -#tag Events dlgCreate - #tag Event - Function UserCreateAction(Name As String, Password As String) As Boolean - Return Self.ActionCreateButtonPressed(Name, Password) - - End Function - #tag EndEvent -#tag EndEvents -#tag Events dlgRename - #tag Event - Function NameAction(Name As String) As Boolean - Return Self.ActionRenameButtonPressed(Name) - - End Function - #tag EndEvent -#tag EndEvents #tag Events thrDetails #tag Event Sub Run() @@ -863,14 +998,6 @@ End End Sub #tag EndEvent #tag EndEvents -#tag Events dlgPassword - #tag Event - Function UserCreateAction(Name As String, Password As String) As Boolean - Return Self.ActionPasswordButtonPressed(Name, Password) - - End Function - #tag EndEvent -#tag EndEvents #tag Events btnGroups #tag Event Sub Pressed() @@ -879,22 +1006,35 @@ End End Sub #tag EndEvent #tag EndEvents -#tag Events dlgGroups +#tag Events dlgDrop #tag Event - Sub NeedsRefresh() - self.ActionGroupsButtonPressed() + Sub ButtonPressed(button As WebMessageDialogButton) + Self.ActionDropButtonPressed(Me, button) + End Sub #tag EndEvent #tag EndEvents -#tag Events dlgDrop +#tag Events lstFilterGroup #tag Event - Sub ButtonPressed(button As WebMessageDialogButton) - Self.ActionDropButtonPressed(Me, button) + Sub SelectionChanged(item As WebMenuItem) + #Pragma unused item + + If (Not ebOpened) Then Return + + Self.RefreshInfos() End Sub #tag EndEvent #tag EndEvents #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty #tag ViewProperty Name="SearchAvailable" Visible=false diff --git a/webapp/containers/server/cntConsole.xojo_code b/webapp/containers/server/cntConsole.xojo_code index f004d20..8181365 100644 --- a/webapp/containers/server/cntConsole.xojo_code +++ b/webapp/containers/server/cntConsole.xojo_code @@ -22,7 +22,6 @@ Begin cntBase cntConsole Width = 750 _mDesignHeight = 0 _mDesignWidth = 0 - _mName = "" _mPanelIndex = -1 Begin WebListBox lstInfos ColumnCount = 1 @@ -271,7 +270,9 @@ End Sub Constructor() Super.Constructor - me.Title = "Console" + Me.Area = "Server" + Me.Title = "Console" + End Sub #tag EndMethod @@ -409,6 +410,22 @@ End #tag EndEvent #tag EndEvents #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty + #tag ViewProperty + Name="SearchAvailable" + Visible=false + Group="Behavior" + InitialValue="False" + Type="Boolean" + EditorType="" + #tag EndViewProperty #tag ViewProperty Name="_mPanelIndex" Visible=false diff --git a/webapp/containers/server/cntDatabases.xojo_code b/webapp/containers/server/cntDatabases.xojo_code index 84d8f07..4701f4f 100644 --- a/webapp/containers/server/cntDatabases.xojo_code +++ b/webapp/containers/server/cntDatabases.xojo_code @@ -172,35 +172,6 @@ Begin cntDatasourceBase cntDatabases Width = 100 _mPanelIndex = -1 End - Begin dlgDatabaseCreate dlgCreate - ControlCount = 0 - ControlID = "" - Enabled = True - Height = 314 - Index = -2147483648 - Indicator = 0 - LayoutDirection = 0 - LayoutType = 0 - Left = 20 - LockBottom = False - LockedInPosition= True - LockHorizontal = False - LockLeft = False - LockRight = False - LockTop = False - LockVertical = False - PanelIndex = "0" - Scope = 2 - TabIndex = 5 - TabStop = True - Tooltip = "" - Top = 20 - Visible = True - Width = 600 - _mDesignHeight = 0 - _mDesignWidth = 0 - _mPanelIndex = -1 - End Begin WebButton btnRename AllowAutoDisable= False Cancel = False @@ -229,35 +200,6 @@ Begin cntDatasourceBase cntDatabases Width = 100 _mPanelIndex = -1 End - Begin dlgCommonName dlgRename - ControlCount = 0 - ControlID = "" - Enabled = True - Height = 314 - Index = -2147483648 - Indicator = 0 - LayoutDirection = 0 - LayoutType = 0 - Left = 60 - LockBottom = False - LockedInPosition= True - LockHorizontal = False - LockLeft = False - LockRight = False - LockTop = False - LockVertical = False - PanelIndex = "0" - Scope = 2 - TabIndex = 7 - TabStop = True - Tooltip = "" - Top = 60 - Visible = True - Width = 600 - _mDesignHeight = 0 - _mDesignWidth = 0 - _mPanelIndex = -1 - End Begin WebMessageDialog dlgDrop ControlID = "" Enabled = True @@ -290,13 +232,17 @@ End #tag Method, Flags = &h21 Private Sub ActionCreate() + Var dlgCreate As New dlgDatabaseCreate + AddHandler dlgCreate.DatabaseCreateAction, WeakAddressOf ActionCreateButtonPressed dlgCreate.Show() End Sub #tag EndMethod #tag Method, Flags = &h21 - Private Function ActionCreateButtonPressed(Name As String, Key As String, Encoding As String) As Boolean + Private Function ActionCreateButtonPressed(obj As dlgDatabaseCreate, Name As String, Key As String, Encoding As String) As Boolean + #Pragma unused obj + If (Name = "") Then Return False Try @@ -383,13 +329,17 @@ End esActionDatabasename = databasename + Var dlgRename As New dlgCommonName + AddHandler dlgRename.NameAction, WeakAddressOf ActionRenameButtonPressed dlgRename.Show("Rename Database", "Name", "Rename", Indicators.Primary, databasename) End Sub #tag EndMethod #tag Method, Flags = &h21 - Private Function ActionRenameButtonPressed(Name As String) As Boolean + Private Function ActionRenameButtonPressed(obj As dlgCommonName, Name As String) As Boolean + #Pragma unused obj + If (esActionDatabasename = "") Then Return False If (Name = "") Then Return False If (esActionDatabasename = Name) Then Return False @@ -474,6 +424,7 @@ End Sub Constructor() Super.Constructor + Me.Area = "Server" Me.Title = "Databases" Me.SearchAvailable = True @@ -595,8 +546,10 @@ End #tag Method, Flags = &h21 Private Function GetSelectedDatabasename() As String If (lstInfos.SelectedRowIndex < 0) Then Return "" - If (lstInfos.RowTagAt(lstInfos.SelectedRowIndex) IsA Dictionary) Then - Return Dictionary(lstInfos.RowTagAt(lstInfos.SelectedRowIndex)).Lookup("databasename", "").StringValue + + Var selectedRowTag As Variant = lstInfos.RowTagAt(lstInfos.SelectedRowIndex) + If (selectedRowTag IsA Dictionary) Then + Return Dictionary(selectedRowTag).Lookup("databasename", "").StringValue End If Return "" @@ -652,6 +605,8 @@ End #tag Method, Flags = &h21 Private Sub ShowInfos() + Me.UpdateNoRowsMessage() + Me.LoadDatasource(Session.DB.SelectSQL("SHOW DATABASES WITH DETAILS")) If (lstInfos.DataSource = Nil) Then @@ -663,11 +618,27 @@ End End Sub #tag EndMethod + #tag Method, Flags = &h21 + Private Sub UpdateNoRowsMessage() + Var sInfo As String = "No Databases" + + If (Me.SearchValue <> "") Then + sInfo = sInfo + " matching '" + Me.SearchValue + "'" + End If + + lstInfos.NoRowsMessage = sInfo + + End Sub + #tag EndMethod + #tag Method, Flags = &h1 Protected Sub WebTimer_RowDataLoaded(obj As WebTimer) Super.WebTimer_RowDataLoaded(obj) - If (esSelectAfterReload = "") Then Return + If (esSelectAfterReload = "") Then + Me.RefreshButtons() + Return + End If Var sSelectAfterReload As String = esSelectAfterReload esSelectAfterReload = "" @@ -750,14 +721,6 @@ End End Sub #tag EndEvent #tag EndEvents -#tag Events dlgCreate - #tag Event - Function DatabaseCreateAction(Name As String, Key As String, Encoding As String) As Boolean - Return Self.ActionCreateButtonPressed(Name, Key, Encoding) - - End Function - #tag EndEvent -#tag EndEvents #tag Events btnRename #tag Event Sub Pressed() @@ -766,14 +729,6 @@ End End Sub #tag EndEvent #tag EndEvents -#tag Events dlgRename - #tag Event - Function NameAction(Name As String) As Boolean - Return Self.ActionRenameButtonPressed(Name) - - End Function - #tag EndEvent -#tag EndEvents #tag Events dlgDrop #tag Event Sub ButtonPressed(button As WebMessageDialogButton) @@ -783,6 +738,14 @@ End #tag EndEvent #tag EndEvents #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty #tag ViewProperty Name="SearchAvailable" Visible=false diff --git a/webapp/containers/server/cntRegistration.xojo_code b/webapp/containers/server/cntRegistration.xojo_code index 0d3ccb4..b387bb5 100644 --- a/webapp/containers/server/cntRegistration.xojo_code +++ b/webapp/containers/server/cntRegistration.xojo_code @@ -105,7 +105,8 @@ End Sub Constructor() Super.Constructor - me.Title = "Registration" + Me.Area = "Server" + Me.Title = "Registration" End Sub #tag EndMethod @@ -186,6 +187,22 @@ End #tag EndEvent #tag EndEvents #tag ViewBehavior + #tag ViewProperty + Name="Area" + Visible=false + Group="Behavior" + InitialValue="Home" + Type="String" + EditorType="MultiLineEditor" + #tag EndViewProperty + #tag ViewProperty + Name="SearchAvailable" + Visible=false + Group="Behavior" + InitialValue="False" + Type="Boolean" + EditorType="" + #tag EndViewProperty #tag ViewProperty Name="_mPanelIndex" Visible=false diff --git a/webapp/containers/server/cntRegistrationAction.xojo_code b/webapp/containers/server/cntRegistrationAction.xojo_code index 151bf3d..c1a9e89 100644 --- a/webapp/containers/server/cntRegistrationAction.xojo_code +++ b/webapp/containers/server/cntRegistrationAction.xojo_code @@ -22,7 +22,6 @@ Begin WebContainer cntRegistrationAction Width = 750 _mDesignHeight = 0 _mDesignWidth = 0 - _mName = "" _mPanelIndex = -1 Begin WebButton btnGetServerKey AllowAutoDisable= False @@ -42,7 +41,7 @@ Begin WebContainer cntRegistrationAction LockRight = False LockTop = False LockVertical = False - PanelIndex = 0 + PanelIndex = "0" Scope = 2 TabIndex = 0 TabStop = True @@ -70,7 +69,7 @@ Begin WebContainer cntRegistrationAction LockRight = True LockTop = False LockVertical = False - PanelIndex = 0 + PanelIndex = "0" Scope = 2 TabIndex = 1 TabStop = True @@ -80,40 +79,12 @@ Begin WebContainer cntRegistrationAction Width = 266 _mPanelIndex = -1 End - Begin dlgRegisterServer dlgRegistration - ControlCount = 0 - ControlID = "" - Enabled = True - Height = 272 - Index = -2147483648 - Indicator = 0 - LayoutDirection = 0 - LayoutType = 0 - Left = 0 - LockBottom = False - LockedInPosition= True - LockHorizontal = False - LockLeft = False - LockRight = False - LockTop = False - LockVertical = False - Scope = 2 - TabIndex = 2 - TabStop = True - Tooltip = "" - Top = 0 - Visible = True - Width = 600 - _mDesignHeight = 0 - _mDesignWidth = 0 - _mPanelIndex = -1 - End Begin WebMessageDialog dlgGetServerKey ControlID = "" Enabled = True Explanation = "" Index = -2147483648 - Indicator = 0 + Indicator = "" LockBottom = False LockedInPosition= False LockHorizontal = False @@ -132,7 +103,21 @@ End #tag WindowCode #tag Method, Flags = &h21 - Private Sub GetServerKeyAction(obj As WebMessageDialog, button As WebMessageDialogButton) + Private Sub ActionGetServerKey() + dlgGetServerKey.Title = "Server Key" + dlgGetServerKey.Indicator = Indicators.Default + dlgGetServerKey.ActionButton.Caption = "Get a Key" + dlgGetServerKey.CancelButton.Visible = True + dlgGetServerKey.Message = "Get a Server Key from SQlabs." + dlgGetServerKey.Explanation = "Open this URL in a new Browser Window: " + constUrl_DeveloperKey + + dlgGetServerKey.Show() + + End Sub + #tag EndMethod + + #tag Method, Flags = &h21 + Private Sub ActionGetServerKeyButtonPressed(obj As WebMessageDialog, button As WebMessageDialogButton) If (button = obj.ActionButton) Then Self.GoToURL(constUrl_DeveloperKey, True) End If @@ -141,7 +126,41 @@ End #tag EndMethod #tag Method, Flags = &h21 - Private Function RegistrationAction(Name As String, Key As String) As Boolean + Private Sub ActionRegistration() + Var Name, Key As String + + Try + Var rs As RowSet = Session.DB.SelectSQL("SHOW PREFERENCES") + If (rs <> Nil) Then + Var infos As New Dictionary + For Each row As DatabaseRow In rs + infos.Value(row.ColumnAt(0).StringValue) = row.ColumnAt(1).StringValue + Next + + rs.Close + + Name = infos.Lookup("KEY_NAME", "").StringValue + Key = infos.Lookup("KEY_VALUE", "").StringValue + End If + + + Catch DatabaseException + + Finally + Var dlgRegistration As New dlgRegisterServer + AddHandler dlgRegistration.RegistrationAction, WeakAddressOf ActionRegistrationButtonPressed + dlgRegistration.Show(Name, Key) + + End Try + + + End Sub + #tag EndMethod + + #tag Method, Flags = &h21 + Private Function ActionRegistrationButtonPressed(obj As dlgRegisterServer, Name As String, Key As String) As Boolean + #Pragma unused obj + If (Name = "") Or (Key = "") Then Return False Try @@ -180,50 +199,6 @@ End End Function #tag EndMethod - #tag Method, Flags = &h21 - Private Sub ShowGetServerKeyDialog() - dlgGetServerKey.Title = "Server Key" - dlgGetServerKey.Indicator = Indicators.Default - dlgGetServerKey.ActionButton.Caption = "Get a Key" - dlgGetServerKey.CancelButton.Visible = True - dlgGetServerKey.Message = "Get a Server Key from SQlabs." - dlgGetServerKey.Explanation = "Open this URL in a new Browser Window: " + constUrl_DeveloperKey - - dlgGetServerKey.Show() - - End Sub - #tag EndMethod - - #tag Method, Flags = &h21 - Private Sub ShowRegistrationDialog() - Var Name, Key As String - - Try - Var rs As RowSet = Session.DB.SelectSQL("SHOW PREFERENCES") - If (rs <> Nil) Then - Var infos As New Dictionary - For Each row As DatabaseRow In rs - infos.Value(row.ColumnAt(0).StringValue) = row.ColumnAt(1).StringValue - Next - - rs.Close - - Name = infos.Lookup("KEY_NAME", "").StringValue - Key = infos.Lookup("KEY_VALUE", "").StringValue - End If - - - Catch DatabaseException - - Finally - dlgRegistration.Show(Name, Key) - - End Try - - - End Sub - #tag EndMethod - #tag Hook, Flags = &h0 Event NeedsRefresh() @@ -235,29 +210,21 @@ End #tag Events btnGetServerKey #tag Event Sub Pressed() - self.ShowGetServerKeyDialog() + self.ActionGetServerKey() End Sub #tag EndEvent #tag EndEvents #tag Events btnRegisterServer #tag Event Sub Pressed() - self.ShowRegistrationDialog() + self.ActionRegistration() End Sub #tag EndEvent #tag EndEvents -#tag Events dlgRegistration - #tag Event - Function RegistrationAction(Name As String, Key As String) As Boolean - Return Self.RegistrationAction(Name, Key) - - End Function - #tag EndEvent -#tag EndEvents #tag Events dlgGetServerKey #tag Event Sub ButtonPressed(button As WebMessageDialogButton) - Self.GetServerKeyAction(Me, button) + Self.ActionGetServerKeyButtonPressed(Me, button) End Sub #tag EndEvent diff --git a/webapp/dialogs/dlgUserCreate.xojo_code b/webapp/dialogs/dlgUserCreate.xojo_code index 1be6bb0..af7e9ed 100644 --- a/webapp/dialogs/dlgUserCreate.xojo_code +++ b/webapp/dialogs/dlgUserCreate.xojo_code @@ -4,7 +4,7 @@ Begin WebDialog dlgUserCreate ControlCount = 0 ControlID = "" Enabled = True - Height = 314 + Height = 360 Index = -2147483648 Indicator = 0 LayoutDirection = 0 @@ -22,7 +22,6 @@ Begin WebDialog dlgUserCreate Width = 600 _mDesignHeight = 0 _mDesignWidth = 0 - _mName = "" _mPanelIndex = -1 Begin WebLabel labTitle Bold = True @@ -36,7 +35,7 @@ Begin WebDialog dlgUserCreate Italic = False Left = 20 LockBottom = False - LockedInPosition= True + LockedInPosition= False LockHorizontal = False LockLeft = True LockRight = True @@ -62,14 +61,14 @@ Begin WebDialog dlgUserCreate ControlID = "" Enabled = True HasBackgroundColor= False - Height = 171 + Height = 217 Index = -2147483648 Indicator = 0 LayoutDirection = 0 LayoutType = 0 Left = 20 LockBottom = True - LockedInPosition= True + LockedInPosition= False LockHorizontal = False LockLeft = True LockRight = True @@ -98,14 +97,14 @@ Begin WebDialog dlgUserCreate Italic = False Left = 40 LockBottom = False - LockedInPosition= True + LockedInPosition= False LockHorizontal = False LockLeft = True LockRight = False LockTop = True LockVertical = False Multiline = False - PanelIndex = 0 + PanelIndex = "0" Parent = "rctFormContent" Scope = 2 TabIndex = 2 @@ -134,14 +133,14 @@ Begin WebDialog dlgUserCreate Italic = False Left = 40 LockBottom = False - LockedInPosition= True + LockedInPosition= False LockHorizontal = False LockLeft = True LockRight = False LockTop = True LockVertical = False Multiline = False - PanelIndex = 0 + PanelIndex = "0" Parent = "rctFormContent" Scope = 2 TabIndex = 0 @@ -171,14 +170,14 @@ Begin WebDialog dlgUserCreate InitialParent = "rctFormContent" Left = 188 LockBottom = False - LockedInPosition= True + LockedInPosition= False LockHorizontal = False LockLeft = True LockRight = True LockTop = True LockVertical = False MaximumCharactersAllowed= 0 - PanelIndex = 0 + PanelIndex = "0" Parent = "rctFormContent" ReadOnly = False Scope = 2 @@ -207,14 +206,14 @@ Begin WebDialog dlgUserCreate InitialParent = "rctFormContent" Left = 188 LockBottom = False - LockedInPosition= True + LockedInPosition= False LockHorizontal = False LockLeft = True LockRight = True LockTop = True LockVertical = False MaximumCharactersAllowed= 0 - PanelIndex = 0 + PanelIndex = "0" Parent = "rctFormContent" ReadOnly = False Scope = 2 @@ -242,14 +241,14 @@ Begin WebDialog dlgUserCreate Italic = False Left = 40 LockBottom = False - LockedInPosition= True + LockedInPosition= False LockHorizontal = False LockLeft = True LockRight = False LockTop = True LockVertical = False Multiline = False - PanelIndex = 0 + PanelIndex = "0" Parent = "rctFormContent" Scope = 2 TabIndex = 4 @@ -279,14 +278,14 @@ Begin WebDialog dlgUserCreate InitialParent = "rctFormContent" Left = 188 LockBottom = False - LockedInPosition= True + LockedInPosition= False LockHorizontal = False LockLeft = True LockRight = True LockTop = True LockVertical = False MaximumCharactersAllowed= 0 - PanelIndex = 0 + PanelIndex = "0" Parent = "rctFormContent" ReadOnly = False Scope = 2 @@ -301,6 +300,73 @@ Begin WebDialog dlgUserCreate Width = 372 _mPanelIndex = -1 End + Begin WebLabel labGroup + Bold = False + ControlID = "" + Enabled = True + FontName = "" + FontSize = 0.0 + Height = 38 + Index = -2147483648 + Indicator = 0 + Italic = False + Left = 40 + LockBottom = False + LockedInPosition= False + LockHorizontal = False + LockLeft = True + LockRight = False + LockTop = True + LockVertical = False + Multiline = False + PanelIndex = "0" + Parent = "rctFormContent" + Scope = 2 + TabIndex = 6 + TabPanelIndex = 0 + TabStop = True + Text = "Group:" + TextAlignment = 0 + TextColor = &c000000FF + Tooltip = "" + Top = 224 + Underline = False + Visible = True + Width = 140 + _mPanelIndex = -1 + End + Begin WebPopupMenu lstGroup + ControlID = "" + Enabled = True + Height = 38 + Index = -2147483648 + Indicator = 0 + InitialValue = "" + LastAddedRowIndex= 0 + LastRowIndex = 0 + Left = 188 + LockBottom = False + LockedInPosition= False + LockHorizontal = False + LockLeft = True + LockRight = False + LockTop = True + LockVertical = False + PanelIndex = "0" + Parent = "rctFormContent" + RowCount = 0 + Scope = 2 + SelectedRowIndex= 0 + SelectedRowText = "" + TabIndex = 7 + TabPanelIndex = 0 + TabStop = True + Tooltip = "" + Top = 224 + Visible = True + Width = 372 + _mPanelIndex = -1 + End End Begin WebButton btnCreate AllowAutoDisable= False @@ -314,7 +380,7 @@ Begin WebDialog dlgUserCreate Indicator = 1 Left = 480 LockBottom = True - LockedInPosition= True + LockedInPosition= False LockHorizontal = False LockLeft = False LockRight = True @@ -324,7 +390,7 @@ Begin WebDialog dlgUserCreate TabIndex = 3 TabStop = True Tooltip = "" - Top = 256 + Top = 302 Visible = True Width = 100 _mPanelIndex = -1 @@ -341,7 +407,7 @@ Begin WebDialog dlgUserCreate Indicator = 0 Left = 372 LockBottom = True - LockedInPosition= True + LockedInPosition= False LockHorizontal = False LockLeft = False LockRight = True @@ -351,7 +417,7 @@ Begin WebDialog dlgUserCreate TabIndex = 2 TabStop = True Tooltip = "" - Top = 256 + Top = 302 Visible = True Width = 100 _mPanelIndex = -1 @@ -362,6 +428,14 @@ End #tag WindowCode #tag Event Sub Shown() + labGroup.Visible = (Not ebActionSetPasswordOnly) + lstGroup.Visible = (Not ebActionSetPasswordOnly) + + Var lastLabel As WebLabel = If(ebActionSetPasswordOnly, labPasswordRepeat, labGroup) + rctFormContent.Height = lastLabel.Top - rctFormContent.Top + 59 + self.Height = lastLabel.Top + 136 + + If edtName.Enabled Then edtName.SetFocus() Return @@ -375,6 +449,47 @@ End #tag EndEvent + #tag Method, Flags = &h21 + Private Sub LoadGroup() + lstGroup.RemoveAllRows + lstGroup.AddRow("(UNASSIGNED)", "") + lstGroup.AddRow("-", "") + + Var iPreSelectGroup As Integer = -1 + Try + Var rs As RowSet = Session.DB.SelectSQL("SHOW GROUPS") + If (rs = Nil) Then Return + + If (rs.RowCount > 0) Then + rs.MoveToFirstRow + While (Not rs.AfterLastRow) + + lstGroup.AddRow(rs.Column("groupname").StringValue, rs.Column("groupname").StringValue) + If (esPreSelectGroup <> "") And (esPreSelectGroup = rs.Column("groupname").StringValue) Then + iPreSelectGroup = lstGroup.LastAddedRowIndex + End If + + + rs.MoveToNextRow + Wend + End If + + rs.Close + + Catch DatabaseException + + Finally + If (iPreSelectGroup >= 0) And (lstGroup.LastRowIndex >= iPreSelectGroup) Then + lstGroup.SelectedRowIndex = iPreSelectGroup + Else + If (lstGroup.RowCount > 0) Then lstGroup.SelectedRowIndex = 0 + End If + + End Try + + End Sub + #tag EndMethod + #tag Method, Flags = &h21 Private Sub RefreshButtons() btnCreate.Enabled = (edtName.Text.Trim <> "") _ @@ -388,11 +503,15 @@ End #tag EndMethod #tag Method, Flags = &h0 - Sub Show() + Sub Show(PreSelectGroup As String) edtName.Text = "" edtPassword.Text = "" edtPasswordRepeat.Text = "" + esPreSelectGroup = PreSelectGroup + Me.LoadGroup() + + ebActionSetPasswordOnly = False Super.Show() End Sub #tag EndMethod @@ -406,16 +525,33 @@ End labTitle.Text = "Set User Password" edtName.Enabled = False + labGroup.Visible = False + lstGroup.Visible = False + + lstGroup.RemoveAllRows + lstGroup.AddRow("(PWD-CHANGE)", "") + lstGroup.SelectedRowIndex = 0 + + ebActionSetPasswordOnly = True Super.Show() End Sub #tag EndMethod #tag Hook, Flags = &h0 - Event UserCreateAction(Name As String, Password As String) As Boolean + Event UserCreateAction(Name As String, Password As String, Group As String) As Boolean #tag EndHook + #tag Property, Flags = &h21 + Private ebActionSetPasswordOnly As Boolean + #tag EndProperty + + #tag Property, Flags = &h21 + Private esPreSelectGroup As String + #tag EndProperty + + #tag EndWindowCode #tag Events edtPassword @@ -445,7 +581,14 @@ End #tag Events btnCreate #tag Event Sub Pressed() - If UserCreateAction(edtName.Text.Trim, edtPassword.Text.Trim) Then + Var group As String + If ebActionSetPasswordOnly Then + group = "" + Else + group = lstGroup.RowTagAt(lstGroup.SelectedRowIndex) + End If + + If UserCreateAction(edtName.Text.Trim, edtPassword.Text.Trim, group) Then Self.Close() End If diff --git a/webapp/main/CubeSQLAdminPage.xojo_code b/webapp/main/CubeSQLAdminPage.xojo_code index 98c17b6..0082d77 100644 --- a/webapp/main/CubeSQLAdminPage.xojo_code +++ b/webapp/main/CubeSQLAdminPage.xojo_code @@ -57,11 +57,11 @@ Begin WebPage CubeSQLAdminPage _mPanelIndex = -1 End Begin WebLabel labContainerTitle - Bold = True + Bold = False ControlID = "" Enabled = True FontName = "" - FontSize = 18.0 + FontSize = 16.0 Height = 38 Index = -2147483648 Indicator = 0 @@ -80,7 +80,7 @@ Begin WebPage CubeSQLAdminPage Scope = 2 TabIndex = 1 TabStop = True - Text = "Container Title" + Text = "Area → Container" TextAlignment = 1 TextColor = &c000000FF Tooltip = "" @@ -124,8 +124,6 @@ Begin WebPage CubeSQLAdminPage Period = 1 RunMode = 0 Scope = 2 - TabIndex = 3 - TabStop = True _mPanelIndex = -1 End End @@ -151,6 +149,7 @@ End edtSearch.Text = "" edtSearch.Visible = False + labContainerTitle.Text = "" End Sub #tag EndMethod @@ -220,7 +219,7 @@ End Me.CloseContainer() - labContainerTitle.Text = showContainer.Title + labContainerTitle.Text = "" + showContainer.Area + "  →  " + showContainer.Title + "" Var top As Integer = labContainerTitle.Top + labContainerTitle.Height + 10 showContainer.EmbedWithin(Self, 0, top, Self.Width, Self.Height - top) @@ -342,7 +341,7 @@ End #tag Events timSearch #tag Event Sub Run() - me.RunMode = WebTimer.RunModes.Off + Me.RunMode = WebTimer.RunModes.Off Me.Enabled = False Self.Search() diff --git a/webapp/main/LoginPage.xojo_code b/webapp/main/LoginPage.xojo_code index 33b1333..9d9b8ec 100644 --- a/webapp/main/LoginPage.xojo_code +++ b/webapp/main/LoginPage.xojo_code @@ -29,6 +29,7 @@ Begin WebPage LoginPage _ImplicitInstance= False _mDesignHeight = 0 _mDesignWidth = 0 + _mName = "" _mPanelIndex = -1 Begin WebRectangle rectLogin BackgroundColor = &cFFFFFF @@ -562,7 +563,7 @@ Begin WebPage LoginPage LockTop = True LockVertical = False Multiline = False - PanelIndex = 0 + PanelIndex = "0" Parent = "rectLogin" Scope = 2 TabIndex = 1 @@ -856,6 +857,67 @@ End #tag EndMethod + #tag Note, Name = DebugMemoryIssues + Place this in the Run Event of a WebThread (Location: Browser). + It'll show the count of instances. + + ***** + + Dim sRuntime As String = "Runtime: Memory Used '" + Runtime.MemoryUsed.ToString + "', ObjectCount '" + Runtime.ObjectCount.ToString + "'" + + + Var dictInfo As New Dictionary + dictInfo.Value("LoginPage") = 0 + dictInfo.Value("CubeSQLAdminPage") = 0 + dictInfo.Value("cntStatus") = 0 + dictInfo.Value("cntRegistration") = 0 + dictInfo.Value("cntRegistrationAction") = 0 + dictInfo.Value("dlgRegisterServer") = 0 + dictInfo.Value("cntDatabases") = 0 + dictInfo.Value("dlgDatabaseCreate") = 0 + dictInfo.Value("dlgCommonName") = 0 + dictInfo.Value("WebMessageDialog") = 0 + dictInfo.Value("WebLabel") = 0 + dictInfo.Value("WebTextField") = 0 + dictInfo.Value("WebButton") = 0 + dictInfo.Value("dlgDrop") = 0 + dictInfo.Value("cntConsole") = 0 + dictInfo.Value("cntGroups") = 0 + dictInfo.Value("cntUsers") = 0 + dictInfo.Value("dlgUserCreate") = 0 + dictInfo.Value("dlgUserGroups") = 0 + dictInfo.Value("cntPrivileges") = 0 + dictInfo.Value("dlgPrivilegeGrant") = 0 + dictInfo.Value("dlgRevoke") = 0 + dictInfo.Value("cntCommands") = 0 + dictInfo.Value("cntClients") = 0 + dictInfo.Value("dlgDisconnect") = 0 + + + Var checkName As String + Var o As Runtime.ObjectIterator = Runtime.IterateObjects + o.Reset + While o.MoveNext + checkName = Introspection.GetType(o.Current).Name + + For Each vKey As Variant In dictInfo.Keys + If (checkName = vKey.StringValue) Then + dictInfo.Value(vKey) = dictInfo.Value(vKey).IntegerValue + 1 + End If + Next + Wend + + Var infos() As String + For Each vKey As Variant In dictInfo.Keys + If (dictInfo.Value(vKey).IntegerValue < 1) Then Continue + infos.Add(vKey.StringValue + ": " + dictInfo.Value(vKey).StringValue) + Next + + labMemory.Text = sRuntime + EndOfLine + _ + String.FromArray(infos, EndOfLine) + #tag EndNote + + #tag Property, Flags = &h21 Private ebShown As Boolean #tag EndProperty