PDA

View Full Version : Tab Content problem with MVC site



logart
04-08-2005, 03:52 PM
I have written a site using Model View Controller methods. What this means is that there may be many different pages all accessed through the same window.location.pathname (ex. /customer.php).

Unfortunately, I have found the persistence plugin for the Tab Content script ( http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm) does not work properly for me in this environment.

What should be happening is that the script should pay attention to the args in the URL for the cookiename. For example:

/customer.php?cmd=list should be one cookie
and
/customer.php?cmd=edit should be another

What is happening now is that both pages "appear" to be the same page to the script.

Any ideas?

logart
04-08-2005, 05:22 PM
Ok, I think I found a couple of bugs that are causing my problem. Below are my fixes:

Issue #1
----------------------------
This line in do_onload fails if there is only one tab:
initTabcolor=cascadedstyle(tabobjlinks[1], "backgroundColor", "background-color")

Changing it to this fixed one of my problems:
initTabcolor=cascadedstyle(tabobjlinks[0], "backgroundColor", "background-color")
---------------------------

Issue #2 - cookie should be built using pathname + search
---------------------------
The line in do_onload() and savetabstate() that reads:
var cookiename=(persisttype=="sitewide")? "tabcontent" :window.location.pathname

needed to be changed to:
var cookiename=(persisttype=="sitewide")? "tabcontent" : escape(window.location.pathname+window.location.search)
---------------------------

I am not sure if this is the proper place for bug reporting of this script. If not, please forward this on to the author.