Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# Constructor 6/4/2009 9:52 PM (edited 6/4/2009 9:54 PM)
I have been looking at the various services in 2.0 core.

To do this I created a test module and a class derived from the 'ContentItem' class. I can save this ti the database via the IContentItemService.

When I try to delete it I get this:
Provided id of the wrong type.
Expected: System.Int64, got System.Guid
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.TypeMismatchException: Provided id of the wrong type.
Expected: System.Int64, got System.Guid
Source Error:


Line 48: public T GetById(Guid id)
Line 49: {
Line 50: return ( T ) this.GetNewSession().Load(persistentType, id);
Line 51: }
Line 52:

Does this mean that V2.0 is not at a stage where testing can take place for R&D purposes?

If it is possible I will study to build modules that are specific to 2.0 and use the new infrastructure.
# Constructor 6/6/2009 8:57 PM (edited 6/6/2009 9:01 PM)
This afternoon I got the latest trunk and decided to have a look at getting some tests working on it.

I found first that the install process broke when creating a default site. The sections and nodes seemed to require a site to be set for each.
...
page2Section.Node = page2;
page2Section.Site = site;
...

I then found that the StaticHTML would not save its content after editing without the 'content.Title' having a value. This I am sure will be the case for all the other modules that use the ContentItem.

I wanted to test some functionality within a test module I had, so I installed it (without any issues). When it came to adding it to a section it failed. It required (on the SectionEdit - btnSave_Click):
this._activeSection.Site = this.ActiveNode.Site;

Then it worked. The test module worked and provided answers to the questions I had. The version of the trunl which I was using prior seems to be less developed in its functionality and therefore failed in the IContentItem tests I was making. They work in the latest version.

I will continue to look at how the content abstraction works and mixes with the Search and other services.
# Constructor 6/6/2009 11:00 PM
A question for Martijn (or anyone else who can help).

Well had some time to play with adding content and the ease of which the site search can be used, fantastic stuff. Really good.

I have a question. The previous version I was using, the ContentItem had a field:
protected string urlFormat;

The latest version does not :s

How can I format the link to get from the content item that is selected in the search results list to the detail view of the content without urlFormat?

How can I get to the content if my module requires url parameters in the following format:
{site url}/page.aspx/detail/23/

I will continue to look but I can not see how to do this. This new stuff is great though...
# Constructor 6/7/2009 11:15 PM (edited 6/8/2009 5:18 PM)
Some more questions.

------------

'Standalone Sections': Now Sections have a Site property how do standalones to work? (Currently throws error).

(UPDATE: In the database the 'cuyahoga_section' table has a new field to take the 'siteid'. This was set to NOT allow nulls and therefore caused the error when creating standalone sections).

The install SQL has these lines:
-- Sections belong to a site
ALTER TABLE cuyahoga_section
	ADD siteid int NULL
go

below that there was also:
ALTER TABLE cuyahoga_section
	ALTER COLUMN siteid int NOT NULL
go 

Commenting the above entry that makes the siteid NOT NULL stops the error.

------------

Is the 'User' going to be given a Site ot Sites collection? (I did this on my own build and although it works perfectly well it is not what I would call 'a part of the system').

As always I will keep on studying and experimenting.

------------
# Constructor 6/9/2009 10:34 PM
Here is where my test build stands.

- Newly created sites copy a selection of (site unassigned) templates to the newly created sites own folder.
- New templates can be added and a copy sent to the selected sites folder.
- Templates can be listed by: All, Unassigned or by specific site.
- Apply template to all nodes in site.
- Deleting a site also includes the deletion of the site folder and subfolders.
- fckEditor uses the new folder for uploading content.
- Default installed site is changed using different templates (css, javascript, image folders and fckStyles Templates xml)
- The other patches from 1.6 (register javascript and ordering fix all added and working)
- A few other changes

It all works great (still with the classic admin). I am looking at the best way to make users site specific. I have this working on a one user per site basis in my other build. I may look at something different (I can not find any information on if this was planned in a specific way). When a user who has a role of administrator and is assigned to a site logs in, they get a cut down admin area.

For me this is all an exercise in learning about the inner workings by experimenting.
# martijnb 6/10/2009 8:10 AM
ConstructorI have a question. The previous version I was using, the ContentItem had a field:
protected string urlFormat;

The latest version does not :s

How can I format the link to get from the content item that is selected in the search results list to the detail view of the content without urlFormat?

How can I get to the content if my module requires url parameters in the following format:
{site url}/page.aspx/detail/23/

ContentItem now has a virtual method GetContentUrl(). It defaults to {sectionId}/section.aspx/{contentItemId}. Inheritors can override this. For example, the new StaticHtmlContent class returns the friendly url of the node, when the section is connected to a node instead of the cryptical section.aspx url.
# martijnb 6/10/2009 8:15 AM
Constructor'Standalone Sections': Now Sections have a Site property how do standalones to work? (Currently throws error).

This is in the works at the moment. We really needed to restrict standalone sections to a single site for simplicity.
# Constructor 6/10/2009 11:06 AM (edited 6/11/2009 11:16 PM)
martijnb
Constructor'Standalone Sections': Now Sections have a Site property how do standalones to work? (Currently throws error).

This is in the works at the moment. We really needed to restrict standalone sections to a single site for simplicity.

This error was caused by the install script creating the sections table to NOT allowing the site vaule of the standalone section to be null. I have changed this and it works fine now.
# Constructor 6/10/2009 11:09 AM
martijnbContentItem now has a virtual method GetContentUrl(). It defaults to {sectionId}/section.aspx/{contentItemId}. Inheritors can override this. For example, the new StaticHtmlContent class returns the friendly url of the node, when the section is connected to a node instead of the cryptical section.aspx url.

Brilliant. This is why sometimes it is best to ask :) I will experiment this and use the example you point me to. Thanks.
# Constructor 6/10/2009 11:11 AM (edited 6/11/2009 11:16 PM)
One more small question.

Is the 'User' going to be given a Site ot Sites collection? (I did this on my own build and although it works perfectly well it is not what I would call 'a part of the system').

Is there a plan to make the users site specific in some way?

As always I will keep on studying and experimenting.
# martijnb 6/12/2009 11:45 AM
Roles can be made site-specific. Depending on which roles a user has, they can be made site-specific. One drawback: usernames still have to be unique across a single Cuyahoga installation.
# Constructor 6/12/2009 2:08 PM
martijnbRoles can be made site-specific. Depending on which roles a user has, they can be made site-specific. One drawback: usernames still have to be unique across a single Cuyahoga installation.

OK, great... I will look at this. Again, thanks for the information. I am now building a V2.0 shopping cart that uses the content abstraction and services that you have added to 2.0. So this and any other information is really helpful.
# Constructor 6/12/2009 10:01 PM (edited 6/13/2009 2:08 PM)
This afternoon I found something in 2.0 that did not seem to work. It was this.

When you add content to StaticHTML module (which is now StaticHtmlContent : ContentItem, ISearchableContent) it saved it by calling:
public void SaveContent(StaticHtmlContent content)
{
	this._contentItemService.Save(content);
}

>-> in the StaticHtmlModule that uses >->

[Transaction(TransactionMode.Requires)]
public T Save(T entity)
{
	return this.contentItemDao.Save(entity);
}

>-> in the ContentItemService that uses >->

[Transaction(TransactionMode.Requires)]
public T Save(T entity)
{
	this.GetNewSession().SaveOrUpdate(entity);
	return entity;
}

SaveorUpdate does exactly that. It saves new content if it is new or updates existing content.

The problem is that the SearchDecorator (which utilises the AbstractContentItemServiceDecorator) overrides the ContentItemService methods (that save and delete the content) ADDS a new entry into the index on updates.
public override T Save(T entity)
{
  if (UseInstantIndexing && entity is ISearchableContent)
  {
    this.searchService.AddContent(entity);
  }
  return base.Save(entity);
}

So an updating the HTML in the editor calls the SaveOrUpdate that adds a new item to the index, which seems to break the indexing.

So in these files:

IContentItemDao
ContentItemDao
SearchDecorator
AbstractContentItemServiceDecorator

I added a separate Update method to see if it would fix this. I have tested it and it seems fine.

The only other thing to change the way these methods were called by adding an Open() method to each:
public void UpdateContent(IContentItem contentItem)
{
    this.IndexBuilder.Open(); //This is a new addition that marks the indexbuilder as open so it can be closed again for saves (otherwise it remains instantiated and closed!)
    this.IndexBuilder.UpdateContent(contentItem);
    if(!this.isRebuildingIndex) this.IndexBuilder.Close();
    this.indexBuilder = null;
}



Another issue that I had was that when I created a new ContentItem and saved it, the SearchDecorator adds it to the index before it is saved. The Id was indexed as -1 (unsaved value). So I changed these:
public override T Save(T entity)
{
  if (UseInstantIndexing && entity is ISearchableContent)
  {
    this.searchService.AddContent(entity);
  }
  return base.Save(entity);
}

to..
public override T Save(T entity)
{
  if (UseInstantIndexing && entity is ISearchableContent)
  {
    base.Save(entity);
    this.searchService.AddContent(entity);
  }
  return entity;
}


Are any of these real issues or have I not understood something (this is more probable!). This is really a study exercise, looking through the code at how Cuyahoga is put together is good learning even if these are not real or unknown issues.

# martijnb 6/13/2009 10:34 AM
You probably ran into a bug. Thanks for pointing out.
# Constructor 6/13/2009 9:34 PM (edited 6/13/2009 9:58 PM)
The latest amendment I have made involves making the search indexes site specific. This is how:
//this.physicalIndexDir = System.IO.Path.Combine(rootDir, indexDir);
//Custom Added: make site specific
string siteurl = Cuyahoga.Core.Util.UrlUtil.GetSiteUrl();
string siteid = this._siteService.GetSiteBySiteUrl(siteurl).Id.ToString();
string indexpath = "SiteData/" + siteid + "/index/";
this.physicalIndexDir = System.IO.Path.Combine(rootDir, indexpath);

Probably not the best way? Does it differ from how it is to be done?

It works fine anyway. All functionality included in the trunk build I have, is now working. I also have a much clearer idea of how things are put together. So all the experimenting in the code has not been a waste of time :)

I am now going to look through the old forum posts to see what I can find (especially the VersioningService and how this is going to work).

# Constructor 6/19/2009 10:55 PM (edited 6/19/2009 11:42 PM)
(Update: before you read this, the issue mentioned is solved) :$

This Cuyahoga V2.0 I have been working with is working multi site. I have found a small issue. It goes like this.

I have been registering CSS and Javascript from templates and modules like this:

Templates:
< script src="<% =String.Format("{0}Templates/DropDownTemplate/JavaScript/jquery-1.3.2.min.js", Cuyahoga.Web.Util.UrlHelper.GetApplicationPath().ToString()) %>" type="text/javascript">< /script>

The path to the template is hardcoded from the application path. Similarly from the module:
RegisterJavascript("CITest_js", UrlHelper.GetApplicationPath() + "Modules/CITest/JavaScript/jquery.lightbox-0.5.min.js");

Where the path to the template is also hardcoded from the application path.

I have now had to change how I do this to something like this:
RegisterJavascript("CITest_js", UrlHelper.GetApplicationPath() + this._Module.Section.Node.Template.BasePath + "/JavaScript/jquery.lightbox-0.5.min.js");

With something similar to register the CSS.

So how can this be done for inside the template? (Currently looks like this)
< script src="<% =String.Format("{0}Templates/DropDownTemplate/JavaScript/jquery-1.3.2.min.js", Cuyahoga.Web.Util.UrlHelper.GetApplicationPath().ToString()) %>" type="text/javascript">< /script>

What is required is the ability to get the template base path from within the template itself. Any ideas?

As a general point. I was thinking about maybe getting something a little more elegant and clear? Is there already a way to do this better? Is it worth thinking about or just leaving it?

Not a big point I know but it could be cleaner.

I have now added the ability to upload template packs to the version I am working with. It was using code that was already there with a few changes. Now I can upload templates to be used by all or just one specific site.

-------------------------------------------------------

UPDATED:

It is ok I remembered. I forgot about 'TemplateSourceDirectory'.
< script src="<% =String.Format("{0}/JavaScript/jquery-1.3.2.min.js", this.TemplateSourceDirectory.ToString()) %>" type="text/javascript">< /script>

All ok. A complete waste of a post!
# Constructor 10/20/2009 11:55 AM
A simple quiestion.

Will the 'Admin' (classic) work in V2.0 along with the new 'Manager'?
# martijnb 10/20/2009 1:24 PM (edited 10/20/2009 1:27 PM)
ConstructorA simple quiestion.

Will the 'Admin' (classic) work in V2.0 along with the new 'Manager'?

A simple answer: No
A more complicated answer: some things might actually still work, but it's insane to support two different admin interfaces.
# Constructor 10/20/2009 3:26 PM
martijnb
ConstructorA simple quiestion.

Will the 'Admin' (classic) work in V2.0 along with the new 'Manager'?

A simple answer: No
A more complicated answer: some things might actually still work, but it's insane to support two different admin interfaces.

I agree that shipping two admin is madness. I was just inquiring as to the compatibility (with the idea of some re-development of the classic admin).

I suppose adding the new core/ NHibernate etc to V1.6 would be easier for that?