Bug reports Found a bug? Post it here please.
Version 4.x > Bug reports > Creating a linked document changes the properties of the original View modes: 
User avatar
Member
Member
Josh Larios - 10/9/2009 8:00:24 PM
   
Creating a linked document changes the properties of the original
I've created a zip file with some supporting documentation for this one. It includes a web part which puts a whole bunch of debugging info into the page content as an HTML comment.

The problem: when you create a linked document pointing to a page, the properties of the original page change. For example, CMSContext.CurrentPageInfo.NodeId no longer reflects the ID of the original page, but of the linked document. CMSContext.CurrentAliasPath also changes to reflect the alias path of the link, not the original.

If you change anything on the original page and republish it, even more properties change for the worse.

However, if you add a new alias to the original page and check the properties at the alias's URL, the properties are correct. That is, they are what they should be for the original page.

This affects any web parts which base their behavior on properties of the current page in CMSContext.CurrentPageInfo or CMSContext.CurrentDocument, and possibly other areas. It explains a bug I've seen in the breadcrumbs, and some other bugs we were encountering with web parts we wrote.

I can't think of any reason that this might be desirable behavior--it makes it impossible to get information about the original document that a linked document points to, using the API. You could probably write something which searched the db directly, looking for the object which corresponds to the URL in the address bar, I suppose, but that would be extremely inefficient, and why should you do that when the API's supposed to have helpers for stuff like that?

To reproduce this condition, see the README.txt contained in the zip file linked above. There should also be sufficient examples of what's changing and when contained in the .txt files. To see the condition for yourself, install the web part contained in the zip file, put it in a page layout, and view the source of a page before and after creating a linked document pointing to it.

If you need further details, I am happy to provide them. This is a show-stopping bug for us, in that we can't write a number of web parts until we can rely on the API delivering correct information about the current page.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 10/13/2009 7:12:49 AM
   
RE:Creating a linked document changes the properties of the original
Hello,

if you want to understand linked document better please open your database – CMS.Tree table and CMS.Document table. Linked document means that the system creates a new record in CMS.Tree table and not in CMS.Document. It only links to record of original document in CMS.Document table. You may see what properties should be common and which different.

However, regards your issue:
I was not able to reproduce the issue on my machine. I tested the mentioned properties: CMSContext.CurrentAliasPath and CMSContext.CurrentPageInfo.NodeId according your instructions. They were unique and correct for the original and linked document even if I used your uwbdebud web part.

Could you please tell me what settings you have in:
Site manager -> Settings -> URLs -> Site: <your site> -> Use name path for URL path?

Do you use the 4.1 version?

Best regards,
Helena Grulichova

User avatar
Member
Member
Josh Larios - 10/13/2009 2:26:15 PM
   
RE:Creating a linked document changes the properties of the original
Yeah, I've become pretty familiar with those two tables recently. The problem isn't in the database, as far as I can tell. When I look at the rows representing pages which exhibit the bug, everything looks fine in the database. Nevertheless, the API is returning the wrong values for pages which have linked documents pointing to them (and which have been modified since the linked document was created).

I've made a screencast demonstrating the problem, starting from a completely clean slate (new Windows Server 2008 instance), going through installing Kentico 4.1, configuring the sample site, and reproducing the bug. It's a 55 megabyte download which runs about 18 minutes long. You can find it at at http://www.elsewhere.org/tmp/kentico-bug-screencast.mov

The audio quality's not the best, but it should serve to show you what I'm seeing.

User avatar
Member
Member
Josh Larios - 10/13/2009 2:52:51 PM
   
RE:Creating a linked document changes the properties of the original
Oh, and we do have "use name path for URL path" enabled.

User avatar
Member
Member
Josh Larios - 10/13/2009 3:21:41 PM
   
RE:Creating a linked document changes the properties of the original
Urf. And that seems to be the critical detail I was forgetting to mention. I have changed the URL settings so that both "use name path for url path" and "remember original urls" are enabled. Everything else is the default, though.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 10/14/2009 3:14:16 PM
   
RE:Creating a linked document changes the properties of the original
Hi Josh,

if these two options (esp. "use name path for url path") are disabled is the behavior same?

Best regards,
Helena Grulichova

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 10/20/2009 8:17:31 AM
   
RE:Creating a linked document changes the properties of the original
For others:

This behavior was fixed by 4.1.9 hotfix (http://devnet.kentico.com/Bugtracker/Hotfixes.aspx) and in 5.0 version.

Best regards,
Helena Grulichova