Ver Mensaje Individual
  #2 (permalink)  
Antiguo 26/10/2005, 06:01
Avatar de zacktagnan
zacktagnan
 
Fecha de Ingreso: abril-2005
Mensajes: 501
Antigüedad: 19 años, 1 mes
Puntos: 3
Orden de los días de la semana - 2ª parte

INICIO de 'prueba_Calendar_Fin.asp'
================================================== ========

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Prueba Calendario</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="../css_js/euskalbid.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
<!--
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var ver;
if (bName == "Netscape" && bVer >= 4) {
ver = 4;
} else if (bName == "Microsoft Internet Explorer" && bVer >= 4) {
ver = 4;
} else {
ver = 0;
}

//-->
</script>

<script language="javascript" type="text/javascript">
<!--
//NUMERANDO DE 0 a 6 LOS DÍAS DE LA SEMANA, SE INDICA CUALES SE SEÑALARÁN COMO FIN DE SEMANA
var weekend = [5,6];
var weekendColor = "#e0eafc"; //Color de Fondo de los días de FindeSemana, y casillas Año+- Mes+-
var fontface = "Arial, Helvetica, sans-serif";
var fontsize = 8;

var gNow = new Date();
var ggWinContent;
var ggPosX = 50;
var ggPosY = 50;

var vNowDay = gNow.getDate();
var vNowMonth = gNow.getMonth(); // El número resultante va de 0 a 11
var vNowYear = gNow.getFullYear();

Calendar.Months = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];

// Nº de días en año NO bisiesto
Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// Nº de días en año bisiesto
Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

/*
CONSTRUCCIÓN DEL CALENDARIO SEGÚN DATOS ENVIADOS
AL PINCHAR EN Año- | Mes- | Mes+ | Año+
*/
function Calendar(p_item, p_month, p_year, p_format) {
if ((p_month == null) && (p_year == null)) return;

if (p_month == null) {
this.gMonthName = null;
this.gMonth = null;
this.gYearly = true;
} else {
/*
EL SIGUIENTE if...else SIRVE PARA CONTROLAR QUE AL HECHAR
HACIA ATRÁS EL AÑO (Año-), COMO MUCHO, SE ECHE HACIA ATRÁS
HASTA EL MES ACTUAL
*/
if ((p_month <= vNowMonth) && (p_year == vNowYear)) {
this.gMonthName = Calendar.get_month(vNowMonth);
this.gMonth = new Number(vNowMonth);
this.gYearly = false;
}
else {
this.gMonthName = Calendar.get_month(p_month);
this.gMonth = new Number(p_month);
this.gYearly = false;
}
}

this.gYear = p_year;
this.gFormat = p_format;
this.gBGColor = "white";
this.gFGColor = "black";
this.gTextColor = "black";
this.gHeaderColor = "black";
this.gReturnItem = p_item;
}/*
FIN DE CONSTRUCCIÓN DEL CALENDARIO SEGÚN DATOS ENVIADOS
AL PINCHAR EN Año- | Mes- | Mes+ | Año+
*/

Calendar.get_month = Calendar_get_month;
Calendar.get_daysofmonth = Calendar_get_daysofmonth;
Calendar.calc_month_year = Calendar_calc_month_year;

function Calendar_get_month(monthNo) {
return Calendar.Months[monthNo];
}

function Calendar_get_daysofmonth(monthNo, p_year) {
/*
Chequeo para año bisiesto
1. Los años divisibles por cuatro son años bisiestos, a excepción de
2. Los años también divisibles por 100 no son años bisiestos, a excepción de
3. Los años también divisibles por 400 son años bisiestos.
*/
if ((p_year % 4) == 0) {
if ((p_year % 100) == 0 && (p_year % 400) != 0)
return Calendar.DOMonth[monthNo];

return Calendar.lDOMonth[monthNo];
} else
return Calendar.DOMonth[monthNo];
}

function Calendar_calc_month_year(p_Month, p_Year, incr) {
/*
Devolverá un array de una dimensión. El primer elemento es el mes calculado y el
segundo el año calculado después de aplicar el mes incrementado/decrementrado como el
parámetro 'incr'.
*/
var ret_arr = new Array();

if (incr == -1) {
// Hacia atrás
if (p_Month == 0) {
ret_arr[0] = 11;
ret_arr[1] = parseInt(p_Year) - 1;
}
else {
ret_arr[0] = parseInt(p_Month) - 1;
ret_arr[1] = parseInt(p_Year);
}
} else if (incr == 1) {
// Hacia delante
if (p_Month == 11) {
ret_arr[0] = 0;
ret_arr[1] = parseInt(p_Year) + 1;
}
else {
ret_arr[0] = parseInt(p_Month) + 1;
ret_arr[1] = parseInt(p_Year);
}
}

return ret_arr;
}

// Esto es para compatibilidad con Navigator 3
new Calendar();

Calendar.prototype.getMonthlyCalendarCode = function() {
var vCode = "";
var vHeader_Code = "";
var vData_Code = "";

// Empezar a dibujar la tabla
vCode += ("<div align=\"center\"><table border=\"1\" cellspacing=\"1\" cellpadding=\"1\" bordercolor=\"#204368\" bgcolor=\"" + this.gBGColor + "\" style=\"font-size:" + fontsize + "pt;\">");

vHeader_Code = this.cal_header();
vData_Code = this.cal_data();
vCode += (vHeader_Code + vData_Code);

vCode += "</table></div>";

return vCode;
}

/*
Función que Contiene la Tabla de Vínculos: Año- | Mes- | Mes+ | Año+
*/
Calendar.prototype.show = function() {
var vCode = "";

// Meter el contenido en la variable global ggWinContent
ggWinContent += ("<span style=\"font-family:" + fontface + "; font-weight:bold;\">");
ggWinContent += (this.gMonthName + " " + this.gYear);
ggWinContent += "<br />";

// Mostrar los botones de navegación
var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);
var prevMM = prevMMYYYY[0];
var prevYYYY = prevMMYYYY[1];

var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);
var nextMM = nextMMYYYY[0];
var nextYYYY = nextMMYYYY[1];

/*
FORMATO PARA EL NÚMERO DEL DÍA
Si es el ACTUAL, se pone en ROJO y NEGRITA
*/
Calendar.prototype.format_day = function(vday) {
if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear)
return ("<span style=\"color:red; font-weight:bold;\">" + vday + "</span>");
else
return (vday);
}/*
FIN DE FORMATO PARA EL NÚMERO DEL DÍA
*/


(Fin de la 2ª parte - Sigue en la 3ª)