<%
if request("dtype") = "" then dtype = dtype else dtype = request("dtype")
if catid = "" then catid = request("catid")
if recid = "" then recid = request("recid")
if weburl = "" then weburl = Request.ServerVariables("url")
if dtype = "1" then
Response.Write DisplayData(1, "", "", weburl)
elseif dtype = "2" then
if catid = "" then catid = 1
Response.Write DisplayData(2, catid, "", weburl)
elseif dtype = "3" then
Response.Write DisplayData(3, "", "", weburl)
elseif dtype = "4" then
if catid = "" then catid = 1
if recid = "" then recid = 1
Response.Write DisplayData(4, catid, recid, weburl)
end if
Function DisplayData(dtype, catid, recid, filename)
tablestyle = """BORDER-RIGHT: #f2f0f4 1px solid; BORDER-TOP: #f2f0f4 1px solid; BORDER-LEFT: #f2f0f4 1px solid; BORDER-BOTTOM: #f2f0f4 1px solid"""
headerbgcolor = "lightgrey"
headerfontsize = "2"
headerfontcolor = "white"
fontface = "Verdana"
fontsize = "2"
fontcolor = "blue"
set dataconn =Server.CreateObject("ADODB.Connection")
dataconn.ConnectionString = xDb_Conn_Str
dataconn.open
Select case dtype
case 1
query = "select catname,catid from NMCattbl"
set rs = dataconn.Execute(query)
do until rs.eof
Response.Write "
<TABLE WIDTH=100% align=center valign=top style="&tablestyle&" BORDER=0 CELLSPACING=0 CELLPADDING=4>"
Response.Write "<tr><td width=100% bgcolor="& headerbgcolor&" valign=top><FONT face="&fontface&" size="& headerfontsize&" color="& headerfontcolor&">
"&rs(0)&"</font></td></tr>"
query1 = "select newsid,newsname from NMNewstbl where catid = "& rs(1) &" and activated = "& true & " and newsexpiry > #"& date() &"# order by newsdateadded desc"
set rs1 = dataconn.Execute(query1)
if rs1.eof then
Response.Write "<tr><td width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">Currently there are no News Articles in this Section</font></td></tr>"
else
do until rs1.eof
Response.Write "<tr><td width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&"><img src=/public/archivio/images/display.gif border=0 align=absmiddle>
<u>"&rs1(1)&"</u></font></td></tr>"
rs1.movenext
loop
end if
rs1.close
set rs1 = nothing
Response.Write "</table>"
rs.movenext
loop
rs.close
set rs = nothing
case 2
query = "select catname from NMCattbl where catid = "& catid
set rs = dataconn.Execute(query)
if not rs.eof then
Response.Write "
<TABLE WIDTH=30% align=center valign=top style="&tablestyle&" BORDER=0 CELLSPACING=0 CELLPADDING=4>"
Response.Write "<tr><td colspan=2 width=100% bgcolor="& headerbgcolor&" valign=top><FONT face="&fontface&" size="& headerfontsize&" color="& headerfontcolor&">
Headlines in "&rs(0)&"</font></td></tr>"
query1 = "select newsid,newsname,newsdateadded,newsdescription,news doc1name from NMNewstbl where catid = "& catid &" and activated = "& true & " and newsexpiry > #"& date() &"# order by newsdateadded desc"
set rs1 = dataconn.Execute(query1)
if rs1.eof then
Response.Write "<tr><td colspan=2 width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">Currently there are no News Articles in this Section</font></td></tr>"
else
do until rs1.eof
Response.Write "<tr><td width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">"
if rs1(4) <> "" then
Response.Write "
<center>[img][/img]</center>"
end if
Response.Write "
"&rs1(1)&" "&rs1(2)&"
"&rs1(3)&"
....Read More</font></td></tr>"
rs1.movenext
loop
end if
rs1.close
set rs1 = nothing
Response.Write "</table>"
else
Response.Write "
<TABLE WIDTH=100% align=center valign=top style="&tablestyle&" BORDER=0 CELLSPACING=0 CELLPADDING=4>"
Response.Write "<tr><td width=100% bgcolor="& headerbgcolor&" valign=top><FONT face="&fontface&" size="& headerfontsize&" color="& headerfontcolor&">
No Category found with this Id.</font></td></tr>"
Response.Write "<tr><td width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">News Articles not found.</font></td></tr>"
Response.Write "</table>"
end if
rs.close
set rs = nothing
case 3
query = "select newsid,newsname,catid,newsdateadded,newsdescriptio n,newsdoc1name from NMNewstbl where activated = "& true & " and newsexpiry > #"& date() &"# order by newsdateadded desc"
set rs = dataconn.Execute(query)
if not rs.eof then
Response.Write "
<TABLE WIDTH=30% align=center valign=top style="&tablestyle&" BORDER=0 CELLSPACING=0 CELLPADDING=4>"
'Response.Write "<tr><td colspan=2 width=100% bgcolor="& headerbgcolor&" valign=top><FONT face="&fontface&" size="& headerfontsize&" color="& headerfontcolor&">
Headlines</font></td></tr>"
'do until rs.eof
Response.Write "<tr>"
if rs(5) <> "" then
Response.Write "<td width=20% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">
<center>[img][/img]</center></td>"
else
Response.Write "<td width=20% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&"></td>"
end if
Response.Write "<td width=80% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">
"&rs(1)&" "&rs(3)&"
"&rs(4)&"
....Read More</font>
</td></tr>"
rs.movenext
'loop
Response.Write "</table>"
else
Response.Write "
<TABLE WIDTH=30% align=center valign=top style="&tablestyle&" BORDER=0 CELLSPACING=0 CELLPADDING=4>"
Response.Write "<tr><td colspan=2 width=100% bgcolor="& headerbgcolor&" valign=top><FONT face="&fontface&" size="& headerfontsize&" color="& headerfontcolor&">
Headlines</font></td></tr>"
Response.Write "<tr><td width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">There are no News Articles in our database records.</font></td></tr>"
Response.Write "</table>"
end if
rs.close
set rs = nothing
case 4
query = "select * from NMNewstbl where catid = "&catid&" and newsid = "&recid&" and activated = "& true &" and newsexpiry > #"& date() &"#"
set rs = dataconn.Execute(query)
if not rs.eof then
Response.Write "
<TABLE WIDTH=100% align=center valign=top style="&tablestyle&" BORDER=0 CELLSPACING=0 CELLPADDING=4>"
'Response.Write "<tr><td width=100% bgcolor="& headerbgcolor&" valign=top><FONT face="&fontface&" size="& headerfontsize&" color="& headerfontcolor&">
News Article</font></td></tr>"
Response.Write "<tr><td width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">"
Response.Write "
"&rs("newsname")&" "&"
"
Response.Write rs("newsdescription")&"
"
Response.Write "
Autore:
"&rs("newsauthorname")& " - " &rs("newsauthoremail")&"
"
if rs("newsdoc1name") <> "" or rs("newsdoc2name") <> "" or rs("newsdoc3name") <> "" or rs("newsdoc4name") <> "" then
Response.Write "
<U>Related Documents</U>
"
Response.Write "<TABLE WIDTH=100% align=center valign=top BORDER=0 CELLSPACING=0 CELLPADDING=4>"
if rs("newsdoc1name") <> "" then
Response.Write "<td width=20% align=center valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">"
Response.Write "
"&rs("newsdoc1name")&"
"
Response.Write "
[img][/img]</td>"
end if
if rs("newsdoc2name") <> "" then
Response.Write "<td width=20% align=center valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">"
Response.Write "
"&rs("newsdoc2name")&"
"
Response.Write "
[img][/img]</td>"
end if
if rs("newsdoc3name") <> "" then
Response.Write "<td width=20% align=center valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">"
Response.Write "
"&rs("newsdoc3name")&"
"
Response.Write "
[img][/img]</td>"
end if
if rs("newsdoc4name") <> "" then
Response.Write "<td width=20% align=center valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">"
Response.Write "
"&rs("newsdoc4name")&"
"
Response.Write "
[img][/img]</td>"
end if
if rs("newsdoc5name") <> "" then
Response.Write "<td width=20% align=center valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">"
Response.Write "
"&rs("newsdoc5name")&"
"
Response.Write "
[img][/img]</td>"
end if
Response.Write "</tr></table>"
end if
Response.Write "</font></td></tr>"
Response.Write "</table>"
query3 = "select catname from NMCattbl where catid = "& catid
set rs3 = dataconn.Execute(query3)
if not rs3.eof then
query1 = "select newsid,newsname from NMNewstbl where catid = "& catid &" and activated = "& true & " and newsid <> "&recid&" and newsexpiry > #"& date() &"# order by newsdateadded desc"
set rs1 = dataconn.Execute(query1)
if not rs1.eof then
Response.Write "
<center><FONT face="&fontface&" size=2>
Particular Category With News Articles</center>"
Response.Write "<TABLE WIDTH=100% align=center valign=top style="&tablestyle&" BORDER=0 CELLSPACING=0 CELLPADDING=4>"
Response.Write "<tr><td width=100% bgcolor="& headerbgcolor&" valign=top><FONT face="&fontface&" size="& headerfontsize&" color="& headerfontcolor&">
"&rs3(0)&"</font></td></tr>"
do until rs1.eof
Response.Write "<tr><td width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&"><img src=/NewsManager/images/display.gif border=0 align=absmiddle>
<u>"&rs1(1)&"</u></font></td></tr>"
rs1.movenext
loop
Response.Write "</table>"
end if
rs1.close
set rs1 = nothing
end if
rs3.close
set rs3 = nothing
else
Response.Write "
<TABLE WIDTH=100% align=center valign=top style="&tablestyle&" BORDER=0 CELLSPACING=0 CELLPADDING=4>"
Response.Write "<tr><td width=100% bgcolor="& headerbgcolor&" valign=top><FONT face="&fontface&" size="& headerfontsize&" color="& headerfontcolor&">
News Article</font></td></tr>"
Response.Write "<tr><td width=100% valign=top><FONT face="&fontface&" size="&fontsize&" color="&fontcolor&">News Article not found in our records</font></td></tr>"
Response.Write "</table>"
end if
rs.close
set rs = nothing
case else
End select
dataconn.Close
set dataconn = nothing
End Function%>