|
From: creedon <icr...@us...> - 2005-07-25 21:56:48
|
Update of /cvsroot/frontierkernel/odbs/mainResponderRoot/mainResponder/discuss In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13771 Modified Files: listDay Log Message: added else to if (flCss) and (class != ""), sets class to "", otherwise we end up with funky html Index: listDay =================================================================== RCS file: /cvsroot/frontierkernel/odbs/mainResponderRoot/mainResponder/discuss/listDay,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** listDay 26 Mar 2005 21:45:35 -0000 1.1.1.1 --- listDay 25 Jul 2005 21:56:38 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:mainResponder.discuss.listDay ! on listDay (d, bgColor="ivory", otherColor="beige", tableWidth=425, pta=nil, headerColor="black", headerTextColor=nil, cssPrefix="") { ÇList the discussion group messages for a single day. ÇChanges: ÇSat, 27 Feb 1999 23:16:13 GMT by AR ÇModified call to mainresponder.calendar.getdayaddress so it doesn't create the calendar entry ÇTweaked the html code to use valign=middle instead of valign=center ÇMon, 01 Mar 1999 15:01:02 GMT by AR ÇThe script's parameter must be a date type - otherwise a scripterror will be thrown. ÇTo convert other date representations to date type, take a look at mainResponder.calendar.getAddressDay and mainResponder.calendar.pathArgsToDate ÇSat, 06 Mar 1999 17:08:06 GMT by AR ÇCommented out code for caching table lines. ÇWed, 26 May 1999 01:10:41 GMT by AR ÇAdded new optional paramaters bgcolor, othercolor, and tablewidth to allow the calling script more influence over the layout of the table. ÇChanged value of membershipGroup from config.mainresponder.globals.defaultMembershipGroup to pta^.responderAttributes.defaultMembershipGroup. ÇTue, Aug 3, 1999 at 12:39:52 PM by PBS ÇAdded optional pta parameter. ÇSince member names are often repeated, added a local table to cache the names while building the page, to avoid unnecessary calls out. Ç10/30/99; 1:12:22 PM by PBS ÇheaderColor is a new optional parameter for specifying the color of the header at the top of a discussion group messages list. If not specified, the default is black, which is current behavior. ÇheaderTextColor is a new optional parameter for specifying the color of the text inside the header. If not specified, the default is the parameter in bgColor. ÇIn both cases, default behavior applies if you don't specify the parameter. Ç04/12/00; 1:01:38 PM by JES ÇLocalized column headers and table header using mainResponder.getString Ç05/30/00; 5:22:03 PM by PBS ÇcssPrefix is a new optional parameter. If supplied, then CSS classes are added to the tables, rows, cells, and font tags. Ç05/31/00; 3:50:03 PM by PBS ÇTypo fix: there was a colspan=6 when there are only 5 columns. Ç06/01/00; 9:04:38 PM by JES Çmerged CSS code with localization code if pta == nil { pta = html.getPageTableAddress ()}; local (adrData = mainResponder.discuss.openRoot (pta)); local (adrCal = @adrData^.calendar); local (adrMsgs = @adrData^.messages); local (htmlText = "", indentLevel = 0); local (adrDay, i, ct); local (membershipGroup = pta^.responderAttributes.defaultMembershipGroup); local (msgReaderUrl = pta^.responderAttributes.urls^.discussMsgReader); local (flCss = (cssPrefix != "")); //if true, emit CSS classes, otherwise don't local (nameTable); new (tableType, @nameTable); on add (s) { htmlText = htmlText + string.filledString ("\t", indentLevel) + s + "\r"}; Çon td (s, align="") Çadd ("<td nowrap " + align + " valign=\"middle\"><font size=\"-1\"> " + s + " </font></td>") on td (s, align="", class="", height="") { local (fontClass = ""); if (flCss) and (class != "") { class = cssPrefix + class; fontClass = " class=\"" + class + "Font\""; class = " class=\"" + class + "\""}; if height != "" { height = " height=\"" + height + "\""}; if align != "" { align = " " + align}; add ("<td nowrap" + align + " valign=\"middle\"" + class + height + "><font size=\"-1\"" + fontClass + "> " + s + " </font></td>")}; on shortenString (s, maxLen=35) { Çif sizeOf (s) <= maxLen Çreturn (s) return (string.mid (s, 1, maxLen - 3) + "...")}; try { //get the address of this day in the calendar structure for this discussion group. adrDay = mainResponder.calendar.getDayAddress (adrCal, d, flCreate:false); ct = sizeOf (adrDay^)} else { ct = 0}; //no messages yet, shortcut building of message listing Çadd ("<table cellpadding=\"0\" cellspacing=\"1\">"); indentLevel++ bundle { //start the table if flCss { add ("<table cellpadding=\"0\" cellspacing=\"1\" class=\"" + cssPrefix + "Table\">"); indentLevel++} else { add ("<table cellpadding=\"0\" cellspacing=\"1\">"); indentLevel++}}; Çbundle //add the date on a black background Çadd ("<tr><td height=\"10\"><td> </td></tr>") //blank spacer row Çadd ("<tr bgcolor=\"" + headerColor + "\">"); indentLevel++ //PBS 10/30/99: variable header color, black by default Çif headerTextColor == nil //PBS 10/30/99: the header text color may also be specified ÇheaderTextColor = bgColor Çadd ("<td height=\"24\" width=\"" + tableWidth + "\" colspan=\"6\"><font color=\"" + headerTextColor + "\" size=\"-0\"> <b> " + mainResponder.localization.longDateString (d, pta) + " </b></font></td>") // 4/13/00 JES: localized the date Çadd ("</tr>"); indentLevel-- bundle { //add the date on a black background if flCss { //header row add ("<tr bgcolor=\"" + headerColor + "\" class=\"" + cssPrefix + "SeparatorRow\">"); indentLevel++} //PBS 10/30/99: variable header color, black by default else { add ("<tr bgcolor=\"" + headerColor + "\">"); indentLevel++}; //PBS 10/30/99: variable header color, black by default if headerTextColor == nil { //PBS 10/30/99: the header text color may also be specified headerTextColor = bgColor}; if flCss { //header cell -- 06/01/00 JES: localized date string in new code add ("<td height=\"24\" width=\"" + tableWidth + "\" colspan=\"5\" class=\"" + cssPrefix + "SeparatorCell\"><font color=\"" + headerTextColor + "\" size=\"-0\" class=\"" + cssPrefix + "SeparatorFont\"> <b> " + mainResponder.localization.longDateString (d, pta) + " </b></font></td>")} //PBS 05/31/00: 5 columns, not 6 else { add ("<td height=\"24\" width=\"" + tableWidth + "\" colspan=\"5\"><font color=\"" + headerTextColor + "\" size=\"-0\"> <b> " + mainResponder.localization.longDateString (d, pta) + " </b></font></td>")}; //PBS 05/31/00: 5 columns, not 6 add ("</tr>"); indentLevel--}; bundle { //add column titles Çbundle // 06/01/00 JES: old code Çadd ("<tr bgcolor=\"" + otherColor + "\">"); indentLevel++ Çadd ("<td height=\"28\"></td>") //a dummy table cell to establish row height if flCss { //titles row add ("<tr bgcolor=\"" + otherColor + "\" class=\"" + cssPrefix + "TitleRow\">"); indentLevel++} else { add ("<tr bgcolor=\"" + otherColor + "\">"); indentLevel++}; Ç4/13/00; 3:53:31 PM by JES -- localized column headers td ("<b>" + mainResponder.getString ("listHeaders.shortNum") + "</b>", align:"align=\"center\"", class:"MessageLinkTitle", height:28); td ("<b>" + mainResponder.getString ("listHeaders.posted") + "</b>", align:"align=\"center\"", class:"PostedTitle"); td ("<b>" + mainResponder.getString ("listHeaders.ct") + "</b>", align:"align=\"center\"", class:"ReadsTitle"); td ("<b>" + mainResponder.getString ("listHeaders.author") + "</b>", class:"AuthorTitle"); td ("<b>" + mainResponder.getString ("listHeaders.subject") + "</b>", class:"SubjectTitle"); add ("</tr>"); indentLevel--}; for i = ct downTo 1 { //loop through messages in reverse-chronological order local (adrItem, memberName); adrItem = @adrMsgs^.[nameOf (adrDay^ [i])]; bundle { //was this message deleted? If so, skip it. if defined (adrItem^.flDeleted) { ÇThe flDeleted flag may not exist: it's necessary to test for existence before testing whether it's true or false. if adrItem^.flDeleted { continue}}}; bundle { //message row if flCss { add ("<tr bgcolor=\"" + otherColor + "\" class=\"" + cssPrefix + "MessageRow\">"); indentLevel++} else { add ("<tr bgcolor=\"" + otherColor + "\">"); indentLevel++}}; bundle { //add the message number, it's the link local (url = msgReaderUrl + adrItem^.msgNum); td ("<a href=\"" + url + "\">" + adrItem^.msgNum + "</a>", align:"align=\"center\"", class:"MessageLink", height:28)}; bundle { //add post time and read count. td (mainResponder.localization.shortTimeString (adrItem^.postTime), align:"align=\"center\"", class:"Posted"); // 4/13/00 by JES: localized postTime td (adrItem^.ctReads, align:"align=\"right\"", class:"CountReads")}; bundle { //get the name of the member who posted this message. if defined (nameTable.[adrItem^.member]) { //cache member names in a local table, since repetitions are likely memberName = nameTable.[adrItem^.member]} else { memberName = mainResponder.members.getMemberName (membershipGroup, adrItem^.member); nameTable.[adrItem^.member] = memberName}}; bundle { //add the name of the member who posted this message. if sizeOf (memberName) > 20 { td (shortenString (memberName, 20), class:"Author")} else { td (memberName, class:"Author")}}; bundle { //add the subject of the message. if sizeOf (adrItem^.subject) > 40 { td (shortenString (adrItem^.subject, 40), class:"Subject")} else { td (adrItem^.subject, class:"Subject")}}; add ("</tr>"); indentLevel--; Çbundle //code to implement caching (deactivated) Çif false //defined (adritem^.htmlcache) Çlocal (oldindentlevel = indentlevel) Çindentlevel = 0 Çadd (adritem^.htmlcache) Çindentlevel = oldindentlevel Çelse Çon shortenstring (s, maxlen=35) Çif sizeof (s) <= maxlen Çreturn (s) Çreturn (string.mid (s, 1, maxlen - 3) + "...") Çlocal (ixhtmltext = sizeof (htmltext)) Çadd ("<tr bgcolor=\"" + othercolor + "\">"); indentlevel++ Çadd ("<td height=\"28\"></td>") //a dummy table cell to establish row height Çbundle //add the message number, it's the link Çlocal (url = pta^.responderAttributes.urls^.discussMsgReader + adritem^.msgnum) Çtd ("<a href=\"" + url + "\">" + adritem^.msgnum + "</a>", align:"align=\"center\"") Çtd (date.timeString (adritem^.posttime, includeSeconds:false), align:"align=\"center\"") Çtd (adritem^.ctreads, align:"align=\"right\"") Çlocal (membername = mainResponder.members.getMemberName (membershipGroup, adritem^.member)) Çtd (shortenstring (membername, 20)) Çtd (shortenstring (adritem^.subject, 40)) Çadd ("</tr>"); indentlevel-- Ç Çadritem^.htmlcache = string.delete (htmltext, 1, ixhtmltext) Çadritem^.htmlcache = string.delete (adritem^.htmlcache, sizeof (adritem^.htmlcache), 1)}; add ("</table>"); indentLevel--; return (htmlText)} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:mainResponder.discuss.listDay ! on listDay (d, bgColor="ivory", otherColor="beige", tableWidth=425, pta=nil, headerColor="black", headerTextColor=nil, cssPrefix="") { ÇList the discussion group messages for a single day. ÇChanges Ç7/14/05; 8:07:35 PM by TAC Çadded else to if (flCss) and (class != ""), sets class to "", otherwise we end up with funky html Ç06/01/00; 9:04:38 PM by JES Çmerged CSS code with localization code Ç05/31/00; 3:50:03 PM by PBS ÇTypo fix: there was a colspan=6 when there are only 5 columns. Ç05/30/00; 5:22:03 PM by PBS ÇcssPrefix is a new optional parameter. If supplied, then CSS classes are added to the tables, rows, cells, and font tags. Ç04/12/00; 1:01:38 PM by JES ÇLocalized column headers and table header using mainResponder.getString Ç10/30/99; 1:12:22 PM by PBS ÇheaderColor is a new optional parameter for specifying the color of the header at the top of a discussion group messages list. If not specified, the default is black, which is current behavior. ÇheaderTextColor is a new optional parameter for specifying the color of the text inside the header. If not specified, the default is the parameter in bgColor. ÇIn both cases, default behavior applies if you don't specify the parameter. ÇTue, Aug 3, 1999 at 12:39:52 PM by PBS ÇAdded optional pta parameter. ÇSince member names are often repeated, added a local table to cache the names while building the page, to avoid unnecessary calls out. ÇWed, 26 May 1999 01:10:41 GMT by AR ÇAdded new optional paramaters bgcolor, othercolor, and tablewidth to allow the calling script more influence over the layout of the table. ÇChanged value of membershipGroup from config.mainresponder.globals.defaultMembershipGroup to pta^.responderAttributes.defaultMembershipGroup. ÇSat, 06 Mar 1999 17:08:06 GMT by AR ÇCommented out code for caching table lines. ÇMon, 01 Mar 1999 15:01:02 GMT by AR ÇThe script's parameter must be a date type - otherwise a scripterror will be thrown. ÇTo convert other date representations to date type, take a look at mainResponder.calendar.getAddressDay and mainResponder.calendar.pathArgsToDate ÇSat, 27 Feb 1999 23:16:13 GMT by AR ÇModified call to mainresponder.calendar.getdayaddress so it doesn't create the calendar entry ÇTweaked the html code to use valign=middle instead of valign=center if pta == nil { pta = html.getPageTableAddress ()}; local (adrData = mainResponder.discuss.openRoot (pta)); local (adrCal = @adrData^.calendar); local (adrMsgs = @adrData^.messages); local (htmlText = "", indentLevel = 0); local (adrDay, i, ct); local (membershipGroup = pta^.responderAttributes.defaultMembershipGroup); local (msgReaderUrl = pta^.responderAttributes.urls^.discussMsgReader); local (flCss = (cssPrefix != "")); //if true, emit CSS classes, otherwise don't local (nameTable); new (tableType, @nameTable); on add (s) { htmlText = htmlText + string.filledString ("\t", indentLevel) + s + "\r"}; Çon td (s, align="") Çadd ("<td nowrap " + align + " valign=\"middle\"><font size=\"-1\"> " + s + " </font></td>") on td (s, align="", class="", height="") { local (fontClass = ""); if (flCss) and (class != "") { class = cssPrefix + class; fontClass = " class=\"" + class + "Font\""; class = " class=\"" + class + "\""} else { class = ""}; if height != "" { height = " height=\"" + height + "\""}; if align != "" { align = " " + align}; add ("<td nowrap" + align + " valign=\"middle\"" + class + height + "><font size=\"-1\"" + fontClass + "> " + s + " </font></td>")}; on shortenString (s, maxLen=35) { Çif sizeOf (s) <= maxLen Çreturn (s) return (string.mid (s, 1, maxLen - 3) + "...")}; try { //get the address of this day in the calendar structure for this discussion group. adrDay = mainResponder.calendar.getDayAddress (adrCal, d, flCreate:false); ct = sizeOf (adrDay^)} else { ct = 0}; //no messages yet, shortcut building of message listing Çadd ("<table cellpadding=\"0\" cellspacing=\"1\">"); indentLevel++ bundle { //start the table if flCss { add ("<table cellpadding=\"0\" cellspacing=\"1\" class=\"" + cssPrefix + "Table\">"); indentLevel++} else { add ("<table cellpadding=\"0\" cellspacing=\"1\">"); indentLevel++}}; Çbundle //add the date on a black background Çadd ("<tr><td height=\"10\"><td> </td></tr>") //blank spacer row Çadd ("<tr bgcolor=\"" + headerColor + "\">"); indentLevel++ //PBS 10/30/99: variable header color, black by default Çif headerTextColor == nil //PBS 10/30/99: the header text color may also be specified ÇheaderTextColor = bgColor Çadd ("<td height=\"24\" width=\"" + tableWidth + "\" colspan=\"6\"><font color=\"" + headerTextColor + "\" size=\"-0\"> <b> " + mainResponder.localization.longDateString (d, pta) + " </b></font></td>") // 4/13/00 JES: localized the date Çadd ("</tr>"); indentLevel-- bundle { //add the date on a black background if flCss { //header row add ("<tr bgcolor=\"" + headerColor + "\" class=\"" + cssPrefix + "SeparatorRow\">"); indentLevel++} //PBS 10/30/99: variable header color, black by default else { add ("<tr bgcolor=\"" + headerColor + "\">"); indentLevel++}; //PBS 10/30/99: variable header color, black by default if headerTextColor == nil { //PBS 10/30/99: the header text color may also be specified headerTextColor = bgColor}; if flCss { //header cell -- 06/01/00 JES: localized date string in new code add ("<td height=\"24\" width=\"" + tableWidth + "\" colspan=\"5\" class=\"" + cssPrefix + "SeparatorCell\"><font color=\"" + headerTextColor + "\" size=\"-0\" class=\"" + cssPrefix + "SeparatorFont\"> <b> " + mainResponder.localization.longDateString (d, pta) + " </b></font></td>")} //PBS 05/31/00: 5 columns, not 6 else { add ("<td height=\"24\" width=\"" + tableWidth + "\" colspan=\"5\"><font color=\"" + headerTextColor + "\" size=\"-0\"> <b> " + mainResponder.localization.longDateString (d, pta) + " </b></font></td>")}; //PBS 05/31/00: 5 columns, not 6 add ("</tr>"); indentLevel--}; bundle { //add column titles Çbundle // 06/01/00 JES: old code Çadd ("<tr bgcolor=\"" + otherColor + "\">"); indentLevel++ Çadd ("<td height=\"28\"></td>") //a dummy table cell to establish row height if flCss { //titles row add ("<tr bgcolor=\"" + otherColor + "\" class=\"" + cssPrefix + "TitleRow\">"); indentLevel++} else { add ("<tr bgcolor=\"" + otherColor + "\">"); indentLevel++}; Ç4/13/00; 3:53:31 PM by JES -- localized column headers td ("<b>" + mainResponder.getString ("listHeaders.shortNum") + "</b>", align:"align=\"center\"", class:"MessageLinkTitle", height:28); td ("<b>" + mainResponder.getString ("listHeaders.posted") + "</b>", align:"align=\"center\"", class:"PostedTitle"); td ("<b>" + mainResponder.getString ("listHeaders.ct") + "</b>", align:"align=\"center\"", class:"ReadsTitle"); td ("<b>" + mainResponder.getString ("listHeaders.author") + "</b>", class:"AuthorTitle"); td ("<b>" + mainResponder.getString ("listHeaders.subject") + "</b>", class:"SubjectTitle"); add ("</tr>"); indentLevel--}; for i = ct downTo 1 { //loop through messages in reverse-chronological order local (adrItem, memberName); adrItem = @adrMsgs^.[nameOf (adrDay^ [i])]; bundle { //was this message deleted? If so, skip it. if defined (adrItem^.flDeleted) { ÇThe flDeleted flag may not exist: it's necessary to test for existence before testing whether it's true or false. if adrItem^.flDeleted { continue}}}; bundle { //message row if flCss { add ("<tr bgcolor=\"" + otherColor + "\" class=\"" + cssPrefix + "MessageRow\">"); indentLevel++} else { add ("<tr bgcolor=\"" + otherColor + "\">"); indentLevel++}}; bundle { //add the message number, it's the link local (url = msgReaderUrl + adrItem^.msgNum); td ("<a href=\"" + url + "\">" + adrItem^.msgNum + "</a>", align:"align=\"center\"", class:"MessageLink", height:28)}; bundle { //add post time and read count. td (mainResponder.localization.shortTimeString (adrItem^.postTime), align:"align=\"center\"", class:"Posted"); // 4/13/00 by JES: localized postTime td (adrItem^.ctReads, align:"align=\"right\"", class:"CountReads")}; bundle { //get the name of the member who posted this message. if defined (nameTable.[adrItem^.member]) { //cache member names in a local table, since repetitions are likely memberName = nameTable.[adrItem^.member]} else { memberName = mainResponder.members.getMemberName (membershipGroup, adrItem^.member); nameTable.[adrItem^.member] = memberName}}; bundle { //add the name of the member who posted this message. if sizeOf (memberName) > 20 { td (shortenString (memberName, 20), class:"Author")} else { td (memberName, class:"Author")}}; bundle { //add the subject of the message. if sizeOf (adrItem^.subject) > 40 { td (shortenString (adrItem^.subject, 40), class:"Subject")} else { td (adrItem^.subject, class:"Subject")}}; add ("</tr>"); indentLevel--; Çbundle //code to implement caching (deactivated) Çif false //defined (adritem^.htmlcache) Çlocal (oldindentlevel = indentlevel) Çindentlevel = 0 Çadd (adritem^.htmlcache) Çindentlevel = oldindentlevel Çelse Çon shortenstring (s, maxlen=35) Çif sizeof (s) <= maxlen Çreturn (s) Çreturn (string.mid (s, 1, maxlen - 3) + "...") Çlocal (ixhtmltext = sizeof (htmltext)) Çadd ("<tr bgcolor=\"" + othercolor + "\">"); indentlevel++ Çadd ("<td height=\"28\"></td>") //a dummy table cell to establish row height Çbundle //add the message number, it's the link Çlocal (url = pta^.responderAttributes.urls^.discussMsgReader + adritem^.msgnum) Çtd ("<a href=\"" + url + "\">" + adritem^.msgnum + "</a>", align:"align=\"center\"") Çtd (date.timeString (adritem^.posttime, includeSeconds:false), align:"align=\"center\"") Çtd (adritem^.ctreads, align:"align=\"right\"") Çlocal (membername = mainResponder.members.getMemberName (membershipGroup, adritem^.member)) Çtd (shortenstring (membername, 20)) Çtd (shortenstring (adritem^.subject, 40)) Çadd ("</tr>"); indentlevel-- Ç Çadritem^.htmlcache = string.delete (htmltext, 1, ixhtmltext) Çadritem^.htmlcache = string.delete (adritem^.htmlcache, sizeof (adritem^.htmlcache), 1)};}; add ("</table>"); indentLevel--; return (htmlText)} \ No newline at end of file |