Aktualnost
<%
'***((( KONEKCIJA )))***
Set ConnNovost = Server.CreateObject("ADODB.Connection")
ConnNovost.Open Application("Conn")
%>
<%'*****ako kategorija ne postoji
If prazniID then %>
Odabrana aktualnost ne postoji.
<%'***** u protivnom je dobra kategorija
Else %>
<%
'* prikaz odabrane novosti *
Set rsZadnjeNovosti = ConnNovost.Execute("SELECT aktID, aktNaslov, aktSadrzaj, aktDatum FROM tblAktualnosti WHERE aktObjava = 1 AND aktDatum <= now() AND aktID = " & queryAktID & "")
if rsZadnjeNovosti.Eof then %>
Odabrana aktualnost ne postoji.
<% else %>
<%= day(rsZadnjeNovosti("aktDatum")) %>.<%= month(rsZadnjeNovosti("aktDatum")) %>.<%= year(rsZadnjeNovosti("aktDatum")) %>.
<%= rsZadnjeNovosti("aktNaslov") %>
<%= rsZadnjeNovosti("aktSadrzaj") %>
<%'provjera znamenki u queriju %>
<% if queryAktID >= 1 and queryAktID <= 9 then %>
<% queryAktIDZnamenka = "1znamenka" %>
<% elseif queryAktID >= 10 and queryAktID <= 99 then %>
<% queryAktIDZnamenka = "2znamenka" %>
<% elseif queryAktID >= 100 and queryAktID <= 999 then %>
<% queryAktIDZnamenka = "3znamenka" %>
<% End If %>
<%'/provjera znamenki u queriju %>
<%
'**fotografije
localcjpath = server.mappath("/slikeDocsID/aktualnosti/fotografije/")
Set fso = Server.Createobject("Scripting.FileSystemObject")
Set f = fso.GetFolder(localcjpath)
Set fc = f.Files
'ako postoje fotografije u folderu
if fc.count > 0 then %>
<%'provjere znamenki ID-a %>
<% if queryAktIDZnamenka = "1znamenka" then %>
<% for each n in fc
fajlIme = fso.GetFileName(n)
If inStr(left(fajlIme,2), queryAktID &"-")>0 then ima = "1" end if
next
%>
<% elseif queryAktIDZnamenka = "2znamenka" then %>
<% for each n in fc
fajlIme = fso.GetFileName(n)
If inStr(left(fajlIme,3), queryAktID &"-")>0 then ima = "1" end if
next
%>
<% elseif queryAktIDZnamenka = "3znamenka" then %>
<% for each n in fc
fajlIme = fso.GetFileName(n)
If inStr(left(fajlIme,4), queryAktID &"-")>0 then ima = "1" end if
next
%>
<% End If %>
<%'/provjere znamenki ID-a %>
<%'ako postoje fotografije koji imaju trazeni ID
If ima = "1" then %>
Priložene fotografije:
<%for each n in fc %>
<%
fajlnejm = fso.GetFileName(n)
ime = replace(fajlnejm, "_", " ")
ime = replace(ime, ".gif", "")
ime = replace(ime, ".jpg", "")
ime = replace(ime, ".png", "")
ekstenzija = right(fajlnejm,3)
Set fille = fso.GetFile(localcjpath & "\" & fajlnejm)
velicina = (fille.Size \ 1024)
Set fille = Nothing
if velicina>999 then bvelicina=cstr(round(velicina / 1024,2))& " MB" else bvelicina=velicina & " KB"
if velicina<1 then bvelicina="< 1 KB"
%>
<% If queryAktIDZnamenka = "1znamenka" then %>
<% If inStr(left(fajlnejm,2), queryAktID &"-")>0 then %>
<% ime = (replace(ime,queryAktID & "-","")) %>
- <%= ime %>
<% End If %>
<% elseIf queryAktIDZnamenka = "2znamenka" then %>
<% If inStr(left(fajlnejm,3), queryAktID &"-")>0 then %>
<% ime = (replace(ime,queryAktID & "-","")) %>
- <%= ime %>
<% End If %>
<% elseIf queryAktIDZnamenka = "3znamenka" then %>
<% If inStr(left(fajlnejm,4), queryAktID &"-")>0 then %>
<% ime = (replace(ime,queryAktID & "-","")) %>
- <%= ime %>
<% End If %>
<% End If %>
<%
next
%>
<%'/ako postoje fotografije koji imaju trazeni ID
End If %>
<% End If
'/ako postoje fotografije u folderu
'/**fotografije
%>
<%
'**dokumenti
localcjpath = server.mappath("/slikeDocsID/aktualnosti/dokumenti/")
Set fso = Server.Createobject("Scripting.FileSystemObject")
Set f = fso.GetFolder(localcjpath)
Set fc = f.Files
'ako postoje dokumenti u folderu
if fc.count > 0 then %>
<%'provjere znamenki ID-a %>
<% if queryAktIDZnamenka = "1znamenka" then %>
<% for each n in fc
fajlIme = fso.GetFileName(n)
If inStr(left(fajlIme,2), queryAktID &"-")>0 then ima = "1" end if
next
%>
<% elseif queryAktIDZnamenka = "2znamenka" then %>
<% for each n in fc
fajlIme = fso.GetFileName(n)
If inStr(left(fajlIme,3), queryAktID &"-")>0 then ima = "1" end if
next
%>
<% elseif queryAktIDZnamenka = "3znamenka" then %>
<% for each n in fc
fajlIme = fso.GetFileName(n)
If inStr(left(fajlIme,4), queryAktID &"-")>0 then ima = "1" end if
next
%>
<% End If %>
<%'/provjere znamenki ID-a %>
<%'ako postoje dokumenti koji imaju trazeni ID
If ima = "1" then %>
Priloženi dokumenti:
<%for each n in fc %>
<%
fajlnejm = fso.GetFileName(n)
ime = replace(fajlnejm, "_", " ")
ime = replace(ime, ".doc", "")
ime = replace(ime, ".pdf", "")
ime = replace(ime, ".xls", "")
ime = replace(ime, ".zip", "")
ime = replace(ime, ".rar", "")
ekstenzija = right(fajlnejm,3)
Set fille = fso.GetFile(localcjpath & "\" & fajlnejm)
velicina = (fille.Size \ 1024)
Set fille = Nothing
if velicina>999 then bvelicina=cstr(round(velicina / 1024,2))& " MB" else bvelicina=velicina & " KB"
if velicina<1 then bvelicina="< 1 KB"
%>
<% If queryAktIDZnamenka = "1znamenka" then %>
<% If inStr(left(fajlnejm,2), queryAktID &"-")>0 then %>
<% ime = (replace(ime,queryAktID & "-","")) %>
- <%= ime %> (.<%= ekstenzija %>, <%= bvelicina %>)
<% End If %>
<% elseIf queryAktIDZnamenka = "2znamenka" then %>
<% If inStr(left(fajlnejm,3), queryAktID &"-")>0 then %>
<% ime = (replace(ime,queryAktID & "-","")) %>
- <%= ime %> (.<%= ekstenzija %>, <%= bvelicina %>)
<% End If %>
<% elseIf queryAktIDZnamenka = "3znamenka" then %>
<% If inStr(left(fajlnejm,4), queryAktID &"-")>0 then %>
<% ime = (replace(ime,queryAktID & "-","")) %>
- <%= ime %> (.<%= ekstenzija %>, <%= bvelicina %>)
<% End If %>
<% End If %>
<%
next
%>
<%'/ako postoje dokumenti koji imaju trazeni ID
End If %>
<% End If
'/ako postoje dokumenti u folderu
'/**dokumenti
%>
<%
End If
rsZadnjeNovosti.Close
set rsZadnjeNovosti = nothing
'/* prikaz odabeane novosti *
%>
<%'***** kraj provjere
End If %>
<%
'***((( KONEKCIJA )))***
ConnNovost.Close
set ConnNovost = nothing
%>