N2 tree redirecting back to start page

Topics: Developer Forum
Developer
Jun 26, 2012 at 11:03 PM
Edited Jun 26, 2012 at 11:03 PM

This is on a Dinamico project - 

every time I navigate to a sub-node of my startpage, the tree refreshes and selects just the startpage (and collapses the tree view). The navigation on the actual page does work, though. Any ideas why this might be happening?

Thanks!

Developer
Jun 26, 2012 at 11:07 PM

It is something wrong with the custom theme. When I set the StartPage theme to Default, the problem goes away. Mystifying... there are no redirects I know of in the template.

Developer
Jun 26, 2012 at 11:16 PM
Edited Jun 26, 2012 at 11:18 PM

More investigating... in this page: 

/family/xxxx-water-company/careers

There is this javascript code: 

<script type='text/javascript'>//<![CDATA[
(function($){
	if (!window.n2ctx) return;

	n2ctx.select('preview');
	$(document).ready(function () {
		n2ctx.refresh({ navigationUrl: '/N2/Content/Navigation/Tree.aspx?selected=%2fstart%2ffamily%2fxxxx-water-company%2fcareers%2f', path: '/start/family/xxxx-water-company/careers/', permission: 'Administer', force: false });
		if (n2ctx.hasTop()) $('.cpAdminister').hide();
		else $('.cpView').hide();
				
		if (window.n2SlidingCurtain) {
			n2SlidingCurtain.init('#cpCurtain', false);
			n2SlidingCurtain.recalculate();
			if($.browser.webkit) setTimeout(function(){ n2SlidingCurtain.recalculate(); }, 50);
		}
	});
})(jQuery);
//]]></script>

 

If I navigate to that URL, then the tree loads fine. In addition, the URL of the management interface is: ~/N2/Content/?selected=/start/family/xxxx-water-company/careers/

However there is something causing the navigation tree to redirect back to /N2/Content/Navigation/Tree.aspx?selected=%2fstart%2f0%2f&location=content

Grr...

Coordinator
Jun 27, 2012 at 7:37 AM

Perhaps you could put a breakpoint in in plugins.ashx to see where the call comes from

		/// update frames
		/// * previewUrl: url to load preview frame
		/// * navigationUrl: url to load navigation frame
		/// * force: force navigation refresh (default true)
		/// * path: update path to
		refresh: function (options) {
			options = jQuery.extend({ previewUrl: null, navigationUrl: null, force: true,

Developer
Jun 27, 2012 at 4:46 PM

Set the breakpoint there and got something that looks fine: 

this: Object
	_path: "/start/0/"
	actionType: null
	append: function (url, data) {
	getAction: function () {
	getMemory: function () {
	getSelected: function () {
	getSelectedUrl: function () {
	hasTop: function () { return true; }
	initToolbar: function () {
	layout: Object
	location: "content"
	memorize: function (selected, action) {
	memorizedPath: null
	path: function (value) {
	refresh: function (options) {
	select: function (name) {
	selectedPath: "/start/family/xxxx-water-company/"
	selectedUrl: "http://localhost:3479/family/xxxx-water-company"

Then when I get to this line: 

if (w.frames.navigation && w.frames.navigation.onNavigating)
w.frames.navigation.onNavigating(options);

Still looks fine. 

options: Object
	force: false
	navigationUrl: "/N2/Content/Navigation/Tree.aspx?selected=%2fstart%2ffamily%2fmiddlesex-water-company%2f"
	path: "/start/family/middlesex-water-company/"
	permission: "Administer"
	previewUrl: null
	showNavigation: function (ctx) {
	showPreview: function () {
	__proto__: Object

If I keep stepping I do eventually get to a point where selectedPath and selectedUrl are not the same thing. 

options: Object
	force: false
	navigationUrl: "/N2/Content/Navigation/Tree.aspx?selected=%2fstart%2f0%2f"
	path: "/start/0/"
	permission: "Administer"
	__proto__: Object
this: Object
	_path: "/start/0/"
	actionType: null
	append: function (url, data) {
	getAction: function () {
	getMemory: function () {
	getSelected: function () {
	getSelectedUrl: function () {
	hasTop: function () { return true; }
	initToolbar: function () {
	layout: Object
	location: "content"
	memorize: function (selected, action) {
	memorizedPath: null
	path: function (value) {
	refresh: function (options) {
	select: function (name) {
	selectedPath: "/start/0/"
	selectedUrl: "http://localhost:3479/family/xxxx-water-company"
	toolbarSelect: function (name, context) {
	unselect: function (name) {
	unselectFrame: function (frame) {
	update: function (options) {
	__proto__: Object
Could this be the problem?

Developer
Jun 27, 2012 at 5:14 PM

Figured it out- turns out there was an iframe in the template that was causing the issue.