YAF and MojoPortal (integration)

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
3/12/2011 12:35:57 PM
bob
Gravatar
Total Posts 126
YAF developer

YAF and MojoPortal (integration)

3/12/2011 1:28:47 PM
Gravatar
Total Posts 245
mojoPortal Community Expert

Re: YAF and MojoPortal (integration)

Thanks for the update Bob.

I am anxious to try this.  I installed YAF for several friend about 10 years ago.  They all loved it.  I can imagine it is 10 times better now.

Is really soon =

days, weeks or months?

Rick

3/13/2011 3:33:40 AM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Hi, Rick.

I can't say exactly, because it heavily depends on YAF current state too. Recent release required some integration files changes and even in the latest YAF release some unpleasant things were found.

But anyway a sort DIY kit  and HOW-TO will be published until the end of the month,

if I don't encounter any horrible bugs. Currently I'm testing latest version  on my site and I want that both communities get it as soon as possible. I'm tired to wait when it will be PA too.

It's not a piece of cake despite the fact  it's rather easy at the first glance.

Best, bob.

 

3/25/2011 9:38:27 AM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Some help on YAF - MP integration. The case of single YAF board and single MojoPortal site.

Let's begin with configs. Of cause it can be made differently but it's the most intuitive way for MP users.All the

instructions are valid for YAF svn v.4799 and can work in 1.9.5.5 RTW and 1.9.5.6. It's recommended to use the

unstable version but with bug fixes.

Part1.Configs.


1.1. You should merge YAF app.config to MP user.config.

user.config.
<?xml version="1.0" encoding="utf-8"?>
<appSettings>

  // Enter mypass - it allows to install | update YAF Module 
  <add key="YAF.ConfigPassword" value="mypass" />

  // If you use 1 board you can set it here/
  <add key="YAF.BoardID" value="1" />

  // Don't allow url rewriting
  <add key="YAF.EnableURLRewriting" value="false" />

  // No matter as URL rewriting is disabled
  <add key="YAF.URLRewritingMode" value="Translit" />

  // To send YAF notifications by a secure email connection only, else should be disabled
  <add key="YAF.UseSMTPSSL" value="false" />

  // THis is a prefix for YAF tables
  <add key="YAF.DatabaseObjectQualifier" value="yaf_" />

  // Obvious
  <add key="YAF.DatabaseOwner" value="dbo" />

  // This string name should be the same as in merged web.config. YAF use a different connection.
  <add key="YAF.ConnectionStringName" value="yafnet" />

  // No matter for integration
  <add key="YAF.ProviderExceptionXML" value="ProviderExceptions.xml" />

  // Set it to the folder name where you put YAF folder in the case of single YAF board 
<add key="YAF.BoardRoot" value="~/YAF" />

  // Set it to false in the first iteration or comment it
  <add key="YAF.MultiBoardFolders" value="false" />

  //
  <add key="YAF.FileRoot" value="~/YAF"/>

  // Important! MojoPortal loads JQuery stuff, so disable YAF JQueryLOading and verify that the version is in sync

with MP version just in case.
  <add key="YAF.JQueryUIFile" value="false" />
  <add key="YAF.DisableJQuery" value="true" />
  <add key="YAF.JQueryUIFile" value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js" />

<add key="YAF.JQueryUILangFile" value="http://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery-ui-i18n.min.js"

// see above
<add key="YAF.AppRoot" value="~/YAF" />

// see YAF comments
  <add key="YAF.BaseUrlMask" value="" />
  <add key="YAF.ForceScriptName" value="default.aspx" />
 
<!--
******************************************************************
** Membership Provider Key Type ** Defaults to: "System.Guid" **

The type that the membership provider expects the ProviderKey
to be. Most providers use expect System.Guid.

Valid values include:

System.Guid (default)
System.String (max 64 character length)
System.Int32
System.Int64
 
-->
  <add key="YAF.ProviderKeyType" value="System.Guid" />

  // don't enable it - it hides forum toolbar and use if you have customs controls only
 
  <add key="YAF.ShowToolBar" value="false" />
  // Important! Disable it. 
  <add key="YAF.AllowLoginAndLogoff" value="false" />
 
// If you experiencing timouts 
  <add key="YAF.SqlCommandTimeout" value="99999" />
  -->

</appSettings>

1.2. Merge mail.config with MP web.config or make a file reference. Keep in mind - it's better to put all configs

into MP root folder.
1.3  Merge YAF web.config to MP web.config section by section, putting all YAF entries after MP entries.

1.3.1.Comment YAF URLRewriting related sections. 

1.3.2.Don't forget to add a separate YAF connection string to web.config.

  <connectionStrings>
    <!--
    <add name="yafnet" connectionString=""
      />
      -->
    <add name="yafnet"   connectionString="yourconnection string" />

  </connectionStrings>  
  <system.web>

1.3.3. YAF uses XTML Transitional - it's overriden in the control but just in case...

1.3.4. Use UTF-8 with YAF if possible.

1.3.5. Remove configs from YAF folder after this.

To be continued...

3/25/2011 11:03:01 AM
Gravatar
Total Posts 245
mojoPortal Community Expert

Re: YAF and MojoPortal (integration)

Hi Bob

Wow...  Looks like things are moving now.

I just joined your forum today.  Very busy place!

If I can be of assistance in testing, LMK when you are ready!

Thanks so much for your efforts!

Rick

3/25/2011 12:42:58 PM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Oh, no, it works more then 3 months on my site with PostgreSQL. The problem is that YAF chnges too fast and new incompatabiliies resurging every time.

Currently there're some problems with profiles, some roles brutality, url rewriting. But it's usable.  The code is derived from my code, but Mek   worked with it a long time, so I can share my code only, as I don't want it to be a mistery and I think it will be beneficial for both communities. And it will boost compatability work. So I'll publish code snippets here and the code which was written by me only. And I don't have much time so I will publish it by portions.

Part2. How-to YAF.

You should compile YAF from source code and be sure that it works fine. All required files are in YetAnotherForum.NET folder wich should be put into MojoPortal solution Web/ folder and renamed to YAF for simplicity - it should correspond to the folder name in the configs above.

No need to add the folder to MP solution. Simply take all dlls from /YAF/bin folder and put them into MP /bin folder.

After you merge configs you should delete or move configs from the YAF folder and clean up the folder from unnecessary files.

After this you should add 2 projects to MP solution - a web application containing 2-3 controls(MP module controls) and  a library where resides MojoUrlRewriter.

After compiling all the required files will be automatically  moved to their locations in Mojo folders. But you should put the folder into mojoportal solution main folder. There can be problems with outdated links, but technically you can simply replace them by fresh ones which are now in MP /bin folder.

If mojoPortal version changes and setup will be launched the module will be hooked and installed. After you added module and changed  its properties you'll be redirected to YAF installation page and you'll have a possibility to initialize YAF database in a traditional way.

Tips.

To get the projects structure which should be added to MojoPortal  you can here. Keep in mind that it doesn't contain any C# code, but contains all project data for relocations and references. It'll simplify you integration a lot. Put unzipped folder to MP solution folder and add projects to MP solution. There are 2 projects - YAF.Mojo.dll and MojoPortal YAF Module.

To download it - enter code and push the green button.

http://narod.ru/disk/8467243001/YetAnotherForum.Mojo.Src.Skeleton.zip.html

 

 

 

3/27/2011 3:44:29 PM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Basic content of  MojoPortalUrlBuilder.cs Technically it's all the required content of YAF.Mojo.dll

 

using System;
using System.Web;
using mojoPortal.Business;
using mojoPortal.Business.WebHelpers;
using YAF.Classes;
using YAF.Core;
using Intelligencia.UrlRewriter;

namespace YAF.Mojo
{
    public class MojoPortalUrlBuilder
        :  RewriteUrlBuilder
    {
     
        private static string _baseUrl = null;

        public override string BuildUrl(string url)
        {
            string scriptName = "";
            PageSettings currentPage = CacheHelper.GetCurrentPage();
         
            scriptName = currentPage == null ? HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"] : currentPage.Url.Replace("~/", "");

            if (!Config.EnableURLRewriting)
            {
                scriptName = HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"];

              
                url = url.Replace("&", "&amp;");
                if (scriptName.Contains("install"))
                {
                    return Config.AppRoot.Replace("~", "").Trim() + scriptName;
                }

                return string.Format("{0}?pageid={1}&{2}", scriptName, currentPage.PageId, url);
            }
            else
            {
            }          
                url = url.Replace("&", "&amp;");           

                string pageid = HttpContext.Current.Request.QueryString["tabid"];              
                return scriptName.Replace(Config.AppRoot.Trim(), "");
           
        }

    }
}
 

3/27/2011 6:32:43 PM
Gravatar
Total Posts 245
mojoPortal Community Expert

Re: YAF and MojoPortal (integration)

Thanks for all the information and updates Bob.  Keep them coming.

I'm on a loosing battle to meet a month end deadline for my employer right now so won't get to try this for about a week.

Rick

3/28/2011 11:02:29 AM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

I've published already all that's required. it's not a problem to write a MP-YAF control and it works. I think that if someone wants to integrate it but has no skills he can  contact someone who has like Joe. I have no doubts that you can cope with the rest yourself. smiley

Best, bob.

4/14/2011 2:08:11 PM
Gravatar
Total Posts 9

Re: YAF and MojoPortal (integration)

Bob - thanks for all the work done on this!

I've managed to get YAF 1.9.5.5 RTW created as a module and 'integrated' into MojoPortal 2.6.3.2.

However. A lot of the links within YAF aren't working. Namely anything that kicks off a JavaScript postback, but most importantly links from topic to post. They all return an object reference not set to an instance of an object error: Here's an example link - Default.aspx?pageid=23&g=topics&f=1

Any thoughts?

I have to say YAF looks fantastic, and I'm hoping its something simple I've overlooked (quite possible as I'm new to this). Brilliant forum system though and fits wonderfully into MojoPortal.

r3fl3x

 

4/15/2011 6:53:03 PM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Hi,

I use YAF 1.9.5.6 from svn and MP 2.3.6.4. You should not encounter any problems with it. Really, I can't help with it as I don't encounter any problems with url rewriting. It has 2 YAF boards in 1 MP site and even in the case it works fine. I use it with Postgre as database but it doesn't matter.

I think you have problems with Forum.aspx.cs control.

There's a profile sync problem and you should enter display name by hand in YAF,  but nothing more. 

Really, I've posted exactly the code I use on my site. Try to move all entries from user.config to web.config.

Make sure that you've enabled it for YAF in Forum.ascx.cs control.

Page.EnableViewState = true;         
        
         

   

You must sign in to post in the forums. This thread is closed to new posts.