forked from ventrian/Simple-Gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gallery.ascx.vb
executable file
·177 lines (123 loc) · 6.24 KB
/
Gallery.ascx.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
'
' Simple Gallery for DotNetNuke - http://www.dotnetnuke.com
' Copyright (c) 2002-2007
' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
'
Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Entities.Modules.Actions
Imports DotNetNuke.Security
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Localization
Imports Ventrian.SimpleGallery.Common
Imports Ventrian.SimpleGallery.Entities
Namespace Ventrian.SimpleGallery
Partial Public Class Gallery
Inherits SimpleGalleryBase
Implements IActionable
#Region " Private Members "
Private _controlToLoad As String
#End Region
#Region " Private Methods "
Private Sub LoadControlType()
Dim objPortalModuleBase As PortalModuleBase = CType(Me.LoadControl(_controlToLoad), PortalModuleBase)
If Not (objPortalModuleBase Is Nothing) Then
objPortalModuleBase.ModuleConfiguration = Me.ModuleConfiguration
objPortalModuleBase.ID = System.IO.Path.GetFileNameWithoutExtension(_controlToLoad)
phControls.Controls.Add(objPortalModuleBase)
End If
End Sub
Private Sub InitializeModule()
If (Settings.Contains("InitializeModule") = False) Then
Dim objAlbumController As New AlbumController
Dim objAlbums As ArrayList = objAlbumController.List(Me.ModuleId, Null.NullInteger, False, False, AlbumSortType.Caption, SortDirection.ASC)
If (objAlbums.Count = 0) Then
Dim objAlbum As New AlbumInfo
objAlbum.ModuleID = Me.ModuleId
objAlbum.ParentAlbumID = Null.NullInteger
objAlbum.Caption = Localization.GetString("UntitledAlbum", Me.LocalResourceFile)
If (objAlbum.Caption = "") Then
objAlbum.Caption = "Untitled Album"
End If
objAlbum.Description = ""
objAlbum.IsPublic = True
objAlbum.HomeDirectory = "Gallery/Album/[ALBUMID]"
objAlbum.CreateDate = DateTime.Now
objAlbum.AlbumID = objAlbumController.Add(objAlbum)
objAlbum.HomeDirectory = "Gallery/Album/" & objAlbum.AlbumID.ToString()
objAlbum.InheritSecurity = True
objAlbumController.Update(objAlbum)
End If
Dim objModuleController As New ModuleController
objModuleController.UpdateModuleSetting(Me.ModuleId, "InitializeModule", "true")
End If
End Sub
Private Sub ReadQueryString()
If Not (Request("galleryType") Is Nothing) Then
' Load the appropriate Control
'
Select Case Request("galleryType").ToLower()
Case "slideshow"
_controlToLoad = "SlideShow.ascx"
Case "upload"
_controlToLoad = "Upload.ascx"
Case "zipalbum"
_controlToLoad = "ZipAlbum.ascx"
Case Else
_controlToLoad = "ViewGallery.ascx"
End Select
Else
_controlToLoad = "ViewGallery.ascx"
If (Request("Tags") = Me.TabModuleId.ToString()) Then
If (Request("Tag") <> "" Or Request("TagID") <> "") Then
_controlToLoad = "ViewTag.ascx"
Else
_controlToLoad = "Tags.ascx"
End If
End If
If (Request("SearchID") = Me.TabModuleId.ToString()) Then
If (Request("SearchText") <> "") Then
_controlToLoad = "ViewSearch.ascx"
Else
_controlToLoad = "SearchBox.ascx"
End If
End If
End If
End Sub
#End Region
#Region " Event Handlers "
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
InitializeModule()
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub Page_Initialize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
Try
ReadQueryString()
LoadControlType()
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
#Region " Optional Interfaces "
Public ReadOnly Property ModuleActions() As DotNetNuke.Entities.Modules.Actions.ModuleActionCollection Implements IActionable.ModuleActions
Get
Dim Actions As New ModuleActionCollection
If (HasUploadPhotoPermissions) Then
Actions.Add(GetNextActionID, Localization.GetString("AddNewPhoto.Text", LocalResourceFile), ModuleActionType.AddContent, "", "", EditUrl("Add"), False, SecurityAccessLevel.View, True, False)
End If
If (HasAlbumPermissions()) Then
Actions.Add(GetNextActionID, Localization.GetString("EditAlbums.Text", LocalResourceFile), ModuleActionType.AddContent, "", "", EditUrl("EditAlbums"), False, SecurityAccessLevel.View, True, False)
End If
Actions.Add(GetNextActionID, Localization.GetString("EditTags.Text", LocalResourceFile), ModuleActionType.ContentOptions, "", "", EditUrl("EditTags"), False, SecurityAccessLevel.Edit, True, False)
Actions.Add(GetNextActionID, Localization.GetString("EditTemplates.Text", LocalResourceFile), ModuleActionType.ContentOptions, "", "", EditUrl("EditTemplates"), False, SecurityAccessLevel.Edit, True, False)
Return Actions
End Get
End Property
#End Region
End Class
End Namespace