Forum 

Forum AspNuke.it - Il tuo Portale OpenSource in ASP

pagina news con solo banner scorrimento senza dettagli

Autore Messaggio
lucapuccetti

Utente
Utente
93 Discussioni



Profilo - lucapuccetti
05 luglio 2004 alle 12:52:46 Profilo - lucapuccettiInvia un messaggio privato Rispondi quotando
cari amici vi posto una paginamnews modificata che può essere utile. In pratica nella versione originale c'era la lista delle categorie e poi una tabella con top news e poi lo stesso numero di news scelte come top per tutte le categorie o per ogni categoria in pratica se si metteva 30 top news la pagina diventava lunghissima per tutti i dettagli delle singole news. ora con la modifica si ottiene una lista a scorrimento verticale e cliccando sul titolo si ottiene il dettaglio della news praticamente si possono mettere anche 50 news e la pagina rimane comunque assai contenuta in lunghezza. Esiste un solo problema cliccando sulla categoria compare una tabella allineata a destra e questo vorrei che qualcuno mi aiutasse a risolvere questo problemino estetico .

codice :

<%
' ************************************************************************
' * ASP-Nuke: Free web portal in ASP *
' ************************************************************************
' * Copyright (c) 2002-2003 by Gaetan Bouveret (webmaster@asp-nuke.com) *
' * http://www.asp-nuke.com *
' * *
' * This program is free software. You can redistribute it and/or modify *
' * it under the terms of the GNU General Public License as published by *
' * the Free Software Foundation; either version 2 of the License, or *
' * (at your option) any later version. *
' * *
' ************************************************************************
%>
<%
' Display a news
' IN : iID (int) : news' id (table news, field nID)
' : bFull (boolean) : if news if fully displayed (header + text)
' : bCountIt (boolean) : if it's the first time user read it
' OUT : -
Sub DisplayNews(iID, bFull, bCountIt)
Dim oCn, oRs, oRs2, rSQL, sURL, tURL, tTemp, iNbWords
Dim printell
printell =" | <a href=""print.asp?print=news&pID=" & iID & """ target=""_blank""><img src=""" & GLOBAL_SITE_IMAGES_PATH & "print.gif"" align=""absbottom"" onclick="""" alt="""&GetTranslation("LANG_PRINT_NEWS")&""" border=""0""></a>"
iID= Replace(iID," ","")
iID= Replace(iID,"%20","")
iID= Replace(iID,"'","''")

if (not isnumeric (iID)) then
iID="1"
End if
response.write"<a href=""" & GLOBAL_SITE_PATH & "archivionews.asp"" class=""small"">ARCHIVIO</a> <a href=""" & GLOBAL_SITE_PATH & "cercanews.asp"" class=""small"">CERCA NEWS</a>"

Set oCn = DBConnexion(DB_MAIN)

rSQL = "SELECT nID, nTitle, nAuthor, nDate, nHeader, nText, nImage, nURL, nRead, nCategory, cTitle, vCode FROM news, categories, versions WHERE nCategory=cID AND nVersion=vID AND nValid=True AND nID=" & iID

Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then
Response.Write " <a name=""news_" & oRs("nID") & """></a>" & vbCRLF
CreateTopTable "news_" & oRs("nID"), CodeMessage(oRs("nTitle"), False)
Response.Write "<span class=""small"">" & Replace(Replace(GetTranslation("LANG_POST_DATE_BY"), "%1%", GetDateLitteralDDMMYYYYHHMMSS(StringToDate(oRs("nDate")))), "%2%", "<a href=""" & GLOBAL_SITE_PATH & GLOBAL_SITE_PROFILE_PAGE & "?id=" & Server.URLEncode(oRs("nAuthor")) & """>" & Server.HTMLEncode(oRs("nAuthor")) & "</a>")
Response.Write " " & Server.HTMLEncode(oRs("vCode")) & " - <a href=""" & GLOBAL_SITE_NEWS_PAGE & "?cat=" & oRs("nCategory") & """>" & Server.HTMLEncode(oRs("cTitle")) & "</a>"
If oRs("nURL") <> "" Then
sURL = Replace(LCase(oRs("nURL")), "http://", "")
rSQL = "SELECT uTitle FROM urls WHERE uURL LIKE '%" & SQLEncrypt(sURL) & "%'"
Set oRs2 = DBRecordSet(oCn, rSQL)
Response.Write "<br>" & GetTranslation("LANG_SOURCE") & " : <a href=""" & GLOBAL_SITE_PATH & GLOBAL_SITE_GOTOURL_PAGE & "?url=http://" & Server.URLEncode(sURL) & """ target=""_blank"">"
If Not oRs2.EOF Then
Response.Write Server.HTMLEncode(oRs2("uTitle"))
Else
tURL = Split(sURL, "/")
Response.Write Server.HTMLEncode(tURL(0))
End If
Response.Write "</a>" & vbCRLF
End If
Response.Write "</span><br><br>" & vbCRLF

If oRs("nImage") <> "" Then
Response.Write "<img src="""
If Left(LCase(oRs("nImage")), 7) <> "http://" Then Response.Write GLOBAL_SITE_IMAGES_NEWS_PATH
Response.Write oRs("nImage") & """ align=""left"" border=""0"">" & vbCRLF
End If

Response.Write CodeMessage(oRs("nHeader"), False) & vbCRLF
If bFull Then
Response.Write "<br><br>" & vbCRLF
Response.Write CodeMessage(oRs("nText"), False) & vbCRLF

If bCountIt Then
rSQL = "UPDATE news SET nRead=" & oRs("nRead")+1 & " WHERE nID=" & iID
DBExecute oCn, rSQL
End If
End If

If bFull Then
If bCountIt then
CreateBottomTable GetTranslation("LANG_READ") & " : " & oRs("nRead")+1 & " | <a href=""" & GLOBAL_SITE_PATH & "Default.asp"">" & GetTranslation("LANG_BACK") & "</a>" & printell & vbCRLF

Else
CreateBottomTable GetTranslation("LANG_READ") & " : " & oRs("nRead") & " | <a href=""" & GLOBAL_SITE_PATH & "Default.asp"">" & GetTranslation("LANG_BACK") & "</a>" & printell & vbCRLF

End If
Else
rSQL = "SELECT Count(cID) FROM Comments WHERE cItem=" & iID & " AND cType=" & CATEGORY_TYPE_NEWS & " AND cValid=True"
Set oRs2 = DBRecordSet(oCn, rSQL)

tTemp = Split(oRs("nText"))
If IsArray(tTemp) Then
iNbWords = Ubound(tTemp) + 1
Else
iNbWords = 0
End If
CreateBottomTable "<a href=""" & GLOBAL_SITE_NEWS_PAGE & "?id=" & iID & """>" & GetTranslation("LANG_COMMENTS") & " : " & oRs2(0) & "</a> | " & GetTranslation("LANG_READ") & " : " & oRs("nRead") & " | <a href=""" & GLOBAL_SITE_PATH & GLOBAL_SITE_NEWS_PAGE & "?id=" & iID & """>" & GetTranslation("LANG_READ_MORE") & "</a> (" & Replace(GetTranslation("LANG_READ_MORE_WORDS"), "%1%", iNbWords) & ")" & vbCRLF
End If
End If


oCn.Close
Set oCn = Nothing
Set oRs = Nothing
Set oRs2 = Nothing
End Sub

' Display all current daily news for a special date
' IN : iID (int) : news' id (table news, field nID)
' : iCategory : news' category (table news, field nCategory)
' : bFull (boolean) : display all news (header + body) if true, just header if false
' OUT : -
Sub DisplayNewsDate(dDate, iCategory, bFull)
Dim oCn, oRs, oRs2, rSQL, sURL, tURL, iNewsID

Set oCn = DBConnexion(DB_MAIN)

rSQL = "SELECT nID, nTitle, nAuthor, nDate, nHeader, nText, nImage, nURL, nRead, nCategory, cTitle, vCode FROM news, categories, versions WHERE nCategory=cID AND nVersion=vID AND nDate LIKE '" & DateToString(dDate) & "%' AND nValid=True"
If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'"

If iCategory <> "" and iCategory <> 0 Then rSQL = rSQL & " AND nCategory=" & iCategory

Set oRs = DBRecordSet(oCn, rSQL)
While Not oRs.EOF
iNewsID = oRs("nID")
Response.Write " <a name=""news_" & iNewsID & """></a>" & vbCRLF
CreateTopTable "news_" & iNewsID, CodeMessage(oRs("nTitle"), False)
Response.Write "<span class=""small"">" & Replace(Replace(GetTranslation("LANG_POST_DATE_BY"), "%1%", GetDateLitteralDDMMYYYYHHMMSS(StringToDate(oRs("nDate")))), "%2%", "<a href=""" & GLOBAL_SITE_PATH & GLOBAL_SITE_PROFILE_PAGE & "?id=" & Server.URLEncode(oRs("nAuthor")) & """>" & Server.HTMLEncode(oRs("nAuthor")) & "</a>")
Response.Write " " & Server.HTMLEncode(oRs("vCode")) & " - <a href=""" & GLOBAL_SITE_NEWS_PAGE & "?cat=" & oRs("nCategory") & """>" & Server.HTMLEncode(oRs("cTitle")) & "</a>"
If oRs("nURL") <> "" Then
sURL = Replace(LCase(oRs("nURL")), "http://", "")
rSQL = "SELECT uTitle FROM urls WHERE uURL LIKE '%" & SQLEncrypt(sURL) & "%'"
Set oRs2 = DBRecordSet(oCn, rSQL)
Response.Write "<br>" & GetTranslation("LANG_SOURCE") & " : <a href=""" & GLOBAL_SITE_PATH & GLOBAL_SITE_GOTOURL_PAGE & "?url=http://" & sURL & """ target=_blank>"
If Not oRs2.EOF Then
Response.Write Server.HTMLEncode(oRs2("uTitle"))
Else
tURL = Split(sURL, "/")
Response.Write Server.HTMLEncode(tURL(0))
End If
Response.Write "</a>" & vbCRLF
End If
Response.Write "</span><br><br>" & vbCRLF

If oRs("nImage") <> "" Then
Response.Write "<img src="""
If Left(LCase(oRs("nImage")), 7) <> "http://" Then Response.Write GLOBAL_SITE_IMAGES_NEWS_PATH
Response.Write oRs("nImage") & """ align=""left"" border=""0"">" & vbCRLF
End If

Response.Write CodeMessage(oRs("nHeader"), False) & vbCRLF
If bFull Then
Response.Write "<br><br>" & vbCRLF
Response.Write CodeMessage(oRs("nText"), False) & vbCRLF

rSQL = "UPDATE news SET nRead=" & oRs("nRead")+1 & " WHERE nID=" & iNewsID
DBExecute oCn, rSQL
End If
rSQL = "SELECT Count(cID) FROM Comments WHERE cItem=" & iNewsID & " AND cType=" & CATEGORY_TYPE_NEWS & " AND cValid=True"
Set oRs2 = DBRecordSet(oCn, rSQL)
If bFull Then
CreateBottomTable "<a href=""" & GLOBAL_SITE_NEWS_PAGE & "?id=" & iNewsID & """>" & GetTranslation("LANG_COMMENTS") & " : " & oRs2(0) & "</a> | " & GetTranslation("LANG_READ") & " : " & oRs("nRead")+1 & " | <a href=""" & "Default.asp"">" & GetTranslation("LANG_BACK") & "</a>" & vbCRLF
Else
CreateBottomTable "<a href=""" & GLOBAL_SITE_NEWS_PAGE & "?id=" & iNewsID & """>" & GetTranslation("LANG_COMMENTS") & " : " & oRs2(0) & "</a> | " & GetTranslation("LANG_READ") & " : " & oRs("nRead") & " | <a href=""" & GLOBAL_SITE_NEWS_PAGE & "?id=" & iNewsID & """>" & GetTranslation("LANG_READ_MORE") & "</a>" & vbCRLF
End If

oRs.MoveNext
WEnd

oCn.Close
Set oCn = Nothing
Set oRs = Nothing
End Sub

' Display the top news (for one category)
' IN : iTop (int) : number of results wanted
' IN : iCategory (int) : category's wanted (0 if all)
' OUT : -
Sub DisplayTopNews(iTop, iCategory)
Dim oCn, oRs, rSQL
Dim titreNews, texteNews, dateNews

Set oCn = DBConnexion(DB_MAIN)

rSQL = "SELECT TOP " & iTop & " nID FROM news, versions WHERE nVersion=vID AND (nDate < '" & DateTimeToString(Now()) & "') AND (nValid = True)"

If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'"
If iCategory <> "" and iCategory <> 0 Then rSQL = rSQL & " AND (nCategory=" & iCategory & ")"
rSQL = rSQL & " ORDER BY nDate DESC"

Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then
While Not oRs.EOF
DisplayNews oRs(0), False, False
oRs.MoveNext
WEnd
End If

oCn.Close
Set oCn = Nothing
Set oRs = Nothing
End Sub

' Display the top news list (links to news)
' IN : iTop (int) : number of results wanted
' : iCategory (int) : news' category (table news, field nCategory)
' OUT : -
Sub DisplayTopNewsLinks(iTop, iCategory)
Dim oCn, oRs, rSQL
Dim titreNews, texteNews, dateNews, sCategory, sTitleCat

Set oCn = DBConnexion(DB_MAIN)
If iCategory <> "" and iCategory <> 0 Then
sCategory = "?cat=" & iCategory
rSQL = "SELECT cTitle FROM categories WHERE cID=" & iCategory
Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then sTitleCat = " - " & Server.HTMLEncode(oRs(0))
End If

rSQL = "SELECT TOP " & iTop & " nID, nDate, nTitle FROM news, versions WHERE nVersion=vID AND nDate < '" & DateTimeToString(Now()) & "' AND nValid=1"
If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'"
If sCategory <> "" Then rSQL = rSQL & " AND nCategory=" & iCategory
rSQL = rSQL & " ORDER BY nDate DESC"

Set oRs = DBRecordSet(oCn, rSQL)

CreateTopTable "TopNewsLinks", GetTranslation("LANG_TOP") & " " & iTop & " - " & GetTranslation("LANG_NEWS") & sTitleCat

'inizio modifica scroll top news
dim effetto_marquee,elenco_comunicati,scrollSpeed,scrollTop,scrollLeft,scrollWidth,scrollHeight
effetto_marquee=""


If Not oRs.EOF Then
While Not oRs.EOF



elenco_comunicati=elenco_comunicati&"<a href=""" & GLOBAL_SITE_NEWS_PAGE & "?id=" & Left(oRs("nID"),8) & "&sid="&session.sessionid&""">" & CodeMessage(oRs("nTitle"), False) & "</a> <span class=""small"">" & GetDateLitteralDDMMYYYY(StringToDate(oRs("nDate"))) & "</span><br><br>"


'Response.Write "<a href=""" & GLOBAL_SITE_NEWS_PAGE & sCategory & "#news_" & Left(oRs("nID"),8) & """>" & CodeMessage(oRs("nTitle"), False) & "</a> <span class=""small"">" & GetDateLitteralDDMMYYYY(StringToDate(oRs("nDate"))) & "</span><br>" & vbCRLF
oRs.MoveNext
WEnd


scrollSpeed = 85
scrollTop = 0
scrollLeft = 0
scrollWidth = "100%"
scrollHeight = 80
effetto_marquee="<MARQUEE onmouseover='this.stop();' " & _
"onmouseout='this.start();'direction='up' scrollamount='1' " & _
"scrolldelay='" & scrollSpeed & "' Top='" & scrollTop & "' left='" & scrollLeft & _
"' width='" & scrollWidth & "' height='" & scrollHeight & "'>" & elenco_comunicati & "</MARQUEE>"

Response.Write(effetto_Marquee)

elenco_comunicati=""

'fine modifica news scroll
Else
Response.Write GetTranslation("LANG_EMPTY_SECTION")
End If
CreateBottomTable ""


oCn.Close
Set oCn = Nothing
Set oRs = Nothing
End Sub

' Display the navigation bar for news (previous and next day)
' IN : dDate (datetime) : actual date
' : iCategory (int) : news' category (table news, field nCategory)
' OUT : -
Sub DisplayNewsNavigation(dDate, iCategory)
Dim oCn, oRs, rSQL, jPrec, jSuiv, X, sCategory

Set oCn = DBConnexion(DB_MAIN)

If iCategory <> "" and iCategory <> 0 Then sCategory = "&cat=" & iCategory

rSQL = "SELECT TOP 1 nDate FROM news, versions WHERE nVersion=vID AND nDate < '" & DateToString(dDate) & "' AND nValid=1"
If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'"
If sCategory <> "" Then rSQL = rSQL & " AND nCategory=" & iCategory
rSQL = rSQL & " ORDER BY nDate DESC"

Set oRs = DBRecordSet(oCn, rSQL)

If Not oRs.EOF Then jPrec = Left(oRs(0), 8)

rSQL = "SELECT TOP 1 nDate FROM news, versions WHERE nVersion=vID AND nDate > '" & DateToString(DateAdd("d", 1, dDate)) & "' AND nValid=True"
If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'"
If sCategory <> "" Then rSQL = rSQL & " AND nCategory=" & iCategory
rSQL = rSQL & " ORDER BY nDate"
Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then jSuiv = Left(oRs(0), 8)

If jPrec <> "" or jSuiv <> "" Then
CreateTopTable "NewsNavigate", GetTranslation("LANG_OLD_NEWS")
Response.Write "<table width=""100%"" cellspacing=""0"" cellpadding=""5"" border=""0"" align=""center"">" & vbCRLF
Response.Write " <tr>" & vbCRLF
Response.Write " <td width=""35%"" class=""small"">" & vbCRLF
If jPrec <> "" Then Response.Write " << <a href=""" & GLOBAL_SITE_NEWS_PAGE & "?date=" & Server.HTMLEncode(jPrec) & sCategory & """>" & GetTranslation("LANG_LAST_DAY") & "</a><br>" & GetDateLitteralDDMMYYYY(StringToDate(jPrec)) & vbCRLF
Response.Write " </td>" & vbCRLF
Response.Write " <td width=""30%"" class=""small"" align=""center"" valign=""bottom"">" & GetDateLitteralDDMMYYYY(dDate) & "</td>" & vbCRLF
Response.Write " <td width=""35%"" class=""small"" align=""right"">" & vbCRLF
If jSuiv <> "" Then Response.Write " <a href=""" & GLOBAL_SITE_NEWS_PAGE & "?date=" & Server.HTMLEncode(jSuiv) & sCategory & """>" & GetTranslation("LANG_NEXT_DAY") & "</a> >><br>" & GetDateLitteralDDMMYYYY(StringToDate(jSuiv)) & vbCRLF
Response.Write " </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write "</table>" & vbCRLF
CreateBottomTable ""
End If

oCn.Close
Set oCn = Nothing
Set oRs = Nothing
End Sub

' Display all news' categories
' IN : iCategoryParent (int) : news' parent category id (table categories, field cParent)
' OUT : -
Sub DisplayNewsCategories(iCategoryParent)
Dim oCn, oRs, oRs2, rSQL, iLine, iNum
response.write"<a href=""" & GLOBAL_SITE_PATH & "archivionews.asp"" class=""small"">ARCHIVIO</a> <a href=""" & GLOBAL_SITE_PATH & "cercanews.asp"" class=""small"">CERCA NEWS</a>"

Set oCn = DBConnexion(DB_MAIN)

If iCategoryParent = "" Then iCategoryParent = 0

If iCategoryParent <> 0 Then
rSQL = "SELECT cId, cParent, cTitle, cDescription, cImage FROM categories WHERE cID=" & iCategoryParent
Set oRs = DBRecordSet(oCn, rSQL)

If Not oRs.EOF Then
CreateTopTable "NewsCategory", CodeMessage(oRs("cTitle"), True)
If oRs("cImage") <> "" Then
Response.Write "<img src=""" & Server.HTMLEncode(oRs("cImage") & "") & """ border=""0"" align=""left"">"
End If
Response.Write CodeMessage(oRs("cDescription"), True)
Response.Write "<br><br><a href=""" & GLOBAL_SITE_NEWS_PAGE & "?cat=" & oRs("cParent") & """>" & GetTranslation("LANG_BACK") & "</a>" & vbCRLF
CreateBottomTable ""
End If
End If

rSQL = "SELECT DISTINCT cId, cTitle FROM categories, news, versions WHERE cType=" & CATEGORY_TYPE_NEWS & " AND nVersion=vID AND nCategory=cID and cParent=" & iCategoryParent
If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'"
rSQL = rSQL & " ORDER BY cTitle"
Set oRs = DBRecordSet(oCn, rSQL)

If Not oRs.EOF Then
If iCategoryParent = 0 Then
CreateTopTable "SearchNewsCategories", GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_CATEGORIES")
Else
CreateTopTable "SearchNewsCategories", GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_SUB_CATEGORIES")
End If
Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
iLine = 1
iNum = 0

While Not oRs.EOF
If iNum mod 2 = 0 Then Response.Write " <tr class=""tableline" & iLine & """>" & vbCRLF
rSQL = "SELECT Count(nID) FROM news, versions WHERE nVersion=vID AND nValid=True AND nCategory=" & oRs("cID")
If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'"
Set oRs2 = DBRecordSet(oCn, rSQL)
Response.Write " <td width=""50%""><a href=""" & GLOBAL_SITE_NEWS_PAGE & "?cat=" & oRs("cID") & """>" & Server.HTMLEncode(oRs("cTitle")) & "</a> (" & oRs2(0) & ")</td>" & vbCRLF
If iNum mod 2 = 1 Then
Response.Write " </tr>" & vbCRLF
iLine = 1 + ((iLine-1) XOR 1)
End If

iNum = iNum + 1
oRs.MoveNext
WEnd
If iNum mod 2 = 1 Then
Response.Write " <td> </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
End If
Response.Write "</table>" & vbCRLF
CreateBottomTable ""
End If

oCn.Close
Set oCn = Nothing
Set oRs = Nothing
Set oRs2 = Nothing
End Sub

' Display a line to let users post their news
' IN : iCat : news category
' OUT : -
Sub DisplayAddNews(iCat)
If sPseudo <> "" Then
CreateTable "AddMemberNews", "", "<a href=""" & GLOBAL_SITE_NEWS_PAGE & "?do=new&cat=" & iCat & """>" & GetTranslation("LANG_ADD") & " - " & GetTranslation("LANG_NEWS") & "</a>", ""
End If
End Sub

' Edit news for members
' IN : sAuthor (string) : username
' : iCat : news category
' OUT : -
Sub EditMemberNews(sAuthor, iCat)
Dim oCn, oRs, rSQL, X

If iCat = 0 Then iCat = 1

If sAuthor <> "" Then
Set oCn = DBConnexion(DB_MAIN)

rSQL = "SELECT cID, cTitle FROM categories WHERE cType=" & CATEGORY_TYPE_NEWS
Set oRs = DBRecordSet(oCn, rSQL)

If Not oRs.EOF Then
Response.Write "<script language=""Java_Script"" type=""text/Java_Script"">" & vbCRLF
Response.Write " function confirmDo()" & vbCRLF
Response.Write " {" & vbCRLF
Response.Write " var ok;" & vbCRLF
Response.Write " ok = true;" & vbCRLF
Response.Write " if (!confirm('" & JSEncrypt(GetTranslation("LANG_CONFIRM")) & "')) ok = false;" & vbCRLF
Response.Write " if ((document.edition.nTitle.value == '') || (document.edition.nText.value == ''))" & vbCRLF
Response.Write " {" & vbCRLF
Response.Write " ok = false;" & vbCRLF
Response.Write " alert('" & GetTranslation("LANG_MUST_FILL") & "');" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write " if (ok)" & vbCRLF
Response.Write " {" & vbCRLF
Response.Write " document.edition.submit();" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write " function openPicture()" & vbCRLF
Response.Write " {" & vbCRLF
Response.Write " var sMyPicture = document.edition.nImage.value;" & vbCRLF
Response.Write " if (sMyPicture != '')"
Response.Write " {" & vbCRLF
Response.Write " window.open('" & GLOBAL_SITE_PATH & GLOBAL_SITE_VIEW_IMAGE_PAGE & "?img=' + sMyPicture, 'Picture', 'width=500,height=100,menubar=no,resizable=yes');" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write " function preview()" & vbCRLF
Response.Write " {" & vbCRLF
Response.Write " document.edition.Do.value = 'preview';" & vbCRLF
Response.Write " document.edition.submit();" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write "</script>" & vbCRLF
CreateTopTable "EditionNews", GetTranslation("LANG_ADD") & " - " & GetTranslation("LANG_NEWS")
Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
Response.Write "<form name=""edition"" method=""post"" action=""" & sUrlPage & "?cat=" & iCat & """>" & vbCRLF
Response.Write "<input type=""hidden"" name=""Do"" value=""add"">" & vbCRLF
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
Response.Write " <td width=""150"">" & GetTranslation("LANG_FIELD") & "</td>" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_VALUE") & "</td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline1"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_TITLE") & "</td>" & vbCRLF
Response.Write " <td><input name=""nTitle"" value="""" maxlength=""100"" size=""50"" class=""cell""></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline2"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_AUTHOR") & "</td>" & vbCRLF
Response.Write " <td><input type=""hidden"" name=""nAuthor"" value=""" & Server.HTMLEncode(sAuthor) & """>" & sAuthor & "</td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline1"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_DATE") & "</td>" & vbCRLF
Response.Write " <td><input type=""hidden"" name=""nDate"" value=""" & DateTimeToString(Now()) & """>" & GetDateLitteralDDMMYYYYHHMMSS(Now()) & "</td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline2"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_EDIT_MENU") & "</td>" & vbCRLF
Response.Write " <td>" & vbCRLF
DisplayEditBar "document.edition.nHeader", 0
Response.Write " </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline1"">" & vbCRLF
Response.Write " <td valign=""top"">" & GetTranslation("LANG_HEADER") & "</td>" & vbCRLF
Response.Write " <td><textarea name=""nHeader"" cols=""50"" rows=""8"" class=""cell""></textarea></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline2"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_EDIT_MENU") & "</td>" & vbCRLF
Response.Write " <td>" & vbCRLF
DisplayEditBar "document.edition.nText", 1
Response.Write " </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline1"">" & vbCRLF
Response.Write " <td valign=""top"">" & GetTranslation("LANG_CONTENT") & "</td>" & vbCRLF
Response.Write " <td><textarea name=""nText"" cols=""50"" rows=""10"" class=""cell""></textarea></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline2"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_URL") & " - " & GetTranslation("LANG_IMAGE") & "</td>" & vbCRLF
Response.Write " <td>" & vbCRLF
Response.Write " <input name=""nImage"" class=""cell"" maxlength=""200"" size=""50"" value="""">" & vbCRLF
Response.Write " <a href=""Java_Script:openPicture()""><img src=""" & GLOBAL_SITE_IMAGES_PATH & "view.gif"" border=""0""></a>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline1"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_URL") & " - " & GetTranslation("LANG_SOURCE") & "</td>" & vbCRLF
Response.Write " <td><input name=""nURL"" value="""" maxlength=""250"" size=""50"" class=""cell""></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline2"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_CATEGORY") & "</td>" & vbCRLF
Response.Write " <td>" & vbCRLF
Response.Write " <select name=""nCategory"" class=""cell"">" & vbCRLF

While Not oRs.EOF
Response.Write " <option value=""" & oRs("cID") & """"
If oRs("cID") = iCat Then Response.Write " selected"
Response.Write ">" & Server.HTMLEncode(oRs("cTitle")) & "</option>" & vbCRLF
oRs.MoveNext
WEnd

Response.Write " </select>" & vbCRLF

Response.Write " </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline1"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_VERSION") & "</td>" & vbCRLF
Response.Write " <td>" & vbCRLF
Response.Write " <select name=""nVersion"" class=""cell"">" & vbCRLF

rSQL = "SELECT vID, vCode FROM versions"
Set oRs = DBRecordSet(oCn, rSQL)

While Not oRs.EOF
Response.Write " <option value=""" & oRs("vID") & """"
If oRs("vCode") = sXMLVersion Then Response.Write " selected"
Response.Write ">" & Server.HTMLEncode(oRs("vCode")) & "</option>" & vbCRLF
oRs.MoveNext
WEnd

Response.Write " </select>" & vbCRLF
Response.Write " </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
Response.Write " <td> </td>" & vbCRLF
Response.Write " <td>" & vbCRLF
Response.Write " <input type=""button"" value="" " & GetTranslation("LANG_SUBMIT") & " "" class=""button"" onClick=""confirmDo();"">" & vbCRLF
Response.Write " </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write "</form>" & vbCRLF
Response.Write "</table>" & vbCRLF
CreateBottomTable ""
End If

oCn.Close
Set oCn = Nothing
Set oRs = Nothing
End If
End Sub

' Add a member's news (insert query)
' IN : sTitle (string) : news' title (table news, field nTitle)
' : dDate (datetime) : news' posting date (table news, field nDate)
' : sAuthor (string) : news' author (table news, field nAuthor)
' : sHeader (string) : news' header (table news, field nHeader)
' : sText (string) : news' content (table news, field nText)
' : sImage (string) : news' image path (table news, field nImage)
' : sURL (string) : news' source (table news, field nURL)
' : iCategory (int) : news' category (table news, field nCategory)
' : iVersion (int) : news' version (table news, field nVersion)
' OUT : (boolean) : True if added
Function AddMemberNews(sTitle, dDate, sAuthor, sHeader, sText, sImage, sURL, iCategory, iVersion)
Dim oCn, rSQL

Set oCn = DBConnexion(DB_MAIN)
rSQL = "INSERT INTO news (nTitle, nDate, nAuthor, nHeader, nText, nImage, nURL, nCategory, nVersion, nValid) VALUES ('" & SQLEncrypt(sTitle) & "', '" & dDate &"', '" & SQLEncrypt(sAuthor) & "', '" & SQLEncrypt(sHeader) & "', '" & SQLEncrypt(sText) & "', '" & SQLEncrypt(sImage) & "', '" & SQLEncrypt(sURL) & "', " & iCategory & ", " & iVersion & ", 0)"
DBExecute oCn, rSQL

oCn.Close
Set oCn = Nothing

AddMemberNews = True
End Function


' Get the last date of news from a specific date
' IN : dDate (datetime) : actual date
' OUT : (datetime) : last known news date
Function GetLastNewsDate(dDate)
Dim oCn, oRs, rSQL

Set oCn = DBConnexion(DB_MAIN)

rSQL = "SELECT TOP 1 nDate FROM news, versions WHERE nVersion=vID AND nDate <= '" & DateToString(dDate) & " 23:59' AND nValid=1"
If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'"
rSQL = rSQL & " ORDER BY nDate DESC"

Set oRs = DBRecordSet(oCn, rSQL)

If Not oRs.EOF Then
GetLastNewsDate = StringToDate(oRs(0))
Else
GetLastNewsDate = Date
End If

oCn.Close
Set oCn = Nothing
Set oRs = Nothing
End Function

Sub DoNews()
Dim iID

iID = Request.QueryString("id")
If iID <> "" Then
If Request.Cookies("news_" & iID) = "" Then
Response.Cookies("news_" & iID) = "read"
Else
Response.Cookies("news_" & iID) = "stop"
End If
End If

If Request.Form("do") = "add" And Request.Form("nTitle") <> "" Then
If AddMemberNews(Request.Form("nTitle"), Request.Form("nDate"), Request.Form("nAuthor"), Request.Form("nHeader"), Request.Form("nText"), Request.Form("nImage"), Request.Form("nURL"), Request.Form("nCategory"), Request.Form("nVersion")) Then
sInfoPage = GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_ADD_SUCCESS")
Else
sInfoPage = GetTranslation("LANG_NEWS") & " - " & GetTranslation("LANG_ADD_ERROR")
End If
End If
End Sub

Sub DisplayNewsPage()
Dim dDatePage, iCat, iNews

iCat = Request.QueryString("cat")
If iCat <> "" and IsNumeric(iCat) Then
iCat = CInt(iCat)
Else
iCat = 0
End If
iNews = Request.QueryString("id")

If iNews <> "" Then
If Request.Cookies("news_" & iNews) = "stop" Then
DisplayNews iNews, True, False
Else
DisplayNews iNews, True, True
End If
ElseIf Request.QueryString("date") <> "" Then
dDatePage = StringToDate(Request.QueryString("date"))
DisplayNewsDate(dDatePage), iCat, False
'DisplayNewsNavigation dDatePage, iCat
ElseIf Request.QueryString("do") = "new" Then
EditMemberNews sPseudo, iCat
Else
DisplayNewsCategories(iCat)
'DisplayAddNews(iCat)
DisplayTopNewsLinks GLOBAL_NEWS_LINKS_TOP, iCat
'DisplayTopNews GLOBAL_NEWS_LINKS_TOP, iCat
'DisplayNewsNavigation Date, iCat
End If
End Sub
%>

saluti Luca

Log in

Login
Password
Memorizza i tuoi dati:

Cerca

 

Sostieni AspNuke

Un piccolo gesto per aiutarci a mantenere AspNuke.it online

Promo

MusicWebItalia.it
Video Testi Traduzioni Spot Colonne sonore Accordi e Spartiti gratis.

Visitatori

Visitatori Correnti : 261
Membri : 0 offline Anna

Iscritti

 Utenti: 18940
Ultimo iscritto : glauco
Lista iscritti
Messaggi privati: 3373 Commenti: 2210 Immagini: 39 Downloads: 144 Articoli: 49 Pagine: 101 Siti web: 558 Notizie: 180 Sondaggi: 11 Preferiti: 5685033 Post sui forum: 51195 Libro degli ospiti: 4 Eventi: 7

Versioni

Temi