Index: openacs-4/packages/forums/www/message-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-view.adp,v diff -u -r1.38 -r1.38.2.1 --- openacs-4/packages/forums/www/message-view.adp 22 Feb 2008 07:17:42 -0000 1.38 +++ openacs-4/packages/forums/www/message-view.adp 19 Mar 2008 02:05:45 -0000 1.38.2.1 @@ -9,11 +9,6 @@ - Index: openacs-4/packages/forums/www/message-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-view.tcl,v diff -u -r1.44 -r1.44.2.1 --- openacs-4/packages/forums/www/message-view.tcl 12 Mar 2008 05:26:43 -0000 1.44 +++ openacs-4/packages/forums/www/message-view.tcl 19 Mar 2008 02:05:45 -0000 1.44.2.1 @@ -91,43 +91,16 @@ set thread_url [export_vars -base forum-view { { forum_id $message(forum_id) } }] -set dynamic_script " - -" - if {$forum(presentation_type) eq "flat"} { set display_mode flat } # stylesheets set lang [ad_conn language] template::head::add_css -href /resources/forums/forums.css -media all -lang $lang -#template::head::add_css -alternate -href /resources/forums/collapse.css -media all -lang $lang -title "collapse" -#template::head::add_css -alternate -href /resources/forums/expand.css -media all -lang $lang -title "expand" -#template::head::add_css -alternate -href /resources/forums/print.css -media print -lang $lang +template::head::add_css -alternate -href /resources/forums/print.css -media print -lang $lang # js scripts template::head::add_script -type "text/javascript" -src "/resources/forums/forums.js" -template::head::add_script -type "text/javascript" -src "/resources/forums/dynamic-comments.js" -template::head::add_script -type "text/javascript" -script $dynamic_script -# cookie handling for the expand/collpase -set onunload_script { - saveMsgsState(); -} - -set onload_script { - loadMsgsState(); -} - -template::add_body_handler -event onunload -script $onunload_script -template::add_body_handler -event onload -script $onload_script - set page_title "#forums.Thread_title#" Index: openacs-4/packages/forums/www/resources/forums.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/resources/forums.js,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/forums/www/resources/forums.js 13 Mar 2008 17:52:48 -0000 1.6 +++ openacs-4/packages/forums/www/resources/forums.js 19 Mar 2008 02:05:45 -0000 1.6.2.1 @@ -1,152 +1,52 @@ -var collapse_symbol = '-'; -var expand_symbol = '+'; -var replies = new Array(); - -// toggle visibility - -function getid(id) { - if(document.getElementById) - return document.getElementById(id); - else if(document.all) - return document.all(id); - return false; -} - -function toggle( targetId, state ){ - var symbol; - var content = getid( 'content'+targetId ); - var link = getid( 'toggle'+targetId ); - if(!link || !content) return; - - var s; - if(state != null) - s = state; - else if (content.className == "dynexpanded") { - s = 0; - } else { - s = 1; - } - if (s) { - content.className = "dynexpanded"; - symbol = collapse_symbol; - } else { - content.className = "dyncollapsed"; - symbol = expand_symbol; - } - - if(link.innerHTML) - link.innerHTML = symbol; - else if(link.appendChild) { - while(link.hasChildNodes()) - link.removeChild(link.firstChild); - link.appendChild(document.createTextNode(symbol)); - } -} - -function toggleList(a,state) { - if(!a.length) return; - for(var i = 0; i < a.length; ++i) { - toggle(a[i], state); - } -} - -// switch styles - -function setActiveStyleSheet(title) { - var i, a, msg_id, state; - //for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { - // if (a.getAttribute("rel") && - // a.getAttribute("rel").indexOf("style") != -1 && - // a.getAttribute("title")) { - // a.disabled = true; - // if(a.getAttribute("title") == title) a.disabled = false; - // } - //} - - switch (title) { - case 'expand': - a = document.getElementById('expand'); - if (a) {a.style.display = 'none';} - a = document.getElementById('collapse'); - if (a) {a.style.display = 'inline';} - state = 1; - break; - case 'collapse': - a = document.getElementById('expand'); - if (a) {a.style.display = 'inline';} - a = document.getElementById('collapse'); - if (a) {a.style.display = 'none';} - state = 0; - break; - } - - for (i=0; (a = document.getElementsByTagName("div")[i]); i++) { - if (a.getAttribute("id") && a.getAttribute("id").substring(0,4) == "msg_") { - msg_id = a.getAttribute("id").substring(4); - toggle(msg_id, state); - } - } - - -} - -function getActiveStyleSheet() { -// var i, a; -// for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { -// if (a.getAttribute("rel") && -// a.getAttribute("rel").indexOf("style") != -1 && -// a.getAttribute("title") && -// !a.disabled -// ) return a.getAttribute("title"); -// } -// return null; - var a; - a = document.getElementById('expand'); - if (a && a.style.display == 'none') - return 'expand'; - return 'collapse'; -} - -function getPreferredStyleSheet() { -// var i, a; -// for (i=0; (a = document.getElementsByTagName("link")[i]); i++) { -// if (a.getAttribute("rel") && -// a.getAttribute("rel").indexOf("style") != -1 && -// a.getAttribute("rel").indexOf("alt") == -1 && -// a.getAttribute("title") -// ) return a.getAttribute("title"); -// } - return 'expand'; -} - -function createCookie(name,value,days) { - if (days) { - var date = new Date(); - date.setTime(date.getTime()+(days*24*60*60*1000)); - var expires = "; expires="+date.toGMTString(); - } - else expires = ""; - document.cookie = name+"="+value+expires+"; path=/"; -} - -function readCookie(name) { - var nameEQ = name + "="; - var ca = document.cookie.split(';'); - for(var i=0;i < ca.length;i++) { - var c = ca[i]; - while (c.charAt(0)==' ') c = c.substring(1,c.length); - if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); - } - return null; -} - -function loadMsgsState() { - var cookie = readCookie("forums_messages_state"); - var title = cookie ? cookie : getPreferredStyleSheet(); - setActiveStyleSheet(title); -} - -function saveMsgsState() { - var title = getActiveStyleSheet(); - createCookie("forums_messages_state", title, 365); -} +var collapse_symbol = '-'; +var expand_symbol = '+'; +var replies = new Array(); + +// toggle visibility + +function getid(id) { + if(document.getElementById) + return document.getElementById(id); + else if(document.all) + return document.all(id); + return false; +} + +function toggle( targetId, state ){ + var symbol; + var content = getid( 'content'+targetId ); + var link = getid( 'toggle'+targetId ); + if(!link || !content) return; + + var s; + if(state != null) + s = state; + else if (content.className == "dynexpanded") { + s = 0; + } else { + s = 1; + } + if (s) { + content.className = "dynexpanded"; + symbol = collapse_symbol; + } else { + content.className = "dyncollapsed"; + symbol = expand_symbol; + } + + if(link.innerHTML) + link.innerHTML = symbol; + else if(link.appendChild) { + while(link.hasChildNodes()) + link.removeChild(link.firstChild); + link.appendChild(document.createTextNode(symbol)); + } +} + +function toggleList(a,state) { + if(!a.length) return; + for(var i = 0; i < a.length; ++i) { + toggle(a[i], state); + } +} +