Forum 

Forum AspNuke.it - Il tuo Portale OpenSource in ASP

cambiare data agli articoli

Autore Messaggio
lucapuccetti

Utente
Utente
93 Discussioni



Profilo - lucapuccetti
06 gennaio 2005 alle 00:12:13 Profilo - lucapuccettiInvia un messaggio privato Rispondi quotando
Cari amici ho la versione 1.2 e va benissimo con tutte le modifiche fatte
www.pillole.org

ho necessità di modificare come amministratore la data di inserimento degli articoli

sembra che abbia risolto almeno mi sembra il codice modificato è





' Display edit article's form (add or update data)
' IN : iID (int) : article's id (table articles, field arID), if null or = 0 then add article
' OUT : -
Sub EditArticle(iID)
Dim oCn, oRs, rSQL
Dim sEditTitle, sDo, sTitle, dDate, sAuthor, sDescription, iCategory, iVersion, bValid

Set oCn = DBConnexion(DB_MAIN)

If iID <> "" and iID <> 0 Then
sDo = "updt"
sEditTitle = GetTranslation("LANG_EDIT") & " - " & GetTranslation("LANG_ARTICLE")
rSQL = "SELECT * FROM articles WHERE arID=" & iID
Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then
sTitle = oRs("arTitle")
'dDate = oRs("arDate")
dDate = StringToDate(oRs("arDate"))


sDescription = oRs("arDescription")
sAuthor = oRs("arAuthor")
iCategory = oRs("arCategory")
iVersion = oRs("arVersion")
bValid = oRs.Fields("arValid").Value
End If
Else
sDo = "add"
sEditTitle = GetTranslation("LANG_ADD") & " - " & GetTranslation("LANG_ARTICLE")
sTitle = ""


'dDate = DateTimeToString(Now())
dDate = Now()
sDescription = ""
sAuthor = sPseudo
iCategory = 1
iVersion = 1
bValid = False
End If

Response.Write "<_Script language=""Java_Script"" type=""text/Java_Script"">" & vbCRLF
Response.Write " function confirmDo()" & vbCRLF
Response.Write " {" & vbCRLF
Response.Write " if (confirm('" & JSEncrypt(GetTranslation("LANG_CONFIRM")) & "'))" & vbCRLF
Response.Write " {" & vbCRLF
Response.Write " document.edition.submit();" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write " }" & vbCRLF
Response.Write "</_Script>" & vbCRLF
CreateTopTable "EditArticles", sEditTitle
Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
Response.Write "<_form name=""edition"" method=""post"" action=""" & sUrlPage & """>" & vbCRLF
Response.Write "<input type=""hidden"" name=""Do"" value=""" & sDo & """>" & vbCRLF
Response.Write "<input type=""hidden"" name=""arID"" value=""" & iID & """>" & vbCRLF
Response.Write " <tr class=""tableline1"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_TITLE") & "</td>" & vbCRLF
Response.Write " <td><input name=""arTitle"" value=""" & Server.HTMLEncode(sTitle) & """ 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 name=""arAuthor"" value=""" & Server.HTMLEncode(sAuthor) & """ maxlength=""100"" size=""50"" class=""cell""></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF







dim X

Response.Write " <tr class=""tableline1"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_DATE") & "</td>" & vbCRLF
Response.Write " <td>Il " & vbCRLF
Response.Write " <select name=""nJour"" class=""cell"">" & vbCRLF
For X = 1 to 31
Response.Write " <option value=""" & Right("0" & CStr(X), 2) & """"
If X = Day(dDate) Then Response.Write " selected"
Response.Write ">" & Right("0" & CStr(X), 2) & "</option>" & vbCRLF
Next
Response.Write " </select>" & vbCRLF
Response.Write " <select name=""nMois"" class=""cell"">" & vbCRLF
For X = 1 to 12
Response.Write " <option value=""" & Right("0" & CStr(X), 2) & """"
If X = Month(dDate) Then Response.Write " selected"
Response.Write ">" & Right("0" & CStr(X), 2) & "</option>" & vbCRLF
Next
Response.Write " </select>" & vbCRLF
Response.Write " <select name=""nAnnee"" class=""cell"">" & vbCRLF
For X = Year(DateAdd("yyyy", -6, dDate)) to Year(DateAdd("yyyy", 2, Date))
Response.Write " <option value=""" & X & """"
If X = Year(dDate) Then Response.Write " selected"
Response.Write ">" & CStr(X) & "</option>" & vbCRLF
Next
Response.Write " </select>" & vbCRLF
Response.Write " ore " & vbCRLF
Response.Write " <select name=""nHeure"" class=""cell"">" & vbCRLF
For X = 0 to 23
Response.Write " <option value=""" & Right("0" & CStr(X), 2) & """"
If X = Hour(dDate) Then Response.Write " selected"
Response.Write ">" & Right("0" & CStr(X), 2) & "</option>" & vbCRLF
Next
Response.Write " </select>" & vbCRLF
Response.Write " e " & vbCRLF
Response.Write " <select name=""nMinute"" class=""cell"">" & vbCRLF
For X = 0 to 59
Response.Write " <option value=""" & Right("0" & CStr(X), 2) & """"
If X = Minute(dDate) Then Response.Write " selected"
Response.Write ">" & Right("0" & CStr(X), 2) & "</option>" & vbCRLF
Next
Response.Write " </select>" & vbCRLF
Response.Write " min" & vbCRLF
Response.Write " </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF










Response.Write " <tr class=""tableline2"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_DESCRIPTION") & "</td>" & vbCRLF
Response.Write " <td><textarea name=""arDescription"" cols=""50"" rows=""8"" class=""cell"">" & Server.HTMLEncode(sDescription) & "</textarea></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tableline1"">" & vbCRLF
Response.Write " <td>" & GetTranslation("LANG_CATEGORY") & "</td>" & vbCRLF
Response.Write " <td>" & vbCRLF

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

If Not oRs.EOF Then
Response.Write " <select name=""arCategory"" class=""cell"">" & vbCRLF
While Not oRs.EOF
Response.Write " <option value=""" & oRs("cID") & """"
If oRs("cID") = iCategory Then Response.Write " selected"
Response.Write ">" & Server.HTMLEncode(oRs("cTitle")) & "</option>" & vbCRLF
oRs.MoveNext
WEnd
Response.Write " </select>" & vbCRLF
Response.Write " " & GetTranslation("LANG_ADD") & " - " & GetTranslation("LANG_CATEGORY") & " : <input name=""arCategory2"" class=""cell"" size=""20"" maxlength=""50"" value="""">" & vbCRLF
Else
Response.Write " <input name=""arCategory2"" class=""cell"" size=""20"" maxlength=""50"" value=""" & Server.HTMLEncode(GLOBAL_SITE_NAME) & """>" & vbCRLF
End If

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

rSQL = "SELECT vID, vCode FROM Versions ORDER BY vCode"
Set oRs = DBRecordSet(oCn, rSQL)

While Not oRs.EOF
Response.Write " <option value=""" & oRs("vID") & """"
If iVersion = oRs("vID") Then Response.Write " selected"
Response.Write ">" & oRs("vCode") & "</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_VALID") & "</td>" & vbCRLF
Response.Write " <td><input type=""checkbox"" name=""arValid"""
If bValid Then Response.Write " checked"
Response.Write "></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
Response.Write " <td colspan=""2""><input type=""button"" value=""" & GetTranslation("LANG_SUBMIT") & """ class=""button"" onClick=""confirmDo();""></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
If sDo = "updt" Then
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
Response.Write " <td colspan=""2""><a href=""" & GLOBAL_SITE_ARTICLES_PAGES_PAGE & "?article=" & iID & """>" & GetTranslation("LANG_EDIT") & " - " & GetTranslation("LANG_ARTICLE_PAGES") & "</a></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
End If
Response.Write "</_form>" & vbCRLF
Response.Write "</table>" & vbCRLF
CreateBottomTable ""

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


verso la fine del file............



Case "updt" :
dim articleDate
articleDate = Request.Form("nAnnee") & Request.Form("nMois") & Request.Form("nJour") & " " & Request.Form("nHeure") & ":" & Request.Form("nMinute") & ":00"

If Request.Form("arCategory2") <> "" Then
iCategory = AddCategoryArticle(Request.Form("arCategory2"))
Else
iCategory = Request.Form("arCategory")
End If
If Request.Form("arValid") <> "" Then
bValid = "1"
Else
bValid = "0"
End If
If ModifyArticle(Request.Form("arID"), Request.Form("arTitle"), Request.Form("arAuthor"), articleDate , Request.Form("arDescription"), iCategory, Request.Form("arVersion"), bValid) Then
sInfoPage = GetTranslation("LANG_ARTICLE") & " - " & GetTranslation("LANG_MODIFY_SUCCESS")
Else
sInfoPage = GetTranslation("LANG_ARTICLE") & " - " & GetTranslation("LANG_MODIFY_ERROR")
End If


saluti

Luca
verderamina

Amatore
Amatore
27 Discussioni



Profilo - verderamina
25 gennaio 2005 alle 00:36:06 Profilo - verderaminaInvia un messaggio privato Rispondi quotando
Molto bene era anche un mio problema. Ho provato e funziona perfettamente.
Una cosa.... è difficile adattare la stessa cosa per i download?. Se si potesse cambiare la data si potrebbe modificare l'ordine con cui compaiono. Queste sono delle piccole cose ma secondo me molto importanti perchè valorizzano lo strumento che abbiamo permettendo ad un amministratore di gestire meglio il portale. Grazie per il tuo contributo
verderamina

Amatore
Amatore
27 Discussioni



Profilo - verderamina
30 marzo 2005 alle 23:33:13 Profilo - verderaminaInvia un messaggio privato Rispondi quotando
ho provato ad inserire un articolo ma mi da dei problemi: l'artticolo sparisce e muovendomi con A/D per data mi restituisce questo errore:
Errore di run-time di Microsoft VB Script error '800a000d'
Tipo non corrispondente: '[string: ""]'

/comunicazioni/includes/functions-inc.asp, line 272

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 : 210
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: 5688358 Post sui forum: 51195 Libro degli ospiti: 4 Eventi: 7

Versioni

Temi