Index: openacs-4/packages/forums/lib/message/row.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/lib/message/row.adp,v diff -u -N -r1.15 -r1.16 --- openacs-4/packages/forums/lib/message/row.adp 23 Dec 2007 14:50:15 -0000 1.15 +++ openacs-4/packages/forums/lib/message/row.adp 25 Mar 2008 21:26:57 -0000 1.16 @@ -29,7 +29,7 @@
- + + +
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 -N -r1.6 -r1.7 --- 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 25 Mar 2008 21:26:57 -0000 1.7 @@ -1,152 +1,53 @@ -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 forums_collapse_symbol = '-'; +var forums_expand_symbol = '+'; +var forums_replies = new Array(); + +// toggle visibility + +function forums_getid(id) { + if(document.getElementById) + return document.getElementById(id); + else if(document.all) + return document.all(id); + return false; +} + +function forums_toggle(targetId, state){ + var symbol; + var content = forums_getid('content'+targetId); + var link = forums_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 = forums_collapse_symbol; + } else { + content.className = "dyncollapsed"; + symbol = forums_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 forums_toggleList(a,state) { + if (!a.length) return; + for (var i = 0; i < a.length; ++i) { + forums_toggle(a[i], state); + } +} +