24/03/2010, 06:33
|
| | Fecha de Ingreso: febrero-2004
Mensajes: 85
Antigüedad: 20 años, 10 meses Puntos: 0 | |
Calendario: que empiece por lunes en vez de domingo. Hola a todos.
Estoy haciendo pruebas con un código de un calendario que he encontrado. Está en formato anglosajón, o sea, que la semana empieza por domingo en vez de por lunes. No soy capaz de hacer que empieze por lunes y que los días del mes aparezcan correctamente sin estar adelantados o tratrasados una posición.
Os Pongo el código a ver si me podeis ayudar.
Muchas gracias. Cita: <%
TableWidth = 500
BgColor = "#3399CC"
CellColor = "#FFFFFF"
dbName = "ofer_nov_even.mdb"
Conn= "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & Server.MapPath(dbName)
ViewDayImage = "imagenes/calendario_evento.gif"
Session.LCID = 2058
%>
<%
'***** FUNCTIONS *********
Sub DisplayCalendar(mMonth, yYear)
dDay = DateSerial(yYear,mMonth,1)
mMonth = Month(dDay)
yYear = Year(dDay)
FirstDayOfMonth = Weekday(dDay)
'## Display the Top of Calendar ##
CALL DisplayCalendarTop(dDay)
'## Start Displaying the Actual Calendar ##
Response.Write "<Table Align=center width=" & TableWidth & " CellPadding=3 CellSpacing=1 Border=1 BgColor=" & BgColor & ">" & vbCrlf
Response.Write "<TR Valign=Top Align=Center BgColor=" & bgcolor & ">" & vbCrlf
For i = vbSunday To vbSaturday
Response.Write "<TD><Font Size='-2'><b>" & left(WeekDayName(i), 3) & "</b></Font></TD>" & vbCrlf
Next
Response.Write "</TR>" & vbCrlf
'## Set dDay to the First day of the month ##
dDay = DateSerial(yYear,mMonth,1)
FOR j=1 to 5
Response.Write "<TR>" & vbCrlf
FOR i=vbSunday to vbSaturday
CellStr="<Font size=-3> </Font>"
Color=cellcolor
If WeekDay(dDay) = i and Month(dDay) = mMonth then
'## Set Color to Yellow if Current Day
if (Day(dDay) = Day(now)) and (Month(dDay) = Month(now)) and (Year(dDay) = Year(now)) then Color="Yellow"
'Mostrmoas los días del mes.
CellStr = "<Font size=-2>" & Day(dDay) & "</Font>"
'## Get the Memo Field out of Database for current Date
evento = GetCellData(dDay)
IF evento <> "" then
'## Format Cell String if there is a Memo ##
CellStr ="<Font size=-2>" & Day(dDay) & "</Font>" & "<a href=eventos_info.asp?fecha=" & dDay & " target=eventos_info><img alt='Ver evento.' border=0 src=" & ViewDayImage & "></a>"
'## Save Calendar Details to Print After the Calendar is Displayed ##
Details = Details & "<Table Align=center width=" & TableWidth & " cellspacing=2 cellpadding=3 border=0>" & vbCrlf
Details = Details & "<TR>" & vbCrlf
Details = Details & " <TD width=" & TableWidth-10 & " bgcolor='" & Bgcolor & "'>" & vbCrlf
Details = Details & " <a name='" & dDay & "'><Font Size=-1>" & (WeekDayName(weekday(dDay))) & " " & (MonthName(Month(dDay))) & " " & Day(dDay) & " , " & Year(dDay) & "</Font>" & vbCrlf
Details = Details & " </TD>" & vbCrlf
Details = Details & "</TR>" & vbCrlf
Details = Details & "</Table>" & vbCrlf
Details = Details & "<Table Align=center width=" & TableWidth & " cellspacing=2 cellpadding=3 border=0>" & vbCrlf
Details = Details & "<TR>" & vbCrlf
Details = Details & " <TD bgcolor='" & color & "'>" & vbCrlf
Details = Details & " <PRE><Font Face=arial>" & evento & "</Font></PRE>" & vbCrlf
Details = Details & " </TD>" & vbCrlf
Details = Details & "</TR>" & vbCrlf
Details = Details & "</Table>" & vbCrlf
'## End Calendar Details ##
End If
'## Get the Next Day
dDay = DateAdd("d",1,dDay)
End If
Response.Write "<TD vAlign=top align=left BgColor='" & Color & "'>" & CellStr & "</TD>" & vbCrlf
NEXT '## FOR i=vbSunday to vbSaturday ##
Response.Write "</TR>" & vbCrlf
NEXT '## For j=1 to 6 ##
Response.Write "</Table>" & vbCrlf
'## Display the Months at the bottom of the calendar ##
'## Display the Calendar Details ##
Response.write "<BR>" & Details & "<BR><BR>"
For i=1 to 50
Response.write "<BR>"
Next
End Sub
'************************************************
Sub DisplayCalendarTop(dDay)
Title = MonthName(month(dDay)) & " " & year(dDay)
pPREVIOUS = dateadd("m",-1, dDay)
nNEXT = dateadd("m",1,dDay)
Response.Write "<a name=top><TABLE Align=center CELLPADDING=0 CELLSPACING=0 WIDTH=" & TableWidth & " BORDER=1>" & vbCrlf
Response.Write "<TR VALIGN=MIDDLE ALIGN=CENTER>" & vbCrlf
Response.Write "<TD BgColor='" & BgColor & "' ALIGN=center>" & vbCrlf
Response.Write "<a href='" & request.servervariables("SCRIPT_NAME") & "?month=" & month(pPREVIOUS) & "&year=" & year(pPREVIOUS) & "'1><img src=""imagenes/eventos_ant.png"" width=12 height=11 border=0></a>" & vbCrlf
Response.Write "</TD>" & vbCrlf
Response.Write "<TD BgColor='" & BgColor & "' ALIGN=center>" & vbCrlf
Response.Write "<B><small>" & Title & "</small></B>" & vbCrlf
Response.Write "</TD>" & vbCrlf
Response.Write "<TD BgColor='" & BgColor & "' ALIGN=center>" & vbCrlf
Response.Write "<a href='" & request.servervariables("SCRIPT_NAME") & "?month=" & month(nNEXT) & "&year=" & year(nNEXT) & "'><img src=""imagenes/eventos_sig.png"" width=12 height=11 border=0></a>" & vbCrlf
Response.Write "</TD>" & vbCrlf
Response.Write "</TR>" & vbCrlf
Response.Write "</TABLE>" & vbCrlf
End Sub
'************************************************
Function GetCellData(dDay)
Set rs = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT * FROM eventos WHERE Date=#" & dDay & "#"
rs.open sSQL, Conn,3,3
GetCellData = ""
if rs.recordcount > 0 then GetCellData=rs("evento")
rs.close
Set rs = nothing
End Function
'************************************************
%> |