@@ -32,6 +32,7 @@ namespace YAF.DotNetNuke
32
32
using System . Web ;
33
33
using System . Web . Security ;
34
34
using System . Web . UI ;
35
+ using System . Web . UI . WebControls ;
35
36
36
37
using global ::DotNetNuke . Common . Utilities ;
37
38
using global ::DotNetNuke . Entities . Modules ;
@@ -53,14 +54,12 @@ namespace YAF.DotNetNuke
53
54
using YAF . Classes ;
54
55
using YAF . Classes . Data ;
55
56
using YAF . Core ;
56
- using YAF . Core . Model ;
57
57
using YAF . DotNetNuke . Components . Objects ;
58
58
using YAF . DotNetNuke . Components . Utils ;
59
59
using YAF . Types ;
60
60
using YAF . Types . Attributes ;
61
61
using YAF . Types . Extensions ;
62
62
using YAF . Types . Interfaces ;
63
- using YAF . Types . Models ;
64
63
65
64
#endregion
66
65
@@ -71,11 +70,6 @@ public partial class YafDnnModule : PortalModuleBase, IActionable, IHaveServiceL
71
70
{
72
71
#region Constants and Fields
73
72
74
- /// <summary>
75
- /// The _create new board.
76
- /// </summary>
77
- private bool createNewBoard ;
78
-
79
73
/// <summary>
80
74
/// The _portal settings.
81
75
/// </summary>
@@ -109,23 +103,28 @@ public ModuleActionCollection ModuleActions
109
103
get
110
104
{
111
105
ModuleActionCollection actions = new ModuleActionCollection
112
- {
113
- {
114
- this . GetNextActionID ( ) ,
115
- Localization . GetString ( "EditYafSettings.Text" , this . LocalResourceFile ) ,
116
- ModuleActionType . AddContent , string . Empty , string . Empty , this . EditUrl ( ) ,
117
- false ,
118
- SecurityAccessLevel . Host ,
119
- true ,
120
- false
121
- } ,
122
- {
123
- this . GetNextActionID ( ) , Localization . GetString ( "UserImporter.Text" , this . LocalResourceFile ) ,
124
- ModuleActionType . AddContent , string . Empty , string . Empty , this . EditUrl ( "Import" ) , false ,
125
- SecurityAccessLevel . Host ,
126
- true ,
127
- false }
128
- } ;
106
+ {
107
+ {
108
+ this . GetNextActionID ( ) ,
109
+ Localization . GetString (
110
+ "EditYafSettings.Text" ,
111
+ this . LocalResourceFile ) ,
112
+ ModuleActionType . AddContent ,
113
+ string . Empty , string . Empty ,
114
+ this . EditUrl ( ) , false ,
115
+ SecurityAccessLevel . Host , true , false
116
+ } ,
117
+ {
118
+ this . GetNextActionID ( ) ,
119
+ Localization . GetString (
120
+ "UserImporter.Text" ,
121
+ this . LocalResourceFile ) ,
122
+ ModuleActionType . AddContent ,
123
+ string . Empty , string . Empty ,
124
+ this . EditUrl ( "Import" ) , false ,
125
+ SecurityAccessLevel . Host , true , false
126
+ }
127
+ } ;
129
128
130
129
return actions ;
131
130
}
@@ -139,7 +138,9 @@ public string SessionUserKeyName
139
138
get
140
139
{
141
140
return "yaf_dnn_boardid{0}_userid{1}_portalid{2}" . FormatWith (
142
- this . forum1 . BoardID , this . UserId , this . CurrentPortalSettings . PortalId ) ;
141
+ this . forum1 . BoardID ,
142
+ this . UserId ,
143
+ this . CurrentPortalSettings . PortalId ) ;
143
144
}
144
145
}
145
146
@@ -289,63 +290,6 @@ private static void SetDnnLangToYaf()
289
290
}
290
291
}
291
292
292
- /// <summary>
293
- /// Creates the new board.
294
- /// </summary>
295
- /// <param name="dnnUserInfo">The DNN user info.</param>
296
- /// <param name="dnnUser">The DNN user.</param>
297
- private void CreateNewBoard ( UserInfo dnnUserInfo , MembershipUser dnnUser )
298
- {
299
- if ( dnnUserInfo . IsSuperUser )
300
- {
301
- // This is HOST and probably the first board.
302
- // The install routine already created the first board.
303
- // Make sure Module settings are in place
304
- var objForumSettings = new ModuleController ( ) ;
305
-
306
- objForumSettings . UpdateModuleSetting ( this . ModuleId , "forumboardid" , "1" ) ;
307
- objForumSettings . UpdateModuleSetting ( this . ModuleId , "forumcategoryid" , string . Empty ) ;
308
-
309
- this . forum1 . BoardID = 1 ;
310
- }
311
- else
312
- {
313
- // This is an admin adding a new forum.
314
- var newBoardName = "{0} Forums" . FormatWith ( this . CurrentPortalSettings . PortalName ) ;
315
-
316
- // Create the board
317
- var yafCultureInfo = CultureUtilities . GetYafCultureInfo (
318
- YafCultures ,
319
- Localization . GetPageLocale ( this . CurrentPortalSettings ) ) ;
320
-
321
- var largestBoardId = YafContext . Current . GetRepository < Board > ( )
322
- . Create (
323
- newBoardName ,
324
- yafCultureInfo . Culture ,
325
- yafCultureInfo . LanguageFile ,
326
- "DotNetNuke" ,
327
- "DotNetNuke" ,
328
- dnnUserInfo . Username ,
329
- dnnUserInfo . Email ,
330
- dnnUser . ProviderUserKey . ToString ( ) ,
331
- false ,
332
- string . Empty ) ;
333
-
334
- // Assign the new forum to this module
335
- var objForumSettings = new ModuleController ( ) ;
336
-
337
- objForumSettings . UpdateModuleSetting ( this . ModuleId , "forumboardid" , largestBoardId . ToString ( ) ) ;
338
- objForumSettings . UpdateModuleSetting ( this . ModuleId , "forumcategoryid" , string . Empty ) ;
339
-
340
- this . forum1 . BoardID = largestBoardId ;
341
- }
342
-
343
- var boardSettings = new YafLoadBoardSettings ( this . forum1 . BoardID ) { DNNPageTab = this . TabId } ;
344
-
345
- // save the settings to the database
346
- boardSettings . SaveRegistry ( ) ;
347
- }
348
-
349
293
/// <summary>
350
294
/// Handles the Load event of the DotNetNukeModule control.
351
295
/// </summary>
@@ -366,7 +310,7 @@ private void DotNetNukeModule_Load(object sender, EventArgs e)
366
310
367
311
try
368
312
{
369
- this . CreateOrUpdateUser ( ) ;
313
+ this . CreateOrUpdateUser ( ) ;
370
314
}
371
315
catch ( Exception ex )
372
316
{
@@ -412,13 +356,6 @@ private void CreateOrUpdateUser()
412
356
return ;
413
357
}
414
358
415
- // Admin or Host user?
416
- if ( ( dnnUserInfo . IsSuperUser || dnnUserInfo . UserID == this . CurrentPortalSettings . AdministratorId ) &&
417
- this . createNewBoard )
418
- {
419
- this . CreateNewBoard ( dnnUserInfo , dnnMembershipUser ) ;
420
- }
421
-
422
359
// Check if the user exists in yaf
423
360
var yafUserId = LegacyDb . user_get ( this . forum1 . BoardID , dnnMembershipUser . ProviderUserKey ) ;
424
361
@@ -482,8 +419,8 @@ private void Forum1_PageTitleSet(object sender, ForumPageTitleArgs e)
482
419
if ( this . CurrentPortalSettings . ActiveTab . Title . IsSet ( ) )
483
420
{
484
421
if (
485
- YafContext . Current . Get < YafBoardSettings > ( ) . Name . Equals (
486
- this . CurrentPortalSettings . ActiveTab . Title ) )
422
+ YafContext . Current . Get < YafBoardSettings > ( )
423
+ . Name . Equals ( this . CurrentPortalSettings . ActiveTab . Title ) )
487
424
{
488
425
removeTabName = 1 ;
489
426
}
@@ -495,7 +432,8 @@ private void Forum1_PageTitleSet(object sender, ForumPageTitleArgs e)
495
432
{
496
433
this . BasePage . Title =
497
434
this . BasePage . Title . Replace (
498
- "> {0}" . FormatWith ( this . CurrentPortalSettings . ActiveTab . TabName ) , string . Empty ) ;
435
+ "> {0}" . FormatWith ( this . CurrentPortalSettings . ActiveTab . TabName ) ,
436
+ string . Empty ) ;
499
437
}
500
438
501
439
BreadCrumbHelper . UpdateDnnBreadCrumb ( this , "dnnBreadcrumb" ) ;
@@ -518,8 +456,6 @@ private void InitializeComponent()
518
456
this . Load += this . DotNetNukeModule_Load ;
519
457
this . forum1 . PageTitleSet += this . Forum1_PageTitleSet ;
520
458
521
- this . createNewBoard = false ;
522
-
523
459
// This will create an error if there is no setting for forumboardid
524
460
if ( this . Settings [ "forumboardid" ] != null )
525
461
{
@@ -538,7 +474,7 @@ private void InitializeComponent()
538
474
this . PortalSettings . ActiveTab . TabID ,
539
475
this . ModuleId ) ) ) ;
540
476
}
541
- else
477
+ /* else
542
478
{
543
479
boardSettings.DNNPageTab = this.TabId;
544
480
@@ -547,14 +483,30 @@ private void InitializeComponent()
547
483
548
484
// Reload forum settings
549
485
YafContext.Current.BoardSettings = null;
550
- }
486
+ }*/
487
+ }
488
+
489
+ // Inherit Language from Dnn?
490
+ var ineritDnnLanguage = true ;
491
+
492
+ if ( this . Settings [ "InheritDnnLanguage" ] != null )
493
+ {
494
+ ineritDnnLanguage = this . Settings [ "InheritDnnLanguage" ] . ToType < bool > ( ) ;
495
+ }
496
+
497
+ if ( ineritDnnLanguage )
498
+ {
499
+ SetDnnLangToYaf ( ) ;
500
+ }
501
+
502
+ // Override to set to specifc ID
503
+ if ( this . Settings [ "forumcategoryid" ] != null )
504
+ {
505
+ this . forum1 . CategoryID = this . Settings [ "forumcategoryid" ] . ToType < int > ( ) ;
551
506
}
552
507
}
553
508
else
554
509
{
555
- // Create a new board
556
- this . createNewBoard = true ;
557
-
558
510
if ( HttpContext . Current . User . Identity . IsAuthenticated && UserController . GetCurrentUserInfo ( ) . IsSuperUser )
559
511
{
560
512
this . Response . Redirect (
@@ -563,25 +515,17 @@ private void InitializeComponent()
563
515
this . PortalSettings . ActiveTab . TabID ,
564
516
this . ModuleId ) ) ) ;
565
517
}
566
- }
567
-
568
- // Inherit Language from Dnn?
569
- var ineritDnnLanguage = true ;
570
-
571
- if ( this . Settings [ "InheritDnnLanguage" ] != null )
572
- {
573
- ineritDnnLanguage = this . Settings [ "InheritDnnLanguage" ] . ToType < bool > ( ) ;
574
- }
575
-
576
- if ( ineritDnnLanguage )
577
- {
578
- SetDnnLangToYaf ( ) ;
579
- }
580
-
581
- // Override to set to specifc ID
582
- if ( this . Settings [ "forumcategoryid" ] != null )
583
- {
584
- this . forum1 . CategoryID = this . Settings [ "forumcategoryid" ] . ToType < int > ( ) ;
518
+ else
519
+ {
520
+ this . pnlModuleContent . Controls . Clear ( ) ;
521
+
522
+ this . pnlModuleContent . Controls . Add (
523
+ new Literal
524
+ {
525
+ Text =
526
+ "<div class=\" dnnFormMessage dnnFormInfo\" >Please login as Superuser (host) and Setup the forum first.</div>"
527
+ } ) ;
528
+ }
585
529
}
586
530
}
587
531
0 commit comments