Index: openacs-4/packages/forums/www/resources/Collapse16.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/resources/Collapse16.gif,v diff -u Binary files differ Index: openacs-4/packages/forums/www/resources/CollapseAll16.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/resources/CollapseAll16.gif,v diff -u Binary files differ Index: openacs-4/packages/forums/www/resources/Expand16.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/resources/Expand16.gif,v diff -u Binary files differ Index: openacs-4/packages/forums/www/resources/ExpandAll16.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/resources/ExpandAll16.gif,v diff -u Binary files differ Index: openacs-4/packages/forums/www/resources/dyn_wait.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/resources/dyn_wait.gif,v diff -u Binary files differ Index: openacs-4/packages/forums/www/resources/dynamic-comments.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/resources/dynamic-comments.js,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/www/resources/dynamic-comments.js 27 Jan 2005 22:12:08 -0000 1.1 @@ -0,0 +1,242 @@ +// JavaScript used to manage dynamic-mode comments +// (c) 2002 Joe Groff. Use this code under whatever terms you wish, as long +// as you give me some credit. + +var nIframes = 0; + +// Block data which should be set from Scoop +var collapse_symbol; +var expand_symbol; +var loading_symbol; +var loading_message; +var rootdir; +var sid; + +// Internet Explorer on Windows prior to 5.5 doesn't support Array.push() +if(!Array.prototype.push) { + Array.prototype.push = function() { + var l = this.length; + for(var i = 0; i < arguments.length; ++i,++l) + this[l] = arguments[i]; + } +} + +// Arrays of cid indices for comment replies and new comments +var replies = new Array(); +var newcomments = new Array(); + +// Get an element by ID in a portable manner +function getid(id) { + if(document.all) + return document.all(id); + else if(document.getElementById) + return document.getElementById(id); + return false; +} + +// Get the document object inside an iframe in a portable manner +function getIframeDocument(id) { + if(document.frames) + return document.frames[id].document; + var ifrm = getid(id); + if(ifrm.contentDocument) + return ifrm.contentDocument; + else if(ifrm.contentWindow) + return ifrm.contentWindow.document; + else if(ifrm.document) + return ifrm.document; +} + +// Set the state of a comment. +// n is the cid of the comment to expand. +// move, if true, will cause the page to jump to that comment's header before +// changing its state. +// state, if set, will change the comment to that specific state (0 = collapsed +// 1 = expanded). If not set or set to null, the state will be toggled. +// rate, if set, will cause the comment to be given that specific rating. +function toggle(n,move,state,rate) { + var ifrmdoc = getIframeDocument('dynamic'); + var link = getid('toggle'+n); + var content = getid('content'+n); + if(!link || !content || !ifrmdoc) + return; + // Initialise the link's expandStatus if it hasn't yet been set + if(link.expandStatus == null) { + if(content.className == 'dynexpanded') + link.expandStatus = 1; + else + link.expandStatus = 0; + } + var s; + if(state != null) + s = state; + else if(!link.expandStatus) + s = 1; // set to expand + else + s = 0; // set to collapse + + // Immediately return if we aren't changing state at all + if((s == link.expandStatus) && (rate == null)) + return; + + if(move) window.location.hash = 'toggle'+n; + + if(rate == null + && (((s == 1) && content.expandedContent) + || ((s == 0) && content.collapsedContent))) { + // If we've already grabbed the desired state for this comment, + // set it right here + + setSavedState(n, s); + } + else { + // Otherwise grab it from the server using the iframe + setLoading(n); + var src = rootdir+"?cid="+n+"&sid="+sid+"&dynamicmode="+s; + if(rate != null) + src += ";rate=Rate;rating_"+n+"="+rate; + ifrmdoc.location.replace(src); + // The content will be set by the iframe's onLoad property + } +} + +// Set the state of all the comments listed in an array. +function toggleList(a,state) { + var fetch_cids = new Array(); // cids we need to ask the server for + var contentprop = (state? 'expandedContent' : 'collapsedContent'); + var content; + var ifrmdoc = getIframeDocument('dynamic'); + + if(!a.length) return; + for(var i = 0; i < a.length; ++i) { + content = getid('content'+a[i]); + if(!content) continue; + // Skip this one if it's already in the proper state + if((state && (content.className == 'dynexpanded')) + || (!state && (content.className == 'dyncollapsed'))) + continue; + // Check if we already have the desired content for this cid + if(content[contentprop]) + setSavedState(a[i], state); + else { + fetch_cids.push(a[i]); + setLoading(a[i]); + } + } + // Grab the remaining comments from the server + if(fetch_cids.length > 0) + ifrmdoc.location.replace(rootdir+"?cid="+fetch_cids.join('&cid=')+"&sid="+sid+"&dynamicmode="+state); +} + +// Function to set comment content from already-saved data +function setSavedState(n,s) { + var content = getid('content'+n); + // Fill in the comment + if(content.innerHTML) { + if((s == 1) && content.expandedContent) + content.innerHTML = content.expandedContent; + else if((s == 0) && content.collapsedContent) + content.innerHTML = content.collapsedContent; + } + else if(content.appendChild) { + var nodes; + if((s == 1) && content.expandedContent) + nodes = content.expandedContent; + else if((s == 0) && content.collapsedContent) + nodes = content.collapsedContent; + if(nodes) { + while(content.hasChildNodes()) + content.removeChild(content.firstChild); + for(var i = 0; i < nodes.length; ++i) + content.appendChild(nodes[i]); + } + } + // Set the link state + setState(n,s); +} + +// Set a link into waiting state +function setLoading(n) { + var link = getid('toggle'+n); + var content = getid('content'+n); + if(!link || !content) return; + + if(content.innerHTML) { + content.innerHTML = loading_message; + link.innerHTML = loading_symbol; + } + else if(content.appendChild) { + while(content.hasChildNodes()) + content.removeChild(content.firstChild); + content.appendChild(document.createTextNode(loading_message)); + + while(link.hasChildNodes()) + link.removeChild(link.firstChild); + link.appendChild(document.createTextNode(loading_symbol)); + } +} + +// Set a link into collapsed or expanded state +function setState(n,s) { + var link = getid('toggle'+n); + var content = getid('content'+n); + if(!link || !content) return; + + var symbol; + if (s) symbol = collapse_symbol; + else 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)); + } + link.expandStatus = s; + content.className = (s? 'dynexpanded' : 'dyncollapsed'); +} + +// Called from the iframe's onload event to ship the content into the main +// page +function copyContent(no,s) { + if(window == top || !parent.setState) return true; + + var content; + var body = document.body; + var divs; + var n; + + // Get the set of comments out of the body + if(body.children) + divs = body.children.tags('DIV'); + else if(body.childNodes) { + divs = new Array(); + for(var i = 0; i < body.childNodes.length; ++i) + if(body.childNodes[i].tagName == 'DIV') + divs.push(body.childNodes[i]); + } + + for (var i = 0; i < divs.length; ++i) { + n = divs[i].getAttribute('id'); + content = parent.getid('content'+n); + if(!content) continue; + + if (content.innerHTML) { + content.innerHTML = divs[i].innerHTML; + if(s == 1) content.expandedContent = content.innerHTML; + else if(s == 0) content.collapsedContent = content.innerHTML; + } + else if(content.appendChild) { + while(content.hasChildNodes()) + content.removeChild(content.firstChild); + for(var i = 0; i < divs[i].childNodes.length; ++i) { + var nod = divs[i].childNodes[i].cloneNode(true); + content.appendChild(nod); + } + if(s == 1) content.expandedContent = content.childNodes; + else if(s == 0) content.collapsedContent = content.childNodes; + } + parent.setState(n,s); + } +} + Index: openacs-4/packages/forums/www/resources/flat.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/resources/flat.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/www/resources/flat.css 27 Jan 2005 22:12:08 -0000 1.1 @@ -0,0 +1,30 @@ +#forum-thread .level1 { + margin-left: 0em; +} +#forum-thread .level2 { + margin-left: 0em; +} +#forum-thread .level3 { + margin-left: 0em; +} +#forum-thread .level4 { + margin-left: 0em; +} +#forum-thread .level5 { + margin-left: 0em; +} +#forum-thread .level6 { + margin-left: 0em; +} +#forum-thread .level7 { + margin-left: 0em; +} +#forum-thread .level8 { + margin-left: 0em; +} +#forum-thread .level9 { + margin-left: 0em; +} +#forum-thread .level10 { + margin-left: 0em; +} Index: openacs-4/packages/forums/www/resources/forums.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/resources/forums.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/www/resources/forums.css 27 Jan 2005 22:12:08 -0000 1.1 @@ -0,0 +1,118 @@ +#forum-thread { + max-width: 95%; + text-align: left; + margin-bottom: 5px; + margin-left: 1em; +} + +#forum-thread .action-list { + float: right; + text-align: right; + margin-top: 8px; + margin-right: 8px; +} + +#forum-thread .details { + margin-top: 3px; +} + +#forum-thread .content { + text-align: left; + padding: 0.5em; + margin-bottom: 1em; +} + +#forum-thread .dynexpanded { + padding-top: 3px; + padding-bottom: 3px; + border: 0px; +} + +#forum-thread .dyncollapsed { + padding: 0px; +} + +#forum-thread .subject { + text-align: left; + background: #f0f0f0; + padding: 0.5em; +} + +#forum-thread .subject a.title { +# color: blue; +# font-weight: bold; + text-decoration:none; +} + +#forum-thread .subject .viewed0 { +} + +#forum-thread .subject .viewed1 { + font-weight: normal; +} + +#forum-thread .subject .response { + color: black; +} +#forum-thread .subject .reference { + color: green; +} + +#forum-thread .attribution { + padding-top: 0.5em; + color: #aaaaaa; +} + +#forum-thread .attribution a { + font-weight: normal; +} + +#forum-thread .odd { + background: #d9e4f9; +} + +#forum-thread .even { + background: #eeeeee; +} + +#forum-thread .level0 { + margin-left: 0em; +} +#forum-thread .level1 { + margin-left: 1em; +} +#forum-thread .level2 { + margin-left: 2em; +} +#forum-thread .level3 { + margin-left: 3em; +} +#forum-thread .level4 { + margin-left: 4em; +} +#forum-thread .level5 { + margin-left: 5em; +} +#forum-thread .level6 { + margin-left: 6em; +} +#forum-thread .level7 { + margin-left: 7em; +} +#forum-thread .level8 { + margin-left: 8em; +} +#forum-thread .level9 { + margin-left: 9em; +} +#forum-thread .level10 { + margin-left: 10em; +} + +.left { + float: left; +} + +.right { + float: right; +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/www/resources/forums.js 27 Jan 2005 22:12:08 -0000 1.1 @@ -0,0 +1,126 @@ +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, main; + 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; + } + } +} + +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; +} + +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 null; +} + +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; +} + +window.onload = function(e) { + var cookie = readCookie("style"); + var title = cookie ? cookie : getPreferredStyleSheet(); + setActiveStyleSheet(title); +} + +window.onunload = function(e) { + var title = getActiveStyleSheet(); + createCookie("style", title, 365); +} + +var cookie = readCookie("style"); +var title = cookie ? cookie : getPreferredStyleSheet(); +setActiveStyleSheet(title); +