167 lines
5.7 KiB
VB.net
167 lines
5.7 KiB
VB.net
|
|
Partial Class admin_admin
|
|
Inherits System.Web.UI.Page
|
|
|
|
Private DB As New cDBADMINFunctions
|
|
|
|
Dim blocks As New List(Of cBlock)
|
|
Private margin_top As Integer = 20
|
|
Private margin_left As Integer = 20
|
|
Private top_value As Integer = 0
|
|
Private left_value As Integer = 0
|
|
Private rowmaxheight As Integer = 0
|
|
Private screenwidth As Integer = 1200
|
|
' Dim WithEvents fctbHTML As New FastColoredTextBox
|
|
Dim hp_content As hp_content = Nothing
|
|
|
|
Public laenderkuerzel As String = "de"
|
|
Dim hp_test As String = ""
|
|
Public menueId As Integer = 1
|
|
|
|
Dim WithEvents fctbHTML As New TextBox
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Me.Page.User.Identity.IsAuthenticated Then
|
|
FormsAuthentication.RedirectToLoginPage()
|
|
End If
|
|
|
|
If Not Request.IsSecureConnection Then
|
|
' Response.Redirect(Request.Url.AbsoluteUri.Replace("http://", "https://").Replace("56551", "44300"))
|
|
|
|
End If
|
|
|
|
|
|
|
|
If Not IsPostBack Then 'ERSTES MAL
|
|
Page.Session("navParent") = "admin"
|
|
|
|
If Not Request.QueryString("lan") Is Nothing AndAlso Request.QueryString("lan").ToString <> "" Then
|
|
laenderkuerzel = Request.QueryString("lan")
|
|
Else
|
|
If laenderkuerzel = "" Then laenderkuerzel = "de"
|
|
End If
|
|
|
|
|
|
If Not Request.QueryString("menuID") Is Nothing AndAlso Request.QueryString("menuID").ToString <> "" Then
|
|
menueId = Request.QueryString("menuID")
|
|
Else
|
|
menueId = 1
|
|
End If
|
|
|
|
initHomepage()
|
|
Page.Session("hp_content") = hp_content
|
|
Try
|
|
Me.Sprache.SelectedValue = laenderkuerzel.ToUpper
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Protected Sub Update_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click ' Handles btnUpdate.Click
|
|
|
|
Dim hp_content As hp_content = Nothing
|
|
hp_content = Page.Session("hp_content") 'sonst gehs ned, weil werte nicht geladfen sind
|
|
hp_content.hp_content = txtContent.Text
|
|
hp_content.hp_imgPath = txtMenueIMGPfad.Text
|
|
hp_content.hp_title = txtMenueBez.Text
|
|
hp_content.hp_slogan = txtMenueSlogan.Text
|
|
|
|
laenderkuerzel = Request.QueryString("lan")
|
|
'If hp_content.hp_id >= 0 Then
|
|
DB.update_HPContentNew(hp_content, laenderkuerzel)
|
|
'Else
|
|
|
|
'End If
|
|
' initHomepage()
|
|
End Sub
|
|
|
|
|
|
Protected Sub SpracheChanged(sender As Object, e As EventArgs) Handles Sprache.SelectedIndexChanged
|
|
Response.Redirect("admin.aspx?menuId=" & Request.QueryString("menuID") & "&lan=" & Sprache.Text.ToLower)
|
|
End Sub
|
|
|
|
|
|
Protected Sub btnDoSql_Click(sender As Object, e As EventArgs) Handles btnDoSql.Click ' Handles btnUpdate.Click
|
|
|
|
If sqlText.Text <> "" Then
|
|
DB.doTheSql(sqlText.Text)
|
|
Else
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
Sub initHomepage()
|
|
Try
|
|
|
|
laenderkuerzel = Request.QueryString("lan")
|
|
hp_content = DB.qry_contentNew(menueId, laenderkuerzel)
|
|
If hp_content Is Nothing Then
|
|
hp_content = New hp_content
|
|
hp_content.hp_content = ""
|
|
hp_content.hp_id = menueId
|
|
|
|
' hp_content.hp_id = -1
|
|
End If
|
|
Catch ex As Exception
|
|
' MsgBox("ERR")
|
|
System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">alert('ERR: " & ex.Message & "')</SCRIPT>")
|
|
End Try
|
|
' Exit Sub
|
|
txtContent.Text = hp_content.hp_content.Replace("\r\n", vbNewLine)
|
|
txtMenueIMGPfad.Text = hp_content.hp_imgPath
|
|
txtMenueBez.Text = hp_content.hp_title
|
|
txtMenueSlogan.Text = hp_content.hp_slogan
|
|
|
|
Try
|
|
If hp_content.hp_imgPath <> "" Then
|
|
picMenue.ImageUrl = "../" & hp_content.hp_imgPath
|
|
End If
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
|
|
' btnDel.Enabled = False 'del
|
|
' BtnAdd.Enabled = False 'unter
|
|
If hp_content.hp_instance <> "" Then
|
|
' If hp_content.hp_instance > 0 Then btnDel.Enabled = True
|
|
' If hp_content.hp_instance < 2 Then BtnAdd.Enabled = True
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
Protected Sub BtnAdd_Click(sender As Object, e As EventArgs) 'Handles BtnAdd.Click
|
|
Exit Sub
|
|
Dim hp_content As hp_content = Nothing
|
|
|
|
hp_content = Page.Session("hp_content") 'sonst gehs ned, weil werte nicht geladfen sind
|
|
Dim title = InputBox("Bitte geben Sie den deutschen Menü-Titel an:")
|
|
' System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">alert('Hello this is an Alert')</SCRIPT>")
|
|
|
|
If title <> "" Then
|
|
MsgBox(laenderkuerzel)
|
|
'Request.QueryString("menuID")
|
|
menueId = DB.insert_HPContentNew(hp_content, laenderkuerzel, title, hp_content.hp_id, hp_content.hp_instance)
|
|
Response.Redirect("admin.aspx?menuId=" & menueId & "&lan=" & laenderkuerzel)
|
|
'initHomepage()
|
|
Else
|
|
MsgBox("Der Titel darf nicht leer sein!")
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub btnDel_Click(sender As Object, e As EventArgs) 'Handles btnDel.Click
|
|
Dim hp_content As hp_content = Nothing
|
|
hp_content = Page.Session("hp_content") 'sonst gehs ned, weil werte nicht geladfen sind
|
|
If vbYes = MsgBox("Möchten Sie wirklich diese Seite und allen Sprachen löschen?" & vbNewLine & "'" & hp_content.hp_title & "'", vbYesNoCancel) Then 'alle Unterseiten in
|
|
DB.deleteHpMenueAndContent(hp_content.hp_id)
|
|
End If
|
|
Response.Redirect("admin.aspx?menuId=1&lan=" & laenderkuerzel)
|
|
End Sub
|
|
End Class
|