Documente Academic
Documente Profesional
Documente Cultură
1 Contents
2 3 Preface .................................................................................................................................................. 3 Changes to Source Code ....................................................................................................................... 4 3.1 3.2 3.3 3.4 4 5 YafUserProfile ............................................................................................................................... 4 SitecoreMembershipUser and SitecoreDomainManager ............................................................. 4 UrlBuilder ...................................................................................................................................... 4 Other changes ............................................................................................................................... 4
How to build the project ....................................................................................................................... 5 Setup YAF in Sitecore ............................................................................................................................ 6 5.1 5.2 5.3 5.4 Prerequisites ................................................................................................................................. 6 Files ............................................................................................................................................... 6 Web.config merges ....................................................................................................................... 7 \App_Config\ConnectionStrings.config ...................................................................................... 10
6 7 8 9
Installing YAF database ....................................................................................................................... 11 Applying YAF to a Sitecore layout ....................................................................................................... 14 Setting up YAF ..................................................................................................................................... 16 Notes ................................................................................................................................................... 17 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 The YAF Security provider is disabled ......................................................................................... 17 YAF uses the Sitecore users from the current domain ............................................................... 17 YAF needs the Anonymous user ................................................................................................. 17 The YAF Guest user no longer exist ............................................................................................ 17 The YAF Guests membership role cannot be used ..................................................................... 17 Provide your own login page ...................................................................................................... 17 Users can be managed from YAF ............................................................................................ 17 Roles can be managed from YAF ................................................................................................ 18
YAF Integration
Page 2
2 Preface
YetAnotherForum (YAF) is an open source discussion forum written in .NET. YAF cannot run in the same application as Sitecore, unless the source code of YAF is changed. Read more about YAF at: http://www.yetanotherforum.net/ The document describes which changes have been made to the YAF source code, how the source code can be built, and how to set up Sitecore so YAF can be run from a Sitecore layout.
YAF Integration
Page 3
SitecoreDomainManager is a helper class for managing the Sitecore domain. The class allows code to remove and add domain names to the user name, and to determine if the user is from an allowed domain. This is necessary to avoid having users from a different domain logging into YAF. If YAF runs in the extranet domain, only extranet users are allowed to log in.
3.3 UrlBuilder
The UrlBuilder is a class allowing YAF to build Urls depending on settings from the web.config, and external Url rewriters. Url rewriting is disabled in this version of YAF, and since YAF can run from any page on the website, the Urls written must point to the current page, not to a page defined in web.config. The UrlBuilder is modified to return the Url of the current page.
YAF Integration
Page 4
YAF Integration
Page 5
5.2 Files
Files are copied from the YAF source code (the source code) to the Sitecore installation (your website): Copy the \YetAnotherForum.NET\App_Code to the root of your website. Copy the following files from the \YetAnotherForum.NET\bin folder to the \bin\ folder of your website: o Intelligencia.UrlRewriter.dll o YAF.Classes.Base.dll o YAF.Classes.Config.dll o YAF.Classes.Data.dll o YAF.Classes.UI.dll o YAF.Classes.Utils.dll o YAF.Controls.dll o YAF.Providers.dll o Also copy the *.pdb files if you have compiled in debug mode. YAF provides .net 2.0 and 3.5 versions of other DLLs that YAF references. Copy the appropriate version from \YetAnotherForum.NET\Bin\Net2.0 or \YetAnotherForum.NET\Bin\Net3.5 to the /bin/ folder of your website: o AjaxControlToolkit.dll o CookComputing.XmlRpcV2.dll o nStuff.UpdateControls.dll Copy mail.config and UrlRewriter.config from \YetAnotherForum.NET\ to the root of your website. Copy the following folders and files from \YetAnotherForum.NET\ to a folder in your website called /yaf/: o /Controls o /Defs o /Editors o /Images o /Install o /Languages o /Pages o /Resources o /Themes o /Upload o Copying
Page 6
YAF Integration
YAF Integration
Page 7
Insert the following just after the end of the /configuration/system.web/pages/controls section:
<namespaces> <add namespace="YAF" /> <add namespace="YAF.Classes.UI" /> <add namespace="YAF.Classes.Utils" /> <add namespace="YAF.Controls" /> <add namespace="YAF.Classes.Data" /> </namespaces>
Change the /configuration/system.web/profile section. Remove the old section and insert the following:
<profile defaultProvider="sql" enabled="true" inherits="YAF.Classes.Utils.YafUserProfile"> <providers> <clear /> <add name="sql" type="System.Web.Profile.SqlProfileProvider" connectionStringName="core" applicationName="sitecore" /> <add name="switcher" type="Sitecore.Security.SwitchingProfileProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/profile" /> </providers> <properties> <clear /> <add type="System.String" name="SC_UserData" /> </properties> YAF Integration Page 8
Add the following into the /configuration/system.codedom section, after the compiler language="c#;cs;csharp"section:
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="OptionInfer" value="true"/> <providerOption name="WarnAsError" value="false"/> </compiler>
YAF Integration
Page 9
5.4 \App_Config\ConnectionStrings.config
Add the YAF connection string to your own connectionstrings config file:
<connectionStrings> <!-Sitecore connection strings. All database connections for Sitecore are configured here. --> <add name="core" connectionString="user id=xxx;password=xxx;Data Source=LOCALHOST\SQLEXPRESS;Database=Sitecore_yaf_Core" /> <add name="master" connectionString="user id=xxx;password=xxx;Data Source=LOCALHOST\SQLEXPRESS;Database=Sitecore_yaf_Master" /> <add name="web" connectionString="user id=xxx;password=xxx;Data Source=LOCALHOST\SQLEXPRESS;Database=Sitecore_yaf_Web" /> <add name="yafnet" connectionString="data source=LOCALHOST\SQLEXPRESS;initial catalog=YAFNET;user id=xxx;password=xxx" /> </connectionStrings>
YAF Integration
Page 10
Next step is to create a forum, supply a default email address and create or use an existing admin user.
YAF Integration
Page 11
Now you can finish the installation. If you have not added YAF to a Sitecore layout yet, you may use the following URL to access YAF: http://localhost/yaf
YAF Integration
Page 12
Please note that the first time you log in as your exiting user, the domain name will be shown in the username. This is removed the second time you log in.
YAF Integration
Page 13
Notice that the head tags is running server side. This is because YAF uses themes to apply style sheet. Also note that YAF will change the title tag when running.
YAF Integration
Page 14
YAF Integration
Page 15
8 Setting up YAF
YAF can now be setup to hide its own login screen. Login screen is never visible, as Sitecore always supplies a user (default/Anonymous or extranet/Anonymous). YAF will always display the Logout function. Pressing Logout will not log you out, but log the current user out, and login extranet/Anonymous instead. Log in as the YAF administrator and go to Admin->Host Settings. Unclick the Allow Login and Logoff:
YAF Integration
Page 16
9 Notes
Here are some key notes about the YAF integration, and what has happened:
9.2 YAF uses the Sitecore users from the current domain
YAF is modified to use the Sitecore users from the current domain. If your website uses the extranet domain, so will YAF. YAF is programmed to avoid users from other domains than the current. If you to access YAF with a user from the Sitecore domain, and YAF are running in the extranet domain, YAF switches to the extranet/Anonymous user.
YAF Integration
Page 18