Skip to content

Commit cc0758f

Browse files
committed
fixed fresh install of yaf
1 parent 4824786 commit cc0758f

File tree

4 files changed

+69
-121
lines changed

4 files changed

+69
-121
lines changed

yaf_dnn/Installation/License.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en-US">
33
<head>
44
<title>YetAnotherForum.NET Apache License 2.0</title>
5-
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" />
5+
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" />
66
</head>
77
<body>
88
<div class="container">

yaf_dnn/Installation/ReadMe.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en-US">
33
<head>
44
<title>YetAnotherForum.NET DNN Module Installation and Upgrading</title>
5-
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" />
5+
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" />
66
</head>
77
<body>
88
<div class="container">

yaf_dnn/Installation/Uninstall.SqlDataProvider

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if exists (select top 1 1 from {databaseOwner}sysobjects where id = object_id(N'{databaseOwner}{objectQualifier}yaf_topic_latest_in_category') AND Objectproperty(id,N'IsProcedure') = 1)
2+
drop procedure {databaseOwner}{objectQualifier}yaf_topic_latest_in_category
3+
GO
4+
15
IF exists (select top 1 1 from {databaseOwner}sysobjects where id = OBJECT_ID(N'{databaseOwner}{objectQualifier}YafDnn_Messages') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
26
DROP PROCEDURE {databaseOwner}{objectQualifier}YafDnn_Messages
37
GO

yaf_dnn/YafDnnModule.ascx.cs

+63-119
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace YAF.DotNetNuke
3232
using System.Web;
3333
using System.Web.Security;
3434
using System.Web.UI;
35+
using System.Web.UI.WebControls;
3536

3637
using global::DotNetNuke.Common.Utilities;
3738
using global::DotNetNuke.Entities.Modules;
@@ -53,14 +54,12 @@ namespace YAF.DotNetNuke
5354
using YAF.Classes;
5455
using YAF.Classes.Data;
5556
using YAF.Core;
56-
using YAF.Core.Model;
5757
using YAF.DotNetNuke.Components.Objects;
5858
using YAF.DotNetNuke.Components.Utils;
5959
using YAF.Types;
6060
using YAF.Types.Attributes;
6161
using YAF.Types.Extensions;
6262
using YAF.Types.Interfaces;
63-
using YAF.Types.Models;
6463

6564
#endregion
6665

@@ -71,11 +70,6 @@ public partial class YafDnnModule : PortalModuleBase, IActionable, IHaveServiceL
7170
{
7271
#region Constants and Fields
7372

74-
/// <summary>
75-
/// The _create new board.
76-
/// </summary>
77-
private bool createNewBoard;
78-
7973
/// <summary>
8074
/// The _portal settings.
8175
/// </summary>
@@ -109,23 +103,28 @@ public ModuleActionCollection ModuleActions
109103
get
110104
{
111105
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+
};
129128

130129
return actions;
131130
}
@@ -139,7 +138,9 @@ public string SessionUserKeyName
139138
get
140139
{
141140
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);
143144
}
144145
}
145146

@@ -289,63 +290,6 @@ private static void SetDnnLangToYaf()
289290
}
290291
}
291292

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-
349293
/// <summary>
350294
/// Handles the Load event of the DotNetNukeModule control.
351295
/// </summary>
@@ -366,7 +310,7 @@ private void DotNetNukeModule_Load(object sender, EventArgs e)
366310

367311
try
368312
{
369-
this.CreateOrUpdateUser();
313+
this.CreateOrUpdateUser();
370314
}
371315
catch (Exception ex)
372316
{
@@ -412,13 +356,6 @@ private void CreateOrUpdateUser()
412356
return;
413357
}
414358

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-
422359
// Check if the user exists in yaf
423360
var yafUserId = LegacyDb.user_get(this.forum1.BoardID, dnnMembershipUser.ProviderUserKey);
424361

@@ -482,8 +419,8 @@ private void Forum1_PageTitleSet(object sender, ForumPageTitleArgs e)
482419
if (this.CurrentPortalSettings.ActiveTab.Title.IsSet())
483420
{
484421
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))
487424
{
488425
removeTabName = 1;
489426
}
@@ -495,7 +432,8 @@ private void Forum1_PageTitleSet(object sender, ForumPageTitleArgs e)
495432
{
496433
this.BasePage.Title =
497434
this.BasePage.Title.Replace(
498-
"> {0}".FormatWith(this.CurrentPortalSettings.ActiveTab.TabName), string.Empty);
435+
"> {0}".FormatWith(this.CurrentPortalSettings.ActiveTab.TabName),
436+
string.Empty);
499437
}
500438

501439
BreadCrumbHelper.UpdateDnnBreadCrumb(this, "dnnBreadcrumb");
@@ -518,8 +456,6 @@ private void InitializeComponent()
518456
this.Load += this.DotNetNukeModule_Load;
519457
this.forum1.PageTitleSet += this.Forum1_PageTitleSet;
520458

521-
this.createNewBoard = false;
522-
523459
// This will create an error if there is no setting for forumboardid
524460
if (this.Settings["forumboardid"] != null)
525461
{
@@ -538,7 +474,7 @@ private void InitializeComponent()
538474
this.PortalSettings.ActiveTab.TabID,
539475
this.ModuleId)));
540476
}
541-
else
477+
/*else
542478
{
543479
boardSettings.DNNPageTab = this.TabId;
544480
@@ -547,14 +483,30 @@ private void InitializeComponent()
547483
548484
// Reload forum settings
549485
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>();
551506
}
552507
}
553508
else
554509
{
555-
// Create a new board
556-
this.createNewBoard = true;
557-
558510
if (HttpContext.Current.User.Identity.IsAuthenticated && UserController.GetCurrentUserInfo().IsSuperUser)
559511
{
560512
this.Response.Redirect(
@@ -563,25 +515,17 @@ private void InitializeComponent()
563515
this.PortalSettings.ActiveTab.TabID,
564516
this.ModuleId)));
565517
}
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+
}
585529
}
586530
}
587531

0 commit comments

Comments
 (0)