[TYPO3-dev] How typo3 saves highlighted page in the page tree?
Tapio Markula
tapio.markula at atwebteam.com
Wed Dec 27 17:14:24 CET 2006
Benjamin Mack kirjoitti:
> Hey Tapio,
>
> since I'm working on some changes in this file, I know that the pagetree
> script writes it as a Javascript parameter in the "top"-frame.
>
> "top.fsMod.navFrameHighlightedID[frameSetModule]"
In fact I got this directly from Peter Klein too.
I tried to reset that on the base of a cookie from alt_doc.php
I got resetting working but I should delete the cookie and reload then
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}
function deleteCookie(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
function hilight_row(frameSetModule,highLightID) {
...
var cookieStartHIL="pages'.$startID.'_0"; // predefined starting page
var compHIL=highLightID;
if(compHIL==undefined || '.$startNewUID.'>0) { // when starting typo
compHI is undefined because any link hasn not been pressed;
'.$startNewUID.'>0 is true if there is cookie
theObj1 = document.getElementById(cookieStartHIL);
if (theObj1) {
theObj1.className = "navFrameHL";
}
if('.$startNewUID.'>0)
top.fsMod.navFrameHighlightedID["web"]=cookieStartNewUID;
else top.fsMod.navFrameHighlightedID["web"]=cookieStartHIL; // saved
as JavaScript object
deleteCookie("'.$startNewUID.'", "/", "") // this command didn't
delete the cookie => continous reload of page
window.location.reload(); // needed in order to avoid two highlighted items
}
More information about the TYPO3-dev
mailing list