<%@ language="javascript" %> <%/* Filename: dispBBprn.asp Version : 1.0ts Author : Niranjan Mysore Date : start: 07/24/2003 Last Modified: 2/20/2004 Purpose : Bulletin Board on TS site Description: * Print friendly version of BB * For the common user to view the messages (only the approved ones). To do : * Version History: * Variant notes: * No changes other than page title */ %> The TRUTH-SEEKER Bulletin Board <% // v1.1 function printTxtAreaInHTML(str) { var len, opStr; if(str=="null") // works with MS-Access { Response.Write(""); return; } len = str.length; opStr = "" + str.charAt(0); for(i=1;i
<% var w=660; // links for msg posting page, FAQ page, close window //var links = "

\n Post your message\n     \n     \n Close Bulletin Board
\n Frequently Asked Questions\n

"; var links = "

\n Post your message\n     \n\n Frequently Asked Questions\n

"; var conn=Server.CreateObject("ADODB.Connection") ; conn.Open(Session("Server")); var rs=Server.CreateObject("ADODB.recordset"); var count=0; var mySQL = ""; // handle page view of records var pageLength=Session.Contents("viewSetLengthV"); var dispSet1; var dispSet = String(Request.QueryString("st")); if(dispSet == "undefined") { Session("viewPageV")=1; dispSet1=""; } else if(dispSet == "0") { Session("viewPageV")=0; dispSet1=""; } else { Session("viewPageV")=1; dispSet1 = "AND mID <= " + dispSet; } var pageNum = String(Request.QueryString("page")); // receive the page # to be displayed var pageNum1; if(pageNum=="undefined") pageNum1=1; // default to first page else pageNum1 = parseInt(pageNum); // current page num var dispMany1=""; // query part indicating how many recs to be displayed viewPageV = Session.Contents("viewPageV"); if(viewPageV!=0) dispMany1 = "TOP " + pageLength; else dispMany1 = ""; %>

THE TRUTH-SEEKER BULLETIN BOARD


<%=links%> <% // get all the IDs and create page links var mIDAr; mIDAr=new Array(0); mySQL = "SELECT mID FROM BulletinBoard WHERE approved = 'y' ORDER BY mID DESC"; rs.Open(mySQL, conn); count = 0; while(!rs.EOF) { mIDAr[count]=rs.Fields("mID").Value; rs.MoveNext(); count++; } rs.close; var pages = mIDAr.length/pageLength; if(mIDAr.length % pageLength > 0)pages += 1; if(pages>1) { Response.Write("

Page "); for(i=1;i"+i+" "); else { Response.Write(""); Response.Write( i + " "); } } /* No All link as on 20040220 // print the word ALL appropriately if(viewPageV==0)Response.Write("ALL  "); else Response.Write("ALL  "); */ Response.Write("

"); } %>
<% var mID1, postedBy1, postDate1, summary1, msg1, reply1; // print the subject (summary) list first mySQL = "SELECT " + dispMany1 + " mID, postedBy, postDate, summary FROM BulletinBoard WHERE approved = 'y' " + dispSet1 +" ORDER BY mID DESC"; rs.Open(mySQL, conn); while(!rs.EOF) { mID1 = rs.Fields("mID").Value; postedBy1 = rs.Fields("postedBy").Value; postDate1 = rs.Fields("postDate").Value; summary1 = rs.Fields.Item("summary").Value; %> <% rs.MoveNext(); } // end while #1 rs.close; mySQL = "SELECT " + dispMany1 + " mID, postedBy, postDate, summary, msg, reply FROM BulletinBoard WHERE approved = 'y' " + dispSet1 +" ORDER BY mID DESC"; rs.Open(mySQL, conn); %>
Posted by Date Subject
<% =postedBy1 %> <% =postDate1 %>

<%=summary1%>

(Click on the message subject to view the entire message & the reply)


<%=links%> <% // print the message and reply while(!rs.EOF) { mID1 = rs.Fields("mID").Value; postedBy1 = rs.Fields("postedBy").Value; postDate1 = rs.Fields("postDate").Value; summary1 = String(rs.Fields.Item("summary").Value); msg1 = String(rs.Fields.Item("msg").Value); reply1 = String(rs.Fields.Item("reply").Value); %>
<% =postedBy1 %>
<% =postDate1 %>

<%printTxtAreaInHTML(summary1.replace(/\r/g, "
"))%>

<%printTxtAreaInHTML(msg1.replace(/\r/g, "
"))%>
<%printTxtAreaInHTML(reply1.replace(/\r/g, "
"))%>

Go to Top     Go to end <% rs.MoveNext(); count++; } rs.close; conn.close; %> <%=links%>