logo
Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
marwic  
#1 Posted : Friday, June 26, 2009 11:18:55 AM(UTC)
Guest

Rank: Guest

Groups: Guest
Joined: 9/17/2008(UTC)
Posts: 66

I have a question

How make a submenu in 2 columns like you have on PBWEBSOLUTIONS.NET website?

Thanks

Wanna join the discussion?! Login to your Sienn Forum forum account. New Registrations are disabled.

Tijs  
#2 Posted : Wednesday, July 8, 2009 5:33:26 PM(UTC)
Tijs

Rank: Sienn Developer

Reputation:

Groups: Administration
Joined: 10/8/2008(UTC)
Posts: 25
Man
Location: Netherlands

The way it was done on the websolutions site is custom built for that site in an opencontrol. This to determine when a new column needs to start.

Here you find the code:

Source:
Code:


Dim pbwEngine As New SiennEngine.pbwEngine
Dim CID as String = pbw.Get_Cid_Currentdomain
Dim Pbw_MenuScriptDirectStijlen As New SiennEngine.Pbw_Menu_ScriptDirectStijlen
Dim ItemTeller As Integer = -1
Dim ItemTekst(150) As String
Dim ItemType(150) As String
Dim ItemId(150) As Integer
Dim ITeller As Integer = 0
Dim GekozenHmi As Integer = Request.Params("Hmi") 
Dim GekozenSmi As Integer = Request.Params("Smi")  
Dim Selectedid As Integer = Request.Params("Sid") 
Dim Taalid As Integer = Request.Params("Tid")  
Dim Ltekst As New System.Web.UI.LiteralControl
Ltekst.Text = ItemTekst(ITeller)
Dim ItId As Integer = 3191
Dim TussenHoofd, Voorhoofd, Achterhoofd As String
Dim TussenSub, VoorSub, AchterSub As String
Dim Naam As String
Dim DefTid, HoofdmenuCellClassesAantal, SubmenuCellClassesAantal As Integer
Dim Vertikaalmenu, HoofdmenuCellClassesDoornummeren, SubmenuCellClassesDoornummeren As Boolean
Dim retwaarde as integer = -1

Dim StartRow as Integer = 0
Dim EndRow as Integer = 0

StartRow = Cint(Par(0))
EndRow = Cint(Par(1))





Dim TArray(9) As String
Dim VArray(9) As String
Dim ArrayCount As Integer = 0

TArray(0) = "String Tussen Submenu"
TArray(1) = "String Voor Submenu"
TArray(2) = "String Achter Submenu"
TArray(3) = "ClassName"
TArray(4) = "Vaste Taal Id"
TArray(5) = "Vertikaal Menu"
TArray(6) = "Classe Per Submenu"
TArray(7) = "Aantal Classes Per Submenu"
TArray(8) = "Cid Index"
TArray(9) = "Aansturing"

ArrayCount = 10

pbw.Get_SiteTemplate_PropertiesBlock(ItId, ArrayCount, TArray, VArray, CID, Constring)



Dim GekozenMenuItem As Integer
Dim DefTaalId As Integer


DefTaalId = Taalid

'Sub Kopjes
TussenSub = Varray(0)
VoorSub = Varray(1)
AchterSub = Varray(2)

'Naam
Naam = Varray(3)

'TaalOverrule?
Try
	If CInt(Varray(4)) > 0 Then
		DefTaalId = CInt(Varray(4))
	End If
Catch ex As Exception

End Try

'Verticaal Menu?
If microsoft.visualbasic.UCase(Varray(5)) = "JA" Then
	Vertikaalmenu = True
Else
	Vertikaalmenu = False
End If

SubmenuCellClassesDoornummeren = False
Try
	If Varray(6) = "Ja" Then
		SubmenuCellClassesDoornummeren = True
	Else
		SubmenuCellClassesDoornummeren = False
	End If
	If CInt(Varray(7)) > 0 Then
		SubmenuCellClassesAantal = CInt(Varray(7))
	Else
		SubmenuCellClassesDoornummeren = False
		SubmenuCellClassesAantal = 0
	End If

Catch ex As Exception
	SubmenuCellClassesDoornummeren = False
End Try
Dim CidIndex As Integer = 0
Try
	CidIndex = CInt(Varray(8))
	If CidIndex < 0 Then
		CidIndex = 0
	End If
Catch ex As Exception
	CidIndex = 0
End Try
Dim CIDDEF As String
If CidIndex <= 0 Then
	CIDDEF = CID
Else
	CIDDEF = pbw.Get_Config_Value(CID, CidIndex.ToString, "CIDALTERNATIEF", Constring)
End If

Dim SelectieId As Integer = GekozenHMI
Try
	Dim wrd_tmp As String
	wrd_tmp = Varray(9)
	Select Case wrd_tmp
		Case "Geselecteerd Item"
			SelectieId = Selectedid
		Case "Submenu"
			SelectieId = GekozenSMI
		Case Else '"Hoofdmenu"
			SelectieId = GekozenHMI
	End Select
Catch ex As Exception
	SelectieId = 0
End Try
ltekst.Text = Get_Menu_Style_Submenu_scriptdirectlink("/", GekozenMenuItem, submenucellclassesdoornummeren, submenucellclassesaantal, GekozenHMI, GekozenSMI, Selectedid, SelectieId, Naam, Naam, False, Session, Vertikaalmenu, TussenSub, VoorSub, AchterSub, "/Basis.aspx", cidDEF, DefTaalId, StartRow, EndRow, Constring)
Controlplace.Controls.Add(Ltekst)
If pbw.Get_TimerAnalyse() Then
	pbw.Analyse_Timing_WriteEnd(20200 + ITeller, "MENUSCRIPTSUB - " & naam)
End If




Function:

Code:

Function Get_Menu_Style_Submenu_scriptdirectlink( _
        ByVal Rootpath As String, _
        ByRef GekozenMenuNummer As Integer, _
        ByVal SubmenuCellClassesDoornummeren As Boolean, _
        ByVal SubmenuCellClassesAantal As Integer, _
        ByVal GekozenHmi As String, _
        ByVal GekozenSmi As String, _
        ByVal SelectedId As String, _
        ByVal SelectieId As String, _
        ByVal VoorloopstringId As String, _
        ByVal VoorloopstringClass As String, _
        ByVal PBSite As Boolean, _
        ByRef Session As System.Web.SessionState.HttpSessionState, _
        ByVal Vertikaalmenu As Boolean, _
        ByVal StringTussen As String, _
        ByVal StringVoor As String, _
        ByVal Stringachter As String, _
        ByVal PaginaAanroep As String, _
        ByVal CidOrgineel As String, _
        ByVal Taalid As Integer, _
        ByVal StartRow As Integer, _
        ByVal EndRow As Integer, _
        ByVal Constring As String) As String
        Dim ItCon As New SqlConnection(Constring)
        Dim ItSel As String
        Dim loginOk As Boolean = False
        Dim webloginOk As Boolean = False
        Dim cid, login, weblogin As String
        Dim tabel_toegang As String = CidOrgineel & "_Toegang"
        Dim adm As Boolean = False
        Dim SubClassnummer As Integer = 1
        Dim taal As String

        Dim Rownumber as integer = 1     

        Try
            loginOk = pbw.Get_Login_cookie(Session, cid, login, adm, taal, PBSite)
        Catch
            loginOk = False
        Finally
        End Try
        Try
            webloginOk = pbw.Get_Weblogin_cookie(Session, weblogin,0)
        Catch ex As Exception
            webloginOk = False
        End Try
        'Speciale check voor administrators van een andere groep
        If Not cid = CidOrgineel Then
            loginOk = False
            adm = False
        End If
        Get_Menu_Style_Submenu_scriptdirectlink = ""
      
        ItSel = ItSel & "SELECT ID,TEKST,LOGIN,GROEP,STIJLINDEX,WEBLOGIN FROM " & CidOrgineel & "_MENU  "
        ItSel = ItSel & "WHERE TYPE = 'SUBMENU' AND OUDER = " & SelectieId.ToString & " AND TAALID=" & Taalid.ToString
        ItSel = ItSel & "ORDER BY VOLGNUMMER "

        Dim myCommand As New SqlCommand(ItSel, ItCon)
        pbw.DBOpen(ItCon, 602)
        Dim myReader As SqlDataReader = myCommand.ExecuteReader()
        Dim first As Boolean = True
        Dim Teller As Integer = 0
        GekozenMenuNummer = 0
        'Opening Tabel
        Get_Menu_Style_Submenu_scriptdirectlink = "<table  cellpadding=0 cellspacing=0 class='Sub" & VoorloopstringClass & "Table'><tr class='Sub" & VoorloopstringClass & "Row'>"
        While myReader.Read()
          If Rownumber > Startrow and Rownumber <= Endrow then
            Dim toegang As Boolean = False
            Dim hulp1 As String = myReader.GetString(1)
            Dim hulp2 As String = myReader.GetString(2)
            If (myReader.GetString(2) = "Nee") Or adm Then
                toegang = True
            Else
                If loginOk Then
                    'Er is ingelogd, check toegang tot de groep van het item
                    toegang = pbw.Get_Right_User("WIJZIG", "Menu", myReader.GetString(3).trim, login, tabel_toegang, Constring)
                End If
            End If
            Try
                If myReader.GetString(5).trim = "Ja" Then
                    If webloginOk Then
                        toegang = True
                    Else
                        toegang = False
                    End If
                End If
            Catch ex As Exception
            End Try
            If toegang Then
                Dim linkstring As String
                Dim linkstringkaal
                Dim Tekstwaarde As String
                Dim Td As String
                Dim Id As String

                Dim actiefsubmenu As Integer
                If SelectieId = GekozenHmi Then
                    actiefsubmenu = myReader.GetInt32(0)
                Else
                    actiefsubmenu = GekozenSmi
                End If
                linkstringkaal = pbw.Create_Menu_Link(CidOrgineel, Rootpath, PaginaAanroep, Taalid, myReader.GetInt32(0), GekozenHmi, actiefsubmenu, Constring)
                linkstring = "<a href=""" & linkstringkaal & """>"
                Tekstwaarde = StringVoor & linkstring & myReader.GetString(1) & "</a>" & Stringachter
                Id = VoorloopstringId & "I" & Teller
                Td = "<td id=""" & Id & """ class="""
                Dim tmpi As Integer = myReader.GetInt32(0)
                If myReader.GetInt32(0) = GekozenSmi Or myReader.GetInt32(0) = SelectedId Then
                    If SubmenuCellClassesDoornummeren Then
                        Td = Td & "Sub" & VoorloopstringClass & SubClassnummer.ToString.trim & "Selected" & """"
                    Else
                        Td = Td & "Sub" & VoorloopstringClass & "Selected" & """"
                    End If
                    GekozenMenuNummer = Teller + 1
                Else
                    If SubmenuCellClassesDoornummeren Then
                        Td = Td & "Sub" & VoorloopstringClass & SubClassnummer.ToString.trim & "Normal" & """"
                    Else
                        Td = Td & "Sub" & VoorloopstringClass & "Normal" & """"
                    End If
                End If
                If SubmenuCellClassesDoornummeren Then
                    Td = Td & " onmouseover=""MenuOver('" & Id & "','" & SubClassnummer.ToString.trim & "','Sub" & VoorloopstringClass & "')"" onmouseout=""MenuNormal('" & Id & "','" & SubClassnummer.ToString.trim & "','Sub" & VoorloopstringClass & "')"" onclick=""MenuSelected('" & Id & "','" & linkstringkaal & "','" & SubClassnummer.ToString.trim & "','Sub" & VoorloopstringClass & "')"">"
                Else
                    Td = Td & " onmouseover=""MenuOver('" & Id & "','','Sub" & VoorloopstringClass & "')"" onmouseout=""MenuNormal('" & Id & "','','Sub" & VoorloopstringClass & "')"" onclick=""MenuSelected('" & Id & "','" & linkstringkaal & "','','Sub" & VoorloopstringClass & "')"">"
                End If
                'Tussenvoegen StringTussen
                If first Then
                    first = False
                Else
                    If StringTussen.Length > 0 Then
                        Get_Menu_Style_Submenu_scriptdirectlink = Get_Menu_Style_Submenu_scriptdirectlink & "<td class=""" & VoorloopstringClass & "NormalTussen" & """>" & StringTussen & "</td>"
                    End If
                    Tekstwaarde = StringVoor & linkstring & myReader.GetString(1) & "</a>" & Stringachter
                End If
                Get_Menu_Style_Submenu_scriptdirectlink = Get_Menu_Style_Submenu_scriptdirectlink & Td & Tekstwaarde & "</td>"
                If Vertikaalmenu Then
                    Get_Menu_Style_Submenu_scriptdirectlink = Get_Menu_Style_Submenu_scriptdirectlink & "</tr><tr class='Sub" & VoorloopstringClass & "Row'>"
                End If
                Teller = Teller + 1
                SubClassnummer = SubClassnummer + 1
                If SubClassnummer > SubmenuCellClassesAantal Then
                    SubClassnummer = 1
                End If
            End If
            Rownumber = Rownumber + 1
          Else
            Teller = Teller + 1
            SubClassnummer = SubClassnummer + 1
            Rownumber = Rownumber + 1
            GekozenMenuNummer = Teller + 1
          End If

        End While
        pbw.DBClose(ItCon, 602)
        Get_Menu_Style_Submenu_scriptdirectlink = Get_Menu_Style_Submenu_scriptdirectlink & "</tr></table>"
        If Teller <= 0 Then
            Get_Menu_Style_Submenu_scriptdirectlink = ""
        End If

    End Function




Please note that with the new UL menu's, similiar effects are possible
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.