forked from DNNCommunity/DNN.Events
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EditEvents.ascx.vb
2148 lines (1906 loc) · 112 KB
/
EditEvents.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'
' DotNetNuke® - http://www.dnnsoftware.com
' Copyright (c) 2002-2013
' by DNNCorp
'
' 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 DotNetNuke.Security.Permissions
Imports DotNetNuke.Security.Roles
Imports System.Globalization
Imports System.Collections
Imports DotNetNuke.Security
Imports DotNetNuke.Web.UI.WebControls.Extensions
Namespace DotNetNuke.Modules.Events
<DNNtc.ModuleControlProperties("Edit", "Edit Events", DNNtc.ControlType.View, "https://dnnevents.codeplex.com/documentation", False, True)> _
Partial Class EditEvents
Inherits EventBase
#Region "Private Area"
Private _itemID As Integer = -1
Private _editRecur As Boolean = True
Private ReadOnly _objCtlEvent As New EventController
Private ReadOnly _objCtlEventRecurMaster As New EventRecurMasterController
Private _objEvent As New EventInfo
Private _objEventSignups As New EventSignupsInfo
Private ReadOnly _objCtlEventSignups As New EventSignupsController
Private _lstEvents As New ArrayList
Private ReadOnly _lstOwnerUsers As New ArrayList
Private ReadOnly _culture As CultureInfo = Threading.Thread.CurrentThread.CurrentCulture
Private Const RecurTableDisplayType As String = "inline-block"
#End Region
#Region "Event Handlers"
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As EventArgs) Handles MyBase.Load
Try
' Verify that the current user has edit access to this module
If PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName.ToString) Or _
IsModuleEditor() Then
Else
' to stop errors when not authorised to edit
valReminderTime.MinimumValue = "15"
valReminderTime.MaximumValue = "60"
Response.Redirect(GetSocialNavigateUrl(), True)
End If
grdAddUser.ModuleConfiguration = ModuleConfiguration.Clone
' Add the external Validation.js to the Page
Const csname As String = "ExtValidationScriptFile"
Dim cstype As Type = System.Reflection.MethodBase.GetCurrentMethod().GetType()
Dim cstext As String = "<script src=""" & ResolveUrl("~/DesktopModules/Events/Scripts/Validation.js") & """ type=""text/javascript""></script>"
If Not Page.ClientScript.IsClientScriptBlockRegistered(csname) Then
Page.ClientScript.RegisterClientScriptBlock(cstype, csname, cstext, False)
End If
' Determine ItemId of Event to Update
If Not (Request.Params("ItemId") Is Nothing) Then
_itemID = Int32.Parse(Request.Params("ItemId"))
End If
_editRecur = False
If Not (Request.Params("EditRecur") Is Nothing) Then
If Request.Params("EditRecur").ToLower = "all" Then
_editRecur = True
End If
End If
' Set the selected theme
SetTheme(pnlEventsModuleEdit)
'EPT: "Changed DotNetNuke.Security.PortalSecurity.HasEditPermissions(ModuleId)" into "IsEditable"
'RWJS: Replaced with custom function IsModuleEditor which checks whether users has editor permissions
If (IsModuleEditor()) Or _
(IsModerator()) Or _
(PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName.ToString)) Then
Else
Response.Redirect(GetSocialNavigateUrl(), True)
End If
trOwner.Visible = False
If (IsModerator() And Settings.Ownerchangeallowed) Or _
PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName.ToString) Then
trOwner.Visible = True
End If
pnlEnroll.Visible = False
divNoEnrolees.Visible = False
If Settings.Eventsignup Then
pnlEnroll.Visible = True
chkSignups.Visible = True
If Settings.Maxnoenrolees > 1 And divAddUser.Visible Then
divNoEnrolees.Visible = True
End If
End If
trTypeOfEnrollment.Visible = Settings.Eventsignupallowpaid
trPayPalAccount.Visible = Settings.Eventsignupallowpaid
tblEventEmail.Attributes.Add("style", "display:none; width:100%")
If Not Settings.Newpereventemail Then
pnlEventEmailRole.Visible = False
ElseIf _itemID = -1 And Settings.Moderateall And Not IsModerator() Then
pnlEventEmailRole.Visible = False
End If
pnlReminder.Visible = Settings.Eventnotify
pnlImage.Visible = Settings.Eventimage
pnlDetailPage.Visible = Settings.DetailPageAllowed
' Setup Popup Event
dpStartDate.ClientEvents.OnDateSelected = "function() {if (Page_ClientValidate('startdate')) CopyField('" + dpStartDate.ClientID + "','" + dpEndDate.ClientID + "');}"
tpStartTime.ClientEvents.OnDateSelected = "function() {SetComboIndex('" + tpStartTime.ClientID + "','" + tpEndTime.ClientID + "','" + dpStartDate.ClientID + "','" + dpEndDate.ClientID + "','" + Settings.Timeinterval + "');}"
ctlURL.FileFilter = glbImageFileTypes
If Not Page.IsPostBack Then
txtSubject.MaxLength = txtSubject.MaxLength + 1
txtReminder.MaxLength = txtReminder.MaxLength + 1
End If
Dim limitSubject As String = "javascript:limitText(this," + (txtSubject.MaxLength - 1).ToString + ",'" + Localization.GetString("LimitChars", LocalResourceFile) + "');"
Dim limitReminder As String = "javascript:limitText(this," + (txtReminder.MaxLength - 1).ToString + ",'" + Localization.GetString("LimitChars", LocalResourceFile) + "');"
txtSubject.Attributes.Add("onkeydown", limitSubject)
txtSubject.Attributes.Add("onkeyup", limitSubject)
txtReminder.Attributes.Add("onkeydown", limitReminder)
txtReminder.Attributes.Add("onkeyup", limitReminder)
Page.ClientScript.RegisterExpandoAttribute(valValidStartTime2.ClientID, "TimeInterval", Settings.Timeinterval)
Page.ClientScript.RegisterExpandoAttribute(valValidStartTime2.ClientID, "ErrorMessage", String.Format(Localization.GetString("valValidStartTime2", LocalResourceFile), Settings.Timeinterval))
Page.ClientScript.RegisterExpandoAttribute(valValidStartTime2.ClientID, "ClientID", tpStartTime.ClientID)
Page.ClientScript.RegisterExpandoAttribute(valValidEndTime2.ClientID, "TimeInterval", Settings.Timeinterval)
Page.ClientScript.RegisterExpandoAttribute(valValidEndTime2.ClientID, "ErrorMessage", String.Format(Localization.GetString("valValidEndTime2", LocalResourceFile), Settings.Timeinterval))
Page.ClientScript.RegisterExpandoAttribute(valValidEndTime2.ClientID, "ClientID", tpEndTime.ClientID)
' If the page is being requested the first time, determine if an
' contact itemId value is specified, and if so populate page
' contents with the contact details
If Not Page.IsPostBack Then
LocalizeAll()
LoadEvent()
Else
Dim url As String = ctlURL.Url
Dim urlType As String = ctlURL.UrlType
ctlURL.Url = url
ctlURL.UrlType = urlType
End If
If chkReminder.Checked Then
tblReminderDetail.Attributes.Add("style", "display:block;")
Else
tblReminderDetail.Attributes.Add("style", "display:none;")
End If
If chkDetailPage.Checked Then
tblDetailPageDetail.Attributes.Add("style", "display:block;")
Else
tblDetailPageDetail.Attributes.Add("style", "display:none;")
End If
If chkDisplayImage.Checked Then
tblImageURL.Attributes.Add("style", "display:block;")
Else
tblImageURL.Attributes.Add("style", "display:none;")
End If
If chkSignups.Checked Then
tblEnrollmentDetails.Attributes.Add("style", "display:block;")
Else
tblEnrollmentDetails.Attributes.Add("style", "display:none;")
End If
If chkReccuring.Checked Then
tblRecurringDetails.Attributes.Add("style", "display:block;")
Else
tblRecurringDetails.Attributes.Add("style", "display:none;")
End If
If chkEventEmailChk.Checked Then
tblEventEmailRoleDetail.Attributes.Add("style", "display:block;")
Else
tblEventEmailRoleDetail.Attributes.Add("style", "display:none;")
End If
If rblRepeatTypeP1.Checked Then
tblDetailP1.Attributes.Add("style", "display:" & RecurTableDisplayType & ";white-space:nowrap;")
Else
tblDetailP1.Attributes.Add("style", "display:none;white-space:nowrap;")
End If
If rblRepeatTypeW1.Checked Then
tblDetailW1.Attributes.Add("style", "display:" & RecurTableDisplayType & ";")
Else
tblDetailW1.Attributes.Add("style", "display:none;")
End If
If rblRepeatTypeM.Checked Then
tblDetailM1.Attributes.Add("style", "display:" & RecurTableDisplayType & ";")
Else
tblDetailM1.Attributes.Add("style", "display:none;")
End If
If rblRepeatTypeY1.Checked Then
tblDetailY1.Attributes.Add("style", "display:" & RecurTableDisplayType & ";")
Else
tblDetailY1.Attributes.Add("style", "display:none;")
End If
If dpY1Period.SelectedDate.ToString.Length = 0 Then
dpY1Period.SelectedDate = SelectedDate.Date
End If
If txtReminderFrom.Text.Length = 0 Then
txtReminderFrom.Text = Settings.Reminderfrom
End If
If txtEventEmailFrom.Text.Length = 0 Then
txtEventEmailFrom.Text = Settings.Reminderfrom
End If
If chkAllDayEvent.Checked Then
divStartTime.Attributes.Add("style", "display:none;")
divEndTime.Attributes.Add("style", "display:none;")
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Private Sub valValidStartDate3_ServerValidate(source As Object, args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valValidStartDate.ServerValidate
If dpStartDate.SelectedDate Is Nothing Then
args.IsValid = False
valValidStartDate.Visible = True
End If
End Sub
Private Sub valValidStartTime2_ServerValidate(source As Object, args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valValidStartTime2.ServerValidate
Dim inDate As DateTime = CType(tpStartTime.SelectedDate, DateTime)
valValidStartTime2.ErrorMessage = String.Format(Localization.GetString("valValidStartTime2", LocalResourceFile), Settings.Timeinterval)
args.IsValid = ValidateTime(inDate)
End Sub
Private Sub valValidEndTime2_ServerValidate(source As Object, args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valValidEndTime2.ServerValidate
Dim inDate As DateTime = CType(tpEndTime.SelectedDate, DateTime)
valValidEndTime2.ErrorMessage = String.Format(Localization.GetString("valValidEndTime2", LocalResourceFile), Settings.Timeinterval)
args.IsValid = ValidateTime(inDate)
End Sub
Private Sub valValidRecurEndDate_ServerValidate(source As Object, args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles valValidRecurEndDate.ServerValidate
If dpStartDate.SelectedDate Is Nothing Then
Return
End If
Dim recurDate As DateTime = CType(dpRecurEndDate.SelectedDate, DateTime)
Dim startDate As DateTime = CType(dpStartDate.SelectedDate, DateTime)
If recurDate < startDate And Not rblRepeatTypeN.Checked Then
args.IsValid = False
valValidRecurEndDate.Visible = True
Else
args.IsValid = True
valValidRecurEndDate.Visible = False
End If
End Sub
#End Region
#Region "Helper Methods and Functions"
Private Sub LocalizeAll()
Dim culture As CultureInfo = Threading.Thread.CurrentThread.CurrentCulture
txtSubject.Text = Settings.Templates.txtSubject
txtReminder.Text = Settings.Templates.txtMessage
grdEnrollment.Columns(0).HeaderText = Localization.GetString("Select", LocalResourceFile)
grdEnrollment.Columns(1).HeaderText = Localization.GetString("EnrollUserName", LocalResourceFile)
grdEnrollment.Columns(2).HeaderText = Localization.GetString("EnrollDisplayName", LocalResourceFile)
grdEnrollment.Columns(3).HeaderText = Localization.GetString("EnrollEmail", LocalResourceFile)
grdEnrollment.Columns(4).HeaderText = Localization.GetString("EnrollPhone", LocalResourceFile)
grdEnrollment.Columns(5).HeaderText = Localization.GetString("EnrollApproved", LocalResourceFile)
grdEnrollment.Columns(6).HeaderText = Localization.GetString("EnrollNo", LocalResourceFile)
grdEnrollment.Columns(7).HeaderText = Localization.GetString("EventStart", LocalResourceFile)
chkW1Sun.Text = culture.DateTimeFormat.AbbreviatedDayNames(DayOfWeek.Sunday)
chkW1Sun2.Text = culture.DateTimeFormat.AbbreviatedDayNames(DayOfWeek.Sunday)
chkW1Mon.Text = culture.DateTimeFormat.AbbreviatedDayNames(DayOfWeek.Monday)
chkW1Tue.Text = culture.DateTimeFormat.AbbreviatedDayNames(DayOfWeek.Tuesday)
chkW1Wed.Text = culture.DateTimeFormat.AbbreviatedDayNames(DayOfWeek.Wednesday)
chkW1Thu.Text = culture.DateTimeFormat.AbbreviatedDayNames(DayOfWeek.Thursday)
chkW1Fri.Text = culture.DateTimeFormat.AbbreviatedDayNames(DayOfWeek.Friday)
chkW1Sat.Text = culture.DateTimeFormat.AbbreviatedDayNames(DayOfWeek.Saturday)
cmbM1Period.Items.Clear()
' Corrected a problem w/Every nth Week on a specific day with the following
cmbM1Period.Items.Add(New ListItem(culture.DateTimeFormat.GetDayName(DayOfWeek.Sunday), "0"))
cmbM1Period.Items.Add(New ListItem(culture.DateTimeFormat.GetDayName(DayOfWeek.Monday), "1"))
cmbM1Period.Items.Add(New ListItem(culture.DateTimeFormat.GetDayName(DayOfWeek.Tuesday), "2"))
cmbM1Period.Items.Add(New ListItem(culture.DateTimeFormat.GetDayName(DayOfWeek.Wednesday), "3"))
cmbM1Period.Items.Add(New ListItem(culture.DateTimeFormat.GetDayName(DayOfWeek.Thursday), "4"))
cmbM1Period.Items.Add(New ListItem(culture.DateTimeFormat.GetDayName(DayOfWeek.Friday), "5"))
cmbM1Period.Items.Add(New ListItem(culture.DateTimeFormat.GetDayName(DayOfWeek.Saturday), "6"))
cmbM2Period.Items.Clear()
For i As Integer = 1 To 31
cmbM2Period.Items.Add(New ListItem(Localization.GetString(i.ToString(), LocalResourceFile), i.ToString()))
Next
lblMaxRecurrences.Text = String.Format(Localization.GetString("lblMaxRecurrences", LocalResourceFile), Settings.Maxrecurrences)
If culture.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday Then
chkW1Sun.Attributes.Add("style", "display:inline;")
chkW1Sun2.Attributes.Add("style", "display:none;")
Else
chkW1Sun2.Attributes.Add("style", "display:inline;")
chkW1Sun.Attributes.Add("style", "display:none;")
End If
dpStartDate.DatePopupButton.ToolTip = Localization.GetString("DatePickerTooltip", LocalResourceFile)
dpEndDate.DatePopupButton.ToolTip = Localization.GetString("DatePickerTooltip", LocalResourceFile)
dpRecurEndDate.DatePopupButton.ToolTip = Localization.GetString("DatePickerTooltip", LocalResourceFile)
dpY1Period.DatePopupButton.ToolTip = Localization.GetString("DatePickerTooltip", LocalResourceFile)
tpEndTime.TimePopupButton.ToolTip = Localization.GetString("TimePickerTooltip", LocalResourceFile)
End Sub
Public Sub LoadEvent()
StorePrevPageInViewState()
pnlRecurring.Visible = True
lblMaxRecurrences.Visible = False
If Not Settings.Allowreoccurring Then
dpRecurEndDate.Enabled = False
cmbP1Period.Enabled = False
txtP1Every.Enabled = False
dpRecurEndDate.Visible = False
cmbP1Period.Visible = False
txtP1Every.Visible = False
pnlRecurring.Visible = False
Else
If Settings.Maxrecurrences <> "" Then
lblMaxRecurrences.Visible = True
End If
End If
'Populate the timezone combobox (look up timezone translations based on currently set culture)
cboTimeZone.DataBind(Settings.TimeZoneId)
If Not Settings.EnableEventTimeZones Then
cboTimeZone.Enabled = False
End If
If _editRecur Then
deleteButton.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("ConfirmEventSeriesDelete", LocalResourceFile) + "');")
deleteButton.Text = Localization.GetString("deleteSeriesButton", LocalResourceFile)
updateButton.Text = Localization.GetString("updateSeriesButton", LocalResourceFile)
copyButton.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("ConfirmEventCopy", LocalResourceFile) + "');")
copyButton.Text = Localization.GetString("copySeriesButton", LocalResourceFile)
Else
deleteButton.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("ConfirmEventDelete", LocalResourceFile) + "');")
deleteButton.Text = Localization.GetString("deleteButton", LocalResourceFile)
updateButton.Text = Localization.GetString("updateButton", LocalResourceFile)
copyButton.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("ConfirmEventCopy", LocalResourceFile) + "');")
copyButton.Text = Localization.GetString("copyButton", LocalResourceFile)
End If
lnkSelectedEmail.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("ConfirmSendToAllSelected", LocalResourceFile) + "');")
lnkSelectedDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("ConfirmDeleteSelected", LocalResourceFile) + "');")
txtPayPalAccount.Text = Settings.Paypalaccount
Dim iInterval As Integer = CInt(Settings.Timeinterval)
Dim currentDate As DateTime = ModuleNow()
Dim currentMinutes As Integer = currentDate.Minute
Dim remainder As Integer = currentMinutes Mod iInterval
If remainder > 0 Then
currentDate = currentDate.AddMinutes(iInterval - remainder)
End If
tpStartTime.TimeView.Interval = New TimeSpan(0, iInterval, 0)
tpStartTime.SelectedDate = currentDate
tpEndTime.TimeView.Interval = New TimeSpan(0, iInterval, 0)
tpEndTime.SelectedDate = currentDate.AddMinutes(iInterval)
' Can this event be moderated?
lblModerated.Visible = Settings.Moderateall
' Send Reminder Default
chkReminder.Checked = Settings.Sendreminderdefault
' Populate description
ftbDesktopText.Text = Settings.Templates.NewEventTemplate
' Set default validation value
valNoEnrolees.MaximumValue = "9999"
' Hide enrolment info by default
lblEnrolledUsers.Visible = False
grdEnrollment.Visible = False
lnkSelectedDelete.Visible = False
lnkSelectedEmail.Visible = False
trAllowAnonEnroll.Visible = Settings.AllowAnonEnroll
' Populate enrollment email text boxes
txtEventEmailSubject.Text = Settings.Templates.txtEditViewEmailSubject
txtEventEmailBody.Text = Settings.Templates.txtEditViewEmailBody
If _itemID <> -1 Then
' Edit Item Mode
Dim objEvent As EventInfo
objEvent = _objCtlEvent.EventsGet(_itemID, ModuleId)
Dim blEventSignup As Boolean
If Settings.Eventsignup Then
blEventSignup = objEvent.Signups
Else
blEventSignup = False
End If
If blEventSignup Then
pnlEnroll.Visible = True
chkSignups.Visible = True
lnkSelectedDelete.Visible = True
lnkSelectedEmail.Visible = True
If _itemID <> 0 Then
tblEventEmail.Attributes.Add("style", "display:block; width:100%")
End If
End If
' Check user has edit permissions to this event
If IsEventEditor(objEvent, False) Then
Else
Response.Redirect(GetSocialNavigateUrl(), True)
End If
' Create an object to consolidate master/single data into - use master object for common data
Dim objEventData As EventRecurMasterInfo
objEventData = _objCtlEventRecurMaster.EventsRecurMasterGet(objEvent.RecurMasterID, objEvent.ModuleID)
' Hide recurrences section, disable timezone change if it is a recurring event
' and we aren't editing the series
If objEventData.RRULE <> "" And Not _editRecur Then
pnlRecurring.Visible = False
cboTimeZone.Enabled = False
End If
' If we are editing single item, populate with single event data
If Not _editRecur Then
With objEventData
.Dtstart = objEvent.EventTimeBegin
.Duration = CType(objEvent.Duration, String) + "M"
.Until = objEvent.EventTimeBegin
.RRULE = ""
.EventName = objEvent.EventName
.EventDesc = objEvent.EventDesc
.Importance = CType(objEvent.Importance, EventRecurMasterInfo.Priority)
.Notify = objEvent.Notify
.Approved = objEvent.Approved
.Signups = objEvent.Signups
.AllowAnonEnroll = objEvent.AllowAnonEnroll
.JournalItem = objEvent.JournalItem
.MaxEnrollment = objEvent.MaxEnrollment
.EnrollRoleID = objEvent.EnrollRoleID
.EnrollFee = objEvent.EnrollFee
.EnrollType = objEvent.EnrollType
.Enrolled = objEvent.Enrolled
.PayPalAccount = objEvent.PayPalAccount
.DetailPage = objEvent.DetailPage
.DetailNewWin = objEvent.DetailNewWin
.DetailURL = objEvent.DetailURL
.ImageURL = objEvent.ImageURL
.ImageType = objEvent.ImageType
.ImageWidth = objEvent.ImageWidth
.ImageHeight = objEvent.ImageHeight
.ImageDisplay = objEvent.ImageDisplay
.Location = objEvent.Location
.Category = objEvent.Category
.Reminder = objEvent.Reminder
.SendReminder = objEvent.SendReminder
.ReminderTime = objEvent.ReminderTime
.ReminderTimeMeasurement = objEvent.ReminderTimeMeasurement
.ReminderFrom = objEvent.ReminderFrom
.CustomField1 = objEvent.CustomField1
.CustomField2 = objEvent.CustomField2
.EnrollListView = objEvent.EnrollListView
.DisplayEndDate = objEvent.DisplayEndDate
.AllDayEvent = objEvent.AllDayEvent
.OwnerID = objEvent.OwnerID
.SocialGroupID = objEvent.SocialGroupId
.SocialUserID = objEvent.SocialUserId
.Summary = objEvent.Summary
End With
End If
Dim intDuration As Integer
intDuration = CInt(Left(objEventData.Duration, Len(objEventData.Duration) - 1))
txtTitle.Text = objEventData.EventName
ftbDesktopText.Text = objEventData.EventDesc
' Set Dropdown to Original TimeZone w/ModuleID Settings TimeZone
cboTimeZone.DataBind(objEvent.EventTimeZoneId)
' Set dates/times
dpStartDate.SelectedDate = objEventData.Dtstart.Date()
dpEndDate.SelectedDate = objEventData.Dtstart.AddMinutes(intDuration).Date
dpRecurEndDate.SelectedDate = objEventData.Until
' Adjust Time not in DropDown Selection...
Dim starttime As DateTime = objEventData.Dtstart
If starttime.Minute Mod iInterval > 0 Then
starttime = objEventData.Dtstart.Date.AddMinutes((objEventData.Dtstart.Hour * 60) + (starttime.Minute) - (starttime.Minute Mod iInterval))
End If
tpStartTime.SelectedDate = starttime
Dim endtime As DateTime = objEventData.Dtstart.AddMinutes(intDuration)
If endtime.Minute Mod iInterval > 0 Then
endtime = objEventData.Dtstart.AddMinutes(intDuration).Date.AddMinutes((objEventData.Dtstart.AddMinutes(intDuration).Hour * 60) + (endtime.Minute) - (endtime.Minute Mod iInterval))
End If
tpEndTime.SelectedDate = endtime
chkSignups.Checked = objEventData.Signups
chkAllowAnonEnroll.Checked = objEventData.AllowAnonEnroll
txtMaxEnrollment.Text = objEventData.MaxEnrollment.ToString
txtEnrolled.Text = objEventData.Enrolled.ToString
txtPayPalAccount.Text = objEventData.PayPalAccount.ToString
If objEventData.EnrollType = "PAID" Then
rblFree.Checked = False
rblPaid.Checked = True
ElseIf objEventData.EnrollType = "FREE" Then
rblFree.Checked = True
rblPaid.Checked = False
End If
txtEnrollFee.Text = String.Format("{0:F2}", objEventData.EnrollFee)
lblTotalCurrency.Text = PortalSettings.Currency
If blEventSignup Then
' Load Enrolled User Grid
BuildEnrolleeGrid(objEvent)
End If
If IsNumeric(objEventData.EnrollRoleID) Then
LoadEnrollRoles(CInt(objEventData.EnrollRoleID))
LoadNewEventEmailRoles(CInt(objEventData.EnrollRoleID))
Else
LoadEnrollRoles(-1)
LoadNewEventEmailRoles(-1)
End If
LoadCategory(objEventData.Category)
LoadLocation(objEventData.Location)
LoadOwnerUsers(objEventData.OwnerID)
cmbImportance.SelectedIndex = CType(GetCmbStatus(objEventData.Importance, "cmbImportance"), Int16)
CreatedBy.Text = objEvent.CreatedBy
CreatedDate.Text = objEventData.CreatedDate.ToShortDateString
lblCreatedBy.Visible = True
CreatedBy.Visible = True
lblOn.Visible = True
CreatedDate.Visible = True
pnlAudit.Visible = True
Dim objEventRRULE As EventRRULEInfo
objEventRRULE = _objCtlEventRecurMaster.DecomposeRRULE(objEventData.RRULE, objEventData.Dtstart)
Dim strRepeatType As String = _objCtlEventRecurMaster.RepeatType(objEventRRULE)
Select Case strRepeatType
Case "N"
rblRepeatTypeN.Checked = True
cmbP1Period.SelectedIndex = 0
'txtP1Every.Text = "0"
Case "P1"
rblRepeatTypeP1.Checked = True
chkReccuring.Checked = True
cmbP1Period.SelectedIndex = CType(GetCmbStatus(Left(objEventRRULE.Freq, 1), "cmbP1Period"), Int16)
txtP1Every.Text = objEventRRULE.Interval.ToString()
Case "W1"
rblRepeatTypeW1.Checked = True
chkReccuring.Checked = True
If _culture.DateTimeFormat.FirstDayOfWeek = DayOfWeek.Sunday Then
chkW1Sun.Checked = objEventRRULE.Su
Else
chkW1Sun2.Checked = objEventRRULE.Su
End If
chkW1Mon.Checked = objEventRRULE.Mo
chkW1Tue.Checked = objEventRRULE.Tu
chkW1Wed.Checked = objEventRRULE.We
chkW1Thu.Checked = objEventRRULE.Th
chkW1Fri.Checked = objEventRRULE.Fr
chkW1Sat.Checked = objEventRRULE.Sa
txtW1Every.Text = objEventRRULE.Interval.ToString()
Case "M1"
rblRepeatTypeM1.Checked = True
rblRepeatTypeM.Checked = True
chkReccuring.Checked = True
txtMEvery.Text = objEventRRULE.Interval.ToString()
Dim intEvery, intPeriod As Integer
If objEventRRULE.Su Then
intPeriod = 0
intEvery = objEventRRULE.SuNo
End If
If objEventRRULE.Mo Then
intPeriod = 1
intEvery = objEventRRULE.MoNo()
End If
If objEventRRULE.Tu Then
intPeriod = 2
intEvery = objEventRRULE.TuNo
End If
If objEventRRULE.We Then
intPeriod = 3
intEvery = objEventRRULE.WeNo
End If
If objEventRRULE.Th Then
intPeriod = 4
intEvery = objEventRRULE.ThNo
End If
If objEventRRULE.Fr Then
intPeriod = 5
intEvery = objEventRRULE.FrNo
End If
If objEventRRULE.Sa Then
intPeriod = 6
intEvery = objEventRRULE.SaNo
End If
cmbM1Period.SelectedIndex = intPeriod
If intEvery = -1 Then
cmbM1Every.SelectedIndex = 4
Else
cmbM1Every.SelectedIndex = intEvery - 1
End If
Case "M2"
rblRepeatTypeM2.Checked = True
rblRepeatTypeM.Checked = True
chkReccuring.Checked = True
cmbM2Period.SelectedIndex = objEventRRULE.ByMonthDay - 1
txtMEvery.Text = objEventRRULE.Interval.ToString()
Case "Y1"
rblRepeatTypeY1.Checked = True
chkReccuring.Checked = True
Dim invCulture As CultureInfo = CultureInfo.InvariantCulture
Dim annualdate As Date = Date.ParseExact(Format(objEventData.Dtstart, "yyyy") & "/" & objEventRRULE.ByMonth.ToString & "/" & objEventRRULE.ByMonthDay.ToString, "yyyy/M/d", invCulture)
dpY1Period.SelectedDate = annualdate.Date
End Select
chkReminder.Checked = objEventData.SendReminder
txtReminder.Text = objEventData.Reminder
If txtReminder.Text.Length = 0 Then
txtReminder.Text = Settings.Templates.txtMessage
End If
txtSubject.Text = objEventData.Notify
If txtSubject.Text.Length = 0 Then
txtSubject.Text = Settings.Templates.txtSubject
End If
txtReminderFrom.Text = objEventData.ReminderFrom
txtEventEmailFrom.Text = objEventData.ReminderFrom
If objEventData.ReminderTime < 0 Then
txtReminderTime.Text = 15.ToString()
Else
txtReminderTime.Text = objEventData.ReminderTime.ToString
End If
If Not ddlReminderTimeMeasurement.Items.FindByValue(objEventData.ReminderTimeMeasurement.ToString) Is Nothing Then
ddlReminderTimeMeasurement.ClearSelection()
ddlReminderTimeMeasurement.Items.FindByValue(objEventData.ReminderTimeMeasurement.ToString).Selected = True
End If
' Set DetailURL
chkDetailPage.Checked = objEventData.DetailPage
URLDetail.Url = objEventData.DetailURL
' Set Image Control
chkDisplayImage.Checked = objEventData.ImageDisplay
ctlURL.Url = objEventData.ImageURL
If objEventData.ImageURL.StartsWith("FileID=") Then
Dim fileId As Integer = Integer.Parse(objEventData.ImageURL.Substring(7))
Dim objFileInfo As Services.FileSystem.IFileInfo = Services.FileSystem.FileManager.Instance.GetFile(fileId)
If Not objFileInfo Is Nothing Then
ctlURL.Url = objFileInfo.Folder & objFileInfo.FileName
Else
chkDisplayImage.Checked = False
End If
End If
If objEventData.ImageWidth <> 0 And objEventData.ImageWidth <> -1 Then
txtWidth.Text = objEventData.ImageWidth.ToString()
End If
If objEventData.ImageHeight <> 0 And objEventData.ImageHeight <> -1 Then
txtHeight.Text = objEventData.ImageHeight.ToString()
End If
txtCustomField1.Text = objEventData.CustomField1
txtCustomField2.Text = objEventData.CustomField2
chkEnrollListView.Checked = objEventData.EnrollListView
chkDisplayEndDate.Checked = objEventData.DisplayEndDate
chkAllDayEvent.Checked = objEventData.AllDayEvent
ftbSummary.Text = objEventData.Summary
If blEventSignup Then
LoadRegUsers()
End If
Else
dpStartDate.SelectedDate = SelectedDate.Date
dpEndDate.SelectedDate = SelectedDate.Date
txtEnrollFee.Text = String.Format("{0:F2}", 0.0)
lblTotalCurrency.Text = PortalSettings.Currency
dpRecurEndDate.SelectedDate = SelectedDate.AddDays(1)
dpY1Period.SelectedDate = SelectedDate.Date
chkEnrollListView.Checked = Settings.Eventdefaultenrollview
chkDisplayEndDate.Checked = True
chkAllDayEvent.Checked = False
' Do not default recurrance end date
' Force user to key/select
LoadEnrollRoles(-1)
LoadNewEventEmailRoles(-1)
LoadCategory()
LoadLocation(-1)
LoadOwnerUsers(UserId)
pnlAudit.Visible = False
deleteButton.Visible = False
End If
If _itemID = -1 Or _editRecur Then
divAddUser.Visible = False
divNoEnrolees.Visible = False
End If
Dim errorminutes As String = Localization.GetString("invalidReminderMinutes", LocalResourceFile)
Dim errorhours As String = Localization.GetString("invalidReminderHours", LocalResourceFile)
Dim errordays As String = Localization.GetString("invalidReminderDays", LocalResourceFile)
ddlReminderTimeMeasurement.Attributes.Add("onchange", "valRemTime('" & valReminderTime.ClientID & "','" & valReminderTime2.ClientID & "','" & valReminderTime.ValidationGroup & "','" & ddlReminderTimeMeasurement.ClientID & "','" & errorminutes & "','" & errorhours & "','" & errordays & "');")
Select Case ddlReminderTimeMeasurement.SelectedValue
Case "m"
valReminderTime.ErrorMessage = errorminutes
valReminderTime.MinimumValue = "15"
valReminderTime.MaximumValue = "60"
Case "h"
valReminderTime.ErrorMessage = errorhours
valReminderTime.MinimumValue = "1"
valReminderTime.MaximumValue = "24"
Case "d"
valReminderTime.ErrorMessage = errordays
valReminderTime.MinimumValue = "1"
valReminderTime.MaximumValue = "30"
End Select
valReminderTime2.ErrorMessage = valReminderTime.ErrorMessage
If txtPayPalAccount.Text.Length = 0 Then
txtPayPalAccount.Text = Settings.Paypalaccount
End If
trCustomField1.Visible = Settings.EventsCustomField1
trCustomField2.Visible = Settings.EventsCustomField2
trTimeZone.Visible = Settings.Tzdisplay
chkDetailPage.Attributes.Add("onclick", "javascript:showTbl('" + chkDetailPage.ClientID + "','" + tblDetailPageDetail.ClientID + "');")
chkReminder.Attributes.Add("onclick", "javascript:showTbl('" + chkReminder.ClientID + "','" + tblReminderDetail.ClientID + "');")
chkDisplayImage.Attributes.Add("onclick", "javascript:showTbl('" + chkDisplayImage.ClientID + "','" + tblImageURL.ClientID + "');")
chkReccuring.Attributes.Add("onclick", "javascript:if (this.checked == true) dnn.dom.getById('" + rblRepeatTypeP1.ClientID + "').checked = true; else dnn.dom.getById('" + rblRepeatTypeN.ClientID + "').checked = true;showhideTbls('" + RecurTableDisplayType + "','" + chkReccuring.ClientID + "','" + tblRecurringDetails.ClientID + "','" + rblRepeatTypeP1.ClientID + "','" + tblDetailP1.ClientID + "','" + rblRepeatTypeW1.ClientID + "','" + tblDetailW1.ClientID + "','" + rblRepeatTypeM.ClientID + "','" + tblDetailM1.ClientID + "','" + rblRepeatTypeY1.ClientID + "','" + tblDetailY1.ClientID + "');")
If Settings.Eventsignup Then
chkEventEmailChk.Attributes.Add("onclick", "javascript:showhideChk2('" + chkEventEmailChk.ClientID + "','" + tblEventEmailRoleDetail.ClientID + "','" + chkSignups.ClientID + "','" + tblEventEmail.ClientID + "');")
Else
chkEventEmailChk.Attributes.Add("onclick", "javascript:showhideChk2('" + chkEventEmailChk.ClientID + "','" + tblEventEmailRoleDetail.ClientID + "','" + chkEventEmailChk.ClientID + "','" + tblEventEmail.ClientID + "');")
End If
rblRepeatTypeP1.Attributes.Add("onclick", "javascript:showhideTbls('" + RecurTableDisplayType + "','" + chkReccuring.ClientID + "','" + tblRecurringDetails.ClientID + "','" + rblRepeatTypeP1.ClientID + "','" + tblDetailP1.ClientID + "','" + rblRepeatTypeW1.ClientID + "','" + tblDetailW1.ClientID + "','" + rblRepeatTypeM.ClientID + "','" + tblDetailM1.ClientID + "','" + rblRepeatTypeY1.ClientID + "','" + tblDetailY1.ClientID + "');")
rblRepeatTypeW1.Attributes.Add("onclick", "javascript:showhideTbls('" + RecurTableDisplayType + "','" + chkReccuring.ClientID + "','" + tblRecurringDetails.ClientID + "','" + rblRepeatTypeP1.ClientID + "','" + tblDetailP1.ClientID + "','" + rblRepeatTypeW1.ClientID + "','" + tblDetailW1.ClientID + "','" + rblRepeatTypeM.ClientID + "','" + tblDetailM1.ClientID + "','" + rblRepeatTypeY1.ClientID + "','" + tblDetailY1.ClientID + "');")
rblRepeatTypeM.Attributes.Add("onclick", "javascript:showhideTbls('" + RecurTableDisplayType + "','" + chkReccuring.ClientID + "','" + tblRecurringDetails.ClientID + "','" + rblRepeatTypeP1.ClientID + "','" + tblDetailP1.ClientID + "','" + rblRepeatTypeW1.ClientID + "','" + tblDetailW1.ClientID + "','" + rblRepeatTypeM.ClientID + "','" + tblDetailM1.ClientID + "','" + rblRepeatTypeY1.ClientID + "','" + tblDetailY1.ClientID + "');if (this.checked == true) dnn.dom.getById('" + rblRepeatTypeM1.ClientID + "').checked = true;")
rblRepeatTypeY1.Attributes.Add("onclick", "javascript:showhideTbls('" + RecurTableDisplayType + "','" + chkReccuring.ClientID + "','" + tblRecurringDetails.ClientID + "','" + rblRepeatTypeP1.ClientID + "','" + tblDetailP1.ClientID + "','" + rblRepeatTypeW1.ClientID + "','" + tblDetailW1.ClientID + "','" + rblRepeatTypeM.ClientID + "','" + tblDetailM1.ClientID + "','" + rblRepeatTypeY1.ClientID + "','" + tblDetailY1.ClientID + "');")
btnCopyStartdate.Attributes.Add("onclick", String.Format("javascript:CopyStartDateToEnddate('{0}','{1}','{2}','{3}','{4}');", dpStartDate.ClientID, dpEndDate.ClientID, tpStartTime.ClientID, tpEndTime.ClientID, chkAllDayEvent.ClientID))
chkAllDayEvent.Attributes.Add("onclick", "javascript:showTimes('" + chkAllDayEvent.ClientID + "','" + divStartTime.ClientID + "','" + divEndTime.ClientID + "');")
End Sub
Public Function GetCmbStatus(ByVal value As Object, ByVal cmbDropDown As String) As Long
Dim iIndex As Integer
Dim oDropDown As DropDownList
oDropDown = CType(FindControl(cmbDropDown), DropDownList)
For iIndex = 0 To oDropDown.Items.Count - 1
If oDropDown.Items(iIndex).Value = CType(value, String) Then
Return iIndex
End If
Next
End Function
Public Sub LoadEnrollRoles(ByVal roleID As Integer)
Dim objRoles As New RoleController
ddEnrollRoles.DataSource = objRoles.GetPortalRoles(PortalId)
ddEnrollRoles.DataTextField = "RoleName"
ddEnrollRoles.DataValueField = "RoleID"
ddEnrollRoles.DataBind()
'"<None Specified>"
ddEnrollRoles.Items.Insert(0, New ListItem(Localization.GetString("None", LocalResourceFile), "-1"))
If roleID = 0 Then
ddEnrollRoles.Items.FindByValue("0").Selected() = True
ElseIf (roleID > 0) Then
If ddEnrollRoles.Items.FindByValue(CType(roleID, String)) Is Nothing Then
ddEnrollRoles.Items.Insert(0, New ListItem(Localization.GetString("EnrolleeRoleDeleted", LocalResourceFile), roleID.ToString))
End If
ddEnrollRoles.Items.FindByValue(CType(roleID, String)).Selected = True
End If
End Sub
Public Sub LoadNewEventEmailRoles(ByVal roleID As Integer)
Dim objRoles As New RoleController
ddEventEmailRoles.DataSource = objRoles.GetPortalRoles(PortalId)
ddEventEmailRoles.DataTextField = "RoleName"
ddEventEmailRoles.DataValueField = "RoleID"
ddEventEmailRoles.DataBind()
If roleID < 0 Or ddEventEmailRoles.Items.FindByValue(CType(roleID, String)) Is Nothing Then
Try
ddEventEmailRoles.Items.FindByValue(PortalSettings.RegisteredRoleId.ToString).Selected() = True
Catch
End Try
Else
ddEventEmailRoles.Items.FindByValue(CType(roleID, String)).Selected = True
End If
End Sub
Public Sub LoadCategory(Optional ByVal category As Integer = Nothing)
Dim objCntCategories As New EventCategoryController
Dim tmpCategories As ArrayList = objCntCategories.EventsCategoryList(PortalId)
Dim objCategories As New ArrayList
If (Settings.Enablecategories = EventModuleSettings.DisplayCategories.DoNotDisplay And Settings.ModuleCategoriesSelected = EventModuleSettings.CategoriesSelected.Some) _
Or Settings.Restrictcategories Then
For Each objCategory As EventCategoryInfo In tmpCategories
For Each moduleCategory As Integer In Settings.ModuleCategoryIDs
If moduleCategory = objCategory.Category Then
objCategories.Add(objCategory)
End If
Next
Next
Else
objCategories = tmpCategories
End If
cmbCategory.DataSource = objCategories
cmbCategory.DataTextField = "CategoryName"
cmbCategory.DataValueField = "Category"
cmbCategory.DataBind()
' Do we need to add None?
If (Not Settings.Enablecategories = EventModuleSettings.DisplayCategories.DoNotDisplay Or Settings.ModuleCategoriesSelected = EventModuleSettings.CategoriesSelected.All) _
And Settings.Restrictcategories = False Then
cmbCategory.Items.Insert(0, New ListItem(Localization.GetString("None", LocalResourceFile), "-1"))
End If
' Select the appropriate row
If Settings.ModuleCategoriesSelected = EventModuleSettings.CategoriesSelected.All Then
cmbCategory.ClearSelection()
cmbCategory.Items(0).Selected = True
End If
If (category > 0) And Not IsNothing(category) Then
cmbCategory.ClearSelection()
cmbCategory.Items.FindByValue(CType(category, String)).Selected = True
ElseIf Not Settings.Enablecategories = EventModuleSettings.DisplayCategories.DoNotDisplay And Settings.ModuleCategoriesSelected = EventModuleSettings.CategoriesSelected.Some Then
cmbCategory.ClearSelection()
cmbCategory.Items.FindByValue(CType(Settings.ModuleCategoryIDs.Item(0), String)).Selected = True
End If
End Sub
Public Sub LoadLocation(ByVal location As Integer)
Dim objCntLocation As New EventLocationController
cmbLocation.DataSource = objCntLocation.EventsLocationList(PortalId)
cmbLocation.DataTextField = "LocationName"
cmbLocation.DataValueField = "Location"
cmbLocation.DataBind()
'"<None Specified>"
cmbLocation.Items.Insert(0, New ListItem(Localization.GetString("None", LocalResourceFile), "-1"))
If (location > 0) And Not IsNothing(location) Then
cmbLocation.Items.FindByValue(CType(location, String)).Selected = True
End If
End Sub
Private Sub LoadOwnerUsers(ByVal ownerID As Integer)
Dim objCollModulePermission As ModulePermissionCollection
objCollModulePermission = ModulePermissionController.GetModulePermissions(ModuleId, TabId)
Dim objModulePermission As ModulePermissionInfo
' To cope with host users or someone who is no longer an editor!!
Dim objEventModuleEditor As New EventUser
objEventModuleEditor.UserID = ownerID
LoadSingleUser(objEventModuleEditor, _lstOwnerUsers)
If (IsModerator() And Settings.Ownerchangeallowed) Or _
PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName.ToString) Then
For Each objModulePermission In objCollModulePermission
If objModulePermission.PermissionKey = "EVENTSEDT" Then
If objModulePermission.UserID < 0 Then
Dim objCtlRole As New RoleController
Dim lstRoleUsers As ArrayList = objCtlRole.GetUsersByRoleName(PortalId, objModulePermission.RoleName)
For Each objUser As UserInfo In lstRoleUsers
objEventModuleEditor = New EventUser
objEventModuleEditor.UserID = objUser.UserID
objEventModuleEditor.DisplayName = objUser.DisplayName
LoadSingleUser(objEventModuleEditor, _lstOwnerUsers)
Next
Else
objEventModuleEditor = New EventUser
objEventModuleEditor.UserID = objModulePermission.UserID
objEventModuleEditor.DisplayName = objModulePermission.DisplayName
LoadSingleUser(objEventModuleEditor, _lstOwnerUsers)
End If
End If
Next
End If
_lstOwnerUsers.Sort(New UserListSort)
cmbOwner.DataSource = _lstOwnerUsers
cmbOwner.DataTextField = "DisplayName"
cmbOwner.DataValueField = "UserID"
cmbOwner.DataBind()
cmbOwner.Items.FindByValue(CType(ownerID, String)).Selected = True
End Sub
Private Sub LoadRegUsers()
grdAddUser.RefreshGrid()
End Sub
Private Sub LoadSingleUser(ByVal objEventUser As EventUser, ByVal lstUsers As ArrayList)
Dim blAdd As Boolean = True
Dim objEventUser2 As EventUser
For Each objEventUser2 In lstUsers
If objEventUser.UserID = objEventUser2.UserID Then
blAdd = False
End If
Next
If blAdd Then
If objEventUser.DisplayName = Nothing Then
Dim objCtlUser As New UserController
Dim objUser As UserInfo = objCtlUser.GetUser(PortalId, objEventUser.UserID)
If Not objUser Is Nothing Then
objEventUser.DisplayName = objUser.DisplayName
Else
objEventUser.DisplayName = Localization.GetString("OwnerDeleted", LocalResourceFile)
End If
End If
lstUsers.Add(objEventUser)
End If
End Sub
Private Sub Email(ByVal selected As Boolean)
Dim item As DataGridItem
Dim objEnroll As EventSignupsInfo
Dim objEvent As EventInfo
' Get Current Event, if <> 0
If _itemID > 0 Then
objEvent = _objCtlEvent.EventsGet(_itemID, ModuleId)
Else
Exit Sub
End If
Dim objEventEmailInfo As New EventEmailInfo
Dim objEventEmail As New EventEmails(PortalId, ModuleId, LocalResourceFile, CType(Page, PageBase).PageCulture.Name)
objEventEmailInfo.TxtEmailSubject = txtEventEmailSubject.Text
objEventEmailInfo.TxtEmailBody = txtEventEmailBody.Text
objEventEmailInfo.TxtEmailFrom() = txtEventEmailFrom.Text
For Each item In grdEnrollment.Items
If CType(item.FindControl("chkSelect"), CheckBox).Checked Or (selected = False) Then
objEnroll = _objCtlEventSignups.EventsSignupsGet(CType(grdEnrollment.DataKeys(item.ItemIndex), Integer), ModuleId, False)
objEventEmailInfo.UserIDs.Clear()
objEventEmailInfo.UserEmails.Clear()
objEventEmailInfo.UserLocales.Clear()
objEventEmailInfo.UserTimeZoneIds.Clear()
If objEnroll.UserID > -1 Then
objEventEmailInfo.UserIDs.Add(objEnroll.UserID)
Else
objEventEmailInfo.UserEmails.Add(objEnroll.AnonEmail)
objEventEmailInfo.UserLocales.Add(objEnroll.AnonCulture)
objEventEmailInfo.UserTimeZoneIds.Add(objEnroll.AnonTimeZoneId)
End If
objEventEmail.SendEmails(objEventEmailInfo, objEvent, objEnroll)
End If
Next
End Sub
Private Sub UpdateProcessing(ByVal processItem As Integer)
If Not Page.IsValid Then
Return