Hi
Sorry for the delay, but we are very close to a deadline at work, so I'm very busy at the moment :)
Here we go, the first beta version of my forum module.
All the basics that you could expect of a forum module is implemented
Including attachments WITHOUT saving the post first!
To-do:
Minor code cleanup
Better layout - Need help on this one!
Improve the admin part
I expect 3 beta versions before the final release version.
My hope is that the final version will be ready just around Christmas.
Note:
There are no binaries in the zip file, so you have to build the module yourself!
It is based on the latest SVN version!
Hi
I have just discovered that the string resource file is not updated - I'll post an update later today.
Best
Steen
Here is an updated resource file.
Best
Steen
Hi
As of today you can get the source from: svn://www.1-4-all.dk/cuyahoga/forum
It is based on the latest SVN version!
SVN version,where ????
it can not find mothed RegisterStylesheet?
help
thank?
Hi Rabol,
Do you have a newer version of the forum?
Thanks,
Patrick
I had to change this
tUser = (User)this.PageEngine.CoreRepository.ActiveSession.Load(typeof(Cuyahoga.Core.Domain.User),this._module.CurrentUserId);
into this
tUser = (Cuyahoga.Core.Domain.User)Context.User.Identity;
in the Forumviewprofile.cs file BindProfile method
and I had to modify this
hql = "from ForumPost f where f.Message like ':sv' order by f.DateCreated ";
into this
hql = "from ForumPost f where f.Message like :sv order by f.DateCreated ";
in the forummodule.cs file SearchForumPosts method in order to get the search feature working.
Patrick.
Hi,
Each time I open the forum module for the first time I get the following error:
in expected: fc [from ForumCategory fc ]
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: NHibernate.QueryException: in expected: fc [from ForumCategory fc ]
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[QueryException: in expected: fc [from ForumCategory fc ]]
NHibernate.Hql.FromParser.Token(String token, QueryTranslator q) +1785
NHibernate.Hql.ClauseParser.Token(String token, QueryTranslator q) +955
NHibernate.Hql.PreprocessingParser.End(QueryTranslator q) +23
NHibernate.Hql.ParserHelper.Parse(IParser p, String text, String seperators, QueryTranslator q) +244
NHibernate.Hql.QueryTranslator.Compile() +160
NHibernate.Hql.QueryTranslator.Compile(ISessionFactoryImplementor factory, IDictionary replacements, Boolean scalar) +64
NHibernate.Impl.SessionFactoryImpl.GetQuery(String queryString, Boolean shallow) +134
NHibernate.Impl.SessionImpl.GetQueries(String query, Boolean scalar) +29
NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters) +122
NHibernate.Impl.QueryImpl.List() +84
Cuyahoga.Modules.Forum.ForumModule.GetAllCategories() +124
[Exception: Unable to get forum categories ]
Cuyahoga.Modules.Forum.ForumModule.GetAllCategories() +186
Cuyahoga.Modules.Forum.ForumList.BindCategories() +36
Cuyahoga.Modules.Forum.ForumList.Page_Load(Object sender, EventArgs e) +120
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
Then I hit refresh and it works as supposed to.
Does anyone know what is the problem?
Thanks,
Patrick.
I'm afraid it's tough to help you out with this. We haven't heard from the original author for quite a while and I'm afraid development has stalled entirely.
Now about the problem you're having: it might be caused by the fact that old forum module was built for Cuyahoga 1.0 and you're using the current SVN version if I'm correct?
Yes, that was the problem, I had to replace the session manager by the new one:
- Add the Castle libraries to the references
Replace the following code:
This
public class ForumModule : ModuleBase
To
public class ForumModule : ModuleBase, INHibernateModule
AND
this
this._currentAction = ForumModuleAction.ForumList;
//
// Register all the forum classes
//
_categorySortBy = CategorySortBy.None;
_categorySortDirection = SortDirection.ASC;
_forumSortBy = ForumSortBy.None;
_forumSortDirection = SortDirection.ASC;
_forumPostSortBy = ForumPostSortBy.DateCreated;
_forumPostSortDirection = SortDirection.ASC;
SessionFactory sf = SessionFactory.GetInstance();
sf.RegisterPersistentClass(typeof(ForumForum));
sf.RegisterPersistentClass(typeof(ForumCategory));
sf.RegisterPersistentClass(typeof(ForumPost));
sf.RegisterPersistentClass(typeof(ForumEmotion));
sf.RegisterPersistentClass(typeof(ForumTag));
sf.RegisterPersistentClass(typeof(ForumUser));
sf.RegisterPersistentClass(typeof(ForumFile));
base.SessionFactoryRebuilt = sf.Rebuild();
this._forumthemepath = UrlHelper.GetApplicationPath() + "Modules/Forum/Images/Standard/";
to
_sessionManager = sessionManager;
this._currentAction = ForumModuleAction.ForumList;
//
// Register all the forum classes
//
_categorySortBy = CategorySortBy.None;
_categorySortDirection = SortDirection.ASC;
_forumSortBy = ForumSortBy.None;
_forumSortDirection = SortDirection.ASC;
_forumPostSortBy = ForumPostSortBy.DateCreated;
_forumPostSortDirection = SortDirection.ASC;
this._forumthemepath = UrlHelper.GetApplicationPath() + "Modules/Forum/Images/Standard/";
And then replace for each method
this
public IList GetForumsByCategoryId(int categoryid)
{
try
{
string hql = "from ForumForum f where f.CategoryId = :categoryId " + this.GetCategoryOrderByClause("f");
IQuery q = base.NHSession.CreateQuery(hql);
q.SetInt32("categoryId", categoryid);
return q.List();
}
catch (Exception ex)
{
throw new Exception("Unable to get forum by category", ex);
}
}
to
public IList GetForumsByCategoryId(int categoryid)
{
ISession session = this._sessionManager.OpenSession();
try
{
string hql = "from ForumForum f where f.CategoryId = :categoryId " + this.GetCategoryOrderByClause("f");
IQuery q = session.CreateQuery(hql);
q.SetInt32("categoryId", categoryid);
return q.List();
}
catch (Exception ex)
{
throw new Exception("Unable to get forum by category", ex);
}
}
for the update or delete methods:
from this
public void SaveForum(ForumForum forum)
{
ITransaction tx = base.NHSession.BeginTransaction();
try
{
base.NHSession.SaveOrUpdate(forum);
tx.Commit();
}
catch (Exception ex)
{
tx.Rollback();
throw new Exception("Unable to save Forum ", ex);
}
}
to
[Transaction(TransactionMode.RequiresNew)]
public virtual void SaveForum(ForumForum forum)
{
ISession session = this._sessionManager.OpenSession();
try
{
session.SaveOrUpdate(forum);
}
catch (Exception ex)
{
throw new Exception("Unable to save Forum ", ex);
}
}
That's it!
I will post the complete forum as soon as I get it finished.
That looks perfectly fine now. Good job!