-
Notifications
You must be signed in to change notification settings - Fork 1
/
ObjectSummary.ascx.vb
151 lines (121 loc) · 5.25 KB
/
ObjectSummary.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
'
' Copyright (c) 2004-2011 DNN-Europe, http://www.dnn-europe.net
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this
' software and associated documentation files (the "Software"), to deal in the Software
' without restriction, including without limitation the rights to use, copy, modify, merge,
' publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
' to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or
' substantial portions of the Software.
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
' INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
' PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
' FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
' ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'
Imports DNNEurope.Modules.LocalizationEditor.Data
Imports DotNetNuke.Services.Localization
Imports DNNEurope.Modules.LocalizationEditor.Entities.Objects
Imports DNNEurope.Modules.LocalizationEditor.Entities.Permissions
Partial Public Class ObjectSummary
Inherits ModuleBase
#Region " Private Members "
Private _ObjectId As Integer
Private _locale As String
Private _moduleFriendlyName As String
Private _original As ObjectMetrics
Private _target As ObjectMetrics
#End Region
#Region " Properties "
Public Property ModuleFriendlyName() As String
Get
Return _moduleFriendlyName
End Get
Set(ByVal value As String)
_moduleFriendlyName = value
End Set
End Property
Public Property Locale() As String
Get
Return _locale
End Get
Set(ByVal value As String)
_locale = value
End Set
End Property
Public Property ObjectId() As Integer
Get
Return _ObjectId
End Get
Set(ByVal value As Integer)
_ObjectId = value
End Set
End Property
Public Property Target() As ObjectMetrics
Get
Return _target
End Get
Set(ByVal value As ObjectMetrics)
_target = value
End Set
End Property
Public Property Original() As ObjectMetrics
Get
Return _original
End Get
Set(ByVal value As ObjectMetrics)
_original = value
End Set
End Property
#End Region
#Region " Event Handlers "
Private Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init
Globals.ReadValue(Me.Request.Params, "ObjectId", ObjectId)
Globals.ReadValue(Me.Request.Params, "Locale", Locale)
Dim objObjectInfo As ObjectInfo = ObjectsController.GetObject(ObjectId)
If objObjectInfo Is Nothing Then Return
ModuleFriendlyName = objObjectInfo.FriendlyName
' we no longer automatically read the latest version from the installed versions!
'If Not Me.IsPostBack Then
' LocalizationController.ReadResourceFiles(Server.MapPath("~/"), PortalId, objObjectInfo, UserId)
'End If
Original = ObjectsController.GetObjectMetrics(ObjectId, "")
Target = ObjectsController.GetObjectMetrics(ObjectId, Locale)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
' Permission check here
If Not PermissionsController.HasAccess(UserInfo, PortalSettings.AdministratorRoleName, ModuleId, Locale) Then
Throw New Exception("Access denied")
End If
ddSourceLocale.DataSource = DataProvider.Instance.GetLocalesForUser(PortalSettings.AdministratorId, PortalId, ModuleId)
ddSourceLocale.DataBind()
ddSourceLocale.Items.Insert(0, New ListItem(Localization.GetString("NoSource", Me.LocalResourceFile), ""))
ddVersion.DataSource = DataProvider.Instance.GetVersions(ObjectId)
ddVersion.DataBind()
Try
ddVersion.Items.FindByValue(Original.CurrentVersion).Selected = True
Catch
End Try
ddSelection.DataSource = DataProvider.Instance().GetFiles(ObjectId, Original.CurrentVersion)
ddSelection.DataBind()
ddSelection.Items.Insert(0, New ListItem(Localization.GetString("All", Me.LocalResourceFile), "All"))
ddSelection.Items.Insert(0, New ListItem(Localization.GetString("New", Me.LocalResourceFile), "New"))
ddSelection.Items.Insert(0, New ListItem(Localization.GetString("Untranslated", Me.LocalResourceFile), "Untranslated"))
cmdDownload.NavigateUrl = EditUrl("ObjectId", ObjectId.ToString, "DownloadPack")
cmdReturn.NavigateUrl = DotNetNuke.Common.NavigateURL
End If
End Sub
Private Sub cmdEdit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdEdit.Click
Dim url As String = ""
If ddSourceLocale.SelectedValue = "" Then
url = EditUrl("ObjectId", ObjectId.ToString, "Edit", "Locale=" & Locale.ToString, "Version=" & ddVersion.SelectedValue, "Selection=" & ddSelection.SelectedValue)
Else
url = EditUrl("ObjectId", ObjectId.ToString, "Edit", "Locale=" & Locale.ToString, "Version=" & ddVersion.SelectedValue, "SourceLocale=" & ddSourceLocale.SelectedValue, "Selection=" & ddSelection.SelectedValue)
End If
Me.Response.Redirect(url, False)
End Sub
#End Region
End Class