diff --git a/Build Automation.xojo_code b/Build Automation.xojo_code
index 2d2333e..97eb07a 100644
--- a/Build Automation.xojo_code
+++ b/Build Automation.xojo_code
@@ -2,7 +2,92 @@
Begin BuildStepList Linux
Begin BuildProjectStep Build
End
- Begin IDEScriptBuildStep DockerImage , AppliesTo = 2, Architecture = 1, Target = 0
+ Begin CopyFilesBuildStep CopyLaunchSh
+ AppliesTo = 2
+ Architecture = 0
+ Target = 0
+ Destination = 0
+ Subdirectory =
+ FolderItem = Li4vc2NyaXB0cy9MYXVuY2guc2g=
+ End
+ Begin IDEScriptBuildStep ChmodLaunchSh , AppliesTo = 2, Architecture = 0, Target = 0
+ 'Post Build Script is for Builds on macOS
+ If (Not TargetMacOS) Then
+ Return
+ End If
+
+ 'Make sure the Launch Script is executable:
+ Var sBUILD_LOCATION As String = CurrentBuildLocation.ReplaceAll("\", "") 'don't escape Path
+ Call DoShellCommand("chmod 755 """ + sBUILD_LOCATION + "/Launch.sh""", 0)
+
+ End
+ Begin IDEScriptBuildStep CreateTGZ , AppliesTo = 2, Architecture = 0, Target = 0
+ '****************************
+ 'Create .tgz for Linux Builds
+ '****************************
+
+ 'Post Build Script is for Builds on macOS
+ If (Not TargetMacOS) Then
+ Return
+ End If
+
+ 'Check Build
+ If DebugBuild Then
+ Return
+ End If
+
+ 'Check Stage Code
+ Var sStageCodeInfo As String
+ Select Case PropertyValue("App.StageCode")
+ Case "0" 'Development
+ sStageCodeInfo = "-dev"
+ Case "1" 'Alpha
+ sStageCodeInfo = "-alpha"
+ Case "2" 'Beta
+ sStageCodeInfo = "-beta"
+ Case "3" 'Final
+ 'not used in filename
+ End Select
+
+ 'Check Build Target
+ Var sTGZFilename As String
+ Select Case CurrentBuildTarget
+ Case 4 'Linux (Intel, 32Bit)
+ sTGZFilename = "cubeSQLWebAdmin" + sStageCodeInfo + "_Linux_Intel_32Bit.tgz"
+ Case 17 'Linux (Intel, 64Bit)
+ sTGZFilename = "cubeSQLWebAdmin" + sStageCodeInfo + "_Linux_Intel_64Bit.tgz"
+ Case 18 'Linux (ARM, 32Bit)
+ sTGZFilename = "cubeSQLWebAdmin" + sStageCodeInfo + "_Linux_ARM_32Bit.tgz"
+ Case 26 'Linux (ARM, 64Bit)
+ sTGZFilename = "cubeSQLWebAdmin" + sStageCodeInfo + "_Linux_ARM_64Bit.tgz"
+ Else
+ Return
+ End Select
+
+ 'Xojo Project Settings
+ Var sPROJECT_PATH As String = Trim(DoShellCommand("echo $PROJECT_PATH", 0))
+ If Right(sPROJECT_PATH, 1) = "/" Then
+ 'no trailing /
+ sPROJECT_PATH = Mid(sPROJECT_PATH, 1, Len(sPROJECT_PATH)-1)
+ End If
+ Var sBUILD_LOCATION As String = ReplaceAll(CurrentBuildLocation, "\", "") 'don't escape Path
+ Var sBUILD_APPNAME As String = CurrentBuildAppName
+
+ If (sPROJECT_PATH = "") Then
+ Print "Xojo PostBuild Script CreateTGZ requires to get the Environment Variable $PROJECT_PATH from the Xojo IDE." + EndOfLine + EndOfLine + "Unfortunately, it's empty.... try again after re-launching the Xojo IDE and/or rebooting your machine."
+ Return
+ End If
+
+ 'Create .tgz
+ Var pathParts() As String = sBUILD_LOCATION.Split("/")
+ Var foldernameApp As String = pathParts(pathParts.LastIndex)
+ pathParts.RemoveAt(pathParts.LastIndex)
+ Var baseFolder As String = String.FromArray(pathParts, "/")
+
+ Call DoShellCommand("cd """ + baseFolder + """ && tar -c -z -v --no-mac-metadata --no-xattrs -f ../" + sTGZFilename + " ./" + foldernameApp, 0)
+
+ End
+ Begin IDEScriptBuildStep Xojo2Docker , AppliesTo = 2, Architecture = 1, Target = 0
'*************************************************************
'Xojo Web App 2 Docker - How to use with your Xojo-built .app?
'*************************************************************
@@ -65,11 +150,7 @@
'*******************************************
'Xojo Web App 2 Docker - Let's go...
'*******************************************
- 'you shouldn't need to modify anything below
- '(but feel free to do so :-)
- '*******************************************
If (Not TargetMacOS) Then
- Print "The Post Build Script 'DockerImage' can only be run on macOS. You need to modify the Shell Commands if you're building on Linux or Windows."
Return
End If
@@ -79,13 +160,11 @@
Case 17
'Linux (Intel, 64Bit)
Else
- Print "The only supported Build Target for the Post Build Script 'DockerImage' is: Linux, Intel 64Bit"
Return
End Select
'Check Build
If DebugBuild Then
- Print "The Post Build Script 'DockerImage' should not be run for Debug Run's."
Return
End If
@@ -155,14 +234,268 @@
End
Begin BuildStepList Mac OS X
Begin BuildProjectStep Build
+ End
+ Begin CopyFilesBuildStep CopyLaunchShCommand
+ AppliesTo = 2
+ Architecture = 0
+ Target = 0
+ Destination = 0
+ Subdirectory =
+ FolderItem = Li4vc2NyaXB0cy9MYXVuY2guc2guY29tbWFuZA==
+ End
+ Begin IDEScriptBuildStep ChmodLaunchShCommand , AppliesTo = 2, Architecture = 0, Target = 0
+ 'Post Build Script is for Builds on macOS
+ If (Not TargetMacOS) Then
+ Return
+ End If
+
+ 'Make sure the Launch Script is executable:
+ Var sBUILD_LOCATION As String = CurrentBuildLocation.ReplaceAll("\", "") 'don't escape Path
+ Call DoShellCommand("chmod 755 """ + sBUILD_LOCATION + "/Launch.sh.command""", 0)
+
End
Begin SignProjectStep Sign
DeveloperID=
End
+ Begin IDEScriptBuildStep Xojo2PKG , AppliesTo = 2, Architecture = 0, Target = 0
+ '***********************
+ 'Create a notarized .pkg
+ '***********************
+
+ 'Only for Final Builds
+ Select Case PropertyValue("App.StageCode")
+ Case "3" 'Final
+ 'continue
+ Else
+ Return
+ End Select
+
+ 'Post Build Script is for Builds on macOS
+ If (Not TargetMacOS) Then
+ Return
+ End If
+
+ 'Check Build
+ If DebugBuild Then
+ Return
+ End If
+
+ 'Check Xojo's Build Target
+ Select Case CurrentBuildTarget
+ Case 16 'macOS: Intel 64Bit
+ 'ok, continue
+ Case 24 'macOS: ARM 64Bit
+ 'ok, continue
+ Case 9 'macOS: Universal (Intel 64Bit, ARM 64Bit)
+ 'ok, continue
+ Else
+ Return
+ End Select
+
+ '**************************************************
+ 'Xojo2PKG is a modified version of
+ '**************************************************
+ 'Setup Xojo2DMG - Post Build Script
+ '**************************************************
+ '1. Read the comments in this PostBuild Script
+ '2. Edit the values according to your needs
+ '**************************************************
+ '3. If it's working for you:
+ ' Do you like it? Does it help you? Has it saved you time and money?
+ ' You're welcome - it's free...
+ ' If you want to say thanks I appreciate a message or a small donation.
+ ' Contact: xojo@jo-tools.ch
+ ' PayPal: https://paypal.me/jotools
+ '**************************************************
+
+ '*******************************
+ 'Required: Xojo Project Settings
+ '*******************************
+ Var sPROJECT_PATH As String = DoShellCommand("echo $PROJECT_PATH", 0).Trim
+ If sPROJECT_PATH.Right(1) = "/" Then
+ 'No trailing /
+ sPROJECT_PATH = sPROJECT_PATH.Middle(1, sPROJECT_PATH.Length-1)
+ End If
+ Var sBUILD_LOCATION As String = CurrentBuildLocation.ReplaceAll("\", "") 'don't escape Path
+ Var sBUILD_APPNAME As String = CurrentBuildAppName 'Xojo 2022r1 adds .app
+ If (sBUILD_APPNAME.Right(4) = ".app") Then sBUILD_APPNAME = sBUILD_APPNAME.Left(sBUILD_APPNAME.Length-4)
+
+ If (sBUILD_LOCATION.Right(9) = "Universal") Then
+ 'Xojo does not add the folder of the Console/Web App in Universal Builds to the Constant :(
+ sBUILD_LOCATION = sBUILD_LOCATION + "/" + sBUILD_APPNAME
+ End If
+
+ Var sAPP_BUNDLEIDENTIFIER As String = PropertyValue("App.Application Identifier")
+ Var sAPP_VERSION As String = PropertyValue("App.Version")
+
+ 'Check Stage Code
+ Var sStageCodeInfo As String
+ Select Case PropertyValue("App.StageCode")
+ Case "0" 'Development
+ sStageCodeInfo = "-dev"
+ Case "1" 'Alpha
+ sStageCodeInfo = "-alpha"
+ Case "2" 'Beta
+ sStageCodeInfo = "-beta"
+ Case "3" 'Final
+ 'not used in filename
+ End Select
+
+ Var sPKG_FILENAME As String
+ Select Case CurrentBuildTarget
+ Case 16 'macOS: Intel 64Bit
+ sPKG_FILENAME = "cubeSQLWebAdmin" + sStageCodeInfo + "_macOS_Intel_64Bit.pkg"
+ Case 24 'macOS: ARM 64Bit
+ sPKG_FILENAME = "cubeSQLWebAdmin" + sStageCodeInfo + "_macOS_ARM_64Bit.pkg"
+ Case 9 'macOS: Universal (Intel 64Bit, ARM 64Bit)
+ sPKG_FILENAME = "cubeSQLWebAdmin" + sStageCodeInfo + "_macOS_Universal.pkg"
+ Else
+ Return
+ End Select
+
+ Var sFolderScripts As String = "/scripts"
+
+ '*************************
+ 'CodeSign with DeveloperID
+ '*************************
+ 'Var sCODESIGN_IDENT_APPLICATION As String = "Developer ID Application: YOUR NAME"
+ 'Var sCODESIGN_IDENT_INSTALLER As String = "Developer ID Installer: YOUR NAME"
+ Var sCODESIGN_IDENT_APPLICATION As String = "Developer ID Application: Juerg Otter"
+ Var sCODESIGN_IDENT_INSTALLER As String = "Developer ID Installer: Juerg Otter"
+ Var sCODESIGN_ENTITLEMENTS As String = sPROJECT_PATH + sFolderScripts + "/entitlements.plist"
+
+
+ '*********************
+ 'Notarization by Apple
+ '*********************
+ 'This requires CodeSigning (with DeveloperID) to be enabled (see above)
+ 'Apple's Documentation:
+ 'https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution
+ 'Xojo2DMG uses the customized workflow:
+ 'https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow?language=objc
+
+ '**************************************************************
+ 'Keychain: Notarization
+ '**************************************************************
+ '1st: You need to create an application specific password for your AppleID:
+ ' https://support.apple.com/en-us/HT204397
+ '
+ '2nd: You need to know the TeamID. This is especially important if the AppleID is associated with multiple teams.
+ ' The TeamID is shown on https://developer.apple.com/ -> Account: MemberShip Details
+ '
+ 'Now that you have all information you need:
+ 'Store these credentials (AppleID, TeamID, app-specific password) using Apple's notarytool to your keychain:
+ '
+ 'xcrun notarytool store-credentials "Xojo2DMG-notarytool" --apple-id "my-appleid@icloud.com" --team-id "XXXXXXXXXX" --password "aaaa-bbbb-cccc-dddd"
+ '
+ '**************************************************************
+
+
+ '*******************************************
+ 'Xojo2PKG - Let's go...
+ '*******************************************
+ Var sShellArguments() As String
+
+ sShellArguments.Add(sPROJECT_PATH)
+ sShellArguments.Add(sBUILD_LOCATION)
+ sShellArguments.Add(sBUILD_APPNAME)
+
+ sShellArguments.Add(sAPP_BUNDLEIDENTIFIER)
+ sShellArguments.Add(sAPP_VERSION)
+ sShellArguments.Add(sPKG_FILENAME)
+
+ sShellArguments.Add(sCODESIGN_IDENT_APPLICATION)
+ sShellArguments.Add(sCODESIGN_IDENT_INSTALLER)
+ sShellArguments.Add(sCODESIGN_ENTITLEMENTS)
+
+ 'Make sure the ShellScripts are executable:
+ Call DoShellCommand("chmod 755 """ + sPROJECT_PATH + sFolderScripts + "/xojo2pkg.sh""", 0)
+
+ 'Pass ShellArguments to Script and execute it in Terminal.app
+ Call DoShellCommand("osascript -e 'tell application ""Terminal"" to activate'", 0)
+ Call DoShellCommand("osascript -e 'tell application ""Terminal"" to do script ""\""" + sPROJECT_PATH + sFolderScripts + "/xojo2pkg.sh\"" \""" + String.FromArray(sShellArguments, "\"" \""") + "\""""'", 0)
+ Return 'see progress and errors in Terminal.app
+
+ End
End
Begin BuildStepList Windows
Begin BuildProjectStep Build
End
+ Begin CopyFilesBuildStep CopyLaunchBat
+ AppliesTo = 2
+ Architecture = 0
+ Target = 0
+ Destination = 0
+ Subdirectory =
+ FolderItem = Li4vc2NyaXB0cy9MYXVuY2guYmF0
+ End
+ Begin IDEScriptBuildStep CreateZIP , AppliesTo = 2, Architecture = 0, Target = 0
+ '******************************
+ 'Create .zip for Windows Builds
+ '******************************
+
+ 'Post Build Script is for Builds on macOS
+ If (Not TargetMacOS) Then
+ Return
+ End If
+
+ 'Check Build
+ If DebugBuild Then
+ Return
+ End If
+
+ 'Check Stage Code
+ Var sStageCodeInfo As String
+ Select Case PropertyValue("App.StageCode")
+ Case "0" 'Development
+ sStageCodeInfo = "-dev"
+ Case "1" 'Alpha
+ sStageCodeInfo = "-alpha"
+ Case "2" 'Beta
+ sStageCodeInfo = "-beta"
+ Case "3" 'Final
+ 'not used in filename
+ End Select
+
+ 'Check Build Target
+ Var sZIPFilename As String
+ Select Case CurrentBuildTarget
+ Case 3 'Windows (Intel, 32Bit)
+ sZIPFilename = "cubeSQLWebAdmin" + sStageCodeInfo + "_Windows_Intel_32Bit.zip"
+ Case 19 'Windows (Intel, 64Bit)
+ sZIPFilename = "cubeSQLWebAdmin" + sStageCodeInfo + "_Windows_Intel_64Bit.zip"
+ Case 25 'Windows(ARM, 64Bit)
+ sZIPFilename = "cubeSQLWebAdmin" + sStageCodeInfo + "_Windows_ARM_64Bit.zip"
+ Else
+ Return
+ End Select
+
+ 'Xojo Project Settings
+ Var sPROJECT_PATH As String = Trim(DoShellCommand("echo $PROJECT_PATH", 0))
+ If Right(sPROJECT_PATH, 1) = "/" Then
+ 'no trailing /
+ sPROJECT_PATH = Mid(sPROJECT_PATH, 1, Len(sPROJECT_PATH)-1)
+ End If
+ Var sBUILD_LOCATION As String = ReplaceAll(CurrentBuildLocation, "\", "") 'don't escape Path
+ Var sBUILD_APPNAME As String = CurrentBuildAppName
+
+ If (sPROJECT_PATH = "") Then
+ Print "Xojo PostBuild Script CreateZIP requires to get the Environment Variable $PROJECT_PATH from the Xojo IDE." + EndOfLine + EndOfLine + "Unfortunately, it's empty.... try again after re-launching the Xojo IDE and/or rebooting your machine."
+ Return
+ End If
+
+ 'Make sure the ShellScripts are executable:
+ Call DoShellCommand("chmod 755 """ + sBUILD_LOCATION + "/Launch.sh""", 0)
+
+ 'Create .zip
+ Var pathParts() As String = sBUILD_LOCATION.Split("/")
+ Var foldernameApp As String = pathParts(pathParts.LastIndex)
+ pathParts.RemoveAt(pathParts.LastIndex)
+ Var baseFolder As String = String.FromArray(pathParts, "/")
+
+ Call DoShellCommand("cd """ + baseFolder + """ && zip -r ../" + sZIPFilename + " ./" + foldernameApp, 0)
+
+ End
End
Begin BuildStepList Xojo Cloud
Begin BuildProjectStep Build
diff --git a/cubesql-webadmin.xojo_project b/cubesql-webadmin.xojo_project
index fb14ab4..182533a 100644
--- a/cubesql-webadmin.xojo_project
+++ b/cubesql-webadmin.xojo_project
@@ -1,5 +1,5 @@
Type=Web2
-RBProjectVersion=2024.01
+RBProjectVersion=2024.011
MinIDEVersion=20200200
OrigIDEVersion=20240100
Folder=resources;resources;&h0000000035B107FF;&h0000000000000000;false
@@ -9,7 +9,10 @@ Folder=main;webapp/main;&h000000001D9447FF;&h0000000018D38FFF;false
WebView=LoginPage;webapp/main/LoginPage.xojo_code;&h000000005492FFFF;&h000000001D9447FF;false
WebView=CubeSQLAdminPage;webapp/main/CubeSQLAdminPage.xojo_code;&h000000004DEBB7FF;&h000000001D9447FF;false
Folder=dialogs;webapp/dialogs;&h0000000054A427FF;&h0000000018D38FFF;false
+Class=dlgBase;webapp/dialogs/dlgBase.xojo_code;&h00000000304C37FF;&h0000000054A427FF;false
+WebView=dlgUnhandledException;webapp/dialogs/dlgUnhandledException.xojo_code;&h0000000011313FFF;&h0000000054A427FF;false
WebView=dlgRegisterServer;webapp/dialogs/dlgRegisterServer.xojo_code;&h000000000EEC17FF;&h0000000054A427FF;false
+WebView=dlgGetServerKey;webapp/dialogs/dlgGetServerKey.xojo_code;&h0000000076F627FF;&h0000000054A427FF;false
WebView=dlgDatabaseCreate;webapp/dialogs/dlgDatabaseCreate.xojo_code;&h0000000045C397FF;&h0000000054A427FF;false
WebView=dlgDatabaseUpload;webapp/dialogs/dlgDatabaseUpload.xojo_code;&h00000000375D2FFF;&h0000000054A427FF;false
WebView=dlgUserCreate;webapp/dialogs/dlgUserCreate.xojo_code;&h0000000064C14FFF;&h0000000054A427FF;false
@@ -18,6 +21,9 @@ WebView=dlgPrivilegeGrant;webapp/dialogs/dlgPrivilegeGrant.xojo_code;&h000000004
WebView=dlgEnginePreferenceSet;webapp/dialogs/dlgEnginePreferenceSet.xojo_code;&h0000000022F4BFFF;&h0000000054A427FF;false
WebView=dlgCommonName;webapp/dialogs/dlgCommonName.xojo_code;&h0000000053B56FFF;&h0000000054A427FF;false
Folder=containers;webapp/containers;&h000000005859EFFF;&h0000000018D38FFF;false
+Folder=helpers;webapp/helpers;&h000000005D8D07FF;&h0000000018D38FFF;false
+Module=modDialogs;webapp/helpers/modDialogs.xojo_code;&h0000000023524FFF;&h000000005D8D07FF;false
+Module=modFunctions;webapp/helpers/modFunctions.xojo_code;&h0000000064783FFF;&h000000005D8D07FF;false
Folder=base;webapp/containers/base;&h000000000B1567FF;&h000000005859EFFF;false
WebContainer=cntStatus;webapp/containers/cntStatus.xojo_code;&h000000000A45BFFF;&h000000005859EFFF;false
Folder=server;webapp/containers/server;&h0000000045A527FF;&h000000005859EFFF;false
@@ -50,12 +56,12 @@ WebContainer=cntDatabasesEncryption;webapp/containers/data/cntDatabasesEncryptio
DefaultWindow=LoginPage
MajorVersion=0
MinorVersion=0
-SubVersion=4
+SubVersion=9
NonRelease=0
Release=0
InfoVersion=cubeSQL Web Admin
LongVersion=jo-tools.ch
-ShortVersion=0.0.4
+ShortVersion=0.0.9
WinCompanyName=jo-tools.ch
WinInternalName=cubesqlwebadmin
WinProductName=cubeSQL Web Admin
@@ -93,6 +99,7 @@ WebHostingAppName=cubeSQLWebAdmin
WebHostingDomain=
LinuxBuildArchitecture=1
MacBuildArchitecture=4
+WindowsBuildArchitecture=1
OptimizationLevel=6
WindowsVersions={1f676c76-80e1-4239-95bb-83d0f6d0da78}|{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}
WindowsRunAs=0
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index b508564..4f4c91b 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -2,6 +2,8 @@
FROM ubuntu:22.04
#ENVIRONMENT
+ENV TZ=Etc/UTC
+ENV CUBESQL_WEBADMIN_PORT=80
ENV CUBESQL_HOSTNAME=host.docker.internal
ENV CUBESQL_PORT=4430
ENV CUBESQL_ENCRYPTION=AES256
@@ -9,13 +11,18 @@ ENV CUBESQL_USERNAME=admin
ENV CUBESQL_PASSWORD=
#INSTALL REQUIRED LIBRARIES
-ENV DEBIAN_FRONTEND noninteractive
-RUN apt-get update && apt-get install -y libunwind8 libglib2.0 libsoup2.4-1
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update
+RUN apt-get install -y \
+ tzdata \
+ libunwind8 \
+ libglib2.0 \
+ libsoup2.4-1
#ADD APPLICATION TO DOCKER IMAGE
ADD / /app/
#EXPOSE PORT AND RUN APPLICATION
-EXPOSE 80
+EXPOSE $CUBESQL_WEBADMIN_PORT
WORKDIR /app
-CMD /app/cubeSQLWebAdmin
\ No newline at end of file
+CMD /app/cubeSQLWebAdmin --Port=$CUBESQL_WEBADMIN_PORT
\ No newline at end of file
diff --git a/scripts/Launch.bat b/scripts/Launch.bat
new file mode 100644
index 0000000..18449cd
--- /dev/null
+++ b/scripts/Launch.bat
@@ -0,0 +1,29 @@
+@echo off
+cls
+echo *********************
+echo * cubeSQL Web Admin *
+echo *********************
+echo.
+echo Launch Web Application on Port:
+echo - 1: 80
+echo - 2: 8080
+echo - 3: 4431 (default)
+echo.
+
+SET PORT=4431
+CHOICE /T 10 /C 123 /D 3 /m "Choose Port Option:"
+set _choice=%ERRORLEVEL%
+if %_choice%==1 SET PORT=80&GOTO :LAUNCH
+if %_choice%==2 SET PORT=8080&GOTO :LAUNCH
+if %_choice%==3 SET PORT=4431&GOTO :LAUNCH
+
+:LAUNCH
+echo.
+echo Launching cubeSQL Web Admin on Port %PORT%
+echo Connect via Web Browser: http://localhost:%PORT%
+echo.
+echo Web Application is available while this Command Window is open.
+echo To quit press Ctrl+C or close Command Window.
+echo.
+
+%0\..\cubeSQLWebAdmin.exe --Port=%PORT%
diff --git a/scripts/Launch.sh b/scripts/Launch.sh
new file mode 100755
index 0000000..c15502a
--- /dev/null
+++ b/scripts/Launch.sh
@@ -0,0 +1,41 @@
+#/bin/sh
+#
+clear
+
+SCRIPT_PATH=$(dirname "$0")
+TMOUT=10
+
+echo "---------------------"
+echo "- cubeSQL Web Admin -"
+echo "---------------------"
+echo ""
+echo "Launch Web Application on Port:"
+echo ""
+
+PORT=4431
+select portchoice in "80" "8080" "4431 (default)"; do
+ case $REPLY in
+ 1)
+ PORT=80
+ break ;;
+ 2)
+ PORT=8080
+ break ;;
+ 3)
+ PORT=4431
+ break;;
+ *)
+ echo "Invalid choice, try again" >&2
+ esac
+done
+
+echo ""
+echo "Launching cubeSQL Web Admin on Port $PORT"
+echo "Connect via Web Browser: http://localhost:$PORT"
+echo ""
+echo "Web Application is available while this"
+echo "Command Window is open."
+echo "To quit press Ctrl+C or close Command Window."
+echo ""
+
+"${SCRIPT_PATH}/cubeSQLWebAdmin" --Port=${PORT}
diff --git a/scripts/Launch.sh.command b/scripts/Launch.sh.command
new file mode 100755
index 0000000..33dad09
--- /dev/null
+++ b/scripts/Launch.sh.command
@@ -0,0 +1,40 @@
+#/bin/sh
+#
+clear
+
+SCRIPT_PATH=$(dirname "$0")
+TMOUT=10
+
+echo "---------------------"
+echo "- cubeSQL Web Admin -"
+echo "---------------------"
+echo ""
+echo "Launch Web Application on Port:"
+echo ""
+
+PORT=4431
+select portchoice in "80" "8080" "4431 (default)"; do
+ case $REPLY in
+ 1)
+ PORT=80
+ break ;;
+ 2)
+ PORT=8080
+ break ;;
+ 3)
+ PORT=4431
+ break;;
+ *)
+ echo "Invalid choice, try again" >&2
+ esac
+done
+
+echo ""
+echo "Launching cubeSQL Web Admin on Port $PORT"
+echo "Connect via Web Browser: http://localhost:$PORT"
+echo ""
+echo "Web Application is available while this Terminal Window is open."
+echo "To quit press Ctrl+C or close Terminal Window."
+echo ""
+
+"${SCRIPT_PATH}/cubeSQLWebAdmin" --Port=${PORT}
diff --git a/scripts/entitlements.plist b/scripts/entitlements.plist
new file mode 100644
index 0000000..ae4f350
--- /dev/null
+++ b/scripts/entitlements.plist
@@ -0,0 +1,33 @@
+
+
+
+
+ com.apple.security.cs.allow-jit
+
+ com.apple.security.cs.allow-unsigned-executable-memory
+
+ com.apple.security.cs.allow-dyld-environment-variables
+
+ com.apple.security.cs.disable-library-validation
+
+ com.apple.security.cs.disable-executable-page-protection
+
+ com.apple.security.cs.debugger
+
+ com.apple.security.personal-information.audio-input
+
+ com.apple.security.personal-information.camera
+
+ com.apple.security.personal-information.location
+
+ com.apple.security.personal-information.addressbook
+
+ com.apple.security.personal-information.calendars
+
+ com.apple.security.personal-information.photos-library
+
+ com.apple.security.automation.apple-events
+
+
+
+
diff --git a/scripts/xojo2pkg.sh b/scripts/xojo2pkg.sh
new file mode 100755
index 0000000..3927ef5
--- /dev/null
+++ b/scripts/xojo2pkg.sh
@@ -0,0 +1,424 @@
+#!/bin/sh
+#
+
+# **************************************************************
+# Keychain: Notarization
+# **************************************************************
+# https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow?language=objc
+# **************************************************************
+# 1st: You need to create an application specific password for your AppleID.
+# 2nd: You need to know the TeamID.
+#
+# Add the AppleID, TeamID and app-specific password to your keychain:
+# xcrun notarytool store-credentials "Xojo2DMG-notarytool" --apple-id "my-appleid@icloud.com" --team-id "XXXXXXXXXX" --password "aaaa-bbbb-cccc-dddd"
+# **************************************************************
+
+
+# get input
+echo "Xojo2PKG: reading input variables..."
+PROJECT_PATH=$1
+BUILD_LOCATION=$2
+BUILD_APPNAME=$3
+APP_BUNDLEIDENTIFIER=$4
+APP_VERSION=$5
+PKG_FILENAME=$6
+CODESIGN_IDENT_APPLICATION=$7
+CODESIGN_IDENT_INSTALLER=$8
+CODESIGN_ENTITLEMENTS=$9
+
+NOTARYTOOL_KEYCHAIN_PROFILE=Xojo2DMG-notarytool
+
+
+# check input
+echo ""
+echo "Xojo2PKG: checking input variables..."
+if [ -z "$PROJECT_PATH" ]; then
+ echo "Xojo2PKG ERROR: \$PROJECT_PATH is empty."
+ exit 9
+fi
+if [ ! -d "${PROJECT_PATH}" ]; then
+ echo "Xojo2PKG ERROR: \${PROJECT_PATH} = ${PROJECT_PATH} directory doesn't exist."
+ exit 8
+fi
+if [ -z "$BUILD_LOCATION" ]; then
+ echo "Xojo2PKG ERROR: \$BUILD_LOCATION is empty."
+ exit 9
+fi
+if [ ! -d "${BUILD_LOCATION}" ]; then
+ echo "Xojo2PKG ERROR: \${BUILD_LOCATION} = ${BUILD_LOCATION} directory doesn't exist."
+ exit 8
+fi
+if [ -z "$BUILD_APPNAME" ]; then
+ echo "Xojo2PKG ERROR: \$BUILD_APPNAME is empty."
+ exit 9
+fi
+if [ -z "$CODESIGN_IDENT_APPLICATION" ]; then
+ echo "Xojo2PKG ERROR: \$CODESIGN_IDENT_APPLICATION is empty."
+ exit 9
+fi
+if [ -z "$CODESIGN_IDENT_INSTALLER" ]; then
+ echo "Xojo2PKG ERROR: \$CODESIGN_IDENT_INSTALLER is empty."
+ exit 9
+fi
+if [ -z "$CODESIGN_ENTITLEMENTS" ]; then
+ echo "Xojo2PKG ERROR: \$CODESIGN_ENTITLEMENTS is empty."
+ exit 9
+fi
+if [ ! -f "$CODESIGN_ENTITLEMENTS" ]; then
+ echo "Xojo2PKG ERROR: \$CODESIGN_ENTITLEMENTS = ${CODESIGN_ENTITLEMENTS} doesn't exist."
+ exit 9
+fi
+
+# set up a couple of things
+echo ""
+echo "Xojo2PKG: setting up a couple of things..."
+
+
+# we should not need to change these
+FROM_FOLDER="${BUILD_LOCATION}"
+FROM_EXECUTABLE="${BUILD_LOCATION}/${BUILD_APPNAME}"
+FROM_LIBS="${BUILD_LOCATION}/${BUILD_APPNAME} Libs"
+
+PKG_FINAL="${BUILD_LOCATION}/../../${PKG_FILENAME}"
+STAGING_DIR_APP="${BUILD_LOCATION}/../_Staging_APP"
+STAGING_DIR_PKG="${BUILD_LOCATION}/../_Staging_PKG"
+PKG_STAGE="${STAGING_DIR_PKG}/${PKG_FILENAME}"
+
+# change to our working directory
+echo ""
+echo "Xojo2PKG: change to our working directory"
+if [ ! -d "${BUILD_LOCATION}" ]; then
+ echo "Xojo2PKG ERROR: \${BUILD_LOCATION} = ${BUILD_LOCATION} doesn't exist."
+ exit 8
+fi
+cd "${BUILD_LOCATION}"
+
+echo "Xojo2PKG: looking for the built .app's macOS executable"
+if [ ! -f "${FROM_EXECUTABLE}" ]; then
+ echo "Xojo2PKG ERROR: \${FROM_EXECUTABLE} = ${FROM_EXECUTABLE} doesn't exist."
+ exit 8
+fi
+
+echo "Xojo2PKG: looking for the built .app's Libs"
+if [ ! -d "${FROM_LIBS}" ]; then
+ echo "Xojo2PKG ERROR: \${FROM_LIBS} = ${FROM_LIBS} doesn't exist."
+ exit 8
+fi
+
+# clear out any old data
+echo ""
+echo "Xojo2PKG: clear out any old data"
+rm -rf "${STAGING_DIR_APP}" "${STAGING_DIR_PKG}" "${PKG_FINAL}"
+
+sync
+
+# Prepare Environment to build the PKG
+# ************************************
+
+# create our staging directory
+echo ""
+echo "Xojo2PKG: create our staging directory to build the PKG"
+cd "${BUILD_LOCATION}/.."
+mkdir -p "${STAGING_DIR_APP}/${BUILD_APPNAME}"
+if [ ! -d "${STAGING_DIR_APP}/${BUILD_APPNAME}" ]; then
+ echo "Xojo2PKG ERROR: \${STAGING_DIR_APP}/${BUILD_APPNAME} = ${STAGING_DIR_APP}/${BUILD_APPNAME} doesn't exist."
+ exit 8
+fi
+
+# copy over the stuff we want in the final disk image to our staging directory
+echo ""
+echo "Xojo2PKG: copy all we need in the final disk image to our staging directory"
+ditto "${BUILD_LOCATION}" "${STAGING_DIR_APP}/${BUILD_APPNAME}"
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: ditto \"${BUILD_LOCATION}\" \"${STAGING_DIR_APP}/${BUILD_APPNAME}\" failed."
+ exit 8
+fi
+
+echo ""
+echo "Xojo2PKG: waiting for App to finish copying to staging directory..."
+sync
+sleep 2
+
+# CodeSign
+# ********
+cd "${STAGING_DIR_APP}"
+
+echo ""
+echo "Xojo2PKG: Begin CodeSigning"
+# Removing extended Attributes (otherwise Xcode 8 and newer won't sign)
+echo ""
+echo "Xojo2PKG: Remove extended Attributes"
+xattr -rc "${STAGING_DIR_APP}"
+
+echo "Xojo2PKG: perform CodeSign with Hardened Runtime"
+
+echo "Xojo2PKG: Make a copy of Entitlements.plist"
+CODESIGN_ENTITLEMENTS_APPLY="${STAGING_DIR_APP}/CodeSign_Entitlements.plist"
+if [ -f "${CODESIGN_ENTITLEMENTS_APPLY}" ]; then
+ rm -f "${CODESIGN_ENTITLEMENTS_APPLY}"
+fi
+ditto "${CODESIGN_ENTITLEMENTS}" "${CODESIGN_ENTITLEMENTS_APPLY}"
+sync
+if [ ! -f "${CODESIGN_ENTITLEMENTS_APPLY}" ]; then
+ echo "Xojo2PKG ERROR: \$CODESIGN_ENTITLEMENTS plist file not found."
+ exit 11
+fi
+echo "Xojo2PKG: Entitlements: Disable com.apple.security.cs.debugger"
+sed -i '' '/com.apple.security.cs.debugger{n;s/true/false/;}' "${CODESIGN_ENTITLEMENTS_APPLY}"
+
+# Sign the app
+echo ""
+echo "Xojo2PKG: Sign the app..."
+cd "${STAGING_DIR_APP}/${BUILD_APPNAME}"
+if [ -d "./_CodeSignature" ]; then
+ echo "Xojo2PKG: Removing existing _CodeSignature..."
+ rm -r -f "./_CodeSignature"
+ sync
+ sleep 1
+fi
+
+echo ""
+echo "Xojo2PKG: Sign the app's .dylibs"
+codesign --timestamp -f -s "${CODESIGN_IDENT_APPLICATION}" "./${BUILD_APPNAME} Libs/"*.dylib
+echo ""
+echo "Xojo2PKG: Sign the app's .commands"
+codesign --timestamp -f -s "${CODESIGN_IDENT_APPLICATION}" "./"*.command
+echo ""
+echo "Xojo2PKG: Sign the app executable"
+codesign --timestamp -f --options runtime --entitlements "${CODESIGN_ENTITLEMENTS_APPLY}" --deep -s "${CODESIGN_IDENT_APPLICATION}" -i "${APP_BUNDLEIDENTIFIER}" "./${BUILD_APPNAME}"
+echo ""
+echo "Xojo2PKG: waiting for App to finish signing..."
+sleep 3
+
+if [ -f "${CODESIGN_ENTITLEMENTS_APPLY}" ]; then
+ rm -f "${CODESIGN_ENTITLEMENTS_APPLY}"
+fi
+sync
+
+
+# Check CodeSign
+echo ""
+echo "Xojo2PKG: checking CodeSign... (Verifying Part 1)"
+codesign -d -vvvv "./${BUILD_APPNAME}"
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: codesign -d -vvvv \"${BUILD_APPNAME}\" failed."
+ exit 11
+fi
+echo ""
+echo "Xojo2PKG: checking CodeSign... (Verifying Part 2)"
+codesign --verify --verbose=3 "./${BUILD_APPNAME}"
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: codesign --verify --verbose=3 \"${BUILD_APPNAME}\" failed."
+ exit 11
+fi
+echo ""
+echo "Xojo2PKG: checking CodeSign... (Verifying Part 3)"
+codesign -d -vvvv "./${BUILD_APPNAME} Libs/"*.dylib
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: codesign -d -vvvv of .dylibs failed."
+ exit 11
+fi
+echo ""
+echo "Xojo2PKG: checking CodeSign... (Verifying Part 4)"
+codesign --verify --verbose=3 "./${BUILD_APPNAME} Libs/"*.dylib
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: codesign --verify --verbose=3 of .commands failed."
+ exit 11
+fi
+echo ""
+echo "Xojo2PKG: checking CodeSign... (Verifying Part 5)"
+codesign -d -vvvv "./"*.command
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: codesign -d -vvvv of .dylibs failed."
+ exit 11
+fi
+echo ""
+echo "Xojo2PKG: checking CodeSign... (Verifying Part 6)"
+codesign --verify --verbose=3 "./"*.command
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: codesign --verify --verbose=3 of .commands failed."
+ exit 11
+fi
+
+echo ""
+echo "Xojo2PKG: finished checking CodeSign"
+sleep 1
+
+
+#*******************
+# Create .pkg
+#*******************
+echo ""
+echo "Xojo2PKG: preparing stage for .pkg"
+
+cd "${STAGING_DIR_PKG}"
+
+mkdir -p "${STAGING_DIR_PKG}"
+if [ ! -d "${STAGING_DIR_PKG}" ]; then
+ echo "Xojo2PKG ERROR: \${STAGING_DIR_PKG} = ${STAGING_DIR_PKG} doesn't exist."
+ exit 8
+fi
+
+echo ""
+echo "Xojo2PKG: creating .pkg with pkgbuild..."
+
+pkgbuild --root "${STAGING_DIR_APP}" \
+ --identifier "${APP_BUNDLEIDENTIFIER}.pkg" \
+ --version "${APP_VERSION}" \
+ --install-location "/Applications" \
+ --sign "${CODESIGN_IDENT_INSTALLER}" \
+ --timestamp \
+ "${PKG_STAGE}"
+
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: pkgbuild failed."
+ exit 8
+fi
+
+sync
+sleep 1
+
+echo ""
+echo "Xojo2PKG: prep distribution.xml"
+
+cd "${STAGING_DIR_PKG}"
+
+productbuild --synthesize --package "${PKG_STAGE}" "./_distribution.xml"
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: productbuild synthesize package failed."
+ exit 8
+fi
+
+sync
+sleep 1
+
+echo ""
+echo "Xojo2PKG: finalize distribution.xml"
+
+awk "NR==3{print \"${BUILD_APPNAME}\"}1" "./_distribution.xml" > "./distribution.xml"
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: adding title to distribution.xml failed."
+ exit 8
+fi
+
+sync
+sleep 1
+
+echo ""
+echo "Xojo2PKG: productbuild .pkg for distribution"
+
+cd "${STAGING_DIR_PKG}"
+
+productbuild --distribution "./distribution.xml" --package-path "./${PKG_FILENAME}" --sign "${CODESIGN_IDENT_INSTALLER}" "${PKG_FINAL}"
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: productbuild for distribution failed."
+ exit 8
+fi
+
+sync
+sleep 2
+
+
+# check .pkg signature
+echo ""
+echo "Xojo2PKG: check .pkg signature"
+pkgutil --check-signature "$PKG_FINAL"
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: Checking signature of .pkg failed."
+ exit 8
+fi
+
+
+# clean up
+echo ""
+echo "Xojo2PKG: cleaning up..."
+rm -rf "${STAGING_DIR_APP}" "${STAGING_DIR_PKG}"
+
+
+#*******************
+# Notarize by Apple
+#*******************
+NOTARIZATION_COMPLETED=0
+NOTARIZATION_RESULT=0
+
+echo "Xojo2PKG: Notarize by Apple"
+sync
+NOTARIZATION_COMPLETED=0
+echo "Xojo2PKG: Submitting to Apple for Notarization... This can take a while..."
+APP_NOTARIZATION_OUTPUT="${BUILD_LOCATION}/../notarization_output.txt"
+APP_NOTARIZATION_LOG="${BUILD_LOCATION}/../notarization_log.txt"
+xcrun notarytool submit "${PKG_FINAL}" --keychain-profile "${NOTARYTOOL_KEYCHAIN_PROFILE}" --wait 2>&1 | tee "${APP_NOTARIZATION_OUTPUT}"
+NOTARIZATION_RESULT=$?
+sync
+
+NOTARYTOOL_REQUEST_ID=$(sed -n 's/ id: \(.*\)/\1/p' "${APP_NOTARIZATION_OUTPUT}" | head -n 1)
+NOTARYTOOL_STATUS=$(sed -n 's/ status: \(.*\)/\1/p' "${APP_NOTARIZATION_OUTPUT}" | tail -n 1)
+
+if [ "${NOTARYTOOL_STATUS}" = "Accepted" ]; then
+ NOTARIZATION_COMPLETED=1
+ echo "Xojo2PKG: Notarization Accepted - Staple to .pkg"
+ sync
+ xcrun stapler staple -v "${PKG_FINAL}"
+ NOTARIZATION_RESULT=$?
+ if [ $NOTARIZATION_RESULT -eq 0 ]; then
+ echo "Notarization: Staple to .pkg successfully completed"
+ NOTARIZATION_COMPLETED=2
+ else
+ echo "Xojo2PKG ERROR: Notarization Error - Staple to .pkg was not successful."
+ exit 12
+ fi
+else
+ if [ ! -z $NOTARYTOOL_REQUEST_ID ]; then
+ echo "Xojo2PKG: Get Notarization Log"
+ xcrun notarytool log "${NOTARYTOOL_REQUEST_ID}" --keychain-profile "${NOTARYTOOL_KEYCHAIN_PROFILE}" $NOTARIZATION_IN_GITHUB_ACTIONS_KEYCHAINPATH 2>&1 | tee "${APP_NOTARIZATION_LOG}"
+ fi
+ echo "Xojo2PKG ERROR: Notarization Error"
+ exit 12
+fi
+
+#cleanup output - Notarization was successful
+rm -f "${APP_NOTARIZATION_OUTPUT}"
+sync
+
+if [ $NOTARIZATION_COMPLETED -eq 2 ]; then
+ echo "Xojo2PKG: Notarization by Apple has completed successfully."
+else
+ echo "Xojo2PKG ERROR: Notarization could not be completed."
+ exit 12
+fi
+sync
+
+sync
+sleep 2
+
+# check .pkg signature
+echo ""
+echo "Xojo2PKG: check .pkg signature"
+pkgutil --check-signature "$PKG_FINAL"
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: Checking signature of .pkg failed."
+ exit 12
+fi
+
+# check .pkg Notarization
+echo ""
+echo "Xojo2PKG: check .pkg Notarization"
+stapler validate "$PKG_FINAL"
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: Checking Notarization of .pkg failed."
+ exit 12
+fi
+
+# SecAssessment of .pkg
+echo ""
+echo "Xojo2PKG: SecAssessment of .pkg"
+spctl -a -v --type install "$PKG_FINAL"
+if [ $? -gt 0 ]; then
+ echo "Xojo2PKG ERROR: SecAssessment of .pkg failed."
+ exit 12
+fi
+
+
+echo ""
+echo "Xojo2PKG: It's all done."
+exit 0
\ No newline at end of file
diff --git a/webapp/App.xojo_code b/webapp/App.xojo_code
index 2569566..81449be 100644
--- a/webapp/App.xojo_code
+++ b/webapp/App.xojo_code
@@ -3,7 +3,7 @@ Protected Class App
Inherits WebApplication
#tag Event
Sub Opening(args() As String)
- // Store Launch Arguments for later
+ ' Store Launch Arguments for later
modCubeSQLAdmin.StoreLaunchArguments(args)
End Sub
@@ -11,9 +11,12 @@ Inherits WebApplication
#tag Event
Function UnhandledException(error As RuntimeException) As Boolean
- #Pragma unused error
+ If (error = Nil) Then Return True
- Break
+ Var dialog As New dlgUnhandledException
+ dialog.Show(error)
+
+ Return True
End Function
#tag EndEvent
diff --git a/webapp/Session.xojo_code b/webapp/Session.xojo_code
index 8b83480..4621f9d 100644
--- a/webapp/Session.xojo_code
+++ b/webapp/Session.xojo_code
@@ -38,7 +38,6 @@ Inherits WebSession
rs.Close
End If
-
Catch err As DatabaseException
Return False
diff --git a/webapp/containers/base/cntBase.xojo_code b/webapp/containers/base/cntBase.xojo_code
index 402444c..7411e72 100644
--- a/webapp/containers/base/cntBase.xojo_code
+++ b/webapp/containers/base/cntBase.xojo_code
@@ -1,6 +1,40 @@
#tag Class
Protected Class cntBase
Inherits WebContainer
+ #tag Event
+ Sub Opening()
+ Opening
+
+ Me.Load()
+
+ Me.TableInitColumns()
+ Me.TableInitRows()
+ Me.TableLoad()
+
+ ebOpened = True
+
+ End Sub
+ #tag EndEvent
+
+ #tag Event
+ Sub Shown()
+ Shown
+
+ ebShown = True
+
+ End Sub
+ #tag EndEvent
+
+
+ #tag Method, Flags = &h0
+ Sub Close()
+ Me.Table = Nil
+
+ Super.Close()
+
+ End Sub
+ #tag EndMethod
+
#tag Method, Flags = &h0
Sub Constructor()
Super.Constructor
@@ -8,24 +42,59 @@ Inherits WebContainer
Self.LockLeft = True
Self.LockRight = True
Self.LockTop = True
- self.LockBottom = True
+ Self.LockBottom = True
End Sub
#tag EndMethod
- #tag Method, Flags = &h0
- Sub Search(SearchValue As String)
- #Pragma unused SearchValue
+ #tag Method, Flags = &h1
+ Protected Sub Load()
End Sub
#tag EndMethod
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableInitRows()
+ Me.Table.RemoveAllRows
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableLoad()
+
+ End Sub
+ #tag EndMethod
+
+
+ #tag Hook, Flags = &h0
+ Event Opening()
+ #tag EndHook
+
+ #tag Hook, Flags = &h0
+ Event Shown()
+ #tag EndHook
+
#tag Property, Flags = &h0
Area As String = "Home"
#tag EndProperty
- #tag Property, Flags = &h0
- SearchAvailable As Boolean = False
+ #tag Property, Flags = &h1
+ Protected ebOpened As Boolean
+ #tag EndProperty
+
+ #tag Property, Flags = &h1
+ Protected ebShown As Boolean
+ #tag EndProperty
+
+ #tag Property, Flags = &h1
+ Protected Table As WebListBox
#tag EndProperty
#tag Property, Flags = &h0
@@ -278,14 +347,6 @@ 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
diff --git a/webapp/containers/base/cntDatasourceBase.xojo_code b/webapp/containers/base/cntDatasourceBase.xojo_code
index 1089260..8ee4fb5 100644
--- a/webapp/containers/base/cntDatasourceBase.xojo_code
+++ b/webapp/containers/base/cntDatasourceBase.xojo_code
@@ -50,20 +50,12 @@ Implements WebDataSource
#tag EndMethod
#tag Method, Flags = &h1
- Protected Function GetColumnData(col As DatasourceColumn, row As Dictionary) As Variant
- Select Case col.FieldType
- Case DatasourceColumn.FieldTypes.Text
- Return row.Lookup(col.DatabaseColumnName, "").StringValue
- Case DatasourceColumn.FieldTypes.Integer
- Return row.Lookup(col.DatabaseColumnName, 0).IntegerValue.ToString
- Case DatasourceColumn.FieldTypes.Boolean
- Return If(row.Lookup(col.DatabaseColumnName, 0).BooleanValue, "true", "false")
- Case DatasourceColumn.FieldTypes.SQLDateTime
- Return SQLDateTime_AsDateTime_AsLocal(row.Lookup(col.DatabaseColumnName, "").StringValue)
- Else
- Break
- Return ""
- End Select
+ Protected Function GetSelectedTableRowTag() As Variant
+ If (Me.Table = Nil) Then Return Nil
+
+ Var rowIndex As Integer = Me.Table.SelectedRowIndex
+ Return Me.Table.RowTagAt(rowIndex)
+
End Function
#tag EndMethod
@@ -129,6 +121,10 @@ Implements WebDataSource
End Select
If bSearchFilter And col.IsSearchable Then
+ 'Note: This is a technical web app. It'll show Dates as SQLDate/Time
+ 'so we can just use rowSet's .StringValue even for Date Columns.
+ 'Otherwise we would need to get the displayed value out of
+ 'me.TableRowColumnData (which could by a WebListBoxCellRenderer)
If rs.Column(col.DatabaseColumnName).StringValue.Contains(Me.SearchValue, ComparisonOptions.CaseInsensitive) Then
'We want so see rows that contain the text of the SearchFilter
bSearchFilterShowRow = True
@@ -199,11 +195,11 @@ Implements WebDataSource
dictRowTag.Value("id") = Me.TableRows(i).Lookup("id", -1).IntegerValue
Var row As New WebListBoxRowData
- row.PrimaryKey = me.TableRows(i).Lookup("id", -1).IntegerValue
+ row.PrimaryKey = Me.TableRows(i).Lookup("id", -1).IntegerValue
row.Tag = dictRow
For Each col As DatasourceColumn In Me.Columns
- Var colData As Variant = Me.GetColumnData(col, dictRow)
+ Var colData As Variant = Me.TableRowColumnData(col, dictRow)
If (colData <> Nil) Then
If (colData IsA WebListBoxCellRenderer) Then
@@ -245,8 +241,7 @@ Implements WebDataSource
#tag Method, Flags = &h0
Sub Search(SearchValue As String)
Me.SearchValue = SearchValue
-
- Super.Search(SearchValue)
+ Me.TableLoad()
End Sub
#tag EndMethod
@@ -333,6 +328,79 @@ Implements WebDataSource
End Function
#tag EndMethod
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+ Redim Me.Columns(-1)
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableInitRows()
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableLoad()
+ Me.Table.NoRowsMessage = Me.TableNoRowsMessage()
+
+ Me.TableLoadFilters
+ Me.LoadDatasource(Me.TableLoadRowSet)
+
+ If (Me.Table.DataSource = Nil) Then
+ Me.Table.DataSource = Self
+ Else
+ Me.Table.ReloadData()
+ End If
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableLoadFilters()
+ Me.Filters = New Dictionary
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableLoadRowSet() As RowSet
+ Return Nil
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableNoRowsMessage() As String
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableRowColumnData(col As DatasourceColumn, row As Dictionary) As Variant
+ Select Case col.FieldType
+ Case DatasourceColumn.FieldTypes.Text
+ Return row.Lookup(col.DatabaseColumnName, "").StringValue
+ Case DatasourceColumn.FieldTypes.Integer
+ Return row.Lookup(col.DatabaseColumnName, 0).IntegerValue.ToString
+ Case DatasourceColumn.FieldTypes.Boolean
+ Return If(row.Lookup(col.DatabaseColumnName, 0).BooleanValue, "true", "false")
+ Case DatasourceColumn.FieldTypes.SQLDateTime
+ Return SQLDateTime_AsDateTime_AsLocal(row.Lookup(col.DatabaseColumnName, "").StringValue)
+ Else
+ Break
+ Return ""
+ End Select
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableRowDataLoaded()
+
+ End Sub
+ #tag EndMethod
+
#tag Method, Flags = &h21
Private Function UnsortedPrimaryKeys() As Integer()
// Part of the WebDataSource interface.
@@ -341,7 +409,7 @@ Implements WebDataSource
Var keys() As Integer
For i As Integer = 0 To Me.TableRows.LastIndex
- keys.Add(me.TableRows(i).Lookup("id", -1).IntegerValue)
+ keys.Add(Me.TableRows(i).Lookup("id", -1).IntegerValue)
Next
Return keys
@@ -349,11 +417,13 @@ Implements WebDataSource
End Function
#tag EndMethod
- #tag Method, Flags = &h1
- Protected Sub WebTimer_RowDataLoaded(obj As WebTimer)
+ #tag Method, Flags = &h21
+ Private Sub WebTimer_RowDataLoaded(obj As WebTimer)
obj.RunMode = WebTimer.RunModes.Off
obj.Enabled = False
+ Me.TableRowDataLoaded()
+
End Sub
#tag EndMethod
@@ -378,6 +448,10 @@ Implements WebDataSource
Private mSortFieldType As DatasourceColumn.FieldTypes
#tag EndProperty
+ #tag Property, Flags = &h0
+ SearchAvailable As Boolean = False
+ #tag EndProperty
+
#tag Property, Flags = &h1
Protected SearchValue As String
#tag EndProperty
diff --git a/webapp/containers/cntStatus.xojo_code b/webapp/containers/cntStatus.xojo_code
index 544ce42..617ddd4 100644
--- a/webapp/containers/cntStatus.xojo_code
+++ b/webapp/containers/cntStatus.xojo_code
@@ -106,20 +106,6 @@ End
#tag EndWebContainerControl
#tag WindowCode
- #tag Event
- Sub Opening()
- Self.ShowInfos()
- End Sub
- #tag EndEvent
-
- #tag Event
- Sub Shown()
- ebShown = True
-
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h0
Sub Close()
timRefresh.RunMode = WebTimer.RunModes.Off
@@ -136,11 +122,44 @@ End
Me.Area = "cubeSQL"
Me.Title = "Status"
+ Me.Table = lstInfos
+
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
+ #tag Method, Flags = &h1
+ Protected Sub TableInitRows()
+ Super.TableInitRows()
+
+ Me.Table.AddRow "Version"
+ Me.Table.AddRow "Engine version"
+ Me.Table.AddRow "License"
+ Me.Table.AddRow ""
+ Me.Table.AddRow "Server Name"
+ Me.Table.AddRow "Address"
+ Me.Table.AddRow "Port"
+ Me.Table.AddRow "Host OS"
+ Me.Table.AddRow ""
+ Me.Table.AddRow "Current Date Time"
+ Me.Table.AddRow "Connections"
+ Me.Table.AddRow "Bytes"
+ Me.Table.AddRow "Counters"
+ Me.Table.AddRow "Memory Usage"
+ Me.Table.AddRow "Up since"
+
+ Var styleKeyColumn As WebStyle = StyleListboxKeyColumn
+
+ For i As Integer = 0 To Me.Table.LastRowIndex
+ Me.Table.CellTextAt(i, 0) = New WebListBoxStyleRenderer(styleKeyColumn, Me.Table.CellTextAt(i, 0))
+ Next
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableLoad()
+ Super.TableLoad()
+
Try
Var rs As RowSet = Session.DB.SelectSQL("SHOW DETAILED STATISTICS")
If (rs = Nil) Then Return
@@ -152,20 +171,31 @@ End
rs.Close
+ rs = Session.DB.SelectSQL("SHOW PREFERENCE 'SERVER_NAME'")
+ If (rs <> Nil) Then
+ For Each row As DatabaseRow In rs
+ infos.Value(row.ColumnAt(0).StringValue) = row.ColumnAt(1).StringValue
+ Next
+
+ rs.Close
+ End If
+
- lstInfos.CellTextAt(0, 1) = infos.Lookup("server_release", "") + " (" + infos.Lookup("server_mode", "") + ")"
- lstInfos.CellTextAt(1, 1) = infos.Lookup("engine_version", "").StringValue
- lstInfos.CellTextAt(2, 1) = infos.Lookup("server_license", "").StringValue
+ Me.Table.CellTextAt(0, 1) = infos.Lookup("server_release", "") + " (" + infos.Lookup("server_mode", "") + ")"
+ Me.Table.CellTextAt(1, 1) = infos.Lookup("engine_version", "").StringValue
+ Me.Table.CellTextAt(2, 1) = infos.Lookup("server_license", "").StringValue
- lstInfos.CellTextAt(4, 1) = infos.Lookup("ip_address", "").StringValue
- lstInfos.CellTextAt(5, 1) = infos.Lookup("server_port", "").StringValue
- lstInfos.CellTextAt(6, 1) = infos.Lookup("os_version", "").StringValue
+ Me.Table.CellTextAt(4, 1) = infos.Lookup("SERVER_NAME", "").StringValue
+ Me.Table.CellTextAt(5, 1) = infos.Lookup("ip_address", "").StringValue
+ Me.Table.CellTextAt(6, 1) = infos.Lookup("server_port", "").StringValue
+ Me.Table.CellTextAt(7, 1) = infos.Lookup("os_version", "").StringValue
- lstInfos.CellTextAt(8, 1) = "Current: " + infos.Lookup("current_connections", "") + " | Total: " + infos.Lookup("total_connections", "") + " | Max: " + infos.Lookup("max_connections", "")
- lstInfos.CellTextAt(9, 1) = "Sent: " + infos.Lookup("bytes_sent", "") + " | Received: " + infos.Lookup("bytes_received", "")
- lstInfos.CellTextAt(10, 1) = "Query: " + infos.Lookup("query_count", "") + " | Exec: " + infos.Lookup("exec_count", "") + " | Custom Commands: " + infos.Lookup("commands_count", "")
- lstInfos.CellTextAt(11, 1) = "Current: " + infos.Lookup("memory_usage", "") + " | Max: " + infos.Lookup("max_memory_usage", "")
- lstInfos.CellTextAt(12, 1) = infos.Lookup("server_startup_datetime", "").StringValue
+ Me.Table.CellTextAt(9, 1) = infos.Lookup("server_current_datetime", "").StringValue
+ Me.Table.CellTextAt(10, 1) = "Current: " + infos.Lookup("current_connections", "") + " | Total: " + infos.Lookup("total_connections", "") + " | Max: " + infos.Lookup("max_connections", "")
+ Me.Table.CellTextAt(11, 1) = "Sent: " + infos.Lookup("bytes_sent", "") + " | Received: " + infos.Lookup("bytes_received", "")
+ Me.Table.CellTextAt(12, 1) = "Query: " + infos.Lookup("query_count", "") + " | Exec: " + infos.Lookup("exec_count", "") + " | Custom Commands: " + infos.Lookup("commands_count", "")
+ Me.Table.CellTextAt(13, 1) = "Current: " + infos.Lookup("memory_usage", "") + " | Max: " + infos.Lookup("max_memory_usage", "")
+ Me.Table.CellTextAt(14, 1) = infos.Lookup("server_startup_datetime", "").StringValue
If ebShown Then
' Don't change Height before shown...
@@ -174,10 +204,10 @@ End
If serverLicenseIsNotRegistered Or isNotRegistered Then
If (cntServerRegistration.Visible <> True) Then cntServerRegistration.Visible = True
- If (lstInfos.Height <> Self.Height - cntServerRegistration.Height) Then lstInfos.Height = Self.Height - cntServerRegistration.Height
+ If (Me.Table.Height <> Self.Height - cntServerRegistration.Height) Then Me.Table.Height = Self.Height - cntServerRegistration.Height
Else
If (cntServerRegistration.Visible <> False) Then cntServerRegistration.Visible = False
- If (lstInfos.Height <> Self.Height) Then lstInfos.Height = Self.Height
+ If (Me.Table.Height <> Self.Height) Then Me.Table.Height = Self.Height
End If
End If
@@ -190,52 +220,20 @@ End
#tag EndMethod
- #tag Property, Flags = &h21
- Private ebShown As Boolean
- #tag EndProperty
-
-
#tag EndWindowCode
-#tag Events lstInfos
- #tag Event
- Sub Opening()
- Me.RemoveAllRows
-
- Me.AddRow "Version"
- Me.AddRow "Engine version"
- Me.AddRow "License"
- Me.AddRow ""
- Me.AddRow "Address"
- Me.AddRow "Port"
- Me.AddRow "Host OS"
- Me.AddRow ""
- Me.AddRow "Connections"
- Me.AddRow "Bytes"
- Me.AddRow "Counters"
- Me.AddRow "Memory Usage"
- Me.AddRow "Up since"
-
- Var styleKeyColumn As WebStyle = StyleListboxKeyColumn
-
- For i As Integer = 0 To Me.LastRowIndex
- Me.CellTextAt(i, 0) = New WebListBoxStyleRenderer(styleKeyColumn, Me.CellTextAt(i, 0))
- Next
-
- End Sub
- #tag EndEvent
-#tag EndEvents
#tag Events timRefresh
#tag Event
Sub Run()
- self.ShowInfos()
+ Self.TableLoad()
+
End Sub
#tag EndEvent
#tag EndEvents
#tag Events cntServerRegistration
#tag Event
Sub NeedsRefresh()
- Self.ShowInfos()
+ Self.TableLoad()
End Sub
#tag EndEvent
@@ -249,14 +247,6 @@ End
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/data/cntBackups.xojo_code b/webapp/containers/data/cntBackups.xojo_code
index 9b31fb3..f784bc7 100644
--- a/webapp/containers/data/cntBackups.xojo_code
+++ b/webapp/containers/data/cntBackups.xojo_code
@@ -438,18 +438,6 @@ End
#tag EndWebContainerControl
#tag WindowCode
- #tag Event
- Sub Opening()
- Self.Load()
-
- Self.ShowInfos()
-
- ebOpened = True
-
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h21
Private Sub ActionBackup()
If Me.IsThreadRunning Then Return
@@ -482,7 +470,7 @@ End
dlgDelete.Indicator = Indicators.Danger
dlgDelete.ActionButton.Caption = "Delete"
dlgDelete.CancelButton.Visible = True
- dlgDelete.Message = "Are you sure you want to delete Backup '" + backupDate.ToString(DateTime.FormatStyles.Medium, DateTime.FormatStyles.Medium) + "' of Database " + databasename + "?"
+ dlgDelete.Message = "Are you sure you want to delete Backup '" + backupDate.SQLDateTime + "' of Database " + databasename + "?"
dlgDelete.Explanation = "This action cannot be undone."
esActionDatabasename = databasename
@@ -549,7 +537,7 @@ End
dlgRestore.Indicator = Indicators.Danger
dlgRestore.ActionButton.Caption = "Restore"
dlgRestore.CancelButton.Visible = True
- dlgRestore.Message = "Are you sure you want to restore database " + databasename+ " from Backup '" + backupDate.ToString(DateTime.FormatStyles.Medium, DateTime.FormatStyles.Medium) + "' ?"
+ dlgRestore.Message = "Are you sure you want to restore database " + databasename + " from Backup '" + backupDate.SQLDateTime + "' ?"
dlgRestore.Explanation = "This action cannot be undone."
esActionDatabasename = databasename
@@ -579,58 +567,12 @@ End
Me.Area = "Data"
Me.Title = "Backups"
-
-
- Redim Me.Columns(-1)
-
- Var col As DatasourceColumn
-
- col = New DatasourceColumn()
- col.Width = "50%"
- col.DatabaseColumnName = "timestamp"
- col.Heading = "Date"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.Descending
- Me.Columns.Add(col)
-
- col = New DatasourceColumn()
- col.Width = "50%"
- col.DatabaseColumnName = "virtualtime"
- col.Heading = "Time"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = False
- col.IsVirtual = True
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
+ Me.Table = lstInfos
+ Me.SearchAvailable = False
End Sub
#tag EndMethod
- #tag Method, Flags = &h1
- Protected Function GetColumnData(col As DatasourceColumn, row As Dictionary) As Variant
- Select Case col.DatabaseColumnName
-
- Case "timestamp", "virtualtime"
- Var sTimestamp As String = row.Lookup("timestamp", "19000101_000000").StringValue
- Var timestamp As DateTime = Me.GetDateTimeFromTimestamp(sTimestamp)
-
- Select Case col.DatabaseColumnName
- Case "timestamp"
- Return timestamp.ToString(DateTime.FormatStyles.Long, DateTime.FormatStyles.None)
- Case "virtualtime"
- Return timestamp.ToString(DateTime.FormatStyles.None, DateTime.FormatStyles.Medium)
- End Select
-
-
- Else
- Return Super.GetColumnData(col, row)
-
- End Select
-
- End Function
- #tag EndMethod
-
#tag Method, Flags = &h21
Private Function GetDateTimeFromTimestamp(psTimestamp As String) As DateTime
Var iYear As Integer = psTimestamp.Middle(0, 4).ToInteger
@@ -656,9 +598,7 @@ End
#tag Method, Flags = &h21
Private Function GetSelectedTimestamp() As String
- If (lstInfos.SelectedRowIndex < 0) Then Return ""
-
- Var selectedRowTag As Variant = lstInfos.RowTagAt(lstInfos.SelectedRowIndex)
+ Var selectedRowTag As Variant = Me.GetSelectedTableRowTag()
If (selectedRowTag IsA Dictionary) Then
Return Dictionary(selectedRowTag).Lookup("timestamp", "").StringValue
End If
@@ -679,8 +619,8 @@ End
End Function
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub Load()
+ #tag Method, Flags = &h1
+ Protected Sub Load()
Me.LoadDatabases()
End Sub
@@ -738,30 +678,50 @@ End
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
- Me.UpdateNoRowsMessage()
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+ Super.TableInitColumns()
+
+ Var col As DatasourceColumn
+ col = New DatasourceColumn()
+ col.Width = "50%"
+ col.DatabaseColumnName = "timestamp"
+ col.Heading = "Date"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.Descending
+ Me.Columns.Add(col)
+
+ col = New DatasourceColumn()
+ col.Width = "50%"
+ col.DatabaseColumnName = "virtualtime"
+ col.Heading = "Time"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = False
+ col.IsVirtual = True
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableLoadRowSet() As RowSet
Var filterDatabasename As String = Me.GetSelectedDatabasename()
If (filterDatabasename <> "") Then
- Me.LoadDatasource(Session.DB.SelectSQL("SHOW BACKUPS FOR DATABASE '" + filterDatabasename.EscapeSqlQuotes + "'"))
- Else
- Me.LoadDatasource(Nil)
+ Return Session.DB.SelectSQL("SHOW BACKUPS FOR DATABASE '" + filterDatabasename.EscapeSqlQuotes + "'")
+
End If
+ Return Nil
- If (lstInfos.DataSource = Nil) Then
- lstInfos.DataSource = Self
- Else
- lstInfos.ReloadData()
- End If
-
- End Sub
+ End Function
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub UpdateNoRowsMessage()
+ #tag Method, Flags = &h1
+ Protected Function TableNoRowsMessage() As String
Var sInfo As String = "No Backups"
Var filterDatabasename As String = Me.GetSelectedDatabasename()
@@ -769,14 +729,45 @@ End
sInfo = sInfo + " for Database " + filterDatabasename
End If
- lstInfos.NoRowsMessage = sInfo
+ Return sInfo
- End Sub
+ End Function
#tag EndMethod
#tag Method, Flags = &h1
- Protected Sub WebTimer_RowDataLoaded(obj As WebTimer)
- Super.WebTimer_RowDataLoaded(obj)
+ Protected Function TableRowColumnData(col As DatasourceColumn, row As Dictionary) As Variant
+ Select Case col.DatabaseColumnName
+
+ Case "timestamp", "virtualtime"
+ Var sTimestamp As String = row.Lookup("timestamp", "19000101_000000").StringValue
+ Var timestamp As DateTime = Me.GetDateTimeFromTimestamp(sTimestamp)
+
+ 'Note: This is a technical web app. It'll show Dates as SQLDate/Time
+ 'Otherwise we would need to show in User Locale:
+ 'Var userLanguageCode As String = Session.LanguageCode
+ 'Var userLocale As New Locale(userLanguageCode)
+
+ Select Case col.DatabaseColumnName
+ Case "timestamp"
+ Return timestamp.SQLDate
+ 'Return timestamp.ToString(userLocale, DateTime.FormatStyles.Long, DateTime.FormatStyles.None)
+ Case "virtualtime"
+ Return timestamp.ToString("HH:mm:ss")
+ 'Return timestamp.ToString(userLocale, DateTime.FormatStyles.None, DateTime.FormatStyles.Medium)
+ End Select
+
+
+ Else
+ Return Super.TableRowColumnData(col, row)
+
+ End Select
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableRowDataLoaded()
+ Super.TableRowDataLoaded()
If (esSelectAfterReload = "") Then
Me.RefreshButtons()
@@ -787,17 +778,17 @@ End
esSelectAfterReload = ""
Var bFound As Boolean = False
- For i As Integer = lstInfos.LastRowIndex DownTo 0
- If (lstInfos.RowTagAt(i) IsA Dictionary) Then
- Var rowTag As Dictionary = lstInfos.RowTagAt(i)
+ For i As Integer = Me.Table.LastRowIndex DownTo 0
+ If (Me.Table.RowTagAt(i) IsA Dictionary) Then
+ Var rowTag As Dictionary = Me.Table.RowTagAt(i)
If (rowTag.Lookup("timestamp", "-").StringValue <> sSelectAfterReload) Then Continue
- lstInfos.SelectedRowIndex = i
+ Me.Table.SelectedRowIndex = i
bFound = True
Exit 'Loop
End If
Next
- If (Not bFound) Then lstInfos.SelectedRowIndex = -1
+ If (Not bFound) Then Me.Table.SelectedRowIndex = -1
Me.RefreshButtons()
@@ -809,10 +800,6 @@ End
Private Download As WebFile
#tag EndProperty
- #tag Property, Flags = &h21
- Private ebOpened As Boolean
- #tag EndProperty
-
#tag Property, Flags = &h21
Private ebReloadAfterThread As Boolean
#tag EndProperty
@@ -881,7 +868,7 @@ End
If (Not ebOpened) Then Return
- Self.ShowInfos()
+ Self.TableLoad()
End Sub
#tag EndEvent
@@ -944,14 +931,7 @@ End
End If
If update.HasKey("Error") Then
- Var dialog As New WebMessageDialog
- dialog.Title = "Backup Database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not backup database."
- dialog.Explanation = update.Lookup("Error", "").StringValue
- dialog.Show
+ ShowErrorDialog("Backup Database", "Could not backup database.", update.Lookup("Error", "").StringValue)
End If
Next
@@ -998,14 +978,7 @@ End
End If
If update.HasKey("Error") Then
- Var dialog As New WebMessageDialog
- dialog.Title = "Delete Backup"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not delete backup."
- dialog.Explanation = update.Lookup("Error", "").StringValue
- dialog.Show
+ ShowErrorDialog("Delete Backup", "Could not delete backup.", update.Lookup("Error", "").StringValue)
End If
Next
@@ -1052,14 +1025,7 @@ End
End If
If update.HasKey("Error") Then
- Var dialog As New WebMessageDialog
- dialog.Title = "Restore Backup"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not restore backup."
- dialog.Explanation = update.Lookup("Error", "").StringValue
- dialog.Show
+ ShowErrorDialog("Restore Backup", "Could not restore backup.", update.Lookup("Error", "").StringValue)
End If
Next
@@ -1116,7 +1082,7 @@ End
Dim chunk As String = DB.ReceiveChunk
' there was an error receving a chunk, report the error and bail
- If DB.Error Then
+ If (DB.ErrCode <> 0) Or (DB.ErrMsg <> "") Then
Var errorMessage As String = DB.ErrMsg
If (errorMessage = "") Then errorMessage = "Unknown Error while downloading..."
Raise New DatabaseException(errorMessage, DB.ErrCode)
@@ -1175,14 +1141,7 @@ End
End If
If update.HasKey("Error") Then
- Var dialog As New WebMessageDialog
- dialog.Title = "Download Backup"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not download backup."
- dialog.Explanation = update.Lookup("Error", "").StringValue
- dialog.Show
+ ShowErrorDialog("Download Backup", "Could not download backup.", update.Lookup("Error", "").StringValue)
End If
Next
@@ -1197,7 +1156,7 @@ End
Me.RunMode = WebTimer.RunModes.Off
- Session.GoToURL(Self.Download.URL)
+ Call Self.Download.Download()
End Sub
#tag EndEvent
@@ -1212,7 +1171,7 @@ End
pgrWheel.Visible = False
If ebReloadAfterThread Then
- Self.ShowInfos()
+ Self.TableLoad()
End If
diff --git a/webapp/containers/data/cntDatabases.xojo_code b/webapp/containers/data/cntDatabases.xojo_code
index ac201f6..47585d1 100644
--- a/webapp/containers/data/cntDatabases.xojo_code
+++ b/webapp/containers/data/cntDatabases.xojo_code
@@ -399,10 +399,8 @@ Begin cntDatasourceBase cntDatabases
LockTop = True
LockVertical = False
Message = ""
- PanelIndex = 0
+ PanelIndex = "0"
Scope = 2
- TabIndex = 10
- TabStop = True
Title = ""
Tooltip = ""
_mPanelIndex = -1
@@ -411,13 +409,6 @@ End
#tag EndWebContainerControl
#tag WindowCode
- #tag Event
- Sub Opening()
- Self.ShowInfos()
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h21
Private Sub ActionChangeKey(obj As cntDatabasesEncryption)
Var databasename As String = Me.GetSelectedDatabasename()
@@ -446,14 +437,7 @@ End
Session.DB.ExecuteSQL("ENCRYPT DATABASE '" + esActionDatabasename.EscapeSqlQuotes + "' WITH KEY '" + Name.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Change Key for Database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not set change key for database."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Change Key for Database", "Could not set change key for database.", err)
Return False
End Try
@@ -489,14 +473,7 @@ End
Session.DB.ExecuteSQL(sqlCreateDb)
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Create Database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not create database."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Create Database", "Could not create database.", err)
Return False
End Try
@@ -543,14 +520,7 @@ End
Session.DB.ExecuteSQL("DECRYPT DATABASE '" + sDecryptDatabasename.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Decrypt Database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not decrypt database."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Decrypt Database", "Could not decrypt database.", err)
Finally
Me.RefreshInfos()
@@ -619,14 +589,7 @@ End
Session.DB.ExecuteSQL("DROP DATABASE '" + sDropDatabasename.EscapeSqlQuotes + "' IF EXISTS")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Drop Database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not drop database."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Drop Database", "Could not drop database.", err)
Finally
Me.RefreshInfos()
@@ -664,14 +627,7 @@ End
Session.DB.ExecuteSQL("ENCRYPT DATABASE '" + esActionDatabasename.EscapeSqlQuotes + "' WITH KEY '" + Name.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Encrypt Database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not encrypt database."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Encrypt Database", "Could not encrypt database.", err)
Return False
End Try
@@ -685,10 +641,10 @@ End
#tag Method, Flags = &h21
Private Sub ActionEncryption()
- Var dbRowTag As Dictionary = Me.GetSelectedRowTag()
+ Var rowTag As Dictionary = Me.GetSelectedTableRowTag()
Var popEncryption As New cntDatabasesEncryption
- popEncryption.Init(dbRowTag)
+ popEncryption.Init(rowTag)
AddHandler popEncryption.ActionSetKey, WeakAddressOf ActionSetKey
@@ -728,14 +684,7 @@ End
Session.DB.ExecuteSQL("RENAME DATABASE '" + esActionDatabasename.EscapeSqlQuotes + "' TO '" + Name.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Rename Database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not rename database."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Rename Database", "Could not rename database.", err)
Return False
End Try
@@ -775,14 +724,7 @@ End
Session.DB.ExecuteSQL("SET KEY '" + Name.EscapeSqlQuotes + "' FOR DATABASE '" + esActionDatabasename.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Set Key for Database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not set key for database."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Set Key for Database", "Could not set key for database.", err)
Return False
End Try
@@ -803,14 +745,7 @@ End
Session.DB.ExecuteSQL("START DATABASE '" + databasename.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Start database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not start database."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Start database", "Could not start database.", err)
Finally
Me.RefreshInfos()
@@ -829,14 +764,7 @@ End
Session.DB.ExecuteSQL("STOP DATABASE '" + databasename.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Stop database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not stop database."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Stop database", "Could not stop database.", err)
Finally
Me.RefreshInfos()
@@ -857,6 +785,8 @@ End
#tag Method, Flags = &h21
Private Function ActionUploadButtonPressed(obj As dlgDatabaseUpload, Name As String, Key As String, File As WebUploadedFile) As Boolean
+ #Pragma unused obj
+
If Me.IsThreadRunning Then Return False
If (Name = "") Then Return False
If (File.Data = Nil) Then Return False
@@ -882,10 +812,110 @@ End
Me.Area = "Data"
Me.Title = "Databases"
+ Me.Table = lstInfos
Me.SearchAvailable = True
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Shared Function GetDatabasesList() As String()
+ Var databases() As String
+
+ Try
+
+ Var rs As RowSet = Session.DB.SelectSQL("SHOW DATABASES WITH DETAILS")
+ If (rs <> Nil) Then
+ If (rs.RowCount > 0) Then
+ rs.MoveToFirstRow
+ While (Not rs.AfterLastRow)
+ If (databases.IndexOf(rs.Column("databasename").StringValue) < 0) Then
+ databases.Add(rs.Column("databasename").StringValue)
+ End If
+
+ rs.MoveToNextRow
+ Wend
+ End If
+
+ rs.Close
+ End If
+
+
+ Catch DatabaseException
+
+ Finally
+ databases.Sort()
+ return databases
+
+ End Try
+
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Function GetSelectedDatabasename() As String
+ Var selectedRowTag As Variant = Me.GetSelectedTableRowTag()
+ If (selectedRowTag IsA Dictionary) Then
+ Return Dictionary(selectedRowTag).Lookup("databasename", "").StringValue
+ End If
+
+ Return ""
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Function IsThreadRunning() As Boolean
+ If (thrDownload.ThreadState <> Thread.ThreadStates.NotRunning) Then Return True
+ Return False
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Sub RefreshButtons()
+ Var bDownload, bRename, bStart, bStop, bDrop, bEncryption As Boolean
+
+ Var rowTag As Dictionary = Me.GetSelectedTableRowTag()
+ If (rowTag <> Nil) Then
+
+ bDownload = True
+ bRename = True
+ bStart = rowTag.Lookup("stopped", False) = True
+ bStop = (Not bStart)
+ bDrop = True
+ bEncryption = True
+
+ End If
+
+ If (btnDownload.Enabled <> bDownload) Then btnDownload.Enabled = bDownload
+ If (btnRename.Enabled <> bRename) Then btnRename.Enabled = bRename
+ If (btnStart.Enabled <> bStart) Then btnStart.Enabled = bStart
+ If (btnStop.Enabled <> bStop) Then btnStop.Enabled = bStop
+ If (btnDrop.Enabled <> bDrop) Then btnDrop.Enabled = bDrop
+ If (btnEncryption.Enabled <> bEncryption) Then btnEncryption.Enabled = bEncryption
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Sub RefreshInfos(selectDatabasename As String = "")
+ If (selectDatabasename = "") Then
+ selectDatabasename = Me.GetSelectedDatabasename()
+ End If
+
+ esSelectAfterReload = selectDatabasename
+
+ Me.TableLoad()
- Redim Me.Columns(-1)
+ 'Select Row async via TableRowDataLoaded
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+ Super.TableInitColumns()
Var col As DatasourceColumn
@@ -964,7 +994,27 @@ End
#tag EndMethod
#tag Method, Flags = &h1
- Protected Function GetColumnData(col As DatasourceColumn, row As Dictionary) As Variant
+ Protected Function TableLoadRowSet() As RowSet
+ Return Session.DB.SelectSQL("SHOW DATABASES WITH DETAILS")
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableNoRowsMessage() As String
+ Var sInfo As String = "No Databases"
+
+ If (Me.SearchValue <> "") Then
+ sInfo = sInfo + " matching '" + Me.SearchValue + "'"
+ End If
+
+ Return sInfo
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableRowColumnData(col As DatasourceColumn, row As Dictionary) As Variant
Select Case col.DatabaseColumnName
Case "status"
@@ -992,7 +1042,7 @@ End
End If
Else
- Return Super.GetColumnData(col, row)
+ Return Super.TableRowColumnData(col, row)
End Select
@@ -1000,152 +1050,8 @@ End
#tag EndMethod
#tag Method, Flags = &h1
- Protected Shared Function GetDatabasesList() As String()
- Var databases() As String
-
- Try
-
- Var rs As RowSet = Session.DB.SelectSQL("SHOW DATABASES WITH DETAILS")
- If (rs <> Nil) Then
- If (rs.RowCount > 0) Then
- rs.MoveToFirstRow
- While (Not rs.AfterLastRow)
- If (databases.IndexOf(rs.Column("databasename").StringValue) < 0) Then
- databases.Add(rs.Column("databasename").StringValue)
- End If
-
- rs.MoveToNextRow
- Wend
- End If
-
- rs.Close
- End If
-
-
- Catch DatabaseException
-
- Finally
- databases.Sort()
- return databases
-
- End Try
-
-
- End Function
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Function GetSelectedDatabasename() As String
- If (lstInfos.SelectedRowIndex < 0) Then Return ""
-
- Var selectedRowTag As Variant = lstInfos.RowTagAt(lstInfos.SelectedRowIndex)
- If (selectedRowTag IsA Dictionary) Then
- Return Dictionary(selectedRowTag).Lookup("databasename", "").StringValue
- End If
-
- Return ""
-
- End Function
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Function GetSelectedRowTag() As Dictionary
- Var rowTag As Variant
- If (lstInfos.SelectedRowIndex >= 0) Then rowTAg = lstInfos.RowTagAt(lstInfos.SelectedRowIndex)
- If (rowTag IsA Dictionary) Then Return Dictionary(rowTag)
- Return Nil
-
- End Function
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Function IsThreadRunning() As Boolean
- If (thrDownload.ThreadState <> Thread.ThreadStates.NotRunning) Then Return True
- Return False
-
- End Function
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Sub RefreshButtons()
- Var bDownload, bRename, bStart, bStop, bDrop, bEncryption As Boolean
-
- Var dbRowTag As Dictionary = me.GetSelectedRowTag()
- If (dbRowTag <> Nil) Then
-
- bDownload = True
- bRename = True
- bStart = dbRowTag.Lookup("stopped", False) = True
- bStop = (Not bStart)
- bDrop = True
- bEncryption = True
-
- End If
-
- If (btnDownload.Enabled <> bDownload) Then btnDownload.Enabled = bDownload
- If (btnRename.Enabled <> bRename) Then btnRename.Enabled = bRename
- If (btnStart.Enabled <> bStart) Then btnStart.Enabled = bStart
- If (btnStop.Enabled <> bStop) Then btnStop.Enabled = bStop
- If (btnDrop.Enabled <> bDrop) Then btnDrop.Enabled = bDrop
- If (btnEncryption.Enabled <> bEncryption) Then btnEncryption.Enabled = bEncryption
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Sub RefreshInfos(selectDatabasename As String = "")
- If (selectDatabasename = "") Then
- selectDatabasename = Me.GetSelectedDatabasename()
- End If
-
- esSelectAfterReload = selectDatabasename
-
- Me.ShowInfos()
-
- 'Select Row async via WebTimer_RowDataLoaded
-
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h0
- Sub Search(SearchValue As String)
- Super.Search(SearchValue)
-
- Me.ShowInfos()
-
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
- Me.UpdateNoRowsMessage()
-
- Me.LoadDatasource(Session.DB.SelectSQL("SHOW DATABASES WITH DETAILS"))
-
- If (lstInfos.DataSource = Nil) Then
- lstInfos.DataSource = Self
- Else
- lstInfos.ReloadData()
- End If
-
- 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)
+ Protected Sub TableRowDataLoaded()
+ Super.TableRowDataLoaded()
If (esSelectAfterReload = "") Then
Me.RefreshButtons()
@@ -1156,17 +1062,17 @@ End
esSelectAfterReload = ""
Var bFound As Boolean = False
- For i As Integer = lstInfos.LastRowIndex DownTo 0
- If (lstInfos.RowTagAt(i) IsA Dictionary) Then
- Var rowTag As Dictionary = lstInfos.RowTagAt(i)
+ For i As Integer = Me.Table.LastRowIndex DownTo 0
+ If (Me.Table.RowTagAt(i) IsA Dictionary) Then
+ Var rowTag As Dictionary = Me.Table.RowTagAt(i)
If (rowTag.Lookup("databasename", "").StringValue <> sSelectAfterReload) Then Continue
- lstInfos.SelectedRowIndex = i
+ Me.Table.SelectedRowIndex = i
bFound = True
Exit 'Loop
End If
Next
- If (Not bFound) Then lstInfos.SelectedRowIndex = -1
+ If (Not bFound) Then Me.Table.SelectedRowIndex = -1
Me.RefreshButtons()
@@ -1284,7 +1190,6 @@ End
If (Self.Upload = Nil) Or (Self.Upload.Data = Nil) Then Return
Var iDbTimeout As Integer = DB.Timeout
- Var prepareDownload As WebFile
Try
Const kChunkSize = 102400
@@ -1294,7 +1199,7 @@ End
Dim bs As New BinaryStream(Self.Upload.Data)
Dim chunk As String 'upload data in chunks
- While Not bs.EOF
+ While Not bs.EndOfFile
'read the next chunk
chunk = bs.Read(kChunkSize)
@@ -1302,7 +1207,7 @@ End
DB.SendChunk chunk
'if there was an error; report it and bail
- If DB.Error Then
+ If (DB.ErrCode <> 0) or (DB.ErrMsg <> "") Then
Var errorMessage As String = DB.ErrMsg
If (errorMessage = "") Then errorMessage = "Unknown Error while uploading..."
Raise New DatabaseException(errorMessage, DB.ErrCode)
@@ -1351,25 +1256,11 @@ End
End If
If update.HasKey("Hint") Then
- Var dialog As New WebMessageDialog
- dialog.Title = "Upload Database"
- dialog.Indicator = Indicators.Info
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = update.Lookup("Hint", "").StringValue.NthField("|", 1)
- dialog.Explanation = update.Lookup("Hint", "").StringValue.NthField("|", 2)
- dialog.Show
+ ShowInfoDialog("Upload Database", update.Lookup("Hint", "").StringValue.NthField("|", 1), update.Lookup("Hint", "").StringValue.NthField("|", 2))
End If
If update.HasKey("Error") Then
- Var dialog As New WebMessageDialog
- dialog.Title = "Upload Database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not upload database."
- dialog.Explanation = update.Lookup("Error", "").StringValue
- dialog.Show
+ ShowErrorDialog("Upload Database", "Could not upload database.", update.Lookup("Error", "").StringValue)
End If
Next
@@ -1396,7 +1287,7 @@ End
Me.RunMode = WebTimer.RunModes.Off
- Session.GoToURL(Self.Download.URL)
+ Call Self.Download.Download()
End Sub
#tag EndEvent
@@ -1416,7 +1307,7 @@ End
Me.RunMode = WebTimer.RunModes.Off
- Self.ShowInfos()
+ Self.TableLoad()
End Sub
#tag EndEvent
@@ -1448,7 +1339,7 @@ End
Dim chunk As String = DB.ReceiveChunk
' there was an error receving a chunk, report the error and bail
- If DB.Error Then
+ If (DB.ErrCode <> 0) Or (DB.ErrMsg <> "") Then
Var errorMessage As String = DB.ErrMsg
If (errorMessage = "") Then errorMessage = "Unknown Error while downloading..."
Raise New DatabaseException(errorMessage, DB.ErrCode)
@@ -1505,14 +1396,7 @@ End
End If
If update.HasKey("Error") Then
- Var dialog As New WebMessageDialog
- dialog.Title = "Download Database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not download database."
- dialog.Explanation = update.Lookup("Error", "").StringValue
- dialog.Show
+ ShowErrorDialog("Download Database", "Could not download database.", update.Lookup("Error", "").StringValue)
End If
Next
@@ -1523,7 +1407,7 @@ End
#tag Events btnEncryption
#tag Event
Sub Pressed()
- self.ActionEncryption()
+ Self.ActionEncryption()
End Sub
#tag EndEvent
#tag EndEvents
diff --git a/webapp/containers/information/cntClients.xojo_code b/webapp/containers/information/cntClients.xojo_code
index 1c6049e..5f7ad38 100644
--- a/webapp/containers/information/cntClients.xojo_code
+++ b/webapp/containers/information/cntClients.xojo_code
@@ -140,14 +140,6 @@ End
#tag EndWebContainerControl
#tag WindowCode
- #tag Event
- Sub Opening()
- Self.ShowInfos()
-
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h21
Private Sub ActionDisconnect()
Var clientUsername As String
@@ -181,14 +173,7 @@ End
Session.DB.ExecuteSQL("CLOSE CONNECTION " + iDisconnectClientId.ToString)
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Disconnect Client"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not disconnect client."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Disconnect Client", "Could not disconnect client.", err)
Finally
Me.RefreshInfos()
@@ -204,10 +189,65 @@ End
Me.Area = "Information"
Me.Title = "Clients"
+ Me.Table = lstInfos
Me.SearchAvailable = True
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Function GetSelectedClientId(ByRef username As String) As Integer
+ username = ""
+
+ Var selectedRowTag As Variant = Me.GetSelectedTableRowTag()
+ If (selectedRowTag IsA Dictionary) Then
+ username = Dictionary(selectedRowTag).Lookup("username", "").StringValue
+ Return Dictionary(selectedRowTag).Lookup("id", "").IntegerValue
+ End If
+
+ Return -1
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Sub RefreshButtons()
+ Var clientUsername As String
+ Var clientId As Integer = Me.GetSelectedClientId(clientUsername)
+
+ Var bRefresh, bDisconnect As Boolean
- Redim Me.Columns(-1)
+ If (clientId > 0) Then
+ bDisconnect = (clientId <> Session.ClientId)
+ End If
+ bRefresh = True
+
+ If (btnRefresh.Enabled <> bRefresh) Then btnRefresh.Enabled = bRefresh
+ If (btnDisconnect.Enabled <> bDisconnect) Then btnDisconnect.Enabled = bDisconnect
+
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Sub RefreshInfos(selectClientId As Integer = -1)
+ If (eiSelectAfterReload <= 0) Then
+ Var username As String
+ selectClientId = Me.GetSelectedClientId(username)
+ End If
+
+ eiSelectAfterReload = selectClientId
+
+ Me.TableLoad()
+
+ 'Select Row async via TableRowDataLoaded
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+ Super.TableInitColumns()
Var col As DatasourceColumn
@@ -278,113 +318,45 @@ End
#tag EndMethod
#tag Method, Flags = &h1
- Protected Function GetColumnData(col As DatasourceColumn, row As Dictionary) As Variant
- Select Case col.DatabaseColumnName
-
- Case "id"
- Var id As Integer = row.Lookup(col.DatabaseColumnName, 0).IntegerValue
- If (id < 1) Then Return ""
- return New WebListBoxStyleRenderer(StyleListboxTextAlignCenter(), id.ToString)
-
- Else
- Return super.GetColumnData(col, row)
-
- End Select
+ Protected Function TableLoadRowSet() As RowSet
+ Return Session.DB.SelectSQL("SHOW CONNECTIONS")
End Function
#tag EndMethod
- #tag Method, Flags = &h21
- Private Function GetSelectedClientId(ByRef username As String) As Integer
- username = ""
- If (lstInfos.SelectedRowIndex < 0) Then Return -1
+ #tag Method, Flags = &h1
+ Protected Function TableNoRowsMessage() As String
+ Var sInfo As String = "No Clients"
- 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
+ If (Me.SearchValue <> "") Then
+ sInfo = sInfo + " matching '" + Me.SearchValue + "'"
End If
- Return -1
+ Return sInfo
End Function
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub RefreshButtons()
- Var clientUsername As String
- Var clientId As Integer = Me.GetSelectedClientId(clientUsername)
-
- Var bRefresh, bDisconnect As Boolean
-
- If (clientId > 0) Then
- bDisconnect = (clientId <> Session.ClientId)
- End If
- bRefresh = True
-
- If (btnRefresh.Enabled <> bRefresh) Then btnRefresh.Enabled = bRefresh
- If (btnDisconnect.Enabled <> bDisconnect) Then btnDisconnect.Enabled = bDisconnect
-
-
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Sub RefreshInfos(selectClientId As Integer = -1)
- If (eiSelectAfterReload <= 0) Then
- Var username As String
- selectClientId = Me.GetSelectedClientId(username)
- End If
-
- eiSelectAfterReload = selectClientId
-
- Me.ShowInfos()
-
- 'Select Row async via WebTimer_RowDataLoaded
-
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h0
- Sub Search(SearchValue As String)
- Super.Search(SearchValue)
-
- Me.ShowInfos()
-
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
- Me.UpdateNoRowsMessage()
-
- Me.LoadDatasource(Session.DB.SelectSQL("SHOW CONNECTIONS"))
-
- If (lstInfos.DataSource = Nil) Then
- lstInfos.DataSource = Self
+ #tag Method, Flags = &h1
+ Protected Function TableRowColumnData(col As DatasourceColumn, row As Dictionary) As Variant
+ Select Case col.DatabaseColumnName
+
+ Case "id"
+ Var id As Integer = row.Lookup(col.DatabaseColumnName, 0).IntegerValue
+ If (id < 1) Then Return ""
+ Return New WebListBoxStyleRenderer(StyleListboxTextAlignCenter(), id.ToString)
+
Else
- lstInfos.ReloadData()
- End If
-
- 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
+ Return Super.TableRowColumnData(col, row)
+
+ End Select
- End Sub
+ End Function
#tag EndMethod
#tag Method, Flags = &h1
- Protected Sub WebTimer_RowDataLoaded(obj As WebTimer)
- Super.WebTimer_RowDataLoaded(obj)
+ Protected Sub TableRowDataLoaded()
+ Super.TableRowDataLoaded()
If (eiSelectAfterReload <= 0) Then
Me.RefreshButtons()
@@ -395,17 +367,17 @@ End
eiSelectAfterReload = -1
Var bFound As Boolean = False
- For i As Integer = lstInfos.LastRowIndex DownTo 0
- If (lstInfos.RowTagAt(i) IsA Dictionary) Then
- Var rowTag As Dictionary = lstInfos.RowTagAt(i)
+ For i As Integer = Me.Table.LastRowIndex DownTo 0
+ If (Me.Table.RowTagAt(i) IsA Dictionary) Then
+ Var rowTag As Dictionary = Me.Table.RowTagAt(i)
If (rowTag.Lookup("id", "").IntegerValue <> iSelectAfterReload) Then Continue
- lstInfos.SelectedRowIndex = i
+ Me.Table.SelectedRowIndex = i
bFound = True
Exit 'Loop
End If
Next
- If (Not bFound) Then lstInfos.SelectedRowIndex = -1
+ If (Not bFound) Then Me.Table.SelectedRowIndex = -1
Me.RefreshButtons()
@@ -443,7 +415,7 @@ End
#tag Events btnRefresh
#tag Event
Sub Pressed()
- Self.ShowInfos()
+ Self.TableLoad()
End Sub
#tag EndEvent
diff --git a/webapp/containers/information/cntCommands.xojo_code b/webapp/containers/information/cntCommands.xojo_code
index 9ba3a1f..5ce318f 100644
--- a/webapp/containers/information/cntCommands.xojo_code
+++ b/webapp/containers/information/cntCommands.xojo_code
@@ -65,23 +65,21 @@ End
#tag EndWebContainerControl
#tag WindowCode
- #tag Event
- Sub Opening()
- Self.ShowInfos()
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h0
Sub Constructor()
Super.Constructor
Me.Area = "Information"
Me.Title = "Commands"
+ Me.Table = lstInfos
Me.SearchAvailable = True
-
- Redim Me.Columns(-1)
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+ Super.TableInitColumns()
Var col As DatasourceColumn
@@ -115,41 +113,24 @@ End
End Sub
#tag EndMethod
- #tag Method, Flags = &h0
- Sub Search(SearchValue As String)
- Super.Search(SearchValue)
-
- Me.ShowInfos()
-
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
- Me.UpdateNoRowsMessage()
-
- Me.LoadDatasource(Session.DB.SelectSQL("SHOW COMMANDS"))
+ #tag Method, Flags = &h1
+ Protected Function TableLoadRowSet() As RowSet
+ Return Session.DB.SelectSQL("SHOW COMMANDS")
- If (lstInfos.DataSource = Nil) Then
- lstInfos.DataSource = Self
- Else
- lstInfos.ReloadData()
- End If
-
- End Sub
+ End Function
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub UpdateNoRowsMessage()
+ #tag Method, Flags = &h1
+ Protected Function TableNoRowsMessage() As String
Var sInfo As String = "No Commands"
If (Me.SearchValue <> "") Then
sInfo = sInfo + " matching '" + Me.SearchValue + "'"
End If
- lstInfos.NoRowsMessage = sInfo
+ Return sInfo
- End Sub
+ End Function
#tag EndMethod
diff --git a/webapp/containers/information/cntLog.xojo_code b/webapp/containers/information/cntLog.xojo_code
index 7a76553..db3e37e 100644
--- a/webapp/containers/information/cntLog.xojo_code
+++ b/webapp/containers/information/cntLog.xojo_code
@@ -161,8 +161,6 @@ Begin cntDatasourceBase cntLog
Period = 1
RunMode = 0
Scope = 2
- TabIndex = 4
- TabStop = True
_mPanelIndex = -1
End
End
@@ -172,7 +170,6 @@ End
#tag Event
Sub Opening()
Self.RefreshButtons()
- Self.ShowInfos()
End Sub
#tag EndEvent
@@ -184,10 +181,35 @@ End
Me.Area = "Information"
Me.Title = "Log"
+ Me.Table = lstInfos
Me.SearchAvailable = True
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Sub RefreshButtons()
+ btnRefresh.Enabled = (edtLogNumberOfEntries.Text.ToInteger > 0)
- Redim Me.Columns(-1)
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Sub RefreshLog(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 = &h1
+ Protected Sub TableInitColumns()
+ Super.TableInitColumns()
Var col As DatasourceColumn
@@ -248,66 +270,29 @@ End
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub RefreshButtons()
- btnRefresh.Enabled = (edtLogNumberOfEntries.Text.ToInteger > 0)
-
- 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)
-
- Me.ShowInfos()
-
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
+ #tag Method, Flags = &h1
+ Protected Function TableLoadRowSet() As RowSet
Var numLogEntries As Integer = edtLogNumberOfEntries.Text.ToInteger
If (numLogEntries < 1) Then
- Return
+ Return Nil
End If
- Me.UpdateNoRowsMessage()
+ Return Session.DB.SelectSQL("SHOW LAST " + numLogEntries.ToString + " ROWS FROM Log ORDER DESC")
- Me.LoadDatasource(Session.DB.SelectSQL("SHOW LAST " + numLogEntries.ToString + " ROWS FROM Log ORDER DESC"))
-
- If (lstInfos.DataSource = Nil) Then
- lstInfos.DataSource = Self
- Else
- lstInfos.ReloadData()
- End If
-
- End Sub
+ End Function
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub UpdateNoRowsMessage()
+ #tag Method, Flags = &h1
+ Protected Function TableNoRowsMessage() As String
Var sInfo As String = "No Log entries"
If (Me.SearchValue <> "") Then
sInfo = sInfo + " matching '" + Me.SearchValue + "'"
End If
- lstInfos.NoRowsMessage = sInfo
+ Return sInfo
- End Sub
+ End Function
#tag EndMethod
@@ -320,7 +305,7 @@ End
#tag Events btnRefresh
#tag Event
Sub Pressed()
- Self.RefreshSchedule(True)
+ Self.RefreshLog(True)
End Sub
#tag EndEvent
@@ -328,7 +313,7 @@ End
#tag Events edtLogNumberOfEntries
#tag Event
Sub TextChanged()
- Self.RefreshSchedule(False)
+ Self.RefreshLog(False)
End Sub
#tag EndEvent
@@ -347,7 +332,7 @@ End
Me.RunMode = WebTimer.RunModes.Off
Me.Enabled = False
- Self.ShowInfos()
+ Self.TableLoad()
End Sub
#tag EndEvent
diff --git a/webapp/containers/security/cntEnginePreferences.xojo_code b/webapp/containers/security/cntEnginePreferences.xojo_code
index b05c752..00ed19d 100644
--- a/webapp/containers/security/cntEnginePreferences.xojo_code
+++ b/webapp/containers/security/cntEnginePreferences.xojo_code
@@ -369,21 +369,9 @@ End
#tag EndWebContainerControl
#tag WindowCode
- #tag Event
- Sub Opening()
- Self.Load()
-
- Self.ShowInfos()
-
- ebOpened = True
-
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h21
Private Sub ActionDrop()
- Var enginePreference As Dictionary = Me.GetSelectedEnginePreference()
+ Var enginePreference As Dictionary = Me.GetSelectedTableRowTag()
If (enginePreference = Nil) Then Return
Var prefEngine As String = enginePreference.Lookup("engine", "")
@@ -430,14 +418,7 @@ End
Session.DB.ExecuteSQL(sql)
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Drop Engine Preference"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not drop engine preference."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Drop Engine Preference", "Could not drop engine preference.", err)
Finally
Me.RefreshInfos()
@@ -449,7 +430,7 @@ End
#tag Method, Flags = &h21
Private Sub ActionEdit()
- Var enginePreference As Dictionary = Me.GetSelectedEnginePreference()
+ Var enginePreference As Dictionary = Me.GetSelectedTableRowTag()
If (enginePreference = Nil) Then Return
Var prefEngine As String = enginePreference.Lookup("engine", "")
@@ -493,14 +474,7 @@ End
Session.DB.ExecuteSQL(sql)
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Set Engine Preference"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not set engine preference."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Set Engine Preference", "Could not set engine preference.", err)
Return False
End Try
@@ -551,76 +525,19 @@ End
Me.Area = "Security"
Me.Title = "Engine Preferences"
+ Me.Table = lstInfos
Me.SearchAvailable = True
-
- Redim Me.Columns(-1)
-
- Var col As DatasourceColumn
-
- col = New DatasourceColumn()
- col.Width = "15%"
- col.DatabaseColumnName = "engine"
- col.Heading = "Engine"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.Ascending
- Me.Columns.Add(col)
-
- col = New DatasourceColumn()
- col.Width = "18%"
- col.DatabaseColumnName = "databasename"
- col.Heading = "Database"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
-
- col = New DatasourceColumn()
- col.Width = "18%"
- col.DatabaseColumnName = "groupname"
- col.Heading = "Group"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
-
- col = New DatasourceColumn()
- col.Width = "15%"
- col.DatabaseColumnName = "key"
- col.Heading = "Key"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
-
- col = New DatasourceColumn()
- col.Width = "*"
- col.DatabaseColumnName = "value"
- col.Heading = "Value"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
-
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Function GetSelectedEnginePreference() As Dictionary
- If (lstInfos.SelectedRowIndex >= 0) And (lstInfos.RowTagAt(lstInfos.SelectedRowIndex) IsA Dictionary) Then
- Return lstInfos.RowTagAt(lstInfos.SelectedRowIndex)
- End If
-
- Return Nil
+ #tag Method, Flags = &h1
+ Protected Sub Load()
+ Super.Load()
- End Function
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Sub Load()
Me.LoadGroups()
- me.LoadDatabases()
+ Me.LoadDatabases()
+
End Sub
#tag EndMethod
@@ -702,7 +619,7 @@ End
Private Sub RefreshButtons()
Var bSet, bEdit, bDrop As Boolean
- Var selectedEnginePreference As Dictionary = Me.GetSelectedEnginePreference()
+ Var selectedEnginePreference As Dictionary = Me.GetSelectedTableRowTag()
bSet = True
If (selectedEnginePreference <> Nil) Then
@@ -719,33 +636,76 @@ End
#tag Method, Flags = &h21
Private Sub RefreshInfos(selectRowTag As Dictionary = nil)
- If (selectRowTag = Nil) And (lstInfos.SelectedRowIndex >= 0) Then
- selectRowTag = Me.GetSelectedEnginePreference()
+ If (selectRowTag = Nil) Then
+ selectRowTag = Me.GetSelectedTableRowTag()
End If
- esSelectAfterReload = selectRowTag
+ edictSelectAfterReload = selectRowTag
- Me.ShowInfos()
+ Me.TableLoad()
- 'Select Row async via WebTimer_RowDataLoaded
+ 'Select Row async via TableRowDataLoaded
End Sub
#tag EndMethod
- #tag Method, Flags = &h0
- Sub Search(SearchValue As String)
- Super.Search(SearchValue)
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+ Super.TableInitColumns()
+
+ Var col As DatasourceColumn
+
+ col = New DatasourceColumn()
+ col.Width = "15%"
+ col.DatabaseColumnName = "engine"
+ col.Heading = "Engine"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.Ascending
+ Me.Columns.Add(col)
+
+ col = New DatasourceColumn()
+ col.Width = "18%"
+ col.DatabaseColumnName = "databasename"
+ col.Heading = "Database"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
+
+ col = New DatasourceColumn()
+ col.Width = "18%"
+ col.DatabaseColumnName = "groupname"
+ col.Heading = "Group"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
+
+ col = New DatasourceColumn()
+ col.Width = "15%"
+ col.DatabaseColumnName = "key"
+ col.Heading = "Key"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
- Me.ShowInfos()
+ col = New DatasourceColumn()
+ col.Width = "*"
+ col.DatabaseColumnName = "value"
+ col.Heading = "Value"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
- Me.UpdateNoRowsMessage()
-
- Me.Filters = New Dictionary
+ #tag Method, Flags = &h1
+ Protected Sub TableLoadFilters()
+ Super.TableLoadFilters()
Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex)
Var filterDatabasename As String = lstFilterDatabase.RowTagAt(lstFilterDatabase.SelectedRowIndex)
@@ -758,19 +718,18 @@ End
Me.Filters.Value("databasename") = filterDatabasename
End If
- Me.LoadDatasource(Session.DB.SelectSQL("SHOW ENGINE PREFERENCES"))
-
- If (lstInfos.DataSource = Nil) Then
- lstInfos.DataSource = Self
- Else
- lstInfos.ReloadData()
- End If
-
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub UpdateNoRowsMessage()
+ #tag Method, Flags = &h1
+ Protected Function TableLoadRowSet() As RowSet
+ Return Session.DB.SelectSQL("SHOW ENGINE PREFERENCES")
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableNoRowsMessage() As String
Var sInfo As String = "No Engine Preferences"
Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex)
@@ -786,40 +745,40 @@ End
sInfo = sInfo + " matching '" + Me.SearchValue + "'"
End If
- lstInfos.NoRowsMessage = sInfo
+ Return sInfo
- End Sub
+ End Function
#tag EndMethod
#tag Method, Flags = &h1
- Protected Sub WebTimer_RowDataLoaded(obj As WebTimer)
- Super.WebTimer_RowDataLoaded(obj)
+ Protected Sub TableRowDataLoaded()
+ super.TableRowDataLoaded()
- If (esSelectAfterReload = Nil) Then
+ If (edictSelectAfterReload = Nil) Then
Me.RefreshButtons()
Return
End If
- Var sSelectAfterReload As Dictionary = esSelectAfterReload
- esSelectAfterReload = Nil
+ Var sSelectAfterReload As Dictionary = edictSelectAfterReload
+ edictSelectAfterReload = Nil
Var bFound As Boolean = False
- For i As Integer = lstInfos.LastRowIndex DownTo 0
- If (lstInfos.RowTagAt(i) IsA Dictionary) Then
- Var rowTag As Dictionary = lstInfos.RowTagAt(i)
+ For i As Integer = Me.Table.LastRowIndex DownTo 0
+ If (Me.Table.RowTagAt(i) IsA Dictionary) Then
+ Var rowTag As Dictionary = Me.Table.RowTagAt(i)
If(rowTag.Lookup("engine", "").StringValue = sSelectAfterReload.Lookup("engine", "-").StringValue) And _
(rowTag.Lookup("groupname", "").StringValue = sSelectAfterReload.Lookup("groupname", "-").StringValue) And _
(rowTag.Lookup("databasename", "").StringValue = sSelectAfterReload.Lookup("databasename", "-").StringValue) And _
(rowTag.Lookup("key", "").StringValue = sSelectAfterReload.Lookup("key", "-").StringValue) Then
- lstInfos.SelectedRowIndex = i
+ Me.Table.SelectedRowIndex = i
bFound = True
Exit 'Loop
End If
End If
Next
- If (Not bFound) Then lstInfos.SelectedRowIndex = -1
+ If (Not bFound) Then Me.Table.SelectedRowIndex = -1
Me.RefreshButtons()
@@ -827,16 +786,12 @@ End
#tag EndMethod
- #tag Property, Flags = &h21
- Private ebOpened As Boolean
- #tag EndProperty
-
#tag Property, Flags = &h21
Private edictActionEnginePreference As Dictionary
#tag EndProperty
#tag Property, Flags = &h21
- Private esSelectAfterReload As Dictionary
+ Private edictSelectAfterReload As Dictionary
#tag EndProperty
diff --git a/webapp/containers/security/cntGroups.xojo_code b/webapp/containers/security/cntGroups.xojo_code
index 8c827ee..6560f2e 100644
--- a/webapp/containers/security/cntGroups.xojo_code
+++ b/webapp/containers/security/cntGroups.xojo_code
@@ -177,13 +177,6 @@ End
#tag EndWebContainerControl
#tag WindowCode
- #tag Event
- Sub Opening()
- Self.ShowInfos()
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h21
Private Sub ActionCreate()
Var dlgCreate As New dlgCommonName
@@ -204,14 +197,7 @@ End
Session.DB.ExecuteSQL("CREATE GROUP '" + Name.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Create Group"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not create group."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Create Group", "Could not create group.", err)
Return False
End Try
@@ -254,14 +240,7 @@ End
Session.DB.ExecuteSQL("DROP GROUP '" + sDropGroupname.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Drop Group"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not drop group."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Drop Group", "Could not drop group.", err)
Finally
Me.RefreshInfos()
@@ -298,14 +277,7 @@ End
Session.DB.ExecuteSQL("RENAME GROUP '" + esActionGroupname.EscapeSqlQuotes + "' TO '" + Name.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Rename Group"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not rename group."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Rename Group", "Could not rename group.", err)
Return False
End Try
@@ -336,9 +308,9 @@ End
Me.Area = "Security"
Me.Title = "Groups"
+ Me.Table = lstInfos
Me.SearchAvailable = True
-
Try
Var rs As RowSet = Session.DB.SelectSQL("SHOW GROUPS")
ebShowDetails = (rs <> Nil) And (rs.RowCount <= 10)
@@ -346,69 +318,14 @@ End
Catch err As DatabaseException
ebShowDetails = False
-
End Try
- Redim Me.Columns(-1)
-
- Var col As DatasourceColumn
- col = New DatasourceColumn()
- col.Width = "*"
- col.DatabaseColumnName = "groupname"
- col.Heading = "Groupname"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.Ascending
- Me.Columns.Add(col)
-
- If ebShowDetails Then
- col = New DatasourceColumn()
- col.Width = "10%"
- col.DatabaseColumnName = "usercount"
- col.Heading = "#"
- col.IsVirtual = True
- col.IsSearchable = False
- col.FieldType = DatasourceColumn.FieldTypes.Integer
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
-
- col = New DatasourceColumn()
- col.Width = "50%"
- col.DatabaseColumnName = "usernames"
- col.Heading = "Users"
- col.IsVirtual = True
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = False
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
- End If
-
End Sub
#tag EndMethod
- #tag Method, Flags = &h1
- Protected Function GetColumnData(col As DatasourceColumn, row As Dictionary) As Variant
- Select Case col.DatabaseColumnName
-
- Case "usercount"
- Var iCount As Integer = row.Lookup(col.DatabaseColumnName, 0).IntegerValue
- If (iCount < 1) Then Return ""
- return New WebListBoxStyleRenderer(StyleListboxTextAlignCenter(), iCount.ToString)
-
- Else
- Return super.GetColumnData(col, row)
-
- End Select
-
- End Function
- #tag EndMethod
-
#tag Method, Flags = &h21
Private Function GetSelectedGroupname() As String
- If (lstInfos.SelectedRowIndex < 0) Then Return ""
-
- Var selectedRowTag As Variant = lstInfos.RowTagAt(lstInfos.SelectedRowIndex)
+ Var selectedRowTag As Variant = Me.GetSelectedTableRowTag()
If (selectedRowTag IsA Dictionary) Then
Return Dictionary(selectedRowTag).Lookup("groupname", "").StringValue
End If
@@ -437,23 +354,14 @@ End
#tag Method, Flags = &h21
Private Sub RefreshInfos(selectGroupname As String = "")
If (selectGroupname = "") Then
- selectGroupname = me.GetSelectedGroupname()
+ selectGroupname = Me.GetSelectedGroupname()
End If
esSelectAfterReload = selectGroupname
- Me.ShowInfos()
-
- 'Select Row async via WebTimer_RowDataLoaded
-
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h0
- Sub Search(SearchValue As String)
- Super.Search(SearchValue)
+ Me.TableLoad()
- Me.ShowInfos()
+ 'Select Row async via TableRowDataLoaded
End Sub
#tag EndMethod
@@ -463,7 +371,7 @@ End
If (Not ebShowDetails) Then Return
Var groupname As String
- for each dictRow As Dictionary in me.TableRows
+ for each dictRow As Dictionary in Me.TableRows
try
groupname = dictRow.Lookup("groupname", "").StringValue
if (groupname = "") then continue
@@ -497,18 +405,50 @@ End
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
- Me.UpdateNoRowsMessage()
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+ Super.TableInitColumns()
- Me.LoadDatasource(Session.DB.SelectSQL("SHOW GROUPS"))
+ Var col As DatasourceColumn
- If (lstInfos.DataSource = Nil) Then
- lstInfos.DataSource = Self
- Else
- lstInfos.ReloadData()
+ col = New DatasourceColumn()
+ col.Width = "*"
+ col.DatabaseColumnName = "groupname"
+ col.Heading = "Groupname"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.Ascending
+ Me.Columns.Add(col)
+
+ If ebShowDetails Then
+ col = New DatasourceColumn()
+ col.Width = "10%"
+ col.DatabaseColumnName = "usercount"
+ col.Heading = "#"
+ col.IsVirtual = True
+ col.IsSearchable = False
+ col.FieldType = DatasourceColumn.FieldTypes.Integer
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
+
+ col = New DatasourceColumn()
+ col.Width = "50%"
+ col.DatabaseColumnName = "usernames"
+ col.Heading = "Users"
+ col.IsVirtual = True
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = False
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
End If
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableLoad()
+ Super.TableLoad()
If ebShowDetails Then
Try
@@ -521,22 +461,46 @@ End
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub UpdateNoRowsMessage()
+ #tag Method, Flags = &h1
+ Protected Function TableLoadRowSet() As RowSet
+ Return Session.DB.SelectSQL("SHOW GROUPS")
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableNoRowsMessage() As String
Var sInfo As String = "No Groups"
If (Me.SearchValue <> "") Then
sInfo = sInfo + " matching '" + Me.SearchValue + "'"
End If
- lstInfos.NoRowsMessage = sInfo
+ Return sInfo
- End Sub
+ End Function
#tag EndMethod
#tag Method, Flags = &h1
- Protected Sub WebTimer_RowDataLoaded(obj As WebTimer)
- Super.WebTimer_RowDataLoaded(obj)
+ Protected Function TableRowColumnData(col As DatasourceColumn, row As Dictionary) As Variant
+ Select Case col.DatabaseColumnName
+
+ Case "usercount"
+ Var iCount As Integer = row.Lookup(col.DatabaseColumnName, 0).IntegerValue
+ If (iCount < 1) Then Return ""
+ Return New WebListBoxStyleRenderer(StyleListboxTextAlignCenter(), iCount.ToString)
+
+ Else
+ Return Super.TableRowColumnData(col, row)
+
+ End Select
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableRowDataLoaded()
+ Super.TableRowDataLoaded()
If (esSelectAfterReload = "") Then
Me.RefreshButtons()
@@ -547,17 +511,17 @@ End
esSelectAfterReload = ""
Var bFound As Boolean = False
- For i As Integer = lstInfos.LastRowIndex DownTo 0
- If (lstInfos.RowTagAt(i) IsA Dictionary) Then
- Var rowTag As Dictionary = lstInfos.RowTagAt(i)
+ For i As Integer = Me.Table.LastRowIndex DownTo 0
+ If (Me.Table.RowTagAt(i) IsA Dictionary) Then
+ Var rowTag As Dictionary = Me.Table.RowTagAt(i)
If (rowTag.Lookup("groupname", "").StringValue <> sSelectAfterReload) Then Continue
- lstInfos.SelectedRowIndex = i
+ Me.Table.SelectedRowIndex = i
bFound = True
Exit 'Loop
End If
Next
- If (Not bFound) Then lstInfos.SelectedRowIndex = -1
+ If (Not bFound) Then Me.Table.SelectedRowIndex = -1
Me.RefreshButtons()
@@ -627,7 +591,7 @@ End
If (Not ebShowDetails) Then Return
Self.ShowDetails()
- lstInfos.ReloadData()
+
Catch err As RuntimeException
End Try
diff --git a/webapp/containers/security/cntPrivileges.xojo_code b/webapp/containers/security/cntPrivileges.xojo_code
index 356cba1..6adbf0e 100644
--- a/webapp/containers/security/cntPrivileges.xojo_code
+++ b/webapp/containers/security/cntPrivileges.xojo_code
@@ -341,18 +341,6 @@ End
#tag EndWebContainerControl
#tag WindowCode
- #tag Event
- Sub Opening()
- Self.Load()
-
- Self.ShowInfos()
-
- ebOpened = True
-
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h21
Private Sub ActionGrant()
Var dlgGrant As New dlgPrivilegeGrant
@@ -380,14 +368,7 @@ End
Session.DB.ExecuteSQL(sql)
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Grant Privilege"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not grant privilege."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Grant Privilege", "Could not grant privilege.", err)
Return False
End Try
@@ -424,7 +405,7 @@ End
#tag Method, Flags = &h21
Private Sub ActionRevoke()
- Var privilege As Dictionary = Me.GetSelectedPrivilege()
+ Var privilege As Dictionary = Me.GetSelectedTableRowTag()
If (privilege = Nil) Then Return
Var privGroup As String = privilege.Lookup("groupname", "")
@@ -474,14 +455,7 @@ End
Session.DB.ExecuteSQL(sql)
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Revoke Privilege"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not revoke privilege."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Revoke Privilege", "Could not revoke privilege.", err)
Finally
Me.RefreshInfos()
@@ -497,49 +471,9 @@ End
Me.Area = "Security"
Me.Title = "Privileges"
+ Me.Table = lstInfos
Me.SearchAvailable = True
-
- Redim Me.Columns(-1)
-
- Var col As DatasourceColumn
-
- col = New DatasourceColumn()
- col.Width = "*"
- col.DatabaseColumnName = "groupname"
- col.Heading = "Groupname"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.Ascending
- Me.Columns.Add(col)
-
- col = New DatasourceColumn()
- col.Width = "15%"
- col.DatabaseColumnName = "privilege"
- col.Heading = "Privilege"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
-
- col = New DatasourceColumn()
- col.Width = "25%"
- col.DatabaseColumnName = "databasename"
- col.Heading = "Databasename"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
-
- col = New DatasourceColumn()
- col.Width = "30%"
- col.DatabaseColumnName = "tablename"
- col.Heading = "Tablename"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
-
End Sub
#tag EndMethod
@@ -604,21 +538,13 @@ End
End Function
#tag EndMethod
- #tag Method, Flags = &h21
- Private Function GetSelectedPrivilege() As Dictionary
- If (lstInfos.SelectedRowIndex >= 0) And (lstInfos.RowTagAt(lstInfos.SelectedRowIndex) IsA Dictionary) Then
- Return lstInfos.RowTagAt(lstInfos.SelectedRowIndex)
- End If
-
- Return Nil
+ #tag Method, Flags = &h1
+ Protected Sub Load()
+ Super.Load()
- End Function
- #tag EndMethod
-
- #tag Method, Flags = &h21
- Private Sub Load()
Me.LoadGroups()
- me.LoadDatabases()
+ Me.LoadDatabases()
+
End Sub
#tag EndMethod
@@ -678,7 +604,7 @@ End
Private Sub RefreshButtons()
Var bGrant, bRevoke As Boolean
- Var selectedPrivilege As Dictionary = Me.GetSelectedPrivilege()
+ Var selectedPrivilege As Dictionary = Me.GetSelectedTableRowTag()
bGrant = True
If (selectedPrivilege <> Nil) And (selectedPrivilege.Lookup("groupname", "") <> "admin") Then
@@ -693,33 +619,67 @@ End
#tag Method, Flags = &h21
Private Sub RefreshInfos(selectRowTag As Dictionary = nil)
- If (selectRowTag = Nil) And (lstInfos.SelectedRowIndex >= 0) Then
- selectRowTag = Me.GetSelectedPrivilege()
+ If (selectRowTag = Nil) Then
+ selectRowTag = Me.GetSelectedTableRowTag()
End If
- esSelectAfterReload = selectRowTag
+ edictSelectAfterReload = selectRowTag
- Me.ShowInfos()
+ Me.TableLoad()
- 'Select Row async via WebTimer_RowDataLoaded
+ 'Select Row async via TableRowDataLoaded
End Sub
#tag EndMethod
- #tag Method, Flags = &h0
- Sub Search(SearchValue As String)
- Super.Search(SearchValue)
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+ Super.TableInitColumns()
- Me.ShowInfos()
+ Var col As DatasourceColumn
+
+ col = New DatasourceColumn()
+ col.Width = "*"
+ col.DatabaseColumnName = "groupname"
+ col.Heading = "Groupname"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.Ascending
+ Me.Columns.Add(col)
+
+ col = New DatasourceColumn()
+ col.Width = "15%"
+ col.DatabaseColumnName = "privilege"
+ col.Heading = "Privilege"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
+
+ col = New DatasourceColumn()
+ col.Width = "25%"
+ col.DatabaseColumnName = "databasename"
+ col.Heading = "Databasename"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
+
+ col = New DatasourceColumn()
+ col.Width = "30%"
+ col.DatabaseColumnName = "tablename"
+ col.Heading = "Tablename"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
- Me.UpdateNoRowsMessage()
-
- Me.Filters = New Dictionary
+ #tag Method, Flags = &h1
+ Protected Sub TableLoadFilters()
+ Super.TableLoadFilters()
Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex)
Var filterDatabasename As String = lstFilterDatabase.RowTagAt(lstFilterDatabase.SelectedRowIndex)
@@ -732,19 +692,18 @@ End
Me.Filters.Value("databasename") = filterDatabasename
End If
- Me.LoadDatasource(Session.DB.SelectSQL("SHOW ALL PRIVILEGES"))
-
- If (lstInfos.DataSource = Nil) Then
- lstInfos.DataSource = Self
- Else
- lstInfos.ReloadData()
- End If
-
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub UpdateNoRowsMessage()
+ #tag Method, Flags = &h1
+ Protected Function TableLoadRowSet() As RowSet
+ Return Session.DB.SelectSQL("SHOW ALL PRIVILEGES")
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableNoRowsMessage() As String
Var sInfo As String = "No Privileges"
Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex)
@@ -753,47 +712,47 @@ End
Var sFilterParts() As String
If (filterGroupname <> "") Then sFilterParts.Add("Group " + filterGroupname)
If (filterDatabasename <> "") Then sFilterParts.Add("Database " + filterDatabasename)
- sInfo = sInfo + " with Filter " + string.FromArray(sFilterParts, " and ")
+ sInfo = sInfo + " with Filter " + String.FromArray(sFilterParts, " and ")
End If
If (Me.SearchValue <> "") Then
sInfo = sInfo + " matching '" + Me.SearchValue + "'"
End If
- lstInfos.NoRowsMessage = sInfo
+ Return sInfo
- End Sub
+ End Function
#tag EndMethod
#tag Method, Flags = &h1
- Protected Sub WebTimer_RowDataLoaded(obj As WebTimer)
- Super.WebTimer_RowDataLoaded(obj)
+ Protected Sub TableRowDataLoaded()
+ Super.TableRowDataLoaded()
- If (esSelectAfterReload = Nil) Then
+ If (edictSelectAfterReload = Nil) Then
Me.RefreshButtons()
Return
End If
- Var sSelectAfterReload As Dictionary = esSelectAfterReload
- esSelectAfterReload = Nil
+ Var sSelectAfterReload As Dictionary = edictSelectAfterReload
+ edictSelectAfterReload = Nil
Var bFound As Boolean = False
- For i As Integer = lstInfos.LastRowIndex DownTo 0
- If (lstInfos.RowTagAt(i) IsA Dictionary) Then
- Var rowTag As Dictionary = lstInfos.RowTagAt(i)
+ For i As Integer = Me.Table.LastRowIndex DownTo 0
+ If (Me.Table.RowTagAt(i) IsA Dictionary) Then
+ Var rowTag As Dictionary = Me.Table.RowTagAt(i)
If (rowTag.Lookup("groupname", "").StringValue = sSelectAfterReload.Lookup("groupname", "-").StringValue) And _
(rowTag.Lookup("privilege", "").StringValue = sSelectAfterReload.Lookup("privilege", "-").StringValue) And _
(rowTag.Lookup("databasename", "").StringValue = sSelectAfterReload.Lookup("databasename", "-").StringValue) And _
(rowTag.Lookup("tablename", "").StringValue = sSelectAfterReload.Lookup("tablename", "-").StringValue) Then
- lstInfos.SelectedRowIndex = i
+ Me.Table.SelectedRowIndex = i
bFound = True
Exit 'Loop
End If
End If
Next
- If (Not bFound) Then lstInfos.SelectedRowIndex = -1
+ If (Not bFound) Then Me.Table.SelectedRowIndex = -1
Me.RefreshButtons()
@@ -801,16 +760,12 @@ End
#tag EndMethod
- #tag Property, Flags = &h21
- Private ebOpened As Boolean
- #tag EndProperty
-
#tag Property, Flags = &h21
Private edictActionPrivilege As Dictionary
#tag EndProperty
#tag Property, Flags = &h21
- Private esSelectAfterReload As Dictionary
+ Private edictSelectAfterReload As Dictionary
#tag EndProperty
diff --git a/webapp/containers/security/cntUsers.xojo_code b/webapp/containers/security/cntUsers.xojo_code
index 560bdf6..5f1ba29 100644
--- a/webapp/containers/security/cntUsers.xojo_code
+++ b/webapp/containers/security/cntUsers.xojo_code
@@ -366,18 +366,6 @@ End
#tag EndWebContainerControl
#tag WindowCode
- #tag Event
- Sub Opening()
- Self.Load()
-
- Self.ShowInfos()
-
- ebOpened = True
-
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h21
Private Sub ActionCreate()
Var dlgCreate As New dlgUserCreate
@@ -402,14 +390,7 @@ End
End If
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Create User"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not create user."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Create User", "Could not create user.", err)
Return False
End Try
@@ -468,14 +449,7 @@ End
Session.DB.ExecuteSQL("DROP USER '" + sDropUsername.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Drop User"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not drop user."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Drop User", "Could not drop user.", err)
Finally
Me.RefreshInfos()
@@ -534,14 +508,7 @@ End
Session.DB.ExecuteSQL("SET PASSWORD '" + Password.EscapeSqlQuotes + "' FOR USER '" + Name.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Set User Password"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not set user password."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Set User Password", "Could not set user password.", err)
Return False
End Try
@@ -580,14 +547,7 @@ End
Session.DB.ExecuteSQL("RENAME USER '" + esActionUsername + "' TO '" + Name.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Rename User"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not rename user."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Rename User", "Could not rename user.", err)
Return False
End Try
@@ -618,9 +578,9 @@ End
Me.Area = "Security"
Me.Title = "Users"
+ Me.Table = lstInfos
Me.SearchAvailable = True
-
Try
Var rs As RowSet = Session.DB.SelectSQL("SHOW USERS")
ebShowDetails = (rs <> Nil) And (rs.RowCount <= 10)
@@ -630,67 +590,12 @@ End
End Try
-
- Redim Me.Columns(-1)
-
- Var col As DatasourceColumn
- col = New DatasourceColumn()
- col.Width = "*"
- col.DatabaseColumnName = "username"
- col.Heading = "Username"
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.Ascending
- Me.Columns.Add(col)
-
- If ebShowDetails Then
- col = New DatasourceColumn()
- col.Width = "10%"
- col.DatabaseColumnName = "groupcount"
- col.Heading = "#"
- col.IsVirtual = True
- col.IsSearchable = False
- col.FieldType = DatasourceColumn.FieldTypes.Integer
- col.Sortable = True
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
-
- col = New DatasourceColumn()
- col.Width = "50%"
- col.DatabaseColumnName = "groupnames"
- col.Heading = "Groups"
- col.IsVirtual = True
- col.FieldType = DatasourceColumn.FieldTypes.Text
- col.Sortable = False
- col.SortDirection = WebListBox.SortDirections.None
- Me.Columns.Add(col)
- End If
-
End Sub
#tag EndMethod
- #tag Method, Flags = &h1
- Protected Function GetColumnData(col As DatasourceColumn, row As Dictionary) As Variant
- Select Case col.DatabaseColumnName
-
- Case "groupcount"
- Var iCount As Integer = row.Lookup(col.DatabaseColumnName, 0).IntegerValue
- If (iCount < 1) Then Return ""
- return New WebListBoxStyleRenderer(StyleListboxTextAlignCenter(), iCount.ToString)
-
- Else
- Return super.GetColumnData(col, row)
-
- End Select
-
- End Function
- #tag EndMethod
-
#tag Method, Flags = &h21
Private Function GetSelectedUsername() As String
- If (lstInfos.SelectedRowIndex < 0) Then Return ""
-
- Var selectedRowTag As Variant = lstInfos.RowTagAt(lstInfos.SelectedRowIndex)
+ Var selectedRowTag As Variant = Me.GetSelectedTableRowTag()
If (selectedRowTag IsA Dictionary) Then
Return Dictionary(selectedRowTag).Lookup("username", "").StringValue
End If
@@ -700,8 +605,10 @@ End
End Function
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub Load()
+ #tag Method, Flags = &h1
+ Protected Sub Load()
+ Super.Load()
+
Me.LoadGroups()
End Sub
@@ -772,18 +679,9 @@ End
esSelectAfterReload = selectUsername
- Me.ShowInfos()
-
- 'Select Row async via WebTimer_RowDataLoaded
-
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h0
- Sub Search(SearchValue As String)
- Super.Search(SearchValue)
+ Me.TableLoad()
- Me.ShowInfos()
+ 'Select Row async via TableRowDataLoaded
End Sub
#tag EndMethod
@@ -827,29 +725,50 @@ End
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
- Me.UpdateNoRowsMessage()
-
- Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex)
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+ Super.TableInitColumns()
- 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.EscapeSqlQuotes + "'"))
- End If
- Else
- Me.LoadDatasource(Session.DB.SelectSQL("SHOW USERS"))
- End If
+ Var col As DatasourceColumn
+ col = New DatasourceColumn()
+ col.Width = "*"
+ col.DatabaseColumnName = "username"
+ col.Heading = "Username"
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.Ascending
+ Me.Columns.Add(col)
- If (lstInfos.DataSource = Nil) Then
- lstInfos.DataSource = Self
- Else
- lstInfos.ReloadData()
+ If ebShowDetails Then
+ col = New DatasourceColumn()
+ col.Width = "10%"
+ col.DatabaseColumnName = "groupcount"
+ col.Heading = "#"
+ col.IsVirtual = True
+ col.IsSearchable = False
+ col.FieldType = DatasourceColumn.FieldTypes.Integer
+ col.Sortable = True
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
+
+ col = New DatasourceColumn()
+ col.Width = "50%"
+ col.DatabaseColumnName = "groupnames"
+ col.Heading = "Groups"
+ col.IsVirtual = True
+ col.FieldType = DatasourceColumn.FieldTypes.Text
+ col.Sortable = False
+ col.SortDirection = WebListBox.SortDirections.None
+ Me.Columns.Add(col)
End If
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableLoad()
+ Super.TableLoad()
If ebShowDetails Then
Try
@@ -862,8 +781,34 @@ End
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub UpdateNoRowsMessage()
+ #tag Method, Flags = &h1
+ Protected Sub TableLoadFilters()
+ Super.TableLoadFilters()
+
+ 'Filter applied in TableLoadRowSet
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableLoadRowSet() As RowSet
+ Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex)
+
+ If (filterGroupname <> "") Then
+ If (filterGroupname = kGroupTagUnassigned) Then
+ Return Session.DB.SelectSQL("SHOW USERS IN GROUP ''")
+ Else
+ Return Session.DB.SelectSQL("SHOW USERS IN GROUP '" + filterGroupname.EscapeSqlQuotes + "'")
+ End If
+ End If
+
+ Return Session.DB.SelectSQL("SHOW USERS")
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Function TableNoRowsMessage() As String
Var sInfo As String = "No Users"
Var filterGroupname As String = lstFilterGroup.RowTagAt(lstFilterGroup.SelectedRowIndex)
@@ -878,14 +823,31 @@ End
sInfo = sInfo + " matching '" + Me.SearchValue + "'"
End If
- lstInfos.NoRowsMessage = sInfo
+ Return sInfo
- End Sub
+ End Function
#tag EndMethod
#tag Method, Flags = &h1
- Protected Sub WebTimer_RowDataLoaded(obj As WebTimer)
- Super.WebTimer_RowDataLoaded(obj)
+ Protected Function TableRowColumnData(col As DatasourceColumn, row As Dictionary) As Variant
+ Select Case col.DatabaseColumnName
+
+ Case "groupcount"
+ Var iCount As Integer = row.Lookup(col.DatabaseColumnName, 0).IntegerValue
+ If (iCount < 1) Then Return ""
+ Return New WebListBoxStyleRenderer(StyleListboxTextAlignCenter(), iCount.ToString)
+
+ Else
+ Return Super.TableRowColumnData(col, row)
+
+ End Select
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableRowDataLoaded()
+ Super.TableRowDataLoaded()
If (esSelectAfterReload = "") Then
Me.RefreshButtons()
@@ -896,17 +858,17 @@ End
esSelectAfterReload = ""
Var bFound As Boolean = False
- For i As Integer = lstInfos.LastRowIndex DownTo 0
- If (lstInfos.RowTagAt(i) IsA Dictionary) Then
- Var rowTag As Dictionary = lstInfos.RowTagAt(i)
+ For i As Integer = Me.Table.LastRowIndex DownTo 0
+ If (Me.Table.RowTagAt(i) IsA Dictionary) Then
+ Var rowTag As Dictionary = Me.Table.RowTagAt(i)
If (rowTag.Lookup("username", "").StringValue <> sSelectAfterReload) Then Continue
- lstInfos.SelectedRowIndex = i
+ Me.Table.SelectedRowIndex = i
bFound = True
Exit 'Loop
End If
Next
- If (Not bFound) Then lstInfos.SelectedRowIndex = -1
+ If (Not bFound) Then Me.Table.SelectedRowIndex = -1
Me.RefreshButtons()
@@ -914,10 +876,6 @@ End
#tag EndMethod
- #tag Property, Flags = &h21
- Private ebOpened As Boolean
- #tag EndProperty
-
#tag Property, Flags = &h21
Private ebShowDetails As Boolean
#tag EndProperty
@@ -984,6 +942,7 @@ End
If (Not ebShowDetails) Then Return
Self.ShowDetails()
+
Catch err As RuntimeException
End Try
diff --git a/webapp/containers/server/cntConsole.xojo_code b/webapp/containers/server/cntConsole.xojo_code
index 68745a1..3d53381 100644
--- a/webapp/containers/server/cntConsole.xojo_code
+++ b/webapp/containers/server/cntConsole.xojo_code
@@ -198,10 +198,8 @@ End
#tag Event
Sub Opening()
- self.Clear()
Self.RefreshButtons()
- ebOpened = True
End Sub
#tag EndEvent
@@ -227,51 +225,38 @@ End
If isquery Then
rs = Session.DB.SelectSQL(sql)
- lstInfos.NoRowsMessage = "No Records from SELECT SQL"
+ Me.Table.NoRowsMessage = "No Records from SELECT SQL"
Else
Session.DB.ExecuteSQL(sql)
- lstInfos.NoRowsMessage = "EXECUTE SQL successful"
+ Me.Table.NoRowsMessage = "EXECUTE SQL successful"
End If
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = If(isquery, "SELECT SQL", "EXECUTE SQL")
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not execute " + dialog.Title + " command."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ Var errorDialogTitle As String = If(isquery, "SELECT SQL", "EXECUTE SQL")
+ ShowErrorDialog(errorDialogTitle, "Could not execute " + errorDialogTitle + " command.", err)
rs = Nil
If isquery Then
- lstInfos.NoRowsMessage = "SELECT SQL Error"
+ Me.Table.NoRowsMessage = "SELECT SQL Error"
Else
- lstInfos.NoRowsMessage = "EXECUTE SQL Error"
+ Me.Table.NoRowsMessage = "EXECUTE SQL Error"
End If
Finally
- Me.ShowInfos(rs)
+ Me.TableLoadRowSet(rs)
End Try
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub Clear()
- lstInfos.RemoveAllRows
- lstInfos.HasHeader = False
-
- End Sub
- #tag EndMethod
-
#tag Method, Flags = &h0
Sub Constructor()
Super.Constructor
Me.Area = "Server"
Me.Title = "Console"
+ Me.Table = lstInfos
End Sub
#tag EndMethod
@@ -283,39 +268,81 @@ End
#tag EndMethod
#tag Method, Flags = &h21
- Private Sub ShowInfos(rs As RowSet)
- Me.Clear
+ Private Sub TableClear()
+ Me.Table.RemoveAllRows
+ Me.Table.HasHeader = False
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableInitColumns()
+ If (eoRowSet = Nil) Then Return
+
+ Me.Table.HasHeader = True
+
+ Me.Table.ColumnCount = eoRowSet.ColumnCount
+ For i As Integer = eoRowSet.ColumnCount - 1 DownTo 0
+ Me.Table.HeaderAt(i) = eoRowSet.ColumnAt(i).Name
+ Me.Table.ColumnSortTypeAt(i) = WebListBox.SortTypes.Sortable
+ Me.Table.ColumnSortDirectionAt(i) = WebListbox.SortDirections.None
+ Next
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableInitRows()
+ Super.TableInitRows()
+
+ ' No fixed table rows
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableLoad()
+ Super.TableLoad()
+
+ If (eoRowSet = Nil) Then Return
+
+ If (eoRowSet.RowCount > 0) Then
+ eoRowSet.MoveToFirstRow
+ While (Not eoRowSet.AfterLastRow)
+ Me.Table.AddRow("")
+
+ For i As Integer = eoRowSet.ColumnCount - 1 DownTo 0
+ Me.Table.CellTextAt(Me.Table.LastAddedRowIndex, i) = eoRowSet.ColumnAt(i).StringValue
+ Next
+
+ eoRowSet.MoveToNextRow
+ Wend
+ End If
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Sub TableLoadRowSet(rs As RowSet)
+ Me.TableClear()
+ eoRowSet = Nil
Try
If (rs = Nil) Then Return
+ eoRowSet = rs
- lstInfos.HasHeader = True
-
- lstInfos.ColumnCount = rs.ColumnCount
- For i As Integer = rs.ColumnCount - 1 DownTo 0
- lstInfos.HeaderAt(i) = rs.ColumnAt(i).Name
- lstInfos.ColumnSortTypeAt(i) = WebListBox.SortTypes.Sortable
- lstInfos.ColumnSortDirectionAt(i) = WebListbox.SortDirections.None
- Next
-
- If (rs.RowCount > 0) Then
- rs.MoveToFirstRow
- While (Not rs.AfterLastRow)
- lstInfos.AddRow("")
-
- For i As Integer = rs.ColumnCount - 1 DownTo 0
- lstInfos.CellTextAt(lstInfos.LastAddedRowIndex, i) = rs.ColumnAt(i).StringValue
- Next
-
- rs.MoveToNextRow
- Wend
- End If
+ Me.TableInitColumns()
+ Me.TableLoad()
+ eoRowSet.Close
+ eoRowSet = Nil
- rs.Close
+ Catch DatabaseException
+ Finally
- Catch DatabaseException
+ If (eoRowSet <> Nil) Then eoRowSet.Close
+ eoRowSet = Nil
End Try
@@ -324,7 +351,7 @@ End
#tag Property, Flags = &h21
- Private ebOpened As Boolean
+ Private eoRowSet As RowSet
#tag EndProperty
@@ -384,17 +411,10 @@ End
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Change database"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not change database."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Change database", "Could not change database.", err)
Finally
- Self.Clear()
+ Self.TableClear()
End Try
@@ -418,14 +438,6 @@ End
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/cntRegistration.xojo_code b/webapp/containers/server/cntRegistration.xojo_code
index b387bb5..aa7c295 100644
--- a/webapp/containers/server/cntRegistration.xojo_code
+++ b/webapp/containers/server/cntRegistration.xojo_code
@@ -94,38 +94,40 @@ End
#tag EndWebContainerControl
#tag WindowCode
- #tag Event
- Sub Opening()
- Self.ShowInfos()
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h0
Sub Constructor()
Super.Constructor
Me.Area = "Server"
Me.Title = "Registration"
+ Me.Table = lstInfos
+
End Sub
#tag EndMethod
- #tag Method, Flags = &h21
- Private Sub ShowInfos()
- lstInfos.RemoveAllRows
+ #tag Method, Flags = &h1
+ Protected Sub TableInitRows()
+ Super.TableInitRows()
- lstInfos.AddRow "Server Name"
- lstInfos.AddRow ""
- lstInfos.AddRow "Registered to"
- lstInfos.AddRow "Registration type"
- lstInfos.AddRow "Upgrade plan expiration date"
- lstInfos.AddRow "Max allowed connections"
+ Me.Table.AddRow "Server Name"
+ Me.Table.AddRow ""
+ Me.Table.AddRow "Registered to"
+ Me.Table.AddRow "Registration type"
+ Me.Table.AddRow "Upgrade plan expiration date"
+ Me.Table.AddRow "Max allowed connections"
Var styleKeyColumn As WebStyle = StyleListboxKeyColumn
- For i As Integer = 0 To lstInfos.LastRowIndex
- lstInfos.CellTextAt(i, 0) = New WebListBoxStyleRenderer(styleKeyColumn, lstInfos.CellTextAt(i, 0))
+ For i As Integer = 0 To Me.Table.LastRowIndex
+ Me.Table.CellTextAt(i, 0) = New WebListBoxStyleRenderer(styleKeyColumn, Me.Table.CellTextAt(i, 0))
Next
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h1
+ Protected Sub TableLoad()
+ Super.TableLoad()
+
Try
Var rs As RowSet = Session.DB.SelectSQL("SHOW PREFERENCES")
If (rs = Nil) Then Return
@@ -149,23 +151,24 @@ End
End If
- lstInfos.CellTextAt(0, 1) = infos.Lookup("SERVER_NAME", "cubeSQL").StringValue
+ Me.Table.CellTextAt(0, 1) = infos.Lookup("SERVER_NAME", "cubeSQL").StringValue
Var keyName As String = infos.Lookup("KEY_NAME", "").StringValue
If (keyName = "") Or (keyName = "0") Then keyName = "N/A"
- lstInfos.CellTextAt(2, 1) = keyName
+ Me.Table.CellTextAt(2, 1) = keyName
- lstInfos.CellTextAt(3, 1) = infos.Lookup("KEY_STATUS", "N/A").StringValue
+ Me.Table.CellTextAt(3, 1) = infos.Lookup("KEY_STATUS", "N/A").StringValue
+ Var styleKeyColumn As WebStyle = StyleListboxKeyColumn
If (infos.Lookup("KEY_EXPIRATION", "") <> "") Then
- lstInfos.CellTextAt(4, 0) = New WebListBoxStyleRenderer(styleKeyColumn, "Key expiration")
- lstInfos.CellTextAt(4, 1) = infos.Lookup("server_license", "").StringValue
+ Me.Table.CellTextAt(4, 0) = New WebListBoxStyleRenderer(styleKeyColumn, "Key expiration")
+ Me.Table.CellTextAt(4, 1) = infos.Lookup("server_license", "").StringValue
Else
- lstInfos.CellTextAt(4, 0) = New WebListBoxStyleRenderer(styleKeyColumn, "Upgrade plan expiration date")
- lstInfos.CellTextAt(4, 1) = infos.Lookup("KEY_EXPIRATION_PLAN", "").StringValue
+ Me.Table.CellTextAt(4, 0) = New WebListBoxStyleRenderer(styleKeyColumn, "Upgrade plan expiration date")
+ Me.Table.CellTextAt(4, 1) = infos.Lookup("KEY_EXPIRATION_PLAN", "").StringValue
End If
- lstInfos.CellTextAt(5, 1) = infos.Lookup("max_allowed_connections", "").StringValue
+ Me.Table.CellTextAt(5, 1) = infos.Lookup("max_allowed_connections", "").StringValue
Catch DatabaseException
@@ -181,7 +184,7 @@ End
#tag Events cntServerRegistration
#tag Event
Sub NeedsRefresh()
- Self.ShowInfos()
+ Self.TableLoad()
End Sub
#tag EndEvent
@@ -195,14 +198,6 @@ End
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 87a8b62..bb8da04 100644
--- a/webapp/containers/server/cntRegistrationAction.xojo_code
+++ b/webapp/containers/server/cntRegistrationAction.xojo_code
@@ -22,6 +22,7 @@ Begin WebContainer cntRegistrationAction
Width = 750
_mDesignHeight = 0
_mDesignWidth = 0
+ _mName = ""
_mPanelIndex = -1
Begin WebButton btnGetServerKey
AllowAutoDisable= False
@@ -48,7 +49,7 @@ Begin WebContainer cntRegistrationAction
Tooltip = ""
Top = 20
Visible = True
- Width = 266
+ Width = 200
_mPanelIndex = -1
End
Begin WebButton btnRegisterServer
@@ -60,8 +61,8 @@ Begin WebContainer cntRegistrationAction
Enabled = True
Height = 38
Index = -2147483648
- Indicator = 0
- Left = 464
+ Indicator = 3
+ Left = 530
LockBottom = True
LockedInPosition= True
LockHorizontal = False
@@ -71,31 +72,40 @@ Begin WebContainer cntRegistrationAction
LockVertical = False
PanelIndex = "0"
Scope = 2
- TabIndex = 1
+ TabIndex = 2
TabStop = True
Tooltip = ""
Top = 20
Visible = True
- Width = 266
+ Width = 200
_mPanelIndex = -1
End
- Begin WebMessageDialog dlgGetServerKey
+ Begin WebButton btnServerName
+ AllowAutoDisable= False
+ Cancel = False
+ Caption = "Server Name"
ControlID = ""
+ Default = False
Enabled = True
- Explanation = ""
+ Height = 38
Index = -2147483648
- Indicator = ""
- LockBottom = False
- LockedInPosition= False
+ Indicator = 5
+ Left = 322
+ LockBottom = True
+ LockedInPosition= True
LockHorizontal = False
- LockLeft = True
- LockRight = False
- LockTop = True
+ LockLeft = False
+ LockRight = True
+ LockTop = False
LockVertical = False
- Message = ""
+ PanelIndex = "0"
Scope = 2
- Title = ""
+ TabIndex = 1
+ TabStop = True
Tooltip = ""
+ Top = 20
+ Visible = True
+ Width = 200
_mPanelIndex = -1
End
End
@@ -104,23 +114,8 @@ End
#tag WindowCode
#tag Method, Flags = &h21
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
+ Var dlgGetServerKeyInfo As New dlgGetServerKey
+ dlgGetServerKeyInfo.Show()
End Sub
#tag EndMethod
@@ -141,6 +136,9 @@ End
Name = infos.Lookup("KEY_NAME", "").StringValue
Key = infos.Lookup("KEY_VALUE", "").StringValue
+
+ If (Name = "0") Then Name = ""
+ If (Key = "0") Then Key = ""
End If
@@ -171,27 +169,13 @@ End
End If
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Registration"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not register cubeSQL."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Registration", "Could not register cubeSQL Server.", err)
NeedsRefresh
Return False
End Try
- Var dialog As New WebMessageDialog
- dialog.Title = "Registration"
- dialog.Indicator = Indicators.Success
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Thanks for registering cubeSQL Server!"
- dialog.Explanation = ""
- dialog.Show
+ ShowSuccessDialog("Registration", "Thanks for registering cubeSQL Server!", "")
NeedsRefresh
Return True
@@ -199,6 +183,60 @@ End
End Function
#tag EndMethod
+ #tag Method, Flags = &h21
+ Private Sub ActionServerName()
+ Var ServerName 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
+
+ ServerName = infos.Lookup("SERVER_NAME", "").StringValue
+ End If
+
+
+ Catch DatabaseException
+
+ Finally
+ Var dlgServerName As New dlgCommonName
+ AddHandler dlgServerName.NameAction, WeakAddressOf ActionServerNameButtonPressed
+ dlgServerName.Show("Server Name", "Name", "Set", Indicators.Primary, ServerName)
+
+ End Try
+
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Function ActionServerNameButtonPressed(obj As dlgCommonName, Name As String) As Boolean
+ #Pragma unused obj
+
+ If (Name = "") Then Return False
+
+ Try
+
+ Session.DB.ExecuteSQL("SET PREFERENCE 'SERVER_NAME' TO '" + Name.EscapeSqlQuotes + "'")
+
+ Catch err As DatabaseException
+ ShowErrorDialog("Set Server Name", "Could not ser server name.", err)
+ NeedsRefresh
+ Return False
+
+ End Try
+
+ NeedsRefresh
+ Return True
+
+ End Function
+ #tag EndMethod
+
#tag Hook, Flags = &h0
Event NeedsRefresh()
@@ -210,21 +248,21 @@ End
#tag Events btnGetServerKey
#tag Event
Sub Pressed()
- self.ActionGetServerKey()
+ Self.ActionGetServerKey()
End Sub
#tag EndEvent
#tag EndEvents
#tag Events btnRegisterServer
#tag Event
Sub Pressed()
- self.ActionRegistration()
+ Self.ActionRegistration()
End Sub
#tag EndEvent
#tag EndEvents
-#tag Events dlgGetServerKey
+#tag Events btnServerName
#tag Event
- Sub ButtonPressed(button As WebMessageDialogButton)
- Self.ActionGetServerKeyButtonPressed(Me, button)
+ Sub Pressed()
+ Self.ActionServerName()
End Sub
#tag EndEvent
diff --git a/webapp/dialogs/dlgBase.xojo_code b/webapp/dialogs/dlgBase.xojo_code
new file mode 100644
index 0000000..85795e4
--- /dev/null
+++ b/webapp/dialogs/dlgBase.xojo_code
@@ -0,0 +1,266 @@
+#tag Class
+Protected Class dlgBase
+Inherits WebDialog
+ #tag Event
+ Sub Opening()
+ Opening
+
+ ebOpened = True
+
+ End Sub
+ #tag EndEvent
+
+ #tag Event
+ Sub Shown()
+ Shown
+
+ ebShown = True
+
+ End Sub
+ #tag EndEvent
+
+
+ #tag Hook, Flags = &h0
+ Event Opening()
+ #tag EndHook
+
+ #tag Hook, Flags = &h0
+ Event Shown()
+ #tag EndHook
+
+
+ #tag Property, Flags = &h1
+ Protected ebOpened As Boolean
+ #tag EndProperty
+
+ #tag Property, Flags = &h1
+ Protected ebShown As Boolean
+ #tag EndProperty
+
+
+ #tag ViewBehavior
+ #tag ViewProperty
+ Name="ControlCount"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mPanelIndex"
+ Visible=false
+ Group="Behavior"
+ InitialValue="-1"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="ControlID"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="String"
+ EditorType="MultiLineEditor"
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Enabled"
+ Visible=true
+ Group="Behavior"
+ InitialValue="True"
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Height"
+ Visible=true
+ Group="Behavior"
+ InitialValue="400"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LayoutType"
+ Visible=true
+ Group="Behavior"
+ InitialValue="LayoutTypes.Fixed"
+ Type="LayoutTypes"
+ EditorType="Enum"
+ #tag EnumValues
+ "0 - Fixed"
+ "1 - Flex"
+ #tag EndEnumValues
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockBottom"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockHorizontal"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockLeft"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockRight"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockTop"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockVertical"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Visible"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Width"
+ Visible=true
+ Group="Behavior"
+ InitialValue="600"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mDesignHeight"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mDesignWidth"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mName"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="String"
+ EditorType="MultiLineEditor"
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="TabIndex"
+ Visible=true
+ Group="Visual Controls"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Indicator"
+ Visible=false
+ Group="Visual Controls"
+ InitialValue=""
+ Type="WebUIControl.Indicators"
+ EditorType="Enum"
+ #tag EnumValues
+ "0 - Default"
+ "1 - Primary"
+ "2 - Secondary"
+ "3 - Success"
+ "4 - Danger"
+ "5 - Warning"
+ "6 - Info"
+ "7 - Light"
+ "8 - Dark"
+ "9 - Link"
+ #tag EndEnumValues
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LayoutDirection"
+ Visible=true
+ Group="WebView"
+ InitialValue="LayoutDirections.LeftToRight"
+ Type="LayoutDirections"
+ EditorType="Enum"
+ #tag EnumValues
+ "0 - LeftToRight"
+ "1 - RightToLeft"
+ "2 - TopToBottom"
+ "3 - BottomToTop"
+ #tag EndEnumValues
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Name"
+ Visible=true
+ Group="ID"
+ InitialValue=""
+ Type="String"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Index"
+ Visible=true
+ Group="ID"
+ InitialValue="-2147483648"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Super"
+ Visible=true
+ Group="ID"
+ InitialValue=""
+ Type="String"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Left"
+ Visible=true
+ Group="Position"
+ InitialValue="0"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Top"
+ Visible=true
+ Group="Position"
+ InitialValue="0"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag EndViewBehavior
+End Class
+#tag EndClass
diff --git a/webapp/dialogs/dlgCommonName.xojo_code b/webapp/dialogs/dlgCommonName.xojo_code
index 010b143..14a0bb8 100644
--- a/webapp/dialogs/dlgCommonName.xojo_code
+++ b/webapp/dialogs/dlgCommonName.xojo_code
@@ -1,5 +1,5 @@
#tag WebPage
-Begin WebDialog dlgCommonName
+Begin dlgBase dlgCommonName
Compatibility = ""
ControlCount = 0
ControlID = ""
@@ -69,7 +69,7 @@ Begin WebDialog dlgCommonName
LayoutType = 0
Left = 20
LockBottom = True
- LockedInPosition= False
+ LockedInPosition= True
LockHorizontal = False
LockLeft = True
LockRight = True
@@ -105,7 +105,7 @@ Begin WebDialog dlgCommonName
LockTop = True
LockVertical = False
Multiline = False
- PanelIndex = 0
+ PanelIndex = "0"
Parent = "rctFormContent"
Scope = 2
TabIndex = 0
@@ -142,7 +142,7 @@ Begin WebDialog dlgCommonName
LockTop = True
LockVertical = False
MaximumCharactersAllowed= 0
- PanelIndex = 0
+ PanelIndex = "0"
Parent = "rctFormContent"
ReadOnly = False
Scope = 2
diff --git a/webapp/dialogs/dlgDatabaseCreate.xojo_code b/webapp/dialogs/dlgDatabaseCreate.xojo_code
index 0a1de5d..cadf584 100644
--- a/webapp/dialogs/dlgDatabaseCreate.xojo_code
+++ b/webapp/dialogs/dlgDatabaseCreate.xojo_code
@@ -1,5 +1,5 @@
#tag WebPage
-Begin WebDialog dlgDatabaseCreate
+Begin dlgBase dlgDatabaseCreate
Compatibility = ""
ControlCount = 0
ControlID = ""
@@ -22,6 +22,7 @@ Begin WebDialog dlgDatabaseCreate
Width = 600
_mDesignHeight = 0
_mDesignWidth = 0
+ _mName = ""
_mPanelIndex = -1
Begin WebLabel labTitle
Bold = True
diff --git a/webapp/dialogs/dlgDatabaseUpload.xojo_code b/webapp/dialogs/dlgDatabaseUpload.xojo_code
index 4c99b0a..86f6e47 100644
--- a/webapp/dialogs/dlgDatabaseUpload.xojo_code
+++ b/webapp/dialogs/dlgDatabaseUpload.xojo_code
@@ -1,5 +1,5 @@
#tag WebPage
-Begin WebDialog dlgDatabaseUpload
+Begin dlgBase dlgDatabaseUpload
Compatibility = ""
ControlCount = 0
ControlID = ""
@@ -411,7 +411,7 @@ End
Super.Show()
- me.RefreshControls()
+ Me.RefreshControls()
End Sub
#tag EndMethod
@@ -460,6 +460,10 @@ End
#tag EndEvent
#tag Event
Sub FileAdded(filename As String, bytes As UInt64, mimeType As String)
+ #Pragma unused mimeType
+ #Pragma unused bytes
+ #Pragma unused filename
+
Self.RefreshControls()
upProgress.Value = 0
@@ -470,6 +474,8 @@ End
#tag EndEvent
#tag Event
Sub FileRemoved(filename As String)
+ #Pragma unused filename
+
Self.Upload = Nil
Self.RefreshControls()
@@ -490,6 +496,8 @@ End
#tag EndEvent
#tag Event
Sub UploadError(error As RuntimeException)
+ #Pragma unused error
+
upProgress.Value = 0
upProgress.Visible = False
diff --git a/webapp/dialogs/dlgEnginePreferenceSet.xojo_code b/webapp/dialogs/dlgEnginePreferenceSet.xojo_code
index e23359c..b19cf92 100644
--- a/webapp/dialogs/dlgEnginePreferenceSet.xojo_code
+++ b/webapp/dialogs/dlgEnginePreferenceSet.xojo_code
@@ -1,5 +1,5 @@
#tag WebPage
-Begin WebDialog dlgEnginePreferenceSet
+Begin dlgBase dlgEnginePreferenceSet
Compatibility = ""
ControlCount = 0
ControlID = ""
@@ -22,6 +22,7 @@ Begin WebDialog dlgEnginePreferenceSet
Width = 600
_mDesignHeight = 0
_mDesignWidth = 0
+ _mName = ""
_mPanelIndex = -1
Begin WebLabel labTitle
Bold = True
@@ -490,8 +491,6 @@ End
#tag WindowCode
#tag Event
Sub Shown()
- ebShown = True
-
If edtEngine.Enabled Then
edtEngine.SetFocus
Return
@@ -674,10 +673,6 @@ End
#tag EndHook
- #tag Property, Flags = &h21
- Private ebShown As Boolean
- #tag EndProperty
-
#tag Property, Flags = &h21
Private esPreSelectDatabase As String
#tag EndProperty
diff --git a/webapp/dialogs/dlgGetServerKey.xojo_code b/webapp/dialogs/dlgGetServerKey.xojo_code
new file mode 100644
index 0000000..7b1eb5f
--- /dev/null
+++ b/webapp/dialogs/dlgGetServerKey.xojo_code
@@ -0,0 +1,429 @@
+#tag WebPage
+Begin dlgBase dlgGetServerKey
+ Compatibility = ""
+ ControlCount = 0
+ ControlID = ""
+ Enabled = True
+ Height = 300
+ Index = -2147483648
+ Indicator = 0
+ LayoutDirection = 0
+ LayoutType = 0
+ Left = 0
+ LockBottom = False
+ LockHorizontal = False
+ LockLeft = False
+ LockRight = False
+ LockTop = False
+ LockVertical = False
+ TabIndex = 0
+ Top = 0
+ Visible = True
+ Width = 550
+ _mDesignHeight = 0
+ _mDesignWidth = 0
+ _mPanelIndex = -1
+ Begin WebLabel labTitle
+ Bold = True
+ ControlID = ""
+ Enabled = True
+ FontName = ""
+ FontSize = 24.0
+ Height = 38
+ Index = -2147483648
+ Indicator = 0
+ Italic = False
+ Left = 20
+ LockBottom = False
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = True
+ LockRight = True
+ LockTop = True
+ LockVertical = False
+ Multiline = False
+ Scope = 2
+ TabIndex = 0
+ TabStop = True
+ Text = "Get a cubeSQL Server Key"
+ TextAlignment = 2
+ TextColor = &c000000FF
+ Tooltip = ""
+ Top = 20
+ Underline = False
+ Visible = True
+ Width = 510
+ _mPanelIndex = -1
+ End
+ Begin WebRectangle rctFormContent
+ BackgroundColor = &cFFFFFF
+ ControlCount = 0
+ ControlID = ""
+ Enabled = True
+ HasBackgroundColor= False
+ Height = 148
+ Index = -2147483648
+ Indicator = 0
+ LayoutDirection = 0
+ LayoutType = 0
+ Left = 20
+ LockBottom = True
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = True
+ LockRight = True
+ LockTop = True
+ LockVertical = False
+ Scope = 2
+ TabIndex = 1
+ TabStop = True
+ Tooltip = ""
+ Top = 66
+ Visible = True
+ Width = 510
+ _mDesignHeight = 0
+ _mDesignWidth = 0
+ _mPanelIndex = -1
+ Begin WebLabel labInfo
+ Bold = False
+ ControlID = ""
+ Enabled = True
+ FontName = ""
+ FontSize = 0.0
+ Height = 60
+ Index = -2147483648
+ Indicator = ""
+ Italic = False
+ Left = 40
+ LockBottom = False
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = True
+ LockRight = True
+ LockTop = True
+ LockVertical = False
+ Multiline = True
+ Parent = "rctFormContent"
+ Scope = 2
+ TabIndex = 0
+ TabStop = True
+ Text = "You can get a Freeware or Developer Key for cubeSQL Server from sqlabs:"
+ TextAlignment = 0
+ TextColor = &c000000FF
+ Tooltip = ""
+ Top = 86
+ Underline = False
+ Visible = True
+ Width = 470
+ _mPanelIndex = -1
+ End
+ Begin WebLink labLink
+ Appearance = 0
+ Bold = True
+ ControlID = ""
+ Enabled = True
+ FontName = ""
+ FontSize = 0.0
+ Height = 38
+ Index = -2147483648
+ Indicator = ""
+ Italic = False
+ Left = 40
+ LockBottom = False
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = True
+ LockRight = True
+ LockTop = True
+ LockVertical = False
+ Multiline = False
+ Parent = "rctFormContent"
+ Scope = 2
+ TabIndex = 1
+ TabStop = True
+ Target = 1
+ Text = "#constUrl_DeveloperKey"
+ TextAlignment = 0
+ TextColor = &c000000FF
+ Tooltip = ""
+ Top = 154
+ Underline = False
+ URL = "#constUrl_DeveloperKey"
+ Visible = True
+ Width = 470
+ _mPanelIndex = -1
+ End
+ End
+ Begin WebButton btnOk
+ AllowAutoDisable= False
+ Cancel = False
+ Caption = "Ok"
+ ControlID = ""
+ Default = True
+ Enabled = True
+ Height = 38
+ Index = -2147483648
+ Indicator = 0
+ Left = 430
+ LockBottom = True
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = False
+ LockRight = True
+ LockTop = False
+ LockVertical = False
+ Scope = 2
+ TabIndex = 2
+ TabStop = True
+ Tooltip = ""
+ Top = 242
+ Visible = True
+ Width = 100
+ _mPanelIndex = -1
+ End
+End
+#tag EndWebPage
+
+#tag WindowCode
+#tag EndWindowCode
+
+#tag Events labLink
+ #tag Event
+ Sub Opening()
+ Me.URL = constUrl_DeveloperKey
+
+ End Sub
+ #tag EndEvent
+#tag EndEvents
+#tag Events btnOk
+ #tag Event
+ Sub Pressed()
+ Self.Close()
+
+ End Sub
+ #tag EndEvent
+#tag EndEvents
+#tag ViewBehavior
+ #tag ViewProperty
+ Name="ControlCount"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mPanelIndex"
+ Visible=false
+ Group="Behavior"
+ InitialValue="-1"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Index"
+ Visible=false
+ Group="ID"
+ InitialValue="-2147483648"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Name"
+ Visible=true
+ Group="ID"
+ InitialValue=""
+ Type="String"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Super"
+ Visible=true
+ Group="ID"
+ InitialValue=""
+ Type="String"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Left"
+ Visible=true
+ Group="Position"
+ InitialValue="0"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Top"
+ Visible=true
+ Group="Position"
+ InitialValue="0"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="ControlID"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="String"
+ EditorType="MultiLineEditor"
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Enabled"
+ Visible=true
+ Group="Behavior"
+ InitialValue="True"
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Height"
+ Visible=true
+ Group="Behavior"
+ InitialValue="400"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LayoutType"
+ Visible=true
+ Group="Behavior"
+ InitialValue="LayoutTypes.Fixed"
+ Type="LayoutTypes"
+ EditorType="Enum"
+ #tag EnumValues
+ "0 - Fixed"
+ "1 - Flex"
+ #tag EndEnumValues
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockBottom"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockHorizontal"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockLeft"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockRight"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockTop"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockVertical"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Visible"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Width"
+ Visible=true
+ Group="Behavior"
+ InitialValue="600"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mDesignHeight"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mDesignWidth"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mName"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="String"
+ EditorType="MultiLineEditor"
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="TabIndex"
+ Visible=true
+ Group="Visual Controls"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Indicator"
+ Visible=false
+ Group="Visual Controls"
+ InitialValue=""
+ Type="WebUIControl.Indicators"
+ EditorType="Enum"
+ #tag EnumValues
+ "0 - Default"
+ "1 - Primary"
+ "2 - Secondary"
+ "3 - Success"
+ "4 - Danger"
+ "5 - Warning"
+ "6 - Info"
+ "7 - Light"
+ "8 - Dark"
+ "9 - Link"
+ #tag EndEnumValues
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LayoutDirection"
+ Visible=true
+ Group="WebView"
+ InitialValue="LayoutDirections.LeftToRight"
+ Type="LayoutDirections"
+ EditorType="Enum"
+ #tag EnumValues
+ "0 - LeftToRight"
+ "1 - RightToLeft"
+ "2 - TopToBottom"
+ "3 - BottomToTop"
+ #tag EndEnumValues
+ #tag EndViewProperty
+#tag EndViewBehavior
diff --git a/webapp/dialogs/dlgPrivilegeGrant.xojo_code b/webapp/dialogs/dlgPrivilegeGrant.xojo_code
index d2b3789..bcf1295 100644
--- a/webapp/dialogs/dlgPrivilegeGrant.xojo_code
+++ b/webapp/dialogs/dlgPrivilegeGrant.xojo_code
@@ -1,5 +1,5 @@
#tag WebPage
-Begin WebDialog dlgPrivilegeGrant
+Begin dlgBase dlgPrivilegeGrant
Compatibility = ""
ControlCount = 0
ControlID = ""
@@ -22,6 +22,7 @@ Begin WebDialog dlgPrivilegeGrant
Width = 600
_mDesignHeight = 0
_mDesignWidth = 0
+ _mName = ""
_mPanelIndex = -1
Begin WebLabel labTitle
Bold = True
@@ -414,13 +415,6 @@ End
#tag EndWebPage
#tag WindowCode
- #tag Event
- Sub Shown()
- ebShown = true
- End Sub
- #tag EndEvent
-
-
#tag Method, Flags = &h21
Private Sub Load()
Me.LoadGroup()
@@ -597,10 +591,6 @@ End
#tag EndHook
- #tag Property, Flags = &h21
- Private ebShown As Boolean
- #tag EndProperty
-
#tag Property, Flags = &h21
Private esPreSelectGroup As String
#tag EndProperty
diff --git a/webapp/dialogs/dlgRegisterServer.xojo_code b/webapp/dialogs/dlgRegisterServer.xojo_code
index 7f009d5..d0f7ee5 100644
--- a/webapp/dialogs/dlgRegisterServer.xojo_code
+++ b/webapp/dialogs/dlgRegisterServer.xojo_code
@@ -1,5 +1,5 @@
#tag WebPage
-Begin WebDialog dlgRegisterServer
+Begin dlgBase dlgRegisterServer
Compatibility = ""
ControlCount = 0
ControlID = ""
@@ -22,7 +22,6 @@ Begin WebDialog dlgRegisterServer
Width = 600
_mDesignHeight = 0
_mDesignWidth = 0
- _mName = ""
_mPanelIndex = -1
Begin WebLabel labTitle
Bold = True
@@ -105,7 +104,7 @@ Begin WebDialog dlgRegisterServer
LockTop = True
LockVertical = False
Multiline = False
- PanelIndex = 0
+ PanelIndex = "0"
Parent = "rctFormContent"
Scope = 2
TabIndex = 2
@@ -141,7 +140,7 @@ Begin WebDialog dlgRegisterServer
LockTop = True
LockVertical = False
Multiline = False
- PanelIndex = 0
+ PanelIndex = "0"
Parent = "rctFormContent"
Scope = 2
TabIndex = 0
@@ -178,7 +177,7 @@ Begin WebDialog dlgRegisterServer
LockTop = True
LockVertical = False
MaximumCharactersAllowed= 0
- PanelIndex = 0
+ PanelIndex = "0"
Parent = "rctFormContent"
ReadOnly = False
Scope = 2
@@ -214,7 +213,7 @@ Begin WebDialog dlgRegisterServer
LockTop = True
LockVertical = False
MaximumCharactersAllowed= 0
- PanelIndex = 0
+ PanelIndex = "0"
Parent = "rctFormContent"
ReadOnly = False
Scope = 2
@@ -308,7 +307,7 @@ End
#tag Method, Flags = &h0
Sub Show()
- me.Show("", "")
+ Me.Show("", "")
End Sub
#tag EndMethod
@@ -320,6 +319,8 @@ End
esInitialName = edtName.Text
esInitialKey = edtKey.Text
+ Me.RefreshButtons()
+
Super.Show()
End Sub
#tag EndMethod
diff --git a/webapp/dialogs/dlgUnhandledException.xojo_code b/webapp/dialogs/dlgUnhandledException.xojo_code
new file mode 100644
index 0000000..fe7a8ce
--- /dev/null
+++ b/webapp/dialogs/dlgUnhandledException.xojo_code
@@ -0,0 +1,510 @@
+#tag WebPage
+Begin dlgBase dlgUnhandledException
+ Compatibility = ""
+ ControlCount = 0
+ ControlID = ""
+ Enabled = True
+ Height = 600
+ Index = -2147483648
+ Indicator = 0
+ LayoutDirection = 0
+ LayoutType = 0
+ Left = 0
+ LockBottom = False
+ LockHorizontal = False
+ LockLeft = False
+ LockRight = False
+ LockTop = False
+ LockVertical = False
+ TabIndex = 0
+ Top = 0
+ Visible = True
+ Width = 600
+ _mDesignHeight = 0
+ _mDesignWidth = 0
+ _mPanelIndex = -1
+ Begin WebLabel labTitle
+ Bold = True
+ ControlID = ""
+ Enabled = True
+ FontName = ""
+ FontSize = 24.0
+ Height = 38
+ Index = -2147483648
+ Indicator = 0
+ Italic = False
+ Left = 20
+ LockBottom = False
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = True
+ LockRight = True
+ LockTop = True
+ LockVertical = False
+ Multiline = False
+ Scope = 2
+ TabIndex = 0
+ TabStop = True
+ Text = "Unhandled Exception"
+ TextAlignment = 2
+ TextColor = &c000000FF
+ Tooltip = ""
+ Top = 20
+ Underline = False
+ Visible = True
+ Width = 560
+ _mPanelIndex = -1
+ End
+ Begin WebRectangle rctFormContent
+ BackgroundColor = &cFFFFFF
+ ControlCount = 0
+ ControlID = ""
+ Enabled = True
+ HasBackgroundColor= False
+ Height = 450
+ Index = -2147483648
+ Indicator = 0
+ LayoutDirection = 0
+ LayoutType = 0
+ Left = 20
+ LockBottom = True
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = True
+ LockRight = True
+ LockTop = True
+ LockVertical = False
+ Scope = 2
+ TabIndex = 1
+ TabStop = True
+ Tooltip = ""
+ Top = 66
+ Visible = True
+ Width = 560
+ _mDesignHeight = 0
+ _mDesignWidth = 0
+ _mPanelIndex = -1
+ Begin WebLabel labException
+ Bold = False
+ ControlID = ""
+ Enabled = True
+ FontName = ""
+ FontSize = 0.0
+ Height = 38
+ Index = -2147483648
+ Indicator = ""
+ Italic = False
+ Left = 40
+ LockBottom = False
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = True
+ LockRight = True
+ LockTop = True
+ LockVertical = False
+ Multiline = False
+ Parent = "rctFormContent"
+ Scope = 0
+ TabIndex = 0
+ TabStop = True
+ Text = "Oops - an unhandled SomeWeirdException occurred."
+ TextAlignment = 0
+ TextColor = &c000000FF
+ Tooltip = ""
+ Top = 86
+ Underline = False
+ Visible = True
+ Width = 520
+ _mPanelIndex = -1
+ End
+ Begin WebLabel labInfo
+ Bold = False
+ ControlID = ""
+ Enabled = True
+ FontName = ""
+ FontSize = 0.0
+ Height = 60
+ Index = -2147483648
+ indicator = 0
+ Italic = True
+ Left = 40
+ LockBottom = False
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = True
+ LockRight = True
+ LockTop = True
+ LockVertical = False
+ Multiline = True
+ PanelIndex = 0
+ Parent = "rctFormContent"
+ Scope = 0
+ TabIndex = 1
+ TabStop = True
+ Text = "The application will continue. In case of weird behavior try to Logout and Login again."
+ TextAlignment = 0
+ TextColor = &c000000FF
+ Tooltip = ""
+ Top = 132
+ Underline = False
+ Visible = True
+ Width = 520
+ _mPanelIndex = -1
+ End
+ Begin WebLabel labStackTrace
+ Bold = True
+ ControlID = ""
+ Enabled = True
+ FontName = ""
+ FontSize = 0.0
+ Height = 38
+ Index = -2147483648
+ indicator = 0
+ Italic = False
+ Left = 40
+ LockBottom = False
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = True
+ LockRight = True
+ LockTop = True
+ LockVertical = False
+ Multiline = False
+ PanelIndex = 0
+ Parent = "rctFormContent"
+ Scope = 0
+ TabIndex = 2
+ TabStop = True
+ Text = "Stack Trace"
+ TextAlignment = 2
+ TextColor = &c000000FF
+ Tooltip = ""
+ Top = 200
+ Underline = False
+ Visible = True
+ Width = 520
+ _mPanelIndex = -1
+ End
+ Begin WebTextArea edtStackTrace
+ AllowReturnKey = True
+ AllowSpellChecking= False
+ Caption = ""
+ ControlID = ""
+ Enabled = True
+ Height = 250
+ Hint = "Stack Trace"
+ Index = -2147483648
+ Indicator = ""
+ Left = 40
+ LockBottom = True
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = True
+ LockRight = True
+ LockTop = True
+ LockVertical = False
+ MaximumCharactersAllowed= 0
+ Parent = "rctFormContent"
+ ReadOnly = True
+ Scope = 0
+ TabIndex = 3
+ TabStop = True
+ Text = ""
+ TextAlignment = 0
+ Tooltip = ""
+ Top = 246
+ Visible = True
+ Width = 520
+ _mPanelIndex = -1
+ End
+ End
+ Begin WebButton btnOk
+ AllowAutoDisable= False
+ Cancel = False
+ Caption = "OK"
+ ControlID = ""
+ Default = False
+ Enabled = True
+ Height = 38
+ Index = -2147483648
+ Indicator = 5
+ Left = 480
+ LockBottom = True
+ LockedInPosition= True
+ LockHorizontal = False
+ LockLeft = False
+ LockRight = True
+ LockTop = False
+ LockVertical = False
+ Scope = 2
+ TabIndex = 2
+ TabStop = True
+ Tooltip = ""
+ Top = 542
+ Visible = True
+ Width = 100
+ _mPanelIndex = -1
+ End
+End
+#tag EndWebPage
+
+#tag WindowCode
+ #tag Event
+ Sub Shown()
+ edtStackTrace.SetFocus()
+
+ End Sub
+ #tag EndEvent
+
+
+ #tag Method, Flags = &h0
+ Sub Show(Error As RuntimeException)
+ Var errorType As String = Introspection.GetType(Error).Name
+ Var errorStack As String = String.FromArray(Error.Stack, EndOfLine)
+
+ labTitle.Text = "Unhandled Exception"
+ labException.Text = "Oops - an unhandled " + errorType + " occurred."
+ labInfo.Text = "The application will continue." + EndOfLine + _
+ "In case of weird behavior try to Logout and Login again."
+ edtStackTrace.Text = errorStack
+
+ Super.Show()
+
+ End Sub
+ #tag EndMethod
+
+
+#tag EndWindowCode
+
+#tag Events btnOk
+ #tag Event
+ Sub Pressed()
+ Self.Close()
+
+ End Sub
+ #tag EndEvent
+#tag EndEvents
+#tag ViewBehavior
+ #tag ViewProperty
+ Name="ControlCount"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mPanelIndex"
+ Visible=false
+ Group="Behavior"
+ InitialValue="-1"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Index"
+ Visible=false
+ Group="ID"
+ InitialValue="-2147483648"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Name"
+ Visible=true
+ Group="ID"
+ InitialValue=""
+ Type="String"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Super"
+ Visible=true
+ Group="ID"
+ InitialValue=""
+ Type="String"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Left"
+ Visible=true
+ Group="Position"
+ InitialValue="0"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Top"
+ Visible=true
+ Group="Position"
+ InitialValue="0"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="ControlID"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="String"
+ EditorType="MultiLineEditor"
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Enabled"
+ Visible=true
+ Group="Behavior"
+ InitialValue="True"
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Height"
+ Visible=true
+ Group="Behavior"
+ InitialValue="400"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LayoutType"
+ Visible=true
+ Group="Behavior"
+ InitialValue="LayoutTypes.Fixed"
+ Type="LayoutTypes"
+ EditorType="Enum"
+ #tag EnumValues
+ "0 - Fixed"
+ "1 - Flex"
+ #tag EndEnumValues
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockBottom"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockHorizontal"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockLeft"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockRight"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockTop"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LockVertical"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Visible"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Boolean"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Width"
+ Visible=true
+ Group="Behavior"
+ InitialValue="600"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mDesignHeight"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mDesignWidth"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="_mName"
+ Visible=false
+ Group="Behavior"
+ InitialValue=""
+ Type="String"
+ EditorType="MultiLineEditor"
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="TabIndex"
+ Visible=true
+ Group="Visual Controls"
+ InitialValue=""
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Indicator"
+ Visible=false
+ Group="Visual Controls"
+ InitialValue=""
+ Type="WebUIControl.Indicators"
+ EditorType="Enum"
+ #tag EnumValues
+ "0 - Default"
+ "1 - Primary"
+ "2 - Secondary"
+ "3 - Success"
+ "4 - Danger"
+ "5 - Warning"
+ "6 - Info"
+ "7 - Light"
+ "8 - Dark"
+ "9 - Link"
+ #tag EndEnumValues
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="LayoutDirection"
+ Visible=true
+ Group="WebView"
+ InitialValue="LayoutDirections.LeftToRight"
+ Type="LayoutDirections"
+ EditorType="Enum"
+ #tag EnumValues
+ "0 - LeftToRight"
+ "1 - RightToLeft"
+ "2 - TopToBottom"
+ "3 - BottomToTop"
+ #tag EndEnumValues
+ #tag EndViewProperty
+#tag EndViewBehavior
diff --git a/webapp/dialogs/dlgUserCreate.xojo_code b/webapp/dialogs/dlgUserCreate.xojo_code
index 768ce21..d059f60 100644
--- a/webapp/dialogs/dlgUserCreate.xojo_code
+++ b/webapp/dialogs/dlgUserCreate.xojo_code
@@ -1,5 +1,5 @@
#tag WebPage
-Begin WebDialog dlgUserCreate
+Begin dlgBase dlgUserCreate
Compatibility = ""
ControlCount = 0
ControlID = ""
@@ -22,6 +22,7 @@ Begin WebDialog dlgUserCreate
Width = 600
_mDesignHeight = 0
_mDesignWidth = 0
+ _mName = ""
_mPanelIndex = -1
Begin WebLabel labTitle
Bold = True
@@ -433,7 +434,7 @@ End
Var lastLabel As WebLabel = If(ebActionSetPasswordOnly, labPasswordRepeat, labGroup)
rctFormContent.Height = lastLabel.Top - rctFormContent.Top + 59
- self.Height = lastLabel.Top + 136
+ Self.Height = lastLabel.Top + 136
If edtName.Enabled Then
diff --git a/webapp/dialogs/dlgUserGroups.xojo_code b/webapp/dialogs/dlgUserGroups.xojo_code
index 2a71ba6..18e162f 100644
--- a/webapp/dialogs/dlgUserGroups.xojo_code
+++ b/webapp/dialogs/dlgUserGroups.xojo_code
@@ -1,5 +1,5 @@
#tag WebPage
-Begin WebDialog dlgUserGroups
+Begin dlgBase dlgUserGroups
Compatibility = ""
ControlCount = 0
ControlID = ""
@@ -373,14 +373,7 @@ End
Session.DB.ExecuteSQL("ADD USER '" + esUsername.EscapeSqlQuotes + "' TO GROUP '" + group.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Add User to Group"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not add user to group."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Add User to Group", "Could not add user to group.", err)
Return
End Try
@@ -441,14 +434,7 @@ End
Session.DB.ExecuteSQL("REMOVE USER '" + esUsername.EscapeSqlQuotes + "' FROM GROUP '" + group.EscapeSqlQuotes + "'")
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Remove User from Group"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not remove user from group."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Remove User from Group", "Could not remove user from group.", err)
Return
End Try
diff --git a/webapp/helpers/modDialogs.xojo_code b/webapp/helpers/modDialogs.xojo_code
new file mode 100644
index 0000000..a809484
--- /dev/null
+++ b/webapp/helpers/modDialogs.xojo_code
@@ -0,0 +1,98 @@
+#tag Module
+Protected Module modDialogs
+ #tag Method, Flags = &h0
+ Sub ShowErrorDialog(Title As String, Message As String, Error As DatabaseException)
+ Var errorExplanation As String = "Error" + If(Error.ErrorNumber > 0, " " + Error.ErrorNumber.ToString, "") + ": " + Error.Message
+ ShowErrorDialog(Title, Message, errorExplanation)
+
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h0
+ Sub ShowErrorDialog(Title As String, Message As String, Explanation As String)
+ ShowWebMessageDialog(Title, Message, Explanation, WebMessageDialog.Indicators.Danger)
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h0
+ Sub ShowInfoDialog(Title As String, Message As String, Explanation As String)
+ ShowWebMessageDialog(Title, Message, Explanation, WebMessageDialog.Indicators.Info)
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h0
+ Sub ShowSuccessDialog(Title As String, Message As String, Explanation As String)
+ ShowWebMessageDialog(Title, Message, Explanation, WebMessageDialog.Indicators.Success)
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h0
+ Sub ShowWarningDialog(Title As String, Message As String, Explanation As String)
+ ShowWebMessageDialog(Title, Message, Explanation, WebMessageDialog.Indicators.Warning)
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h21
+ Private Sub ShowWebMessageDialog(Title As String, Message As String, Explanation As String, Indicator As WebUIControl.Indicators)
+ Var dialog As New WebMessageDialog
+ dialog.Title = Title
+ dialog.Indicator = Indicator
+ dialog.ActionButton.Caption = "OK"
+ dialog.CancelButton.Visible = False
+ dialog.Message = Message
+ dialog.Explanation = Explanation
+ dialog.Show
+
+ End Sub
+ #tag EndMethod
+
+
+ #tag ViewBehavior
+ #tag ViewProperty
+ Name="Name"
+ Visible=true
+ Group="ID"
+ InitialValue=""
+ Type="String"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Index"
+ Visible=true
+ Group="ID"
+ InitialValue="-2147483648"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Super"
+ Visible=true
+ Group="ID"
+ InitialValue=""
+ Type="String"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Left"
+ Visible=true
+ Group="Position"
+ InitialValue="0"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Top"
+ Visible=true
+ Group="Position"
+ InitialValue="0"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag EndViewBehavior
+End Module
+#tag EndModule
diff --git a/webapp/helpers/modFunctions.xojo_code b/webapp/helpers/modFunctions.xojo_code
new file mode 100644
index 0000000..1d099f3
--- /dev/null
+++ b/webapp/helpers/modFunctions.xojo_code
@@ -0,0 +1,86 @@
+#tag Module
+Protected Module modFunctions
+ #tag Method, Flags = &h0, CompatibilityFlags = API2Only and ( (TargetWeb and (Target32Bit or Target64Bit)) )
+ Sub SleepAndYieldToNext(Extends ThreadInstance As WebThread, Milliseconds As Integer)
+ Var SleepInterval As Integer = Milliseconds / 10
+
+ For i As Integer = 1 To 10
+ ThreadInstance.Sleep SleepInterval
+ ThreadInstance.YieldToNext
+ Next
+
+ End Sub
+ #tag EndMethod
+
+ #tag Method, Flags = &h0, CompatibilityFlags = API2Only and ( (TargetConsole and (Target32Bit or Target64Bit)) or (TargetWeb and (Target32Bit or Target64Bit)) or (TargetDesktop and (Target32Bit or Target64Bit)) )
+ Function SQLDateTime_AsDateTime_AsLocal(sqlDateTime As String) As DateTime
+ Return DateTime.FromString(sqlDateTime, Nil, Timezone.Current)
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h0, CompatibilityFlags = API2Only and ( (TargetConsole and (Target32Bit or Target64Bit)) or (TargetWeb and (Target32Bit or Target64Bit)) or (TargetDesktop and (Target32Bit or Target64Bit)) )
+ Function SQLDateTime_AsDateTime_FromUTC_ToLocal(sqlDateTime As String) As DateTime
+ Var utcDateTimeValue As DateTime = DateTime.FromString(sqlDateTime, Nil, New TimeZone("UTC"))
+ Var localDateTimeValue As New DateTime(utcDateTimeValue.SecondsFrom1970, Timezone.Current)
+ Return localDateTimeValue
+
+ End Function
+ #tag EndMethod
+
+ #tag Method, Flags = &h0, CompatibilityFlags = API2Only and ( (TargetConsole and (Target32Bit or Target64Bit)) or (TargetWeb and (Target32Bit or Target64Bit)) or (TargetDesktop and (Target32Bit or Target64Bit)) )
+ Function Version_AsDouble(version As String) As Double
+ Var iMajor As Integer = version.NthField(".", 1).ToInteger
+ Var iMinor As Integer = version.NthField(".", 2).ToInteger
+ Var iBug As Integer = version.NthField(".", 3).ToInteger
+
+ Return iMajor + (iMinor / 1000) + (iBug / 1000 / 1000)
+
+ End Function
+ #tag EndMethod
+
+
+ #tag ViewBehavior
+ #tag ViewProperty
+ Name="Name"
+ Visible=true
+ Group="ID"
+ InitialValue=""
+ Type="String"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Index"
+ Visible=true
+ Group="ID"
+ InitialValue="-2147483648"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Super"
+ Visible=true
+ Group="ID"
+ InitialValue=""
+ Type="String"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Left"
+ Visible=true
+ Group="Position"
+ InitialValue="0"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag ViewProperty
+ Name="Top"
+ Visible=true
+ Group="Position"
+ InitialValue="0"
+ Type="Integer"
+ EditorType=""
+ #tag EndViewProperty
+ #tag EndViewBehavior
+End Module
+#tag EndModule
diff --git a/webapp/main/CubeSQLAdminPage.xojo_code b/webapp/main/CubeSQLAdminPage.xojo_code
index 1e1bd30..b115e2f 100644
--- a/webapp/main/CubeSQLAdminPage.xojo_code
+++ b/webapp/main/CubeSQLAdminPage.xojo_code
@@ -29,6 +29,7 @@ Begin WebPage CubeSQLAdminPage
_ImplicitInstance= False
_mDesignHeight = 0
_mDesignWidth = 0
+ _mName = ""
_mPanelIndex = -1
Begin WebToolbar tbrCubeSQLAdmin
ControlID = ""
@@ -134,7 +135,7 @@ End
Sub Opening()
Me.Title = "cubeSQL Admin - " + Session.DB.Host + ":" + Session.DB.Port.ToString
- me.ShowContainer(ContainerKey.Status)
+ Me.ShowContainer(ContainerKey.Status)
End Sub
#tag EndEvent
@@ -144,7 +145,7 @@ End
If (Me.CurrentContainer <> Nil) Then
Me.CurrentContainer.Close
Me.CurrentContainer = Nil
- me.CurrentContainerKey = ContainerKey.None
+ Me.CurrentContainerKey = ContainerKey.None
End If
edtSearch.Text = ""
@@ -156,8 +157,10 @@ End
#tag Method, Flags = &h21
Private Sub Search()
- If (Me.CurrentContainer <> Nil) And Me.CurrentContainer.SearchAvailable And edtSearch.Visible Then
- Me.CurrentContainer.Search(edtSearch.Text.Trim)
+ If (Me.CurrentContainer <> Nil) And (Me.CurrentContainer IsA cntDatasourceBase) Then
+ If (cntDatasourceBase(Me.CurrentContainer).SearchAvailable And edtSearch.Visible) Then
+ cntDatasourceBase(Me.CurrentContainer).Search(edtSearch.Text.Trim)
+ End If
End If
End Sub
@@ -232,7 +235,7 @@ End
Me.CurrentContainer = showContainer
Me.CurrentContainerKey = containerItem
- edtSearch.Visible = showContainer.SearchAvailable
+ edtSearch.Visible = (showContainer IsA cntDatasourceBase) And cntDatasourceBase(showContainer).SearchAvailable
End Sub
#tag EndMethod
@@ -309,7 +312,7 @@ End
#tag EndEvent
#tag Event
Sub TitlePressed()
- self.ShowContainer(ContainerKey.Status)
+ Self.ShowContainer(ContainerKey.Status)
End Sub
#tag EndEvent
#tag Event
diff --git a/webapp/main/LoginPage.xojo_code b/webapp/main/LoginPage.xojo_code
index 9d9b8ec..a617b98 100644
--- a/webapp/main/LoginPage.xojo_code
+++ b/webapp/main/LoginPage.xojo_code
@@ -29,7 +29,6 @@ Begin WebPage LoginPage
_ImplicitInstance= False
_mDesignHeight = 0
_mDesignWidth = 0
- _mName = ""
_mPanelIndex = -1
Begin WebRectangle rectLogin
BackgroundColor = &cFFFFFF
@@ -594,8 +593,11 @@ End
#tag Event
Sub Shown()
Self.Prefill()
+
ebShown = True
+ Self.RefreshButtons()
+
End Sub
#tag EndEvent
@@ -642,7 +644,7 @@ End
db.Host = edtHostname.Text.Trim
db.UserName = edtUsername.Text.Trim
db.Password = edtPassword.Text.Trim
- db.Port = edtPort.Text.ToInteger
+ db.Port = edtPort.Text.Trim.ToInteger
db.Encryption = lstEncryption.RowTagAt(lstEncryption.SelectedRowIndex)
db.Timeout = 10
@@ -654,27 +656,13 @@ End
End If
Catch err As DatabaseException
- Var dialog As New WebMessageDialog
- dialog.Title = "Connect"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Could not connect to cubeSQL."
- dialog.Explanation = "Error" + If(err.ErrorNumber > 0, " " + err.ErrorNumber.ToString, "") + ": " + err.Message
- dialog.Show
+ ShowErrorDialog("Connect", "Could not connect to cubeSQL.", err)
Return
End Try
If (Not Self.CheckAdmin(db)) Then
- Var dialog As New WebMessageDialog
- dialog.Title = "cubeSQL Admin Login"
- dialog.Indicator = Indicators.Warning
- dialog.ActionButton.Caption = "OK"
- dialog.CancelButton.Visible = False
- dialog.Message = "Insufficient privileges."
- dialog.Explanation = "This application requires Admin privileges in order to function properly."
- dialog.Show
+ ShowWarningDialog("cubeSQL Admin Login", "Insufficient privileges.", "This application requires Admin privileges in order to function properly.")
Return
End If
@@ -789,6 +777,8 @@ End
#tag Method, Flags = &h21
Private Sub Prefill()
+ 'Prefill only once, first time shown (per session)
+ 'Don't overwrite after Logout
If ebShown Then Return
Var setHostname As String
@@ -856,6 +846,27 @@ End
End Sub
#tag EndMethod
+ #tag Method, Flags = &h21
+ Private Sub RefreshButtons()
+ Var bConnect As Boolean = True
+
+ If (edtHostname.Text.Trim = "") Then bConnect = False
+ If (edtPort.Text.Trim.ToInteger < 1) Then bConnect = False
+
+ If (lstEncryption.RowTagAt(lstEncryption.SelectedRowIndex) <> CubeSQLPlugin.kSSL) Or (Not edtSSLPemPwd.Visible) Then
+ 'needs to be set if:
+ ' - no SSL
+ ' - SSL, but no Certificate
+ If (edtUsername.Text.Trim = "") Then bConnect = False
+ If (edtPassword.Text.Trim = "") Then bConnect = False
+ End If
+
+
+ If (btnConnect.Enabled <> bConnect) Then btnConnect.Enabled = bConnect
+
+ End Sub
+ #tag EndMethod
+
#tag Note, Name = DebugMemoryIssues
Place this in the Run Event of a WebThread (Location: Browser).
@@ -925,6 +936,46 @@ End
#tag EndWindowCode
+#tag Events edtHostname
+ #tag Event
+ Sub TextChanged()
+ If (Not ebShown) Then Return
+
+ Self.RefreshButtons()
+
+ End Sub
+ #tag EndEvent
+#tag EndEvents
+#tag Events edtUsername
+ #tag Event
+ Sub TextChanged()
+ If (Not ebShown) Then Return
+
+ Self.RefreshButtons()
+
+ End Sub
+ #tag EndEvent
+#tag EndEvents
+#tag Events edtPassword
+ #tag Event
+ Sub TextChanged()
+ If (Not ebShown) Then Return
+
+ Self.RefreshButtons()
+
+ End Sub
+ #tag EndEvent
+#tag EndEvents
+#tag Events edtPort
+ #tag Event
+ Sub TextChanged()
+ If (Not ebShown) Then Return
+
+ Self.RefreshButtons()
+
+ End Sub
+ #tag EndEvent
+#tag EndEvents
#tag Events lstEncryption
#tag Event
Sub Opening()
@@ -959,13 +1010,16 @@ End
edtSSLPemPwd.Visible = bSSLPemPwdVisible
+ If (Not ebShown) Then Return
+ Self.RefreshButtons()
+
End Sub
#tag EndEvent
#tag EndEvents
#tag Events btnConnect
#tag Event
Sub Pressed()
- self.Connect()
+ Self.Connect()
End Sub
#tag EndEvent
#tag EndEvents
diff --git a/webapp/modCubeSQLAdmin.xojo_code b/webapp/modCubeSQLAdmin.xojo_code
index 0b85051..d95354b 100644
--- a/webapp/modCubeSQLAdmin.xojo_code
+++ b/webapp/modCubeSQLAdmin.xojo_code
@@ -9,9 +9,9 @@ Protected Module modCubeSQLAdmin
#tag Method, Flags = &h1
Protected Function LaunchArgumentGetValue(argKey As String, envKey As String, ByRef argValue As String) As Boolean
- // Gets the Launch Argument from
- // 1. Launch Argument
- // 2. Environment Variable
+ ' Gets the Launch Argument from
+ ' 1. Launch Argument
+ ' 2. Environment Variable
argValue = dictArgs.Lookup(argKey, "").StringValue.Trim
If (argValue = "") Then argValue = System.EnvironmentVariable(envKey).Trim
@@ -22,29 +22,8 @@ Protected Module modCubeSQLAdmin
#tag EndMethod
#tag Method, Flags = &h0
- Sub SleepAndYieldToNext(Extends ThreadInstance As WebThread, Milliseconds As Integer)
- Var SleepInterval As Integer = Milliseconds / 10
-
- For i As Integer = 1 To 10
- ThreadInstance.Sleep SleepInterval
- ThreadInstance.YieldToNext
- Next
-
- End Sub
- #tag EndMethod
-
- #tag Method, Flags = &h0
- Function SQLDateTime_AsDateTime_AsLocal(sqlDateTime As String) As DateTime
- Return DateTime.FromString(sqlDateTime, Nil, Timezone.Current)
-
- End Function
- #tag EndMethod
-
- #tag Method, Flags = &h0
- Function SQLDateTime_AsDateTime_FromUTC_ToLocal(sqlDateTime As String) As DateTime
- Var utcDateTimeValue As DateTime = DateTime.FromString(sqlDateTime, Nil, New TimeZone("UTC"))
- Var localDateTimeValue As New DateTime(utcDateTimeValue.SecondsFrom1970, Timezone.Current)
- Return localDateTimeValue
+ Function ServerVersion_AsDouble(Extends db As CubeSQLServer) As Double
+ Return Version_AsDouble(db.ServerVersion)
End Function
#tag EndMethod