Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tables and Indexes #11

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cubesql-webadmin.xojo_project
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ MinIDEVersion=20200200
OrigIDEVersion=20240100
Folder=resources;resources;&h0000000035B107FF;&h0000000000000000;false
Folder=styles;styles;&h00000000139DBFFF;&h0000000000000000;false
Class=CheckboxCellRenderer;styles/CheckboxCellRenderer.xojo_code;&h000000007F7FF7FF;&h00000000139DBFFF;false
Folder=webapp;webapp;&h0000000018D38FFF;&h0000000000000000;false
Folder=main;webapp/main;&h000000001D9447FF;&h0000000018D38FFF;false
WebView=LoginPage;webapp/main/LoginPage.xojo_code;&h000000005492FFFF;&h000000001D9447FF;false
Expand All @@ -16,6 +17,9 @@ WebView=dlgGetServerKey;webapp/dialogs/dlgGetServerKey.xojo_code;&h0000000076F62
WebView=dlgDatabaseCreate;webapp/dialogs/dlgDatabaseCreate.xojo_code;&h0000000045C397FF;&h0000000054A427FF;false
WebView=dlgDatabaseUpload;webapp/dialogs/dlgDatabaseUpload.xojo_code;&h00000000375D2FFF;&h0000000054A427FF;false
WebView=dlgDatabaseSchedules;webapp/dialogs/dlgDatabaseSchedules.xojo_code;&h00000000514E3FFF;&h0000000054A427FF;false
WebView=dlgIndexCreate;webapp/dialogs/dlgIndexCreate.xojo_code;&h000000000919DFFF;&h0000000054A427FF;false
WebView=dlgTableEditor;webapp/dialogs/dlgTableEditor.xojo_code;&h0000000035FA4FFF;&h0000000054A427FF;false
WebView=dlgTableEditorField;webapp/dialogs/dlgTableEditorField.xojo_code;&h000000007BD80FFF;&h0000000054A427FF;false
WebView=dlgSchedule;webapp/dialogs/dlgSchedule.xojo_code;&h00000000476F1FFF;&h0000000054A427FF;false
WebView=dlgScheduleDatabases;webapp/dialogs/dlgScheduleDatabases.xojo_code;&h000000005565B7FF;&h0000000054A427FF;false
WebView=dlgUserCreate;webapp/dialogs/dlgUserCreate.xojo_code;&h0000000064C14FFF;&h0000000054A427FF;false
Expand All @@ -33,6 +37,7 @@ Folder=server;webapp/containers/server;&h0000000045A527FF;&h000000005859EFFF;fal
Folder=data;webapp/containers/data;&h00000000107E37FF;&h000000005859EFFF;false
WebContainer=cntDatabases;webapp/containers/data/cntDatabases.xojo_code;&h0000000040B4DFFF;&h00000000107E37FF;false
WebContainer=cntDatabasesEncryption;webapp/containers/data/cntDatabasesEncryption.xojo_code;&h0000000044B7E7FF;&h00000000107E37FF;false
WebContainer=cntTablesIndexes;webapp/containers/data/cntTablesIndexes.xojo_code;&h000000004B6CDFFF;&h00000000107E37FF;false
WebContainer=cntBackups;webapp/containers/data/cntBackups.xojo_code;&h000000004237B7FF;&h00000000107E37FF;false
WebContainer=cntSchedules;webapp/containers/data/cntSchedules.xojo_code;&h000000002F98DFFF;&h00000000107E37FF;false
WebContainer=cntRegistrationAction;webapp/containers/server/cntRegistrationAction.xojo_code;&h000000000788EFFF;&h0000000045A527FF;false
Expand Down Expand Up @@ -97,7 +102,7 @@ WebDebugPort=8080
WebLivePort=80
WebSecurePort=443
WebProtocol=1
WebHTMLHeader=<style>\n.listboxDbHeaderAlignment th:nth-child(1)\x2C\n.listboxDbHeaderAlignment th:nth-child(3)\x2C\n.listboxDbHeaderAlignment th:nth-child(5) {\n text-align: center;\n}\n\n.listboxGroupsHeaderAlignment th:nth-child(2) {\n text-align: center;\n}\n\n.listboxUsersHeaderAlignment th:nth-child(2) {\n text-align: center;\n}\n\n.listboxClientsHeaderAlignment th:nth-child(1) {\n text-align: center;\n}\n\n.listboxSchedulesHeaderAlignment th:nth-child(3) {\n text-align: center;\n}\n</style>
WebHTMLHeader=<style>\n.listboxDbHeaderAlignment th:nth-child(1)\x2C\n.listboxDbHeaderAlignment th:nth-child(3)\x2C\n.listboxDbHeaderAlignment th:nth-child(5) {\n text-align: center;\n}\n\n.listboxGroupsHeaderAlignment th:nth-child(2) {\n text-align: center;\n}\n\n.listboxUsersHeaderAlignment th:nth-child(2) {\n text-align: center;\n}\n\n.listboxClientsHeaderAlignment th:nth-child(1) {\n text-align: center;\n}\n\n.listboxSchedulesHeaderAlignment th:nth-child(3) {\n text-align: center;\n}\n\n.form-check-input {\n cursor:pointer;\n}\n</style>
WebHostingIdentifier=
WebHostingAppName=cubeSQLWebAdmin
WebHostingDomain=
Expand Down
145 changes: 145 additions & 0 deletions styles/CheckboxCellRenderer.xojo_code
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
#tag Class
Protected Class CheckboxCellRenderer
Inherits WebListboxCellRenderer
#tag Event
Sub Deserialize(js As JSONItem)
// Restore the values of the column to the object

Checked = js.Lookup("checked", False).BooleanValue

End Sub
#tag EndEvent

#tag Event
Function JavascriptClassCode(s As WebSession) As String
#Pragma unused s

Var code() As String

// All custom cells extend the XojoWeb.ListboxCellRenderer class
code.Add "class CheckboxCell extends XojoWeb.ListboxCellRenderer {"

// You must override the "render" method
// controlID (string): The identifier of the listbox control that the renderer is currently running under
// row (HTMLElement): The HTML DOM element of the entire row. This is provided so that you can make modifications to the entire row if necessary, like applying a style.
// data (object): The data that the Xojo portion of your control provided for this column
// rowIndex (number): The row number that is currently being rendered
// columnIndex (number): The column number that is currently being rendered
// cell (HTMLElement): The HTML DOM element of the cell that your renderer is responsible for.
code.Add " render(controlID, row, data, rowIndex, columnIndex, cell) {"

// Remove the text that's already in the cell
code.Add " cell.innerHTML= '';"

// Make a bootstrap checkbox
code.Add " let checkbox = document.createElement('input');"
code.Add " checkbox.type = 'checkbox';"
code.Add " checkbox.className = 'form-check-input';"
code.Add " checkbox.checked = data.checked;"
code.Add " checkbox.style.marginLeft = '6px'"
code.Add " checkbox.style.marginRight = '6px'"

// Handle clicking on the button
code.Add " checkbox.addEventListener('click', function(ev) {"
code.Add " ev.stopPropagation();"
code.Add " var obj = new XojoWeb.JSONItem;"
code.Add " obj.set('row', rowIndex);" // All extensions should include the row (default is -1)
code.Add " obj.set('column', columnIndex);" // All extensions should include the column (default is -1)
code.Add " obj.set('identifier', 'idCheckbox');" // All extensions should include an identifier (default is "")
code.Add " obj.set('value', checkbox.checked);" // Including a value is optional (default is null)
code.Add " XojoWeb.controls.lookup(controlID).triggerServerEvent('CustomCellAction', obj);"
code.Add " return false;"
code.Add " });"

// Add our new content
code.Add " cell.appendChild(checkbox);"
code.Add " }"
code.Add "}"

Return String.FromArray(code, EndOfLine.Windows)


End Function
#tag EndEvent

#tag Event
Function Serialize() As JSONItem
// Use this code to convert the value(s) needed to render your codes to JSON.
// This is also used by non-datasource listboxes to store these settings for your column.

Var js As New JSONItem
js.Value("checked") = Checked

return js
End Function
#tag EndEvent


#tag Method, Flags = &h0
Sub Constructor(isChecked As Boolean)
// Calling the overridden superclass constructor.
Super.Constructor

Self.Checked = isChecked

End Sub
#tag EndMethod


#tag Property, Flags = &h0
Checked As Boolean
#tag EndProperty


#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 ViewProperty
Name="Checked"
Visible=false
Group="Behavior"
InitialValue=""
Type="Boolean"
EditorType=""
#tag EndViewProperty
#tag EndViewBehavior
End Class
#tag EndClass
17 changes: 17 additions & 0 deletions webapp/Session.xojo_code
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ Inherits WebSession
rs.Close
End If

rs = db.SelectSQL("SHOW INFO FOR KEY engine_version")
If (rs <> Nil) Then

If (rs.RowCount > 0) Then
rs.MoveToFirstRow

DBEngineVersion = Version_AsDouble(rs.Column("value").StringValue)
End If

rs.Close
End If

Catch err As DatabaseException
Return False

Expand All @@ -60,6 +72,7 @@ Inherits WebSession

DB = Nil
ClientId = -1
DBEngineVersion = 0.0

End Sub
#tag EndMethod
Expand All @@ -73,6 +86,10 @@ Inherits WebSession
DB As CubeSQLServer
#tag EndProperty

#tag Property, Flags = &h0
DBEngineVersion As Double
#tag EndProperty


#tag ViewBehavior
#tag ViewProperty
Expand Down
Loading