diff --git a/_notes/dwsync.xml b/_notes/dwsync.xml new file mode 100755 index 0000000..67412b9 --- /dev/null +++ b/_notes/dwsync.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/admin.php b/admin.php new file mode 100755 index 0000000..b17e6d0 --- /dev/null +++ b/admin.php @@ -0,0 +1,96 @@ +query($sql); + $row = $res->fetch_assoc(); + $num = $res->num_rows; + // Debug echo $sql . '

num: ' . $num . '
$row[password]: ' . $row['password']; + + if ($num > 0) { + $_SESSION['valid_admin'] = $row['username']; + $_SESSION['nombrereal'] = $row['nombrereal']; + } +} +?> + + + + + + + + Administración del Sistema. Usuario: <?= $_SESSION['nombrereal'] ?> + + + + + + +

 

+

 

+ + + + +
+

+ +

+
+ +

 

+

 

+

 

+ Usuario o contraseña incorecta.'; + } ?> +

+ + + + +
+
+
+ + + + + + + + + + + + + + + + +
           + +
Usuario:
Contraseña:
 
+ +
+
+
+ + + + \ No newline at end of file diff --git a/altas.php b/altas.php new file mode 100755 index 0000000..d786ccc --- /dev/null +++ b/altas.php @@ -0,0 +1,826 @@ + + + + + + + + + Vehículos + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + '.$nombre_archivo; + //echo '
'.$imagen_home; + + + // si la imagen se carg� correctamente inserta los datos en la tabla + move_uploaded_file($HTTP_POST_FILES['file']['tmp_name'], $nombre_archivo2); + ///////////////////////////////////////////////////// + //// RESIZE_IMAGE + $image = "images/vehic/" . $imagen_home; + + if (!$max_width) + $max_width = 200; + if (!$max_height) + $max_height = 200; + $size = GetImageSize($image); + $width = $size[0]; + $height = $size[1]; + + $x_ratio = $max_width / $width; + $y_ratio = $max_height / $height; + + if (($width <= $max_width) && ($height <= $max_height)) { + $tn_width = $width; + $tn_height = $height; + } else if (($x_ratio * $height) < $max_height) { + $tn_height = ceil($x_ratio * $height); + $tn_width = $max_width; + } else { + $tn_width = ceil($y_ratio * $width); + $tn_height = $max_height; + } + + + //////////////// + //echo $imagen; + $origen = "images/vehic/" . $imagen_home; + $destino = "images/vehic/" . $imagen_home; + + + $destino_temporal = tempnam("tmp/", "tmp"); + + redimensionar_jpeg($origen, $destino_temporal, $tn_width, $tn_height, 100); + + // guardamos la imagen + $fp = fopen($destino, "w"); + fputs($fp, fread(fopen($destino_temporal, "r"), filesize($destino_temporal))); + fclose($fp); + + // mostramos la imagen + //echo ""; + ////////////////////////////////////////// + + } + + // CREA EL $codigo PARA EL CAMPO code_a + if ($_POST['orden'] != '' && $_POST['asistencia_t'] != '') { + $codigo = 'OB ' . $_POST['orden'] . ' ATO ' . $_POST['asistencia_t']; //.' '.strtoupper($_POST[marca]); + + } elseif ($_POST['orden'] != '') { + $codigo = 'OB ' . $_POST['orden']; //.' '.strtoupper($_POST[marca]); + + } elseif ($_POST['asistencia_t'] != '') { + $codigo = 'ATO ' . $_POST['asistencia_t']; //.' '.strtoupper($_POST[marca]); + } + + $sql = " INSERT INTO altas VALUES ('NULL'"; + $sql .= ", UPPER('" . $_POST['orden'] . "')"; + $sql .= ", '" . $_POST['asistencia_t'] . "'"; + $sql .= ", UPPER('" . $_POST['marca'] . "')"; + $sql .= ", UPPER('" . $_POST['modelo'] . "')"; + $sql .= ", '" . $_POST['anio'] . "'"; + $sql .= ", UPPER('" . $_POST['chasis'] . "')"; + $sql .= ", UPPER('" . $_POST['motor'] . "')"; + $sql .= ", UPPER('" . $_POST['matricula'] . "')"; + $sql .= ", UPPER('" . $_POST['combustible'] . "')"; + $sql .= ", UPPER('" . $_POST['color'] . "')"; + $sql .= ", UPPER('" . $_POST['nivel_brindaje'] . "')"; + $sql .= ", UPPER('" . $_POST['multa'] . "')"; + $sql .= ", UPPER('" . $_POST['renar'] . "')"; + $sql .= ", '" . $_POST['f_ingreso'] . "'"; + $sql .= ", '" . $_POST['f_entrega'] . "'"; + $sql .= ", '" . $_POST['cinta'] . "'"; + $sql .= ", '" . $_POST['techo'] . "'"; + $sql .= ", '" . $_POST['sirena_s'] . "'"; + $sql .= ", '" . $_POST['sirena_c'] . "'"; + $sql .= ", '" . $_POST['tanque_blindado'] . "'"; + $sql .= ", '" . $_POST['run_flat'] . "'"; + $sql .= ", '" . $_POST['piso_b'] . "'"; + $sql .= ", '" . $_POST['com_motor'] . "'"; + $sql .= ", '" . $_POST['cob_bateria'] . "'"; + $sql .= ", '" . $_POST['filtro_aire'] . "'"; + $sql .= ", '" . $_POST['techo_trans'] . "'"; + $sql .= ", UPPER('" . $_POST['color_vidrios'] . "')"; + $sql .= ", '" . $_POST['num_llanta'] . "'"; + $sql .= ", UPPER('" . $_POST['vendedor'] . "')"; + $sql .= ", '" . $_POST['vehi_taller'] . "'"; + $sql .= ", '" . $codigo . "'"; + $sql .= ", '" . $imagen_home . "'"; + $sql .= ", '1'"; + $sql .= " ) "; + + $res = $conn->query($sql); + //echo $sql; + echo '

Registro Ingresado.
'; + } + + if ($_POST['modificar'] == 'Modificar') { + + if ($HTTP_POST_FILES['file']['name'] != '') { + $imagen_home = $HTTP_POST_FILES['file']['name']; + //debbug + $nombre_archivo2 = "images/vehic/" . $imagen_home; // agrega el ID al nombre de la imagen + //echo '
'.$imagen_home; + + if (move_uploaded_file($HTTP_POST_FILES['file']['tmp_name'], $nombre_archivo2)) { + ///////////////////////////////////////////////////// + //// RESIZE_IMAGE + $image = "images/vehic/" . $imagen_home; + + if (!$max_width) + $max_width = 200; + if (!$max_height) + $max_height = 200; + $size = GetImageSize($image); + $width = $size[0]; + $height = $size[1]; + + $x_ratio = $max_width / $width; + $y_ratio = $max_height / $height; + + if (($width <= $max_width) && ($height <= $max_height)) { + $tn_width = $width; + $tn_height = $height; + } else if (($x_ratio * $height) < $max_height) { + $tn_height = ceil($x_ratio * $height); + $tn_width = $max_width; + } else { + $tn_width = ceil($y_ratio * $width); + $tn_height = $max_height; + } + + + //////////////// + //echo $imagen; + $origen = "images/vehic/" . $imagen_home; + $destino = "images/vehic/" . $imagen_home; + + $destino_temporal = tempnam("tmp/", "tmp"); + + redimensionar_jpeg($origen, $destino_temporal, $tn_width, $tn_height, 100); + + // guardamos la imagen + $fp = fopen($destino, "w"); + fputs($fp, fread(fopen($destino_temporal, "r"), filesize($destino_temporal))); + fclose($fp); + + // mostramos la imagen + //echo ""; + //////////////////////////////////////////Borra imagen anterior + if ($_POST['imagen_a'] != '') { + + $archi = "images/vehic/" . $_POST['imagen_a']; + if (file_exists($archi)) { + unlink($archi); + clearstatcache(); + } + } + } + } else { + $imagen_home = $_POST['imagen_a']; + } + + + // CREA EL $codigo PARA EL CAMPO code_a + if ($_POST['orden'] != '' && $_POST['asistencia_t'] != '') { + $codigo = 'OB ' . $_POST['orden'] . ' ATO ' . $_POST['asistencia_t']; //.' '.strtoupper($_POST[marca]); + + } elseif ($_POST['orden'] != '') { + $codigo = 'OB ' . $_POST['orden']; //.' '.strtoupper($_POST[marca]); + + } elseif ($_POST['asistencia_t'] != '') { + $codigo = 'ATO ' . $_POST['asistencia_t']; //.' '.strtoupper($_POST[marca]); + } + + $sql = " UPDATE altas SET "; + $sql .= " orden = '" . $_POST['orden'] . "'"; + $sql .= ", asistencia_t = '" . $_POST['asistencia_t'] . "'"; + $sql .= ", marca = UPPER('" . $_POST['marca'] . "')"; + $sql .= ", modelo = UPPER('" . $_POST['modelo'] . "')"; + $sql .= ", anio = '" . $_POST['anio'] . "'"; + $sql .= ", chasis = UPPER('" . $_POST['chasis'] . "')"; + $sql .= ", motor = UPPER('" . $_POST['motor'] . "')"; + $sql .= ", matricula = UPPER('" . $_POST['matricula'] . "')"; + $sql .= ", combustible = UPPER('" . $_POST['combustible'] . "')"; + $sql .= ", color = UPPER('" . $_POST['color'] . "')"; + $sql .= ", nivel_brindaje = UPPER('" . $_POST['nivel_brindaje'] . "')"; + $sql .= ", multa = UPPER('" . $_POST['multa'] . "')"; + $sql .= ", renar = UPPER('" . $_POST['renar'] . "')"; + $sql .= ", f_ingreso = '" . $_POST['f_ingreso'] . "'"; + $sql .= ", f_entrega = '" . $_POST['f_entrega'] . "'"; + $sql .= ", cinta = '" . $_POST['cinta'] . "'"; + $sql .= ", techo = '" . $_POST['techo'] . "'"; + $sql .= ", sirena_s = '" . $_POST['sirena_s'] . "'"; + $sql .= ", sirena_c = '" . $_POST['sirena_c'] . "'"; + $sql .= ", tanque_blindado = '" . $_POST['tanque_blindado'] . "'"; + $sql .= ", run_flat = '" . $_POST['run_flat'] . "'"; + $sql .= ", piso_b = '" . $_POST['piso_b'] . "'"; + $sql .= ", com_motor = '" . $_POST['com_motor'] . "'"; + $sql .= ", cob_bateria = '" . $_POST['cob_bateria'] . "'"; + $sql .= ", filtro_aire = '" . $_POST['filtro_aire'] . "'"; + $sql .= ", techo_trans = '" . $_POST['techo_trans'] . "'"; + $sql .= ", color_vidrios = UPPER('" . $_POST['color_vidrios'] . "')"; + $sql .= ", num_llanta = '" . $_POST['num_llanta'] . "'"; + $sql .= ", vendedor = UPPER('" . $_POST['vendedor'] . "')"; + $sql .= ", vehi_taller = '" . $_POST['vehi_taller'] . "'"; + $sql .= ", code_a = '" . $codigo . "'"; + $sql .= ", imagen_a = '" . $imagen_home . "'"; + $sql .= " WHERE alta_id = " . $_POST['id_modificar']; + + $res = $conn->query($sql); + //echo $sql; + echo '

Registro Modificado.
'; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + if ($_POST['si'] == 'Si') { + $sql_p = " UPDATE altas SET publico_a = '0' WHERE alta_id = " . $_POST['id_baja']; + $res_p = $conn->query($sql_p); + //echo $sql_p; + echo '

Registro Borrado.
'; + } ?> + + +
Matrícula:
+ +
Buscar por Marca:
+ +
+   +
+ + + +
+ + + + +
+
+
+   Confirma la Baja del Vehículo:
+    +
  Matrícula: + +


+ + + + + +
+
+
+
+ +
+ query($sql_alta); + $row_alta = $res_alta->fetch_assoc(); + } ?> + +
+ + + + + + + + + + + + + + + + + + + + +
   
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ORDEN DE BLINDAJE: + + ASISTENCIA TECNICA: + +
Marca:Modelo:
Chasis:Motor:
Matrícula:Combustible: + +
Año:Color:
Nivel de Blindaje:Fecha de Ingreso: + + +
Multa Prevista:Fecha de Egreso: + + +
Renar:  
    
+

    Opcionales:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Cinta de Seguridad en las Ruedas: checked>Piso Blindado: + checked> +
Techo Solar Móvil Blindado: checked>Compartimiento de Motor: + checked> +
Sirena Simple: + checked> + Cobertura para la Batería: + checked> +
Sirena Completa con Intercomunicador: + checked> + Filtro de Aire: + checked> +
Tanque de Combustible Blindado: checked>Techo Transparente: + checked> +
Run Flat: + checked> + + + + + + +
N° de Llanta : + +
+
+ + + + + +
Color de Vidrios: + +
+
+ + + + + +
Vendedor Responsable:
+
+
+
+
+ + + + + + + +
+ checked> + Vehículo Dentro del Taller.checked>Vehículo Fuera del Taller.
+
+
+

+ + + + + + + + + + + + +
Imagen:   + + + + + +
+ + + +
+
Código de Barra:   + &style=196&type=C128B&width=460&height=75&xres=2&font=5'> +
+
+

+
+ + +       + + + +

+ +
 
 
+
query($sql); + // echo $sql; + ?> + + + + +
+ + + + + + + + + + + num_rows; $i++) { + + $row = $res->fetch_assoc(); + + if (($i % 2) == 0) { + $fondo = "#FFFFFF"; + } else { + $fondo = "#E6E6E6"; + } ?> + + + + + + + + + + + + + + +
OBATMarcaModeloAñoMatrículaNivel de Blindaje
+ +   + +       
+
+
' . $res->num_rows . ' Resultados
'; + } + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + } else { // fin valid_admin + echo ''; + } + /////////////////////////////////////////////////////////////////// + function redimensionar_jpeg($img_original, $img_nueva, $img_nueva_anchura, $img_nueva_altura, $img_nueva_calidad) + { + // crear una imagen desde el original + $img = ImageCreateFromJPEG($img_original); + //////////////// + $white = ImageColorAllocate($img, 255, 255, 255); + // crear una imagen nueva + $thumb = imagecreatetruecolor($img_nueva_anchura, $img_nueva_altura); + ///////////////////////////// + ImageString($img, 5, 5, 0, '', $white); + // redimensiona la imagen original copiandola en la imagen + ImageCopyResized($thumb, $img, 0, 0, 0, 0, $img_nueva_anchura, $img_nueva_altura, ImageSX($img), ImageSY($img)); + // guardar la nueva imagen redimensionada donde indicia $img_nueva + ImageJPEG($thumb, $img_nueva, $img_nueva_calidad); + ImageDestroy($img); + } + //////////////////////////////////////////////////// + ?> + + + \ No newline at end of file diff --git a/barcode.sql b/barcode.sql new file mode 100755 index 0000000..fa06050 --- /dev/null +++ b/barcode.sql @@ -0,0 +1,167 @@ +# phpMyAdmin SQL Dump +# version 2.5.7-pl1 +# http://www.phpmyadmin.net +# +# Servidor: localhost +# Tiempo de generacin: 10-11-2007 a las 17:24:46 +# Versin del servidor: 5.0.16 +# Versin de PHP: 4.4.1 +# +# Base de datos : `barcode` +# + +# -------------------------------------------------------- + +# +# Estructura de tabla para la tabla `altas` +# + +CREATE TABLE `altas` ( + `alta_id` int(10) unsigned NOT NULL auto_increment, + `orden` char(100) default NULL, + `asistencia_t` char(100) default NULL, + `marca` char(100) default NULL, + `modelo` char(100) default NULL, + `anio` char(4) default NULL, + `chasis` char(100) default NULL, + `motor` char(100) default NULL, + `matricula` char(100) default NULL, + `combustible` char(100) default NULL, + `color` char(100) default NULL, + `nivel_brindaje` char(100) default NULL, + `multa` char(100) default NULL, + `f_ingreso` date default NULL, + `f_entrega` date default NULL, + `cinta` int(1) default NULL, + `techo` int(1) unsigned default '1', + `sirena_s` int(1) unsigned default '0', + `sirena_c` int(1) default NULL, + `tanque_blindado` int(1) unsigned default '1', + `run_flat` int(1) unsigned default '2', + `piso_b` int(1) unsigned default '1', + `com_motor` int(1) default NULL, + `cob_bateria` int(1) default NULL, + `filtro_aire` int(1) unsigned default '1', + `techo_trans` char(100) NOT NULL, + `color_vidrios` char(100) NOT NULL, + `num_llanta` char(100) NOT NULL, + `vendedor` char(100) NOT NULL, + `vehi_taller` int(1) default NULL, + `code_a` varchar(100) NOT NULL, + `publico_a` int(1) NOT NULL, + PRIMARY KEY (`alta_id`), + KEY `cliente` (`orden`), + KEY `vendedor_id` (`run_flat`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; + +# +# Volcar la base de datos para la tabla `altas` +# + +INSERT INTO `altas` VALUES (1, '25', '', 'Toyota', 'Hylux', 'Admi', '265655446464', 'sds545646464', 'bfg578', 'Nafta', 'Rojo', 'RB3', '', '2007-09-11', '2007-12-11', 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, '1', 'oscuro', '656565', 'juan', 1, '*OB 25 Toyota Hylux*', 1); +INSERT INTO `altas` VALUES (2, '', '06-88', 'Peugeot', '406', '2006', 'd5665656565', 's546565656565', 'GHD158', 'Nafta', 'Verde', 'RB3', '', '2007-09-11', '0000-00-00', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 'claros', '1546876', 'Jose', 0, '*AT 06-88 385 406*', 1); + +# -------------------------------------------------------- + +# +# Estructura de tabla para la tabla `empleados` +# + +CREATE TABLE `empleados` ( + `empleado_id` int(10) unsigned NOT NULL default '0', + `nombre_e` char(100) default NULL, + `apellido_e` char(100) default NULL, + `dni_e` char(100) default NULL, + `grupo_e` char(100) default NULL, + `code_e` char(100) NOT NULL, + `publico_e` char(50) default '1', + PRIMARY KEY (`empleado_id`), + KEY `cliente` (`nombre_e`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +# +# Volcar la base de datos para la tabla `empleados` +# + +INSERT INTO `empleados` VALUES (1, 'Rodolfo', 'Fernandez', '107119881', 'Sin Grupo', '', '1'); +INSERT INTO `empleados` VALUES (2, 'Rodolfo', 'Fernandez', '107119881', 'Sin Grupo', '', '1'); +INSERT INTO `empleados` VALUES (3, 'Rodolfo', 'Fernandez', '107119881', 'Sin Grupo', '', '1'); +INSERT INTO `empleados` VALUES (4, 'juan', 'salerno', '25177556', '', 'null', '1'); +INSERT INTO `empleados` VALUES (5, 'jorge', 'Robles', '25177556', 'Produccion', 'null', '0'); +INSERT INTO `empleados` VALUES (6, 'jose', 'lopez', '25584566', 'Produccion', 'E00006\n', '1'); +INSERT INTO `empleados` VALUES (7, 'miguel', 'mendez', '1655996', 'Produccion', 'E00007\n', '1'); +INSERT INTO `empleados` VALUES (18, 'luis', 'gonzalez', '26569989', 'Produccion', '*E00018*', '1'); +INSERT INTO `empleados` VALUES (19, 'diego', 'Dotta', '20365699', 'Produccion', '*E00019*', '1'); + +# -------------------------------------------------------- + +# +# Estructura de tabla para la tabla `login` +# + +CREATE TABLE `login` ( + `userid` int(6) NOT NULL auto_increment, + `username` char(50) default NULL, + `nombrereal` char(100) NOT NULL, + `password` char(100) default NULL, + PRIMARY KEY (`userid`), + KEY `username` (`username`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; + +# +# Volcar la base de datos para la tabla `login` +# + +INSERT INTO `login` VALUES (1, 'admin', 'Administrador', 'mmKgxBJO0xJ2U'); +INSERT INTO `login` VALUES (2, 'mauricio', 'Mauricio', 'mmKgxBJO0xJ2U'); +INSERT INTO `login` VALUES (3, 'juampy', 'Juan Pablo', 'mm4Bk2Ze5n8Eg'); + +# -------------------------------------------------------- + +# +# Estructura de tabla para la tabla `operaciones` +# + +CREATE TABLE `operaciones` ( + `operaciones_id` int(10) unsigned NOT NULL auto_increment, + `nombre_o` char(100) default NULL, + `code_o` char(100) default NULL, + `publico_o` int(1) default NULL, + PRIMARY KEY (`operaciones_id`), + KEY `cliente` (`nombre_o`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; + +# +# Volcar la base de datos para la tabla `operaciones` +# + +INSERT INTO `operaciones` VALUES (1, 'LAVADO', '*O00001*', 1); +INSERT INTO `operaciones` VALUES (2, 'DENTRO DE TALLER', '*O00002*', 1); +INSERT INTO `operaciones` VALUES (3, 'DESMONTAJE', '*O00003\n*', 1); +INSERT INTO `operaciones` VALUES (4, 'MOLDES', '*O00004\n*', 1); + +# -------------------------------------------------------- + +# +# Estructura de tabla para la tabla `procesos` +# + +CREATE TABLE `procesos` ( + `procesos_id` int(10) unsigned NOT NULL auto_increment, + `empleado` char(100) default NULL, + `auto` char(100) default NULL, + `operacion` char(100) NOT NULL, + `dia` date NOT NULL, + `inicio` datetime default NULL, + `fin` datetime default NULL, + `publico_p` int(1) default NULL, + PRIMARY KEY (`procesos_id`), + KEY `cliente` (`empleado`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; + +# +# Volcar la base de datos para la tabla `procesos` +# + +INSERT INTO `procesos` VALUES (1, '19', '2', '2', '2007-11-09', '2007-11-23 12:02:55', '2007-11-22 12:02:57', 1); +INSERT INTO `procesos` VALUES (2, '18', '2', '2', '2007-11-10', '2007-11-18 12:03:49', '2007-11-19 12:03:51', 1); diff --git a/barcode/Thumbs.db b/barcode/Thumbs.db new file mode 100755 index 0000000..cc3f115 Binary files /dev/null and b/barcode/Thumbs.db differ diff --git a/barcode/barcode.php b/barcode/barcode.php new file mode 100755 index 0000000..2843c5d --- /dev/null +++ b/barcode/barcode.php @@ -0,0 +1,174 @@ +mWidth = $Width; + $this->mHeight = $Height; + $this->mStyle = $Style; + $this->mFont = BCD_DEFAULT_FONT; + $this->mImg = ImageCreate($this->mWidth, $this->mHeight); + $dbColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_FOREGROUND_COLOR : BCD_DEFAULT_BACKGROUND_COLOR; + $dfColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_BACKGROUND_COLOR : BCD_DEFAULT_FOREGROUND_COLOR; + $this->mBgcolor = ImageColorAllocate($this->mImg, ($dbColor & 0xFF0000) >> 16, + ($dbColor & 0x00FF00) >> 8 , $dbColor & 0x0000FF); + $this->mBrush = ImageColorAllocate($this->mImg, ($dfColor & 0xFF0000) >> 16, + ($dfColor & 0x00FF00) >> 8 , $dfColor & 0x0000FF); + if (!($this->mStyle & BCS_TRANSPARENT)) { + ImageFill($this->mImg, $this->mWidth, $this->mHeight, $this->mBgcolor); + } + __TRACE__("OBJECT CONSTRUCTION: ".$this->mWidth." ".$this->mHeight." ".$this->mStyle); + } + + function DrawObject ($xres) { + /* there is not implementation neded, is simply the asbsract function. */ + __TRACE__("OBJECT DRAW: NEED VIRTUAL FUNCTION IMPLEMENTATION"); + return false; + } + + function DrawBorder () { + ImageRectangle($this->mImg, 0, 0, $this->mWidth-1, $this->mHeight-1, $this->mBrush); + __TRACE__("DRAWING BORDER"); + } + + function DrawChar ($Font, $xPos, $yPos, $Char) { + ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush); + } + + function DrawText ($Font, $xPos, $yPos, $Char) { + ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush); + } + + function DrawSingleBar($xPos, $yPos, $xSize, $ySize) { + if ($xPos>=0 && $xPos<=$this->mWidth && ($xPos+$xSize)<=$this->mWidth && + $yPos>=0 && $yPos<=$this->mHeight && ($yPos+$ySize)<=$this->mHeight) { + for ($i=0;$i<$xSize;$i++) { + ImageLine($this->mImg, $xPos+$i, $yPos, $xPos+$i, $yPos+$ySize, $this->mBrush); + } + return true; + } + __DEBUG__("DrawSingleBar: Out of range"); + return false; + } + + function GetError() { + return $this->mError; + } + + function GetFontHeight($font) { + return ImageFontHeight($font); + } + + function GetFontWidth($font) { + return ImageFontWidth($font); + } + + function SetFont($font) { + $this->mFont = $font; + } + + function GetStyle () { + return $this->mStyle; + } + + function SetStyle ($Style) { + __TRACE__("CHANGING STYLE"); + $this->mStyle = $Style; + } + + function FlushObject () { + if (($this->mStyle & BCS_BORDER)) { + $this->DrawBorder(); + } + if ($this->mStyle & BCS_IMAGE_PNG) { + Header("Content-Type: image/png"); + ImagePng($this->mImg); + } else if ($this->mStyle & BCS_IMAGE_JPEG) { + Header("Content-Type: image/jpeg"); + ImageJpeg($this->mImg); + } else __DEBUG__("FlushObject: No output type"); + } + + function DestroyObject () { + ImageDestroy($obj->mImg); + } + } +?> \ No newline at end of file diff --git a/barcode/c128aobject.php b/barcode/c128aobject.php new file mode 100755 index 0000000..90b8dd0 --- /dev/null +++ b/barcode/c128aobject.php @@ -0,0 +1,320 @@ +BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = " !\"#$%&'()*+�-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"; + $this->mCharSet = array + ( + "212222", /* 00 */ + "222122", /* 01 */ + "222221", /* 02 */ + "121223", /* 03 */ + "121322", /* 04 */ + "131222", /* 05 */ + "122213", /* 06 */ + "122312", /* 07 */ + "132212", /* 08 */ + "221213", /* 09 */ + "221312", /* 10 */ + "231212", /* 11 */ + "112232", /* 12 */ + "122132", /* 13 */ + "122231", /* 14 */ + "113222", /* 15 */ + "123122", /* 16 */ + "123221", /* 17 */ + "223211", /* 18 */ + "221132", /* 19 */ + "221231", /* 20 */ + "213212", /* 21 */ + "223112", /* 22 */ + "312131", /* 23 */ + "311222", /* 24 */ + "321122", /* 25 */ + "321221", /* 26 */ + "312212", /* 27 */ + "322112", /* 28 */ + "322211", /* 29 */ + "212123", /* 30 */ + "212321", /* 31 */ + "232121", /* 32 */ + "111323", /* 33 */ + "131123", /* 34 */ + "131321", /* 35 */ + "112313", /* 36 */ + "132113", /* 37 */ + "132311", /* 38 */ + "211313", /* 39 */ + "231113", /* 40 */ + "231311", /* 41 */ + "112133", /* 42 */ + "112331", /* 43 */ + "132131", /* 44 */ + "113123", /* 45 */ + "113321", /* 46 */ + "133121", /* 47 */ + "313121", /* 48 */ + "211331", /* 49 */ + "231131", /* 50 */ + "213113", /* 51 */ + "213311", /* 52 */ + "213131", /* 53 */ + "311123", /* 54 */ + "311321", /* 55 */ + "331121", /* 56 */ + "312113", /* 57 */ + "312311", /* 58 */ + "332111", /* 59 */ + "314111", /* 60 */ + "221411", /* 61 */ + "431111", /* 62 */ + "111224", /* 63 */ + "111422", /* 64 */ + "121124", /* 65 */ + "121421", /* 66 */ + "141122", /* 67 */ + "141221", /* 68 */ + "112214", /* 69 */ + "112412", /* 70 */ + "122114", /* 71 */ + "122411", /* 72 */ + "142112", /* 73 */ + "142211", /* 74 */ + "241211", /* 75 */ + "221114", /* 76 */ + "413111", /* 77 */ + "241112", /* 78 */ + "134111", /* 79 */ + "111242", /* 80 */ + "121142", /* 81 */ + "121241", /* 82 */ + "114212", /* 83 */ + "124112", /* 84 */ + "124211", /* 85 */ + "411212", /* 86 */ + "421112", /* 87 */ + "421211", /* 88 */ + "212141", /* 89 */ + "214121", /* 90 */ + "412121", /* 91 */ + "111143", /* 92 */ + "111341", /* 93 */ + "131141", /* 94 */ + "114113", /* 95 */ + "114311", /* 96 */ + "411113", /* 97 */ + "411311", /* 98 */ + "113141", /* 99 */ + "114131", /* 100 */ + "311141", /* 101 */ + "411131" /* 102 */ + ); + } + + function GetCharIndex ($char) { + for ($i=0;$i<64;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetBarSize ($xres, $char) { + switch ($char) + { + case '1': + $cVal = BCD_C128_BAR_1; + break; + case '2': + $cVal = BCD_C128_BAR_2; + break; + case '3': + $cVal = BCD_C128_BAR_3; + break; + case '4': + $cVal = BCD_C128_BAR_4; + break; + default: + $cVal = 0; + } + return $cVal * $xres; + } + + + function GetSize($xres) { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + __DEBUG__("GetRealSize: null barcode value"); + return false; + } + $ret = 0; + for ($i=0;$i<$len;$i++) { + if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) { + $this->mError = "C128A not include the char '".$this->mValue[$i]."'"; + return false; + } else { + $cset = $this->mCharSet[$id]; + $ret += $this->GetBarSize($xres, $cset[0]); + $ret += $this->GetBarSize($xres, $cset[1]); + $ret += $this->GetBarSize($xres, $cset[2]); + $ret += $this->GetBarSize($xres, $cset[3]); + $ret += $this->GetBarSize($xres, $cset[4]); + $ret += $this->GetBarSize($xres, $cset[5]); + } + } + + /* length of Check character */ + $cset = $this->GetCheckCharValue(); + for ($i=0;$i<6;$i++) { + $CheckSize += $this->GetBarSize($cset[$i], $xres); + } + $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; + $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; + return $StartSize + $ret + $CheckSize + $StopSize; + } + + function GetCheckCharValue() + { + $len = strlen($this->mValue); + $sum = 103; // 'A' type; + for ($i=0;$i<$len;$i++) { + $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1); + } + $check = $sum % 103; + return $this->mCharSet[$check]; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '211412' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('4', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '2331112' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('3', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) + { + $cset = $this->GetCheckCharValue(); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + if (($size = $this->GetSize($xres))==0) { + __DEBUG__("GetSize: failed"); + return false; + } + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + $cPos = 0; + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + $cPos++; + } while ($cPos<$len); + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + return true; + } + } +?> \ No newline at end of file diff --git a/barcode/c128bobject.php b/barcode/c128bobject.php new file mode 100755 index 0000000..b2c7717 --- /dev/null +++ b/barcode/c128bobject.php @@ -0,0 +1,321 @@ +BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = " !\"#$%&'()*+�-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{ }~"; + $this->mCharSet = array + ( + "212222", /* 00 */ + "222122", /* 01 */ + "222221", /* 02 */ + "121223", /* 03 */ + "121322", /* 04 */ + "131222", /* 05 */ + "122213", /* 06 */ + "122312", /* 07 */ + "132212", /* 08 */ + "221213", /* 09 */ + "221312", /* 10 */ + "231212", /* 11 */ + "112232", /* 12 */ + "122132", /* 13 */ + "122231", /* 14 */ + "113222", /* 15 */ + "123122", /* 16 */ + "123221", /* 17 */ + "223211", /* 18 */ + "221132", /* 19 */ + "221231", /* 20 */ + "213212", /* 21 */ + "223112", /* 22 */ + "312131", /* 23 */ + "311222", /* 24 */ + "321122", /* 25 */ + "321221", /* 26 */ + "312212", /* 27 */ + "322112", /* 28 */ + "322211", /* 29 */ + "212123", /* 30 */ + "212321", /* 31 */ + "232121", /* 32 */ + "111323", /* 33 */ + "131123", /* 34 */ + "131321", /* 35 */ + "112313", /* 36 */ + "132113", /* 37 */ + "132311", /* 38 */ + "211313", /* 39 */ + "231113", /* 40 */ + "231311", /* 41 */ + "112133", /* 42 */ + "112331", /* 43 */ + "132131", /* 44 */ + "113123", /* 45 */ + "113321", /* 46 */ + "133121", /* 47 */ + "313121", /* 48 */ + "211331", /* 49 */ + "231131", /* 50 */ + "213113", /* 51 */ + "213311", /* 52 */ + "213131", /* 53 */ + "311123", /* 54 */ + "311321", /* 55 */ + "331121", /* 56 */ + "312113", /* 57 */ + "312311", /* 58 */ + "332111", /* 59 */ + "314111", /* 60 */ + "221411", /* 61 */ + "431111", /* 62 */ + "111224", /* 63 */ + "111422", /* 64 */ + "121124", /* 65 */ + "121421", /* 66 */ + "141122", /* 67 */ + "141221", /* 68 */ + "112214", /* 69 */ + "112412", /* 70 */ + "122114", /* 71 */ + "122411", /* 72 */ + "142112", /* 73 */ + "142211", /* 74 */ + "241211", /* 75 */ + "221114", /* 76 */ + "413111", /* 77 */ + "241112", /* 78 */ + "134111", /* 79 */ + "111242", /* 80 */ + "121142", /* 81 */ + "121241", /* 82 */ + "114212", /* 83 */ + "124112", /* 84 */ + "124211", /* 85 */ + "411212", /* 86 */ + "421112", /* 87 */ + "421211", /* 88 */ + "212141", /* 89 */ + "214121", /* 90 */ + "412121", /* 91 */ + "111143", /* 92 */ + "111341", /* 93 */ + "131141", /* 94 */ + "114113", /* 95 */ + "114311", /* 96 */ + "411113", /* 97 */ + "411311", /* 98 */ + "113141", /* 99 */ + "114131", /* 100 */ + "311141", /* 101 */ + "411131" /* 102 */ + ); + } + + function GetCharIndex ($char) { + for ($i=0;$i<95;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetBarSize ($xres, $char) { + switch ($char) + { + case '1': + $cVal = BCD_C128_BAR_1; + break; + case '2': + $cVal = BCD_C128_BAR_2; + break; + case '3': + $cVal = BCD_C128_BAR_3; + break; + case '4': + $cVal = BCD_C128_BAR_4; + break; + default: + $cVal = 0; + } + return $cVal * $xres; + } + + + function GetSize($xres) { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + __DEBUG__("GetRealSize: null barcode value"); + return false; + } + $ret = 0; + for ($i=0;$i<$len;$i++) { + if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) { + $this->mError = "C128B not include the char '".$this->mValue[$i]."'"; + return false; + } else { + $cset = $this->mCharSet[$id]; + $ret += $this->GetBarSize($xres, $cset[0]); + $ret += $this->GetBarSize($xres, $cset[1]); + $ret += $this->GetBarSize($xres, $cset[2]); + $ret += $this->GetBarSize($xres, $cset[3]); + $ret += $this->GetBarSize($xres, $cset[4]); + $ret += $this->GetBarSize($xres, $cset[5]); + } + } + /* length of Check character */ + $cset = $this->GetCheckCharValue(); + for ($i=0;$i<6;$i++) { + $CheckSize += $this->GetBarSize($cset[$i], $xres); + } + + $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; + $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; + + return $StartSize + $ret + $CheckSize + $StopSize; + } + + function GetCheckCharValue() + { + $len = strlen($this->mValue); + $sum = 104; // 'B' type; + for ($i=0;$i<$len;$i++) { + $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1); + } + $check = $sum % 103; + return $this->mCharSet[$check]; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '211214' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('4', $xres); + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '2331112' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('3', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) + { + $cset = $this->GetCheckCharValue(); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + if (($size = $this->GetSize($xres))==0) { + __DEBUG__("GetSize: failed"); + return false; + } + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + $cPos = 0; + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + $cPos++; + } while ($cPos<$len); + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + return true; + } + } +?> \ No newline at end of file diff --git a/barcode/c128cobject.php b/barcode/c128cobject.php new file mode 100755 index 0000000..2045334 --- /dev/null +++ b/barcode/c128cobject.php @@ -0,0 +1,344 @@ +BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = array + ( + "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", + "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", + "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", + "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", + "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", + "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", + "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", + "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", + "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", + "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", + ); + $this->mCharSet = array + ( + "212222", /* 00 */ + "222122", /* 01 */ + "222221", /* 02 */ + "121223", /* 03 */ + "121322", /* 04 */ + "131222", /* 05 */ + "122213", /* 06 */ + "122312", /* 07 */ + "132212", /* 08 */ + "221213", /* 09 */ + "221312", /* 10 */ + "231212", /* 11 */ + "112232", /* 12 */ + "122132", /* 13 */ + "122231", /* 14 */ + "113222", /* 15 */ + "123122", /* 16 */ + "123221", /* 17 */ + "223211", /* 18 */ + "221132", /* 19 */ + "221231", /* 20 */ + "213212", /* 21 */ + "223112", /* 22 */ + "312131", /* 23 */ + "311222", /* 24 */ + "321122", /* 25 */ + "321221", /* 26 */ + "312212", /* 27 */ + "322112", /* 28 */ + "322211", /* 29 */ + "212123", /* 30 */ + "212321", /* 31 */ + "232121", /* 32 */ + "111323", /* 33 */ + "131123", /* 34 */ + "131321", /* 35 */ + "112313", /* 36 */ + "132113", /* 37 */ + "132311", /* 38 */ + "211313", /* 39 */ + "231113", /* 40 */ + "231311", /* 41 */ + "112133", /* 42 */ + "112331", /* 43 */ + "132131", /* 44 */ + "113123", /* 45 */ + "113321", /* 46 */ + "133121", /* 47 */ + "313121", /* 48 */ + "211331", /* 49 */ + "231131", /* 50 */ + "213113", /* 51 */ + "213311", /* 52 */ + "213131", /* 53 */ + "311123", /* 54 */ + "311321", /* 55 */ + "331121", /* 56 */ + "312113", /* 57 */ + "312311", /* 58 */ + "332111", /* 59 */ + "314111", /* 60 */ + "221411", /* 61 */ + "431111", /* 62 */ + "111224", /* 63 */ + "111422", /* 64 */ + "121124", /* 65 */ + "121421", /* 66 */ + "141122", /* 67 */ + "141221", /* 68 */ + "112214", /* 69 */ + "112412", /* 70 */ + "122114", /* 71 */ + "122411", /* 72 */ + "142112", /* 73 */ + "142211", /* 74 */ + "241211", /* 75 */ + "221114", /* 76 */ + "413111", /* 77 */ + "241112", /* 78 */ + "134111", /* 79 */ + "111242", /* 80 */ + "121142", /* 81 */ + "121241", /* 82 */ + "114212", /* 83 */ + "124112", /* 84 */ + "124211", /* 85 */ + "411212", /* 86 */ + "421112", /* 87 */ + "421211", /* 88 */ + "212141", /* 89 */ + "214121", /* 90 */ + "412121", /* 91 */ + "111143", /* 92 */ + "111341", /* 93 */ + "131141", /* 94 */ + "114113", /* 95 */ + "114311", /* 96 */ + "411113", /* 97 */ + "411311", /* 98 */ + "113141", /* 99 */ + ); + } + + function GetCharIndex ($char) { + for ($i=0;$i<100;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetBarSize ($xres, $char) { + switch ($char) + { + case '1': + $cVal = BCD_C128_BAR_1; + break; + case '2': + $cVal = BCD_C128_BAR_2; + break; + case '3': + $cVal = BCD_C128_BAR_3; + break; + case '4': + $cVal = BCD_C128_BAR_4; + break; + default: + $cVal = 0; + } + return $cVal * $xres; + } + + + function GetSize($xres) { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + __DEBUG__("GetRealSize: null barcode value"); + return false; + } + $ret = 0; + + for ($i=0;$i<$len;$i++) { + if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) { + $this->mError = "Code-128C is numeric only"; + return false; + } + } + + if (($len%2) != 0) { + $this->mError = "The length of barcode value must be even. You must pad the number with zeros."; + __DEBUG__("GetSize: failed C128-C requiremente"); + return false; + } + + for ($i=0;$i<$len;$i+=2) { + $id = $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]); + $cset = $this->mCharSet[$id]; + $ret += $this->GetBarSize($xres, $cset[0]); + $ret += $this->GetBarSize($xres, $cset[1]); + $ret += $this->GetBarSize($xres, $cset[2]); + $ret += $this->GetBarSize($xres, $cset[3]); + $ret += $this->GetBarSize($xres, $cset[4]); + $ret += $this->GetBarSize($xres, $cset[5]); + } + /* length of Check character */ + $cset = $this->GetCheckCharValue(); + for ($i=0;$i<6;$i++) { + $CheckSize += $this->GetBarSize($cset[$i], $xres); + } + + $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; + $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; + return $StartSize + $ret + $CheckSize + $StopSize; + } + + function GetCheckCharValue() + { + $len = strlen($this->mValue); + $sum = 105; // 'C' type; + $m = 0; + for ($i=0;$i<$len;$i+=2) { + $m++; + $sum += $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]) * $m; + } + $check = $sum % 103; + return $this->mCharSet[$check]; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '211232' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '2331112' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('3', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) + { + $cset = $this->GetCheckCharValue(); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + if (($size = $this->GetSize($xres))==0) { + __DEBUG__("GetSize: failed"); + return false; + } + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + $cPos = 0; + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos].$this->mValue[$cPos+1]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + $cPos += 2; + } while ($cPos<$len); + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + return true; + } + } +?> diff --git a/barcode/c39object.php b/barcode/c39object.php new file mode 100755 index 0000000..991e481 --- /dev/null +++ b/barcode/c39object.php @@ -0,0 +1,228 @@ +BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; + $this->mCharSet = array + ( + /* 0 */ "000110100", + /* 1 */ "100100001", + /* 2 */ "001100001", + /* 3 */ "101100000", + /* 4 */ "000110001", + /* 5 */ "100110000", + /* 6 */ "001110000", + /* 7 */ "000100101", + /* 8 */ "100100100", + /* 9 */ "001100100", + /* A */ "100001001", + /* B */ "001001001", + /* C */ "101001000", + /* D */ "000011001", + /* E */ "100011000", + /* F */ "001011000", + /* G */ "000001101", + /* H */ "100001100", + /* I */ "001001100", + /* J */ "000011100", + /* K */ "100000011", + /* L */ "001000011", + /* M */ "101000010", + /* N */ "000010011", + /* O */ "100010010", + /* P */ "001010010", + /* Q */ "000000111", + /* R */ "100000110", + /* S */ "001000110", + /* T */ "000010110", + /* U */ "110000001", + /* V */ "011000001", + /* W */ "111000000", + /* X */ "010010001", + /* Y */ "110010000", + /* Z */ "011010000", + /* - */ "010000101", + /* . */ "110000100", + /* SP */ "011000100", + /* * */ "010010100", + /* $ */ "010101000", + /* / */ "010100010", + /* + */ "010001010", + /* % */ "000101010" + ); + } + + function GetCharIndex ($char) + { + for ($i=0;$i<44;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetSize($xres) + { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + __DEBUG__("GetRealSize: null barcode value"); + return false; + } + + for ($i=0;$i<$len;$i++) { + if ($this->GetCharIndex($this->mValue[$i]) == -1 || $this->mValue[$i] == '*') { + /* The asterisk is only used as a start and stop code */ + $this->mError = "C39 not include the char '".$this->mValue[$i]."'"; + return false; + } + } + + /* Start, Stop is 010010100 == '*' */ + $StartSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; + $StopSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; + $CharSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; /* Same for all chars */ + + return $CharSize * $len + $StarSize + $StopSize + /* Space between chars */ BCD_C39_NARROW_BAR * $xres * ($len-1); + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '*' */ + $narrow = BCD_C39_NARROW_BAR * $xres; + $wide = BCD_C39_WIDE_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $wide; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $narrow, $ySize); + $DrawPos += $narrow; + $DrawPos += $narrow; /* Space between chars */ + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '*' */ + $narrow = BCD_C39_NARROW_BAR * $xres; + $wide = BCD_C39_WIDE_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $wide; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $narrow, $ySize); + $DrawPos += $narrow; + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + + $narrow = BCD_C39_NARROW_BAR * $xres; + $wide = BCD_C39_WIDE_BAR * $xres; + + if (($size = $this->GetSize($xres))==0) { + __DEBUG__("GetSize: failed"); + return false; + } + + $cPos = 0; + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+($narrow*6+$wide*3)+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+($narrow*6+$wide*3), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[0] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[0] == '0') ? $narrow : $wide; + $DrawPos += ($cset[1] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[2] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[2] == '0') ? $narrow : $wide; + $DrawPos += ($cset[3] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[4] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[4] == '0') ? $narrow : $wide; + $DrawPos += ($cset[5] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[6] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[6] == '0') ? $narrow : $wide; + $DrawPos += ($cset[7] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[8] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[8] == '0') ? $narrow : $wide; + $DrawPos += $narrow; /* Space between chars */ + $cPos++; + } while ($cPos<$len); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + return true; + } + } +?> \ No newline at end of file diff --git a/barcode/debug.php b/barcode/debug.php new file mode 100755 index 0000000..855464f --- /dev/null +++ b/barcode/debug.php @@ -0,0 +1,64 @@ + + + Barcode Download + + + + + + + + +
+

+ + + + + + + + + + +
This is alpha release, report any problem to barcode@mribti.com

Main site
barcode-0.0.8a.tar.gz(45kb)
barcode-0.0.8a.zip(47kb)
Mirror site (fast)
barcode-0.0.8a.tar.gz(45kb)
barcode-0.0.8a.zip(47kb)

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CHANGES LOG

2001-03-25v0.0.1aInitial release.
2001-03-26v0.0.2aError checking has been added, and there are minor bugfixes
2001-03-26v0.0.3aAdd Code 39 support
2001-03-27v0.0.4aMinor feature enhancements, new output styles.
2001-03-28v0.0.5aAdd font control, minor bugfixes.
2001-03-29v0.0.6aBugfix in Code 39 render, thanks to Henry Bland.
2001-04-01v0.0.7aAdd support for Code 128-A and Code 128-B
2001-08-03v0.0.8aNow support Code 128-C, thanks to Sam Michaels.
+ + diff --git a/barcode/download.png b/barcode/download.png new file mode 100755 index 0000000..ace23c4 Binary files /dev/null and b/barcode/download.png differ diff --git a/barcode/home.php b/barcode/home.php new file mode 100755 index 0000000..aaf5fbb --- /dev/null +++ b/barcode/home.php @@ -0,0 +1,30 @@ + + + Barcode home page + + + + + + + + +
+

+ + + + + +
Barcode is a small implementation of a barcode rendering class using the PHP language and GD graphics library.


For any question, please send an email to barcode@mribti.com
+

+ + + + + + + +
SourceForge Logo
+ + diff --git a/barcode/home.png b/barcode/home.png new file mode 100755 index 0000000..2f2fcbe Binary files /dev/null and b/barcode/home.png differ diff --git a/barcode/i25object.php b/barcode/i25object.php new file mode 100755 index 0000000..e60e674 --- /dev/null +++ b/barcode/i25object.php @@ -0,0 +1,169 @@ +BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mCharSet = array + ( + /* 0 */ "00110", + /* 1 */ "10001", + /* 2 */ "01001", + /* 3 */ "11000", + /* 4 */ "00101", + /* 5 */ "10100", + /* 6 */ "01100", + /* 7 */ "00011", + /* 8 */ "10010", + /* 9 */ "01010" + ); + } + + function GetSize($xres) + { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + __DEBUG__("GetRealSize: null barcode value"); + return false; + } + + for ($i=0;$i<$len;$i++) { + if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) { + $this->mError = "I25 is numeric only"; + return false; + } + } + + if (($len%2) != 0) { + $this->mError = "The length of barcode value must be even"; + __DEBUG__("GetSize: failed I25 requiremente"); + return false; + } + $StartSize = BCD_I25_NARROW_BAR * 4 * $xres; + $StopSize = BCD_I25_WIDE_BAR * $xres + 2 * BCD_I25_NARROW_BAR * $xres; + $cPos = 0; + $sPos = 0; + do { + $c1 = $this->mValue[$cPos]; + $c2 = $this->mValue[$cPos+1]; + $cset1 = $this->mCharSet[$c1]; + $cset2 = $this->mCharSet[$c2]; + + for ($i=0;$i<5;$i++) { + $type1 = ($cset1[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $type2 = ($cset2[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $sPos += ($type1 + $type2); + } + $cPos+=2; + } while ($cPos<$len); + + return $sPos + $StarSize + $StopSize; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is "0000" */ + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize); + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize); + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $DrawPos += BCD_I25_NARROW_BAR * $xres; + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is "100" */ + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_WIDE_BAR * $xres , $ySize); + $DrawPos += BCD_I25_WIDE_BAR * $xres; + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize); + $DrawPos += BCD_I25_NARROW_BAR * $xres; + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + + if (($size = $this->GetSize($xres))==0) { + __DEBUG__("GetSize: failed"); + return false; + } + + $cPos = 0; + + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + /* Stretch */ + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+BCD_I25_NARROW_BAR*4*$xres+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET , $this->mValue[$i]); + } + }else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(BCD_I25_NARROW_BAR*4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + $sPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); + do { + $c1 = $this->mValue[$cPos]; + $c2 = $this->mValue[$cPos+1]; + $cset1 = $this->mCharSet[$c1]; + $cset2 = $this->mCharSet[$c2]; + + for ($i=0;$i<5;$i++) { + $type1 = ($cset1[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $type2 = ($cset2[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $this->DrawSingleBar($sPos, BCD_DEFAULT_MAR_Y1, $type1 , $ysize); + $sPos += ($type1 + $type2); + } + $cPos+=2; + } while ($cPos<$len); + $sPos = $this->DrawStop($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); + return true; + } + } +?> \ No newline at end of file diff --git a/barcode/image.php b/barcode/image.php new file mode 100755 index 0000000..5f7bf70 --- /dev/null +++ b/barcode/image.php @@ -0,0 +1,73 @@ +SetFont($font); + $obj->DrawObject($xres); + $obj->FlushObject(); + $obj->DestroyObject(); + unset($obj); /* clean */ + } +?> \ No newline at end of file diff --git a/barcode/image.png b/barcode/image.png new file mode 100755 index 0000000..36c4fab Binary files /dev/null and b/barcode/image.png differ diff --git a/barcode/index.php b/barcode/index.php new file mode 100755 index 0000000..85410d9 --- /dev/null +++ b/barcode/index.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/barcode/lesser.txt b/barcode/lesser.txt new file mode 100755 index 0000000..678c692 --- /dev/null +++ b/barcode/lesser.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/barcode/linux.gif b/barcode/linux.gif new file mode 100755 index 0000000..2540ad3 Binary files /dev/null and b/barcode/linux.gif differ diff --git a/barcode/php_logo.gif b/barcode/php_logo.gif new file mode 100755 index 0000000..7beda43 Binary files /dev/null and b/barcode/php_logo.gif differ diff --git a/barcode/sample.php b/barcode/sample.php new file mode 100755 index 0000000..63d44ce --- /dev/null +++ b/barcode/sample.php @@ -0,0 +1,139 @@ + + + Barcode Sample + + + + + + + + +
+

+0) { + $style = BCS_ALIGN_CENTER; + $style |= ($output == "png" ) ? BCS_IMAGE_PNG : 0; + $style |= ($output == "jpeg") ? BCS_IMAGE_JPEG : 0; + $style |= ($border == "on" ) ? BCS_BORDER : 0; + $style |= ($drawtext== "on" ) ? BCS_DRAW_TEXT : 0; + $style |= ($stretchtext== "on" ) ? BCS_STRETCH_TEXT : 0; + $style |= ($negative== "on" ) ? BCS_REVERSE_COLOR : 0; + + switch ($type) + { + case "I25": + $obj = new I25Object(250, 120, $style, $barcode); + break; + case "C39": + $obj = new C39Object(250, 120, $style, $barcode); + break; + case "C128A": + $obj = new C128AObject(250, 120, $style, $barcode); + break; + case "C128B": + $obj = new C128BObject(250, 120, $style, $barcode); + break; + case "C128C": + $obj = new C128CObject(250, 120, $style, $barcode); + break; + default: + $obj = false; + } + if ($obj) { + if ($obj->DrawObject($xres)) { + echo "
"; + } else echo "
".($obj->GetError())."
"; + } +} +?> +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
Output
Styles>Draw border
>Draw value text
>Stretch text
>Negative (White on black)
SizeWidth:
Height:
Xres + >1       + >2       + >3       +
Text Font + >1       + >2       + >3       + >4       + >5       +
Value
+
+ + diff --git a/barcode/sample.png b/barcode/sample.png new file mode 100755 index 0000000..1fdbbf6 Binary files /dev/null and b/barcode/sample.png differ diff --git a/barcode/spain.png b/barcode/spain.png new file mode 100755 index 0000000..d50f1be Binary files /dev/null and b/barcode/spain.png differ diff --git a/blindaje/BAR CODE.zip b/blindaje/BAR CODE.zip new file mode 100755 index 0000000..4707954 Binary files /dev/null and b/blindaje/BAR CODE.zip differ diff --git a/blindaje/barcode-0.0.8a.zip b/blindaje/barcode-0.0.8a.zip new file mode 100755 index 0000000..aa56336 Binary files /dev/null and b/blindaje/barcode-0.0.8a.zip differ diff --git a/blindaje/barcode/barcode.php b/blindaje/barcode/barcode.php new file mode 100755 index 0000000..2843c5d --- /dev/null +++ b/blindaje/barcode/barcode.php @@ -0,0 +1,174 @@ +mWidth = $Width; + $this->mHeight = $Height; + $this->mStyle = $Style; + $this->mFont = BCD_DEFAULT_FONT; + $this->mImg = ImageCreate($this->mWidth, $this->mHeight); + $dbColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_FOREGROUND_COLOR : BCD_DEFAULT_BACKGROUND_COLOR; + $dfColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_BACKGROUND_COLOR : BCD_DEFAULT_FOREGROUND_COLOR; + $this->mBgcolor = ImageColorAllocate($this->mImg, ($dbColor & 0xFF0000) >> 16, + ($dbColor & 0x00FF00) >> 8 , $dbColor & 0x0000FF); + $this->mBrush = ImageColorAllocate($this->mImg, ($dfColor & 0xFF0000) >> 16, + ($dfColor & 0x00FF00) >> 8 , $dfColor & 0x0000FF); + if (!($this->mStyle & BCS_TRANSPARENT)) { + ImageFill($this->mImg, $this->mWidth, $this->mHeight, $this->mBgcolor); + } + __TRACE__("OBJECT CONSTRUCTION: ".$this->mWidth." ".$this->mHeight." ".$this->mStyle); + } + + function DrawObject ($xres) { + /* there is not implementation neded, is simply the asbsract function. */ + __TRACE__("OBJECT DRAW: NEED VIRTUAL FUNCTION IMPLEMENTATION"); + return false; + } + + function DrawBorder () { + ImageRectangle($this->mImg, 0, 0, $this->mWidth-1, $this->mHeight-1, $this->mBrush); + __TRACE__("DRAWING BORDER"); + } + + function DrawChar ($Font, $xPos, $yPos, $Char) { + ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush); + } + + function DrawText ($Font, $xPos, $yPos, $Char) { + ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush); + } + + function DrawSingleBar($xPos, $yPos, $xSize, $ySize) { + if ($xPos>=0 && $xPos<=$this->mWidth && ($xPos+$xSize)<=$this->mWidth && + $yPos>=0 && $yPos<=$this->mHeight && ($yPos+$ySize)<=$this->mHeight) { + for ($i=0;$i<$xSize;$i++) { + ImageLine($this->mImg, $xPos+$i, $yPos, $xPos+$i, $yPos+$ySize, $this->mBrush); + } + return true; + } + __DEBUG__("DrawSingleBar: Out of range"); + return false; + } + + function GetError() { + return $this->mError; + } + + function GetFontHeight($font) { + return ImageFontHeight($font); + } + + function GetFontWidth($font) { + return ImageFontWidth($font); + } + + function SetFont($font) { + $this->mFont = $font; + } + + function GetStyle () { + return $this->mStyle; + } + + function SetStyle ($Style) { + __TRACE__("CHANGING STYLE"); + $this->mStyle = $Style; + } + + function FlushObject () { + if (($this->mStyle & BCS_BORDER)) { + $this->DrawBorder(); + } + if ($this->mStyle & BCS_IMAGE_PNG) { + Header("Content-Type: image/png"); + ImagePng($this->mImg); + } else if ($this->mStyle & BCS_IMAGE_JPEG) { + Header("Content-Type: image/jpeg"); + ImageJpeg($this->mImg); + } else __DEBUG__("FlushObject: No output type"); + } + + function DestroyObject () { + ImageDestroy($obj->mImg); + } + } +?> \ No newline at end of file diff --git a/blindaje/barcode/c128aobject.php b/blindaje/barcode/c128aobject.php new file mode 100755 index 0000000..90b8dd0 --- /dev/null +++ b/blindaje/barcode/c128aobject.php @@ -0,0 +1,320 @@ +BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = " !\"#$%&'()*+�-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"; + $this->mCharSet = array + ( + "212222", /* 00 */ + "222122", /* 01 */ + "222221", /* 02 */ + "121223", /* 03 */ + "121322", /* 04 */ + "131222", /* 05 */ + "122213", /* 06 */ + "122312", /* 07 */ + "132212", /* 08 */ + "221213", /* 09 */ + "221312", /* 10 */ + "231212", /* 11 */ + "112232", /* 12 */ + "122132", /* 13 */ + "122231", /* 14 */ + "113222", /* 15 */ + "123122", /* 16 */ + "123221", /* 17 */ + "223211", /* 18 */ + "221132", /* 19 */ + "221231", /* 20 */ + "213212", /* 21 */ + "223112", /* 22 */ + "312131", /* 23 */ + "311222", /* 24 */ + "321122", /* 25 */ + "321221", /* 26 */ + "312212", /* 27 */ + "322112", /* 28 */ + "322211", /* 29 */ + "212123", /* 30 */ + "212321", /* 31 */ + "232121", /* 32 */ + "111323", /* 33 */ + "131123", /* 34 */ + "131321", /* 35 */ + "112313", /* 36 */ + "132113", /* 37 */ + "132311", /* 38 */ + "211313", /* 39 */ + "231113", /* 40 */ + "231311", /* 41 */ + "112133", /* 42 */ + "112331", /* 43 */ + "132131", /* 44 */ + "113123", /* 45 */ + "113321", /* 46 */ + "133121", /* 47 */ + "313121", /* 48 */ + "211331", /* 49 */ + "231131", /* 50 */ + "213113", /* 51 */ + "213311", /* 52 */ + "213131", /* 53 */ + "311123", /* 54 */ + "311321", /* 55 */ + "331121", /* 56 */ + "312113", /* 57 */ + "312311", /* 58 */ + "332111", /* 59 */ + "314111", /* 60 */ + "221411", /* 61 */ + "431111", /* 62 */ + "111224", /* 63 */ + "111422", /* 64 */ + "121124", /* 65 */ + "121421", /* 66 */ + "141122", /* 67 */ + "141221", /* 68 */ + "112214", /* 69 */ + "112412", /* 70 */ + "122114", /* 71 */ + "122411", /* 72 */ + "142112", /* 73 */ + "142211", /* 74 */ + "241211", /* 75 */ + "221114", /* 76 */ + "413111", /* 77 */ + "241112", /* 78 */ + "134111", /* 79 */ + "111242", /* 80 */ + "121142", /* 81 */ + "121241", /* 82 */ + "114212", /* 83 */ + "124112", /* 84 */ + "124211", /* 85 */ + "411212", /* 86 */ + "421112", /* 87 */ + "421211", /* 88 */ + "212141", /* 89 */ + "214121", /* 90 */ + "412121", /* 91 */ + "111143", /* 92 */ + "111341", /* 93 */ + "131141", /* 94 */ + "114113", /* 95 */ + "114311", /* 96 */ + "411113", /* 97 */ + "411311", /* 98 */ + "113141", /* 99 */ + "114131", /* 100 */ + "311141", /* 101 */ + "411131" /* 102 */ + ); + } + + function GetCharIndex ($char) { + for ($i=0;$i<64;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetBarSize ($xres, $char) { + switch ($char) + { + case '1': + $cVal = BCD_C128_BAR_1; + break; + case '2': + $cVal = BCD_C128_BAR_2; + break; + case '3': + $cVal = BCD_C128_BAR_3; + break; + case '4': + $cVal = BCD_C128_BAR_4; + break; + default: + $cVal = 0; + } + return $cVal * $xres; + } + + + function GetSize($xres) { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + __DEBUG__("GetRealSize: null barcode value"); + return false; + } + $ret = 0; + for ($i=0;$i<$len;$i++) { + if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) { + $this->mError = "C128A not include the char '".$this->mValue[$i]."'"; + return false; + } else { + $cset = $this->mCharSet[$id]; + $ret += $this->GetBarSize($xres, $cset[0]); + $ret += $this->GetBarSize($xres, $cset[1]); + $ret += $this->GetBarSize($xres, $cset[2]); + $ret += $this->GetBarSize($xres, $cset[3]); + $ret += $this->GetBarSize($xres, $cset[4]); + $ret += $this->GetBarSize($xres, $cset[5]); + } + } + + /* length of Check character */ + $cset = $this->GetCheckCharValue(); + for ($i=0;$i<6;$i++) { + $CheckSize += $this->GetBarSize($cset[$i], $xres); + } + $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; + $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; + return $StartSize + $ret + $CheckSize + $StopSize; + } + + function GetCheckCharValue() + { + $len = strlen($this->mValue); + $sum = 103; // 'A' type; + for ($i=0;$i<$len;$i++) { + $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1); + } + $check = $sum % 103; + return $this->mCharSet[$check]; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '211412' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('4', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '2331112' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('3', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) + { + $cset = $this->GetCheckCharValue(); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + if (($size = $this->GetSize($xres))==0) { + __DEBUG__("GetSize: failed"); + return false; + } + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + $cPos = 0; + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + $cPos++; + } while ($cPos<$len); + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + return true; + } + } +?> \ No newline at end of file diff --git a/blindaje/barcode/c128bobject.php b/blindaje/barcode/c128bobject.php new file mode 100755 index 0000000..b2c7717 --- /dev/null +++ b/blindaje/barcode/c128bobject.php @@ -0,0 +1,321 @@ +BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = " !\"#$%&'()*+�-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{ }~"; + $this->mCharSet = array + ( + "212222", /* 00 */ + "222122", /* 01 */ + "222221", /* 02 */ + "121223", /* 03 */ + "121322", /* 04 */ + "131222", /* 05 */ + "122213", /* 06 */ + "122312", /* 07 */ + "132212", /* 08 */ + "221213", /* 09 */ + "221312", /* 10 */ + "231212", /* 11 */ + "112232", /* 12 */ + "122132", /* 13 */ + "122231", /* 14 */ + "113222", /* 15 */ + "123122", /* 16 */ + "123221", /* 17 */ + "223211", /* 18 */ + "221132", /* 19 */ + "221231", /* 20 */ + "213212", /* 21 */ + "223112", /* 22 */ + "312131", /* 23 */ + "311222", /* 24 */ + "321122", /* 25 */ + "321221", /* 26 */ + "312212", /* 27 */ + "322112", /* 28 */ + "322211", /* 29 */ + "212123", /* 30 */ + "212321", /* 31 */ + "232121", /* 32 */ + "111323", /* 33 */ + "131123", /* 34 */ + "131321", /* 35 */ + "112313", /* 36 */ + "132113", /* 37 */ + "132311", /* 38 */ + "211313", /* 39 */ + "231113", /* 40 */ + "231311", /* 41 */ + "112133", /* 42 */ + "112331", /* 43 */ + "132131", /* 44 */ + "113123", /* 45 */ + "113321", /* 46 */ + "133121", /* 47 */ + "313121", /* 48 */ + "211331", /* 49 */ + "231131", /* 50 */ + "213113", /* 51 */ + "213311", /* 52 */ + "213131", /* 53 */ + "311123", /* 54 */ + "311321", /* 55 */ + "331121", /* 56 */ + "312113", /* 57 */ + "312311", /* 58 */ + "332111", /* 59 */ + "314111", /* 60 */ + "221411", /* 61 */ + "431111", /* 62 */ + "111224", /* 63 */ + "111422", /* 64 */ + "121124", /* 65 */ + "121421", /* 66 */ + "141122", /* 67 */ + "141221", /* 68 */ + "112214", /* 69 */ + "112412", /* 70 */ + "122114", /* 71 */ + "122411", /* 72 */ + "142112", /* 73 */ + "142211", /* 74 */ + "241211", /* 75 */ + "221114", /* 76 */ + "413111", /* 77 */ + "241112", /* 78 */ + "134111", /* 79 */ + "111242", /* 80 */ + "121142", /* 81 */ + "121241", /* 82 */ + "114212", /* 83 */ + "124112", /* 84 */ + "124211", /* 85 */ + "411212", /* 86 */ + "421112", /* 87 */ + "421211", /* 88 */ + "212141", /* 89 */ + "214121", /* 90 */ + "412121", /* 91 */ + "111143", /* 92 */ + "111341", /* 93 */ + "131141", /* 94 */ + "114113", /* 95 */ + "114311", /* 96 */ + "411113", /* 97 */ + "411311", /* 98 */ + "113141", /* 99 */ + "114131", /* 100 */ + "311141", /* 101 */ + "411131" /* 102 */ + ); + } + + function GetCharIndex ($char) { + for ($i=0;$i<95;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetBarSize ($xres, $char) { + switch ($char) + { + case '1': + $cVal = BCD_C128_BAR_1; + break; + case '2': + $cVal = BCD_C128_BAR_2; + break; + case '3': + $cVal = BCD_C128_BAR_3; + break; + case '4': + $cVal = BCD_C128_BAR_4; + break; + default: + $cVal = 0; + } + return $cVal * $xres; + } + + + function GetSize($xres) { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + __DEBUG__("GetRealSize: null barcode value"); + return false; + } + $ret = 0; + for ($i=0;$i<$len;$i++) { + if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) { + $this->mError = "C128B not include the char '".$this->mValue[$i]."'"; + return false; + } else { + $cset = $this->mCharSet[$id]; + $ret += $this->GetBarSize($xres, $cset[0]); + $ret += $this->GetBarSize($xres, $cset[1]); + $ret += $this->GetBarSize($xres, $cset[2]); + $ret += $this->GetBarSize($xres, $cset[3]); + $ret += $this->GetBarSize($xres, $cset[4]); + $ret += $this->GetBarSize($xres, $cset[5]); + } + } + /* length of Check character */ + $cset = $this->GetCheckCharValue(); + for ($i=0;$i<6;$i++) { + $CheckSize += $this->GetBarSize($cset[$i], $xres); + } + + $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; + $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; + + return $StartSize + $ret + $CheckSize + $StopSize; + } + + function GetCheckCharValue() + { + $len = strlen($this->mValue); + $sum = 104; // 'B' type; + for ($i=0;$i<$len;$i++) { + $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1); + } + $check = $sum % 103; + return $this->mCharSet[$check]; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '211214' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('4', $xres); + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '2331112' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('3', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) + { + $cset = $this->GetCheckCharValue(); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + if (($size = $this->GetSize($xres))==0) { + __DEBUG__("GetSize: failed"); + return false; + } + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + $cPos = 0; + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + $cPos++; + } while ($cPos<$len); + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + return true; + } + } +?> \ No newline at end of file diff --git a/blindaje/barcode/c128cobject.php b/blindaje/barcode/c128cobject.php new file mode 100755 index 0000000..2045334 --- /dev/null +++ b/blindaje/barcode/c128cobject.php @@ -0,0 +1,344 @@ +BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = array + ( + "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", + "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", + "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", + "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", + "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", + "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", + "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", + "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", + "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", + "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", + ); + $this->mCharSet = array + ( + "212222", /* 00 */ + "222122", /* 01 */ + "222221", /* 02 */ + "121223", /* 03 */ + "121322", /* 04 */ + "131222", /* 05 */ + "122213", /* 06 */ + "122312", /* 07 */ + "132212", /* 08 */ + "221213", /* 09 */ + "221312", /* 10 */ + "231212", /* 11 */ + "112232", /* 12 */ + "122132", /* 13 */ + "122231", /* 14 */ + "113222", /* 15 */ + "123122", /* 16 */ + "123221", /* 17 */ + "223211", /* 18 */ + "221132", /* 19 */ + "221231", /* 20 */ + "213212", /* 21 */ + "223112", /* 22 */ + "312131", /* 23 */ + "311222", /* 24 */ + "321122", /* 25 */ + "321221", /* 26 */ + "312212", /* 27 */ + "322112", /* 28 */ + "322211", /* 29 */ + "212123", /* 30 */ + "212321", /* 31 */ + "232121", /* 32 */ + "111323", /* 33 */ + "131123", /* 34 */ + "131321", /* 35 */ + "112313", /* 36 */ + "132113", /* 37 */ + "132311", /* 38 */ + "211313", /* 39 */ + "231113", /* 40 */ + "231311", /* 41 */ + "112133", /* 42 */ + "112331", /* 43 */ + "132131", /* 44 */ + "113123", /* 45 */ + "113321", /* 46 */ + "133121", /* 47 */ + "313121", /* 48 */ + "211331", /* 49 */ + "231131", /* 50 */ + "213113", /* 51 */ + "213311", /* 52 */ + "213131", /* 53 */ + "311123", /* 54 */ + "311321", /* 55 */ + "331121", /* 56 */ + "312113", /* 57 */ + "312311", /* 58 */ + "332111", /* 59 */ + "314111", /* 60 */ + "221411", /* 61 */ + "431111", /* 62 */ + "111224", /* 63 */ + "111422", /* 64 */ + "121124", /* 65 */ + "121421", /* 66 */ + "141122", /* 67 */ + "141221", /* 68 */ + "112214", /* 69 */ + "112412", /* 70 */ + "122114", /* 71 */ + "122411", /* 72 */ + "142112", /* 73 */ + "142211", /* 74 */ + "241211", /* 75 */ + "221114", /* 76 */ + "413111", /* 77 */ + "241112", /* 78 */ + "134111", /* 79 */ + "111242", /* 80 */ + "121142", /* 81 */ + "121241", /* 82 */ + "114212", /* 83 */ + "124112", /* 84 */ + "124211", /* 85 */ + "411212", /* 86 */ + "421112", /* 87 */ + "421211", /* 88 */ + "212141", /* 89 */ + "214121", /* 90 */ + "412121", /* 91 */ + "111143", /* 92 */ + "111341", /* 93 */ + "131141", /* 94 */ + "114113", /* 95 */ + "114311", /* 96 */ + "411113", /* 97 */ + "411311", /* 98 */ + "113141", /* 99 */ + ); + } + + function GetCharIndex ($char) { + for ($i=0;$i<100;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetBarSize ($xres, $char) { + switch ($char) + { + case '1': + $cVal = BCD_C128_BAR_1; + break; + case '2': + $cVal = BCD_C128_BAR_2; + break; + case '3': + $cVal = BCD_C128_BAR_3; + break; + case '4': + $cVal = BCD_C128_BAR_4; + break; + default: + $cVal = 0; + } + return $cVal * $xres; + } + + + function GetSize($xres) { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + __DEBUG__("GetRealSize: null barcode value"); + return false; + } + $ret = 0; + + for ($i=0;$i<$len;$i++) { + if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) { + $this->mError = "Code-128C is numeric only"; + return false; + } + } + + if (($len%2) != 0) { + $this->mError = "The length of barcode value must be even. You must pad the number with zeros."; + __DEBUG__("GetSize: failed C128-C requiremente"); + return false; + } + + for ($i=0;$i<$len;$i+=2) { + $id = $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]); + $cset = $this->mCharSet[$id]; + $ret += $this->GetBarSize($xres, $cset[0]); + $ret += $this->GetBarSize($xres, $cset[1]); + $ret += $this->GetBarSize($xres, $cset[2]); + $ret += $this->GetBarSize($xres, $cset[3]); + $ret += $this->GetBarSize($xres, $cset[4]); + $ret += $this->GetBarSize($xres, $cset[5]); + } + /* length of Check character */ + $cset = $this->GetCheckCharValue(); + for ($i=0;$i<6;$i++) { + $CheckSize += $this->GetBarSize($cset[$i], $xres); + } + + $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; + $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; + return $StartSize + $ret + $CheckSize + $StopSize; + } + + function GetCheckCharValue() + { + $len = strlen($this->mValue); + $sum = 105; // 'C' type; + $m = 0; + for ($i=0;$i<$len;$i+=2) { + $m++; + $sum += $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]) * $m; + } + $check = $sum % 103; + return $this->mCharSet[$check]; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '211232' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '2331112' */ + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + $DrawPos += $this->GetBarSize('3', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); + $DrawPos += $this->GetBarSize('3', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); + $DrawPos += $this->GetBarSize('1', $xres); + $DrawPos += $this->GetBarSize('1', $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); + $DrawPos += $this->GetBarSize('2', $xres); + return $DrawPos; + } + + function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) + { + $cset = $this->GetCheckCharValue(); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + if (($size = $this->GetSize($xres))==0) { + __DEBUG__("GetSize: failed"); + return false; + } + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + $cPos = 0; + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos].$this->mValue[$cPos+1]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[0], $xres); + $DrawPos += $this->GetBarSize($cset[1], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[2], $xres); + $DrawPos += $this->GetBarSize($cset[3], $xres); + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); + $DrawPos += $this->GetBarSize($cset[4], $xres); + $DrawPos += $this->GetBarSize($cset[5], $xres); + $cPos += 2; + } while ($cPos<$len); + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + return true; + } + } +?> diff --git a/blindaje/barcode/c39object.php b/blindaje/barcode/c39object.php new file mode 100755 index 0000000..991e481 --- /dev/null +++ b/blindaje/barcode/c39object.php @@ -0,0 +1,228 @@ +BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; + $this->mCharSet = array + ( + /* 0 */ "000110100", + /* 1 */ "100100001", + /* 2 */ "001100001", + /* 3 */ "101100000", + /* 4 */ "000110001", + /* 5 */ "100110000", + /* 6 */ "001110000", + /* 7 */ "000100101", + /* 8 */ "100100100", + /* 9 */ "001100100", + /* A */ "100001001", + /* B */ "001001001", + /* C */ "101001000", + /* D */ "000011001", + /* E */ "100011000", + /* F */ "001011000", + /* G */ "000001101", + /* H */ "100001100", + /* I */ "001001100", + /* J */ "000011100", + /* K */ "100000011", + /* L */ "001000011", + /* M */ "101000010", + /* N */ "000010011", + /* O */ "100010010", + /* P */ "001010010", + /* Q */ "000000111", + /* R */ "100000110", + /* S */ "001000110", + /* T */ "000010110", + /* U */ "110000001", + /* V */ "011000001", + /* W */ "111000000", + /* X */ "010010001", + /* Y */ "110010000", + /* Z */ "011010000", + /* - */ "010000101", + /* . */ "110000100", + /* SP */ "011000100", + /* * */ "010010100", + /* $ */ "010101000", + /* / */ "010100010", + /* + */ "010001010", + /* % */ "000101010" + ); + } + + function GetCharIndex ($char) + { + for ($i=0;$i<44;$i++) { + if ($this->mChars[$i] == $char) + return $i; + } + return -1; + } + + function GetSize($xres) + { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + __DEBUG__("GetRealSize: null barcode value"); + return false; + } + + for ($i=0;$i<$len;$i++) { + if ($this->GetCharIndex($this->mValue[$i]) == -1 || $this->mValue[$i] == '*') { + /* The asterisk is only used as a start and stop code */ + $this->mError = "C39 not include the char '".$this->mValue[$i]."'"; + return false; + } + } + + /* Start, Stop is 010010100 == '*' */ + $StartSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; + $StopSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; + $CharSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; /* Same for all chars */ + + return $CharSize * $len + $StarSize + $StopSize + /* Space between chars */ BCD_C39_NARROW_BAR * $xres * ($len-1); + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is '*' */ + $narrow = BCD_C39_NARROW_BAR * $xres; + $wide = BCD_C39_WIDE_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $wide; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $narrow, $ySize); + $DrawPos += $narrow; + $DrawPos += $narrow; /* Space between chars */ + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is '*' */ + $narrow = BCD_C39_NARROW_BAR * $xres; + $wide = BCD_C39_WIDE_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $wide; + $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize); + $DrawPos += $narrow; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize); + $DrawPos += $wide; + $DrawPos += $narrow; + $this->DrawSingleBar($DrawPos, $yPos, $narrow, $ySize); + $DrawPos += $narrow; + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + + $narrow = BCD_C39_NARROW_BAR * $xres; + $wide = BCD_C39_WIDE_BAR * $xres; + + if (($size = $this->GetSize($xres))==0) { + __DEBUG__("GetSize: failed"); + return false; + } + + $cPos = 0; + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + /* Total height of bar code -Bars only- */ + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + /* Draw text */ + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+($narrow*6+$wide*3)+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); + } + } else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+($narrow*6+$wide*3), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + do { + $c = $this->GetCharIndex($this->mValue[$cPos]); + $cset = $this->mCharSet[$c]; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[0] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[0] == '0') ? $narrow : $wide; + $DrawPos += ($cset[1] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[2] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[2] == '0') ? $narrow : $wide; + $DrawPos += ($cset[3] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[4] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[4] == '0') ? $narrow : $wide; + $DrawPos += ($cset[5] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[6] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[6] == '0') ? $narrow : $wide; + $DrawPos += ($cset[7] == '0') ? $narrow : $wide; + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[8] == '0') ? $narrow : $wide , $ysize); + $DrawPos += ($cset[8] == '0') ? $narrow : $wide; + $DrawPos += $narrow; /* Space between chars */ + $cPos++; + } while ($cPos<$len); + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); + return true; + } + } +?> \ No newline at end of file diff --git a/blindaje/barcode/debug.php b/blindaje/barcode/debug.php new file mode 100755 index 0000000..8faeaea --- /dev/null +++ b/blindaje/barcode/debug.php @@ -0,0 +1,64 @@ + + + Barcode Download + + + + + + + + +
+

+ + + + + + + + + + +
This is alpha release, report any problem to barcode@mribti.com

Main site
barcode-0.0.8a.tar.gz(45kb)
barcode-0.0.8a.zip(47kb)
Mirror site (fast)
barcode-0.0.8a.tar.gz(45kb)
barcode-0.0.8a.zip(47kb)

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CHANGES LOG

2001-03-25v0.0.1aInitial release.
2001-03-26v0.0.2aError checking has been added, and there are minor bugfixes
2001-03-26v0.0.3aAdd Code 39 support
2001-03-27v0.0.4aMinor feature enhancements, new output styles.
2001-03-28v0.0.5aAdd font control, minor bugfixes.
2001-03-29v0.0.6aBugfix in Code 39 render, thanks to Henry Bland.
2001-04-01v0.0.7aAdd support for Code 128-A and Code 128-B
2001-08-03v0.0.8aNow support Code 128-C, thanks to Sam Michaels.
+ + diff --git a/blindaje/barcode/download.png b/blindaje/barcode/download.png new file mode 100755 index 0000000..ace23c4 Binary files /dev/null and b/blindaje/barcode/download.png differ diff --git a/blindaje/barcode/home.php b/blindaje/barcode/home.php new file mode 100755 index 0000000..aaf5fbb --- /dev/null +++ b/blindaje/barcode/home.php @@ -0,0 +1,30 @@ + + + Barcode home page + + + + + + + + +
+

+ + + + + +
Barcode is a small implementation of a barcode rendering class using the PHP language and GD graphics library.


For any question, please send an email to barcode@mribti.com
+

+ + + + + + + +
SourceForge Logo
+ + diff --git a/blindaje/barcode/home.png b/blindaje/barcode/home.png new file mode 100755 index 0000000..2f2fcbe Binary files /dev/null and b/blindaje/barcode/home.png differ diff --git a/blindaje/barcode/i25object.php b/blindaje/barcode/i25object.php new file mode 100755 index 0000000..e60e674 --- /dev/null +++ b/blindaje/barcode/i25object.php @@ -0,0 +1,169 @@ +BarcodeObject($Width, $Height, $Style); + $this->mValue = $Value; + $this->mCharSet = array + ( + /* 0 */ "00110", + /* 1 */ "10001", + /* 2 */ "01001", + /* 3 */ "11000", + /* 4 */ "00101", + /* 5 */ "10100", + /* 6 */ "01100", + /* 7 */ "00011", + /* 8 */ "10010", + /* 9 */ "01010" + ); + } + + function GetSize($xres) + { + $len = strlen($this->mValue); + + if ($len == 0) { + $this->mError = "Null value"; + __DEBUG__("GetRealSize: null barcode value"); + return false; + } + + for ($i=0;$i<$len;$i++) { + if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) { + $this->mError = "I25 is numeric only"; + return false; + } + } + + if (($len%2) != 0) { + $this->mError = "The length of barcode value must be even"; + __DEBUG__("GetSize: failed I25 requiremente"); + return false; + } + $StartSize = BCD_I25_NARROW_BAR * 4 * $xres; + $StopSize = BCD_I25_WIDE_BAR * $xres + 2 * BCD_I25_NARROW_BAR * $xres; + $cPos = 0; + $sPos = 0; + do { + $c1 = $this->mValue[$cPos]; + $c2 = $this->mValue[$cPos+1]; + $cset1 = $this->mCharSet[$c1]; + $cset2 = $this->mCharSet[$c2]; + + for ($i=0;$i<5;$i++) { + $type1 = ($cset1[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $type2 = ($cset2[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $sPos += ($type1 + $type2); + } + $cPos+=2; + } while ($cPos<$len); + + return $sPos + $StarSize + $StopSize; + } + + function DrawStart($DrawPos, $yPos, $ySize, $xres) + { /* Start code is "0000" */ + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize); + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize); + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $DrawPos += BCD_I25_NARROW_BAR * $xres; + return $DrawPos; + } + + function DrawStop($DrawPos, $yPos, $ySize, $xres) + { /* Stop code is "100" */ + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_WIDE_BAR * $xres , $ySize); + $DrawPos += BCD_I25_WIDE_BAR * $xres; + $DrawPos += BCD_I25_NARROW_BAR * $xres; + $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR * $xres , $ySize); + $DrawPos += BCD_I25_NARROW_BAR * $xres; + return $DrawPos; + } + + function DrawObject ($xres) + { + $len = strlen($this->mValue); + + if (($size = $this->GetSize($xres))==0) { + __DEBUG__("GetSize: failed"); + return false; + } + + $cPos = 0; + + if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); + else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; + + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); + else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; + else $sPos = 0; + + if ($this->mStyle & BCS_DRAW_TEXT) { + if ($this->mStyle & BCS_STRETCH_TEXT) { + /* Stretch */ + for ($i=0;$i<$len;$i++) { + $this->DrawChar($this->mFont, $sPos+BCD_I25_NARROW_BAR*4*$xres+($size/$len)*$i, + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET , $this->mValue[$i]); + } + }else {/* Center */ + $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); + $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(BCD_I25_NARROW_BAR*4*$xres), + $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); + } + } + + $sPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); + do { + $c1 = $this->mValue[$cPos]; + $c2 = $this->mValue[$cPos+1]; + $cset1 = $this->mCharSet[$c1]; + $cset2 = $this->mCharSet[$c2]; + + for ($i=0;$i<5;$i++) { + $type1 = ($cset1[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $type2 = ($cset2[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres); + $this->DrawSingleBar($sPos, BCD_DEFAULT_MAR_Y1, $type1 , $ysize); + $sPos += ($type1 + $type2); + } + $cPos+=2; + } while ($cPos<$len); + $sPos = $this->DrawStop($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); + return true; + } + } +?> \ No newline at end of file diff --git a/blindaje/barcode/image.php b/blindaje/barcode/image.php new file mode 100755 index 0000000..f808161 --- /dev/null +++ b/blindaje/barcode/image.php @@ -0,0 +1,73 @@ +SetFont($font); + $obj->DrawObject($xres); + $obj->FlushObject(); + $obj->DestroyObject(); + unset($obj); /* clean */ + } +?> \ No newline at end of file diff --git a/blindaje/barcode/image.png b/blindaje/barcode/image.png new file mode 100755 index 0000000..36c4fab Binary files /dev/null and b/blindaje/barcode/image.png differ diff --git a/blindaje/barcode/index.php b/blindaje/barcode/index.php new file mode 100755 index 0000000..85410d9 --- /dev/null +++ b/blindaje/barcode/index.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/blindaje/barcode/lesser.txt b/blindaje/barcode/lesser.txt new file mode 100755 index 0000000..678c692 --- /dev/null +++ b/blindaje/barcode/lesser.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/blindaje/barcode/linux.gif b/blindaje/barcode/linux.gif new file mode 100755 index 0000000..2540ad3 Binary files /dev/null and b/blindaje/barcode/linux.gif differ diff --git a/blindaje/barcode/php_logo.gif b/blindaje/barcode/php_logo.gif new file mode 100755 index 0000000..7beda43 Binary files /dev/null and b/blindaje/barcode/php_logo.gif differ diff --git a/blindaje/barcode/sample.php b/blindaje/barcode/sample.php new file mode 100755 index 0000000..6534b6f --- /dev/null +++ b/blindaje/barcode/sample.php @@ -0,0 +1,139 @@ + + + Barcode Sample + + + + + + + + +
+

+0) { + $style = BCS_ALIGN_CENTER; + $style |= ($output == "png" ) ? BCS_IMAGE_PNG : 0; + $style |= ($output == "jpeg") ? BCS_IMAGE_JPEG : 0; + $style |= ($border == "on" ) ? BCS_BORDER : 0; + $style |= ($drawtext== "on" ) ? BCS_DRAW_TEXT : 0; + $style |= ($stretchtext== "on" ) ? BCS_STRETCH_TEXT : 0; + $style |= ($negative== "on" ) ? BCS_REVERSE_COLOR : 0; + + switch ($type) + { + case "I25": + $obj = new I25Object(250, 120, $style, $barcode); + break; + case "C39": + $obj = new C39Object(250, 120, $style, $barcode); + break; + case "C128A": + $obj = new C128AObject(250, 120, $style, $barcode); + break; + case "C128B": + $obj = new C128BObject(250, 120, $style, $barcode); + break; + case "C128C": + $obj = new C128CObject(250, 120, $style, $barcode); + break; + default: + $obj = false; + } + if ($obj) { + if ($obj->DrawObject($xres)) { + echo "
"; + } else echo "
".($obj->GetError())."
"; + } +} +?> +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type
Output
Styles>Draw border
>Draw value text
>Stretch text
>Negative (White on black)
SizeWidth:
Height:
Xres + >1       + >2       + >3       +
Text Font + >1       + >2       + >3       + >4       + >5       +
Value
+
+ + diff --git a/blindaje/barcode/sample.png b/blindaje/barcode/sample.png new file mode 100755 index 0000000..1fdbbf6 Binary files /dev/null and b/blindaje/barcode/sample.png differ diff --git a/blindaje/barcode/spain.png b/blindaje/barcode/spain.png new file mode 100755 index 0000000..d50f1be Binary files /dev/null and b/blindaje/barcode/spain.png differ diff --git a/calc/Compound Interest Calculator.htm b/calc/Compound Interest Calculator.htm new file mode 100755 index 0000000..68035f8 --- /dev/null +++ b/calc/Compound Interest Calculator.htm @@ -0,0 +1,206 @@ + + + +Compound Interest Calculator + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + +
+
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ +

Index of Calculators
+
+
A collection of functional online calculators for use in every day domestic and commercial use. +

A collection of functional online calculators for use in every day domestic and commercial use.

+

Compound Interest Calculators

+

+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Compound Interest on Savings +
Initial Deposit + +
Annual Interest Rate + + +
Number of Years + + +
Sum at End of Term + + +
Interest Received + + +
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Compound Interest on a Loan +
Amount Borrowed + +
Annual Interest Rate + + +
Length of loan (Years) + + +
Total amount payable + + +
Interest Repayable + + +
+ + +
+
+
+



+

Index of Interest Calculators

+ +


+
+ Disclaimer:
+ Use of the calculators within this website is free. Whilst every effort has been made to ensure the accuracy of the calculators published within this website, you choose to use them and rely on any results at your own risk. We will not under any circumstances accept responsibility or liability for any losses that may arise from a decision that you may make as aresult of using these calculators. Similarly, we will not be requesting a share of any profits you may make as a result of using the calculators. +
+
+ + \ No newline at end of file diff --git a/calc/calc.htm b/calc/calc.htm new file mode 100755 index 0000000..7906988 --- /dev/null +++ b/calc/calc.htm @@ -0,0 +1,68 @@ + + + +Compound Interest Calculator + + + + + + +
+ Initial Deposit + +
+ Annual Interest Rate + +
+ Number of Years + +
+ Sum at End of Term + +
+ Interest Received + +
+

 

+


+

+
+

Amount Borrowed + +
+ Annual Interest Rate + +
+ Length of loan (Years) + +
+ Total amount payable + +
+ Interest Repayable + +
+ +

+
+ + \ No newline at end of file diff --git a/calc/calculators.css b/calc/calculators.css new file mode 100755 index 0000000..abc3724 --- /dev/null +++ b/calc/calculators.css @@ -0,0 +1,91 @@ +@charset "iso-8859-1"; +/* Creation date: 12/04/2002 */ +body { + background-color: #8FBEE8; + font-size: 8px; + font-family: arial, helvetica; + color: navy; + margin: 0px; +} +h1.header { + font-size: 10px; + margin: 0px; +} +table.pagetable { + background-color: white; + margin: 2px; + border: 1px solid #000080; + padding-left: 3px; + padding-right: 3px; +} +tr.leftnav{ + background-color: #FFFFFF; + vertical-align: top; +} +td.main { + text-align: left; + vertical-align: top; + background-color: white; + font-family: Arial, Helvetica, sans-serif; + font-size: 10pt; + padding-left: 3px; + padding-right: 7px; +} +td.button { + background: url(images/button.gif); +} +td.button1 { + background: url(images/button1.gif); + padding-left: 120px; +} +td.left table tr td{ + font-family: Arial, Helvetica, sans-serif; + padding-left: 5px; + height: 26px; + font-size: 8pt; + color: #006699; + font-weight: bold; + +} +td.left table tr td a:link { + font-family: Arial, Helvetica, sans-serif; + font-size: 8pt; + color: #5255BA; + font-weight: bold; + text-decoration: none; +} +td.left table tr td a:active { + font-family: Arial, Helvetica, sans-serif; + font-size: 8pt; + color: #5255BA; + font-weight: bold; + text-decoration: none; +} +td.left table tr td a:visited { + font-family: Arial, Helvetica, sans-serif; + font-size: 8pt; + color: #5255BA; + font-weight: bold; + text-decoration: none; +} +div.leftnavhead { + text-align: left; + color: black; + font-size: 12px; +} +div.smallest { + text-align: left; + color: black; + font-size: 9px; +} +h4.small { + font-size: 13px; + margin: 0px; + color: #FF0000; +} +td.calculator { + vertical-align: center; + background-color: #A0D6A0; + font-family: Arial, Helvetica, sans-serif; + font-size: 10pt; +} \ No newline at end of file diff --git a/calc/navcalculator.js b/calc/navcalculator.js new file mode 100755 index 0000000..43445ad --- /dev/null +++ b/calc/navcalculator.js @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/calendar.php b/calendar.php new file mode 100755 index 0000000..5b9120d --- /dev/null +++ b/calendar.php @@ -0,0 +1,119 @@ +calendar_file = 'calendar_stripped.js'; + $this->calendar_setup_file = 'calendar-setup_stripped.js'; + } else { + $this->calendar_file = 'calendar.js'; + $this->calendar_setup_file = 'calendar-setup.js'; + } + $this->calendar_lang_file = 'lang/calendar-' . $lang . '.js'; + $this->calendar_theme_file = $theme.'.css'; + $this->calendar_lib_path = preg_replace('/\/+$/', '/', $calendar_lib_path); + $this->calendar_options = array('ifFormat' => '%Y/%m/%d', + 'daFormat' => '%Y/%m/%d'); + } + + function set_option($name, $value) { + $this->calendar_options[$name] = $value; + } + + function load_files() { + echo $this->get_load_files_code(); + } + + function get_load_files_code() { + $code = ( '' . NEWLINE ); + $code .= ( '' . NEWLINE ); + $code .= ( '' . NEWLINE ); + $code .= ( '' ); + return $code; + } + + function _make_calendar($other_options = array()) { + $js_options = $this->_make_js_hash(array_merge($this->calendar_options, $other_options)); + $code = ( '' ); + return $code; + } + + function make_input_field($cal_options = array(), $field_attributes = array()) { + $id = $this->_gen_id(); + $attrstr = $this->_make_html_attr(array_merge($field_attributes, + array('id' => $this->_field_id($id), + 'type' => 'text'))); + echo ''; + echo '' . + ''; + + $options = array_merge($cal_options, + array('inputField' => $this->_field_id($id), + 'button' => $this->_trigger_id($id))); + echo $this->_make_calendar($options); + } + + /// PRIVATE SECTION + + function _field_id($id) { return 'f-calendar-field-' . $id; } + function _trigger_id($id) { return 'f-calendar-trigger-' . $id; } + function _gen_id() { static $id = 0; return ++$id; } + + function _make_js_hash($array) { + $jstr = ''; + reset($array); + while (list($key, $val) = each($array)) { + if (is_bool($val)) + $val = $val ? 'true' : 'false'; + else if (!is_numeric($val)) + $val = '"'.$val.'"'; + if ($jstr) $jstr .= ','; + $jstr .= '"' . $key . '":' . $val; + } + return $jstr; + } + + function _make_html_attr($array) { + $attrstr = ''; + reset($array); + while (list($key, $val) = each($array)) { + $attrstr .= $key . '="' . $val . '" '; + } + return $attrstr; + } +}; + +?> \ No newline at end of file diff --git a/calendar/ChangeLog b/calendar/ChangeLog new file mode 100755 index 0000000..712f773 --- /dev/null +++ b/calendar/ChangeLog @@ -0,0 +1,761 @@ +2005-03-07 Mihai Bazon + + * skins/aqua/theme.css: *** empty log message *** + + * release-notes.html: updated release notes + + * calendar-setup.js: + use a better approach to initialize the calendar--don't call _init twice, + it's the most time consuming function in the calendar. Instead, determine + the date beforehand if possible and pass it to the calendar at constructor. + + * calendar.js: + avoid keyboard operation when 'multiple dates' is set (very buggy for now) + + * calendar.js: + fixed keyboard handling problems: now it works fine when "showsOtherMonths" + is passed; it also seems to be fine with disabled dates (won't normally + allow selection)--however this area is still likely to be buggy, i.e. in a + month that has all the dates disabled. + + * calendar.js: + some trivial performance improvements in the _init function + Added Date.parseDate (old Calendar.prototype.parseDate now calls this one) + +2005-03-05 Mihai Bazon + + * release-notes.html: updated release notes + + * dayinfo.html: *** empty log message *** + + * calendar-setup.js: + bugfix--update an inputField even if flat calendar is selected + + * calendar.js: + fixed bugs in parseDate function (if for some reason the input string is + totally broken, then check numbers for NaN and use values from the current + date instead) + + * make-release.pl: copy the skins subdirectory and all skins + + * index.html: added Aqua skin + + * skins/aqua/active-bg.gif, skins/aqua/dark-bg.gif, skins/aqua/hover-bg.gif, skins/aqua/menuarrow.gif, skins/aqua/normal-bg.gif, skins/aqua/rowhover-bg.gif, skins/aqua/status-bg.gif, skins/aqua/theme.css, skins/aqua/title-bg.gif, skins/aqua/today-bg.gif: + in the future, skins will go to this directory, each in a separate subdir; for now there's only Aqua, an excellent new skin + + * calendar.js: workaround IE bug, needed in the Aqua theme + don't hide select elements unless browser is IE or Opera + + * lang/calendar-bg.js, lang/calendar-big5-utf8.js, lang/calendar-big5.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-cs-utf8.js, lang/calendar-cs-win.js, lang/calendar-da.js, lang/calendar-de.js, lang/calendar-el.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fi.js, lang/calendar-fr.js, lang/calendar-he-utf8.js, lang/calendar-hu.js, lang/calendar-it.js, lang/calendar-ko-utf8.js, lang/calendar-ko.js, lang/calendar-lt-utf8.js, lang/calendar-lt.js, lang/calendar-lv.js, lang/calendar-nl.js, lang/calendar-no.js, lang/calendar-pl-utf8.js, lang/calendar-pl.js, lang/calendar-pt.js, lang/calendar-ro.js, lang/calendar-ru.js, lang/calendar-ru_win_.js, lang/calendar-si.js, lang/calendar-sk.js, lang/calendar-sp.js, lang/calendar-sv.js, lang/calendar-zh.js, lang/cn_utf8.js: + updated urls, copyright notices + + * doc/reference.tex: updated documentation + + * calendar.js, index.html: + renamed the global variable to _dynarch_popupCalendar to avoid name clashes + + * multiple-dates.html: start with an empty array + + * calendar.js: + fixed bugs in the time selector (12:XX pm was wrongfully understood as 12:XX am) + + * calendar.js: + using innerHTML instead of text nodes; works better in Safari and also makes + a smaller, cleaner code + +2005-03-04 Mihai Bazon + + * calendar.js: + fixed a performance regression that occurred after adding support for multiple dates + fixed the time selection bug (now it keeps time correctly) + clicking today will close the calendar if "today" is already selected + + * lang/cn_utf8.js: new translation + +2005-02-17 Mihai Bazon + + * lang/calendar-ar-utf8.zip: Added arabic translation + +2004-10-19 Mihai Bazon + + * lang/calendar-zh.js: updated + +2004-09-20 Mihai Bazon + + * lang/calendar-no.js: updated (Daniel Holmen) + +2004-09-20 Mihai Bazon + + * lang/calendar-no.js: updated (Daniel Holmen) + +2004-08-11 Mihai Bazon + + * lang/calendar-nl.js: updated language file (thanks to Arjen Duursma) + + * lang/calendar-sp.js: updated (thanks to Rafael Velasco) + +2004-07-21 Mihai Bazon + + * lang/calendar-br.js: updated + + * calendar-setup.js: fixed bug (dateText) + +2004-07-21 Mihai Bazon + + * lang/calendar-br.js: updated + + * calendar-setup.js: fixed bug (dateText) + +2004-07-04 Mihai Bazon + + * lang/calendar-lv.js: + added LV translation (thanks to Juris Valdovskis) + +2004-06-25 Mihai Bazon + + * calendar.js: + fixed bug in IE (el.calendar.tooltips is null or not an object) + +2004-06-24 Mihai Bazon + + * doc/reference.tex: fixed latex compilation + + * index.html: linking other sample files + + * calendar-setup.js, calendar.js, dayinfo.html: + ability to display day info (dateText parameter) + sample file + +2004-06-23 Mihai Bazon + + * doc/reference.tex, lang/calendar-bg.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fr.js, lang/calendar-it.js, lang/calendar-ko-utf8.js, lang/calendar-ko.js, lang/calendar-nl.js, lang/calendar-sv.js, README, calendar.js, index.html: + email address changed + +2004-06-14 Mihai Bazon + + * lang/calendar-cs-utf8.js, lang/calendar-cs-win.js: + updated translations + + * calendar-system.css: added z-index to drop downs + + * lang/calendar-en.js: + first day of week can now be part of the language file + + * lang/calendar-es.js: + updated language file (thanks to Servilio Afre Puentes) + + * calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-tas.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar-blue.css: + added z-index property to drop downs (fixes bug) + +2004-06-13 Mihai Bazon + + * calendar-setup.js: fixed bug (apply showOthers to flat calendars too) + +2004-06-06 Mihai Bazon + + * calendar-setup.js: + firstDay defaults to "null", in which case the value in the language file + will be used + + * calendar.js: + firstDayOfWeek can now default to a value specified in the language definition file + + * index.html: first day of week is now numeric + +2004-06-02 Mihai Bazon + + * calendar.js: added date tooltip function + +2004-05-28 Mihai Bazon + + * lang/calendar-br.js: updated (thanks to Marcos Pont) + + * calendar-setup.js: fixed small bug + +2004-05-01 Mihai Bazon + + * calendar-setup.js: returns the calendar object + +2004-04-28 Mihai Bazon + + * calendar-setup.js: + patch to read the date value from the inputField, according to ifFormat (if + both are passed), for flat calendars. (thanks Colin T. Hill) + +2004-04-20 Mihai Bazon + + * calendar-setup.js, calendar.js, multiple-dates.html: + added support for multiple dates selection + + * lang/calendar-nl.js: + updated Dutch translation, thanks to Jeroen Wolsink + + * lang/calendar-big5-utf8.js, lang/calendar-big5.js: + Traditional Chinese language (thanks GaryFu) + +2004-03-26 Mihai Bazon + + * lang/calendar-fr.js, lang/calendar-pt.js: updated + + * lang/calendar-ru_win_.js, lang/calendar-ru.js: + updated, thanks to Sly Golovanov + +2004-03-25 Mihai Bazon + + * lang/calendar-fr.js: updated (thanks to David Duret) + +2004-03-24 Mihai Bazon + + * lang/calendar-da.js: updated (thanks to Michael Thingmand Henriksen) + +2004-03-21 Mihai Bazon + + * lang/calendar-ca.js: updated (thanks to David Valls) + +2004-03-17 Mihai Bazon + + * lang/calendar-de.js: updated to UTF8 (thanks to Jack (tR)) + +2004-03-09 Mihai Bazon + + * lang/calendar-bg.js: Bulgarian translation + +2004-03-08 Mihai Bazon + + * lang/calendar-he-utf8.js: Hebrew translation (thanks to Idan Sofer) + + * lang/calendar-hu.js: updated (thanks to Istvan Karaszi) + +2004-02-27 Mihai Bazon + + * lang/calendar-it.js: updated (thanks to Fabio Di Bernardini) + +2004-02-25 Mihai Bazon + + * calendar.js: fix for Safari (thanks to Olivier Chirouze / XPWeb) + +2004-02-22 Mihai Bazon + + * lang/calendar-al.js: Albanian language file + +2004-02-17 Mihai Bazon + + * lang/calendar-fr.js: fixed + + * lang/calendar-fr.js: + FR translation updated (thanks to SIMON Alexandre) + + * lang/calendar-es.js: ES translation updated, thanks to David Gonzales + +2004-02-10 Mihai Bazon + + * lang/calendar-pt.js: + updated Portugese translation, thanks to Elcio Ferreira + +2004-02-09 Mihai Bazon + + * TODO: updated + +2004-02-06 Mihai Bazon + + * README: describe the PHP files + + * make-release.pl: includes php files + + * make-release.pl: ChangeLog included in the distribution (if found) + + * calendar.js, doc/reference.tex, index.html: switched to version 0.9.6 + + * doc/Calendar.setup.tex, doc/reference.tex: updated documentation + + * release-notes.html: updated release notes + + * calendar.js: Fixed bug: Feb/29 and year change now keeps Feb in view + + * calendar.js: fixed the "ESC" problem (call the close handler) + + * calendar.js: fixed day of year range (1 to 366 instead of 0 to 365) + + * calendar.js: fixed week number calculations + + * doc/reference.tex: fixed (date input format) + + * calendar.php: removed comment + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-tas.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar.js: + workaround for IE bug (you can't normally specify through CSS the style for + an element having two classes or more; we had to change a classname) + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-tas.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + smaller fonts on days that are in neighbor months + +2004-02-04 Mihai Bazon + + * index.html: first demo shows the "showOtherMonths" capability + + * calendar-setup.js: support new parameters in the calendar. + added: firstDay, showOthers, cache. + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar.js, lang/calendar-en.js, lang/calendar-ro.js: + new parameters: firstDayOfWeek, showsOtherMonths; removed mondayFirst. + This adds support for setting any day to be the first day of week (by just + clicking the day name in the display); also, if showsOtherMonths is enabled + then dates belonging to adjacent months that are in the current view will be + displayed and the calendar will have a fixed height. + + all themes updated. + + * test.php: test for calendar.php + + * calendar.php: fixed bug (pass numeric values as numbers) + +2004-02-01 Mihai Bazon + + * calendar.php: added PHP wrapper + + * img.gif: icon updated + + * TODO: updated TODO list + +2004-01-27 Mihai Bazon + + * calendar.js: + Janusz Piwowarski sent over a patch for IE5 compatibility which is much more + elegant than the atrocities that I had wrote :-D I'm gettin' old.. Thanks Janusz! + + * lang/calendar-fi.js: updated + +2004-01-15 Mihai Bazon + + * TODO: updated TODO list + + * calendar-setup.js: default align changed to "Br" + + * doc/reference.tex: changed default value for "align" + + * calendar-setup.js: calling onchange event handler, if available + + * calendar-setup.js: added "position" option + + * simple-1.html: demonstrates "step" option + + * calendar-setup.js: added "step" option + + * calendar.js: added yearStep config parameter + + * calendar.js: + fixed parseDate routine (the NaN bug which occurred when there was a space + after the date and no time) + +2004-01-14 Mihai Bazon + + * lang/calendar-en.js: added "Time:" + + * test-position.html: test for the new position algorithm + + * index.html: do not destroy() the calendar + avoid bug in parseDate (%p must be separated by non-word characters) + + * menuarrow2.gif: for calendar-blue2.css + + * calendar-setup.js: honor "date" parameter if passed + + * calendar.js: IE5 support is back + performance improvements in IE6 (mouseover combo boxes) + display "Time:" beside the clock area, if defined in the language file + new positioning algorithm (try to keep the calendar in page) + rewrote parseDate a little cleaner + + * lang/calendar-el.js: + updated Greek translation (thanks Alexandros Pappas) + +2004-01-13 Mihai Bazon + + * index.html: added style blue2, using utf-8 instead of iso-8859-2 + + * calendar.js: performance under IE (which sucks, by the way) + + * doc/reference.tex: Sunny added to sponsor list + + * doc/Calendar.setup.tex: documenting parameter 'electric' + + * calendar-blue.css, calendar-blue2.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + fixed IE text size problems + +2004-01-08 Mihai Bazon + + * lang/calendar-pl.js: + Polish translation updated to UTF-8 (thanks to Artur Filipiak) + +2004-01-07 Mihai Bazon + + * lang/calendar-si.js: updated (David Milost) + + * lang/calendar-si.js: Slovenian translation (thanks to David Milost) + +2003-12-21 Mihai Bazon + + * TODO: updated TODO list + + * lang/calendar-de.js: German translation (thanks to Peter Strotmann) + +2003-12-19 Mihai Bazon + + * doc/reference.tex: Thank you, Ian Barrak + +2003-12-18 Mihai Bazon + + * doc/reference.tex: fixed documentation bug (thanks Mike) + +2003-12-05 Mihai Bazon + + * lang/calendar-ko-utf8.js: + UTF8 version of the Korean language (hopefully correct) + + * lang/calendar-pl-utf8.js, lang/calendar-pl.js: + updated Polish translation (thanks to Janusz Piwowarski) + +2003-12-04 Mihai Bazon + + * lang/calendar-fr.js: + French translation updated (thanks to Angiras Rama) + +2003-11-22 Mihai Bazon + + * lang/calendar-da.js: updated (thanks to Jesper M. Christensen) + +2003-11-20 Mihai Bazon + + * calendar-blue2.css, calendar-tas.css: + new styles (thanks to Wendall Mosemann for blue2, Mark Lynch for tas) + + * lang/calendar-lt-utf8.js, lang/calendar-lt.js: + Lithuanian translation (thanks to Martynas Majeris) + + * lang/calendar-sp.js: updated + +2003-11-17 Mihai Bazon + + * TODO: added TODO list + +2003-11-14 Mihai Bazon + + * lang/calendar-ko.js: Korean translation (thanks to Yourim Yi) + +2003-11-12 Mihai Bazon + + * lang/calendar-jp.js: small bug fixed (thanks to TAHARA Yusei) + +2003-11-10 Mihai Bazon + + * lang/calendar-fr.js: translation updated, thanks to Florent Ramiere + + * calendar-setup.js: + added new parameter: electric (if false then the field will not get updated on each move) + + * index.html: fixed DOCTYPE + +2003-11-07 Mihai Bazon + + * calendar-setup.js: + fixed minor problem (maybe we're passing object reference instead of ID for + the flat calendar parent) + +2003-11-06 Mihai Bazon + + * lang/calendar-fi.js: + added Finnish translation (thanks to Antti Tuppurainen) + +2003-11-05 Mihai Bazon + + * release-notes.html: fixed typo + + * doc/reference.tex, index.html, calendar.js: 0.9.5 + + * README: fixed license statement + + * release-notes.html: updated release notes (0.9.5) + +2003-11-03 Mihai Bazon + + * lang/calendar-de.js: + updated German translation (thanks to Gerhard Neiner) + + * calendar-setup.js: fixed license statement + + * calendar.js: whitespace + + * calendar.js: fixed license statement + + * calendar.js: + fixed positioning problem when input field is inside scrolled divs + +2003-11-01 Mihai Bazon + + * lang/calendar-af.js: Afrikaan language (thanks to Derick Olivier) + +2003-10-31 Mihai Bazon + + * lang/calendar-it.js: + updated IT translation (thanks to Christian Blaser) + + * lang/calendar-es.js: updated ES translation, thanks to Raul + +2003-10-30 Mihai Bazon + + * lang/calendar-hu.js: updated thanks to Istvan Karaszi + + * index.html, simple-1.html, simple-2.html, simple-3.html: + switched to utf-8 all encodings + + * lang/calendar-sk.js: + added Slovak translation (thanks to Peter Valach) + + * lang/calendar-ro.js: switched to utf-8 + +2003-10-29 Mihai Bazon + + * lang/calendar-es.js: + updated translation, thanks to Jose Ma. Martinez Miralles + + * doc/reference.tex: + fixed the footnote problem (thanks Dominique de Waleffe for the tip) + + * lang/calendar-ro.js: fixed typo + + * lang/calendar-sv.js: oops, license should be LGPL + + * lang/calendar-sw.js: new swedish translation is calendar-sv.js + + * menuarrow.gif, menuarrow.png: + oops, forgot little drop-down menu arrows + + * lang/calendar-sv.js: swedish translation thanks to Leonard Norrgard + + * index.html: oops, some other minor changes + + * index.html, release-notes.html: + latest changes in release-notes and index page for 0.9.4 + + * doc/reference.tex, calendar.js: + added %s date format (# of seconds since Epoch) + + * calendar.js: + A click on TODAY will not close the calendar, even in single-click mode + +2003-10-28 Mihai Bazon + + * index.html: previous cal.html + + * cal.html: moved to index.html + + * README, cal.html, doc/reference.tex, lang/calendar-de.js, lang/calendar-en.js, lang/calendar-ro.js, release-notes.html: + LGPL license, forever. + + * doc/Calendar.setup.tex, simple-1.html: + doc updated for the onUpdate parameter to Calendar.setup + +2003-10-26 Mihai Bazon + + * calendar.js: fixed bug (correct display of the dropdown menus) + + * doc/Calendar.setup.tex, doc/reference.tex, lang/calendar-de.js, lang/calendar-en.js, lang/calendar-ro.js, README, cal.html, calendar-blue.css, calendar-brown.css, calendar-green.css, calendar-setup.js, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css, calendar.js, release-notes.html, simple-1.html, simple-3.html: + lots of changes for the 0.9.4 release (see the release-notes.html) + +2003-10-15 Mihai Bazon + + * doc/reference.tex: + documentation updated for 0.9.4 (not yet finished though) + +2003-10-07 Mihai Bazon + + * calendar.js, doc/reference.tex, release-notes.html, README, cal.html, calendar-setup.js: + modified project website + +2003-10-06 Mihai Bazon + + * calendar-setup.js: + added some properties (onSelect, onClose, date) (thanks altblue) + +2003-09-24 Mihai Bazon + + * simple-3.html: dateIsSpecial does not need the "date" argument ;-) + +2003-09-24 fsoft + + * calendar.js, simple-3.html: + added year, month, day to getDateStatus() function + +2003-09-24 Mihai Bazon + + * simple-3.html: example on how to use special dates + + * calendar-setup.js, calendar.js, simple-1.html: + support for special dates (thanks fabio) + +2003-09-17 Mihai Bazon + + * doc/reference.tex: fixed error in section 3. + +2003-08-01 Mihai Bazon + + * lang/calendar-jp.js: added Japanese translation + +2003-07-16 Mihai Bazon + + * simple-1.html: fixed problem with first example [IE,Opera] + +2003-07-09 Mihai Bazon + + * doc/Calendar.setup.tex: fixed typo (closing parenthesis) + + * lang/calendar-de.js: + added German translation, thanks to Hartwig Weinkauf + +2003-07-08 Mihai Bazon + + * cal.html: added link to release-notes + + * release-notes.html: 0.9.3 release notes + + * make-release.pl: + Script to create distribution archive. It needs some additional packages: + + - LaTeX + - tex2page + - jscrunch (JS compressor) + + * doc/html/makedoc.sh, doc/html/reference.css, doc/reference.tex, doc/makedoc.sh: + documentation updates... + + * calendar.js: added semicolon to make the code "compressible" + +2003-07-06 Mihai Bazon + + * doc/reference.tex: spell checked + + * doc/reference.tex: [minor] changed credits order + + * doc/reference.tex: various improvements and additions + + * doc/html/reference.css: minor eye-candy tweaks + +2003-07-05 Mihai Bazon + + * doc/html/Calendar.setup.html.tex, doc/html/makedoc.sh, doc/html/reference.css, doc/html/reference.t2p, doc/hyperref.cfg, doc/makedoc.sh, doc/reference.tex, doc/Calendar.setup.tex, doc/Calendar.setup.pdf.tex: + full documentation in LaTeX, for PDF and HTML formats + + * simple-2.html: + added demonstration of flat calendar with Calendar.setup + + * simple-1.html: + modified some links, added link to documentation, added demonstration of + disableFunc property + + * calendar-setup.js: added the ability to create flat calendar too + + * cal.html: added links to documentation and simple-[12].html pages + + * README: up-to-date... + + * calendar-setup.html: removed: the documentation is unified + +2003-07-03 Mihai Bazon + + * cal.html: some links to newly added files + + * calendar-setup.html, calendar-setup.js, img.gif, simple-1.html: + added some files to simplify calendar creation for non-(JS)-programmers + + * lang/calendar-zh.js: added simplified chinese (thanks ATang) + +2003-07-02 Mihai Bazon + + * calendar.js: * "yy"-related... [small fix] + + * calendar.js: + * #721833 fixed (yy format will understand years prior to 29 as 20xx) + + * calendar.js: * added refresh() function + + * calendar.js: * fixed bug when in single click mode + * added alignment options to "showAtElement" member function + +2003-06-25 Mihai Bazon + + * lang/calendar-pt.js: + added portugese translation (thanks Nuno Barreto) + +2003-06-24 Mihai Bazon + + * calendar.js: + call user handler when the date was changed using the keyboard + + * bugtest-hidden-selects.html: + file to test bug with hidden select-s (thanks Ying Zhang for reporting and for this test file) + + * lang/calendar-hr-utf8.js: + added croatian translation in utf8 (thanks Krunoslav Zubrinic) + +2003-06-23 Mihai Bazon + + * lang/calendar-hu.js: added hungarian translation + + * lang/calendar-hr.js: + added croatian translation (thanks to Krunoslav Zubrinic) + +2003-06-22 Mihai Bazon + + * calendar.js: + * #723335 fixed (clicking TODAY will not select the today date if the + disabledHandler rejects it) + + * cal.html: * new code for to work with fix for bug #703238 + * switch to new version + + * calendar.js: + * some patches to make code compatible with Opera 7 (well, almost compatible) + * bug #703238 fixed (fix breaks compatibility with older code that uses + calendar in single-click mode) + * bug #703814 fixed + +2003-04-09 Mihai Bazon + + * lang/calendar-tr.js: added turkish lang file + +2003-03-19 Mihai Bazon + + * lang/calendar-ru.js: russian translation added + + * lang/calendar-no.js: norwegian translation added + +2003-03-15 Mihai Bazon + + * lang/calendar-no.js: norwegian translation + +2003-03-12 Mihai Bazon + + * lang/calendar-pl.js: added polish translation + +2003-03-11 Mihai Bazon + + * calendar.js: + bugfix in parseDate (added base to parseInt, thanks Alan!) + +2003-03-05 Mihai Bazon + + * calendar.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-cs-win.js, lang/calendar-da.js, lang/calendar-du.js, lang/calendar-el.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fr.js, lang/calendar-it.js, lang/calendar-nl.js, lang/calendar-ro.js, lang/calendar-sp.js, lang/calendar-sw.js: + New file. + + * calendar.js, lang/calendar-br.js, lang/calendar-ca.js, lang/calendar-cs-win.js, lang/calendar-da.js, lang/calendar-du.js, lang/calendar-el.js, lang/calendar-en.js, lang/calendar-es.js, lang/calendar-fr.js, lang/calendar-it.js, lang/calendar-nl.js, lang/calendar-ro.js, lang/calendar-sp.js, lang/calendar-sw.js: + moved to CVS at sourceforge.net + release: 0.9.2 + new language packs + + + * README, cal.html, calendar-blue.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + New file. + + * README, cal.html, calendar-blue.css, calendar-brown.css, calendar-green.css, calendar-system.css, calendar-win2k-1.css, calendar-win2k-2.css, calendar-win2k-cold-1.css, calendar-win2k-cold-2.css: + moved to CVS at sourceforge.net + release: 0.9.2 + new language packs + + diff --git a/calendar/README b/calendar/README new file mode 100755 index 0000000..455ab3d --- /dev/null +++ b/calendar/README @@ -0,0 +1,33 @@ +The DHTML Calendar +------------------- + + Author: Mihai Bazon, + http://dynarch.com/mishoo/ + + This program is free software published under the + terms of the GNU Lesser General Public License. + + For the entire license text please refer to + http://www.gnu.org/licenses/lgpl.html + +Contents +--------- + + calendar.js -- the main program file + lang/*.js -- internalization files + *.css -- color themes + cal.html -- example usage file + doc/ -- documentation, in PDF and HTML + simple-1.html -- quick setup examples [popup calendars] + simple-2.html -- quick setup example for flat calendar + calendar.php -- PHP wrapper + test.php -- test file for the PHP wrapper + +Homepage +--------- + + For details and latest versions please refer to calendar + homepage, located on my website: + + http://dynarch.com/mishoo/calendar.epl + diff --git a/calendar/Thumbs.db b/calendar/Thumbs.db new file mode 100755 index 0000000..9efc287 Binary files /dev/null and b/calendar/Thumbs.db differ diff --git a/calendar/bugtest-hidden-selects.html b/calendar/bugtest-hidden-selects.html new file mode 100755 index 0000000..ca4d016 --- /dev/null +++ b/calendar/bugtest-hidden-selects.html @@ -0,0 +1,108 @@ + + + +Bug + + + + + + + + + + + + + +
+Date: +
+ + +

+
+
Visible <select>, hides and unhides as expected +
+ + +

+
Hidden <select>, it should stay hidden (but doesn't) +
+ + +

+
Hidden textbox below, it stays hidden as expected +
+ +

+ diff --git a/calendar/calendar-blue.css b/calendar/calendar-blue.css new file mode 100755 index 0000000..ca33cde --- /dev/null +++ b/calendar/calendar-blue.css @@ -0,0 +1,232 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #556; + font-size: 11px; + color: #000; + cursor: default; + background: #eef; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ +} + +.calendar .nav { + background: #778 url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + background: #fff; + color: #000; + padding: 2px; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ + background: #778; + color: #fff; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #bdf; +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #556; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #a66; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #aaf; + color: #000; + border: 1px solid #04f; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #77c; + padding: 2px 0px 0px 2px; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + color: #456; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #bbb; +} +.calendar tbody .day.othermonth.oweekend { + color: #fbb; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #bdf; +} + +.calendar tbody .rowhilite td { + background: #def; +} + +.calendar tbody .rowhilite td.wn { + background: #eef; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #def; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #cde; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { /* Cell showing today date */ + font-weight: bold; + border: 1px solid #000; + padding: 1px 3px 1px 1px; + background: #fff; + color: #000; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #a66; +} + +.calendar tbody td.today { /* Cell showing selected date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #556; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #fff; + color: #445; + border-top: 1px solid #556; + padding: 1px; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #aaf; + border: 1px solid #04f; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #77c; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #655; + background: #def; + color: #000; + font-size: 90%; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: #acf; +} + +.calendar .combo .active { + border-top: 1px solid #46a; + border-bottom: 1px solid #46a; + background: #eef; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #f4f0e8; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #667; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/calendar/calendar-blue2.css b/calendar/calendar-blue2.css new file mode 100755 index 0000000..47128ec --- /dev/null +++ b/calendar/calendar-blue2.css @@ -0,0 +1,236 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #206A9B; + font-size: 11px; + color: #000; + cursor: default; + background: #F1F8FC; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ +} + +.calendar .nav { + background: #007ED1 url(menuarrow2.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + background: #000; + color: #fff; + padding: 2px; +} + +.calendar thead tr { /* Row containing navigation buttons */ + background: #007ED1; + color: #fff; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #C7E1F3; +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #206A9B; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #a66; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #34ABFA; + color: #000; + border: 1px solid #016DC5; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #006AA9; + border: 1px solid #008AFF; + padding: 2px 0px 0px 2px; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + color: #456; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #bbb; +} +.calendar tbody .day.othermonth.oweekend { + color: #fbb; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #C7E1F3; +} + +.calendar tbody .rowhilite td { + background: #def; +} + +.calendar tbody .rowhilite td.wn { + background: #F1F8FC; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #def; + padding: 1px 3px 1px 1px; + border: 1px solid #8FC4E8; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #cde; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { /* Cell showing today date */ + font-weight: bold; + border: 1px solid #000; + padding: 1px 3px 1px 1px; + background: #fff; + color: #000; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #a66; +} + +.calendar tbody td.today { /* Cell showing selected date */ + font-weight: bold; + color: #D50000; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #206A9B; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #000; + color: #fff; + border-top: 1px solid #206A9B; + padding: 1px; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #B8DAF0; + border: 1px solid #178AEB; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #006AA9; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #655; + background: #def; + color: #000; + font-size: 90%; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: #34ABFA; + border-top: 1px solid #46a; + border-bottom: 1px solid #46a; + font-weight: bold; +} + +.calendar .combo .active { + border-top: 1px solid #46a; + border-bottom: 1px solid #46a; + background: #F1F8FC; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #E3F0F9; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #F1F8FC; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #267DB7; + color: #fff; +} + +.calendar td.time span.active { + border-color: red; + background-color: #000; + color: #A5FF00; +} diff --git a/calendar/calendar-brown.css b/calendar/calendar-brown.css new file mode 100755 index 0000000..c42da5e --- /dev/null +++ b/calendar/calendar-brown.css @@ -0,0 +1,225 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #655; + font-size: 11px; + color: #000; + cursor: default; + background: #ffd; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ +} + +.calendar .nav { + background: #edc url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + background: #654; + color: #fed; + padding: 2px; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ + background: #edc; + color: #000; +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #655; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #faa; + color: #000; + border: 1px solid #f40; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #c77; + padding: 2px 0px 0px 2px; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #fed; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #bbb; +} +.calendar tbody .day.othermonth.oweekend { + color: #fbb; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #fed; +} + +.calendar tbody .rowhilite td { + background: #ddf; +} + +.calendar tbody .rowhilite td.wn { + background: #efe; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #ffe; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #ddc; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { /* Cell showing today date */ + font-weight: bold; + border: 1px solid #000; + padding: 1px 3px 1px 1px; + background: #fea; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { font-weight: bold; } + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #988; + color: #000; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + border-top: 1px solid #655; + background: #dcb; + color: #840; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #faa; + border: 1px solid #f40; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #c77; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #655; + background: #ffe; + color: #000; + font-size: 90%; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: #fc8; +} + +.calendar .combo .active { + border-top: 1px solid #a64; + border-bottom: 1px solid #a64; + background: #fee; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #a88; + padding: 1px 0px; + text-align: center; + background-color: #fed; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #988; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #866; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/calendar/calendar-green.css b/calendar/calendar-green.css new file mode 100755 index 0000000..2e1867a --- /dev/null +++ b/calendar/calendar-green.css @@ -0,0 +1,229 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #565; + font-size: 11px; + color: #000; + cursor: default; + background: #efe; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ + background: #676; + color: #fff; + font-size: 90%; +} + +.calendar .nav { + background: #676 url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + padding: 2px; + background: #250; + color: #efa; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #565; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #a66; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #afa; + color: #000; + border: 1px solid #084; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #7c7; + padding: 2px 0px 0px 2px; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #dfb; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + color: #564; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #bbb; +} +.calendar tbody .day.othermonth.oweekend { + color: #fbb; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #8a8; + background: #dfb; +} + +.calendar tbody .rowhilite td { + background: #dfd; +} + +.calendar tbody .rowhilite td.wn { + background: #efe; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #efd; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #dec; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { /* Cell showing today date */ + font-weight: bold; + border: 1px solid #000; + padding: 1px 3px 1px 1px; + background: #f8fff8; + color: #000; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #a66; +} + +.calendar tbody td.today { font-weight: bold; color: #0a0; } + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #565; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + padding: 2px; + background: #250; + color: #efa; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #afa; + border: 1px solid #084; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #7c7; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #565; + background: #efd; + color: #000; + font-size: 90%; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: #af8; +} + +.calendar .combo .active { + border-top: 1px solid #6a4; + border-bottom: 1px solid #6a4; + background: #efe; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #8a8; + padding: 1px 0px; + text-align: center; + background-color: #dfb; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #898; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #686; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/calendar/calendar-setup.js b/calendar/calendar-setup.js new file mode 100755 index 0000000..f2b4854 --- /dev/null +++ b/calendar/calendar-setup.js @@ -0,0 +1,200 @@ +/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ + * --------------------------------------------------------------------------- + * + * The DHTML Calendar + * + * Details and latest version at: + * http://dynarch.com/mishoo/calendar.epl + * + * This script is distributed under the GNU Lesser General Public License. + * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html + * + * This file defines helper functions for setting up the calendar. They are + * intended to help non-programmers get a working calendar on their site + * quickly. This script should not be seen as part of the calendar. It just + * shows you what one can do with the calendar, while in the same time + * providing a quick and simple method for setting it up. If you need + * exhaustive customization of the calendar creation process feel free to + * modify this code to suit your needs (this is recommended and much better + * than modifying calendar.js itself). + */ + +// $Id: calendar-setup.js,v 1.25 2005/03/07 09:51:33 mishoo Exp $ + +/** + * This function "patches" an input field (or other element) to use a calendar + * widget for date selection. + * + * The "params" is a single object that can have the following properties: + * + * prop. name | description + * ------------------------------------------------------------------------------------------------- + * inputField | the ID of an input field to store the date + * displayArea | the ID of a DIV or other element to show the date + * button | ID of a button or other element that will trigger the calendar + * eventName | event that will trigger the calendar, without the "on" prefix (default: "click") + * ifFormat | date format that will be stored in the input field + * daFormat | the date format that will be used to display the date in displayArea + * singleClick | (true/false) wether the calendar is in single click mode or not (default: true) + * firstDay | numeric: 0 to 6. "0" means display Sunday first, "1" means display Monday first, etc. + * align | alignment (default: "Br"); if you don't know what's this see the calendar documentation + * range | array with 2 elements. Default: [1900, 2999] -- the range of years available + * weekNumbers | (true/false) if it's true (default) the calendar will display week numbers + * flat | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID + * flatCallback | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar) + * disableFunc | function that receives a JS Date object and should return true if that date has to be disabled in the calendar + * onSelect | function that gets called when a date is selected. You don't _have_ to supply this (the default is generally okay) + * onClose | function that gets called when the calendar is closed. [default] + * onUpdate | function that gets called after the date is updated in the input field. Receives a reference to the calendar. + * date | the date that the calendar will be initially displayed to + * showsTime | default: false; if true the calendar will include a time selector + * timeFormat | the time format; can be "12" or "24", default is "12" + * electric | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close + * step | configures the step of the years in drop-down boxes; default: 2 + * position | configures the calendar absolute position; default: null + * cache | if "true" (but default: "false") it will reuse the same calendar object, where possible + * showOthers | if "true" (but default: "false") it will show days from other months too + * + * None of them is required, they all have default values. However, if you + * pass none of "inputField", "displayArea" or "button" you'll get a warning + * saying "nothing to setup". + */ +Calendar.setup = function (params) { + function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } }; + + param_default("inputField", null); + param_default("displayArea", null); + param_default("button", null); + param_default("eventName", "click"); + param_default("ifFormat", "%Y/%m/%d"); + param_default("daFormat", "%Y/%m/%d"); + param_default("singleClick", true); + param_default("disableFunc", null); + param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined + param_default("dateText", null); + param_default("firstDay", null); + param_default("align", "Br"); + param_default("range", [1900, 2999]); + param_default("weekNumbers", true); + param_default("flat", null); + param_default("flatCallback", null); + param_default("onSelect", null); + param_default("onClose", null); + param_default("onUpdate", null); + param_default("date", null); + param_default("showsTime", false); + param_default("timeFormat", "24"); + param_default("electric", true); + param_default("step", 2); + param_default("position", null); + param_default("cache", false); + param_default("showOthers", false); + param_default("multiple", null); + + var tmp = ["inputField", "displayArea", "button"]; + for (var i in tmp) { + if (typeof params[tmp[i]] == "string") { + params[tmp[i]] = document.getElementById(params[tmp[i]]); + } + } + if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) { + alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code"); + return false; + } + + function onSelect(cal) { + var p = cal.params; + var update = (cal.dateClicked || p.electric); + if (update && p.inputField) { + p.inputField.value = cal.date.print(p.ifFormat); + if (typeof p.inputField.onchange == "function") + p.inputField.onchange(); + } + if (update && p.displayArea) + p.displayArea.innerHTML = cal.date.print(p.daFormat); + if (update && typeof p.onUpdate == "function") + p.onUpdate(cal); + if (update && p.flat) { + if (typeof p.flatCallback == "function") + p.flatCallback(cal); + } + if (update && p.singleClick && cal.dateClicked) + cal.callCloseHandler(); + }; + + if (params.flat != null) { + if (typeof params.flat == "string") + params.flat = document.getElementById(params.flat); + if (!params.flat) { + alert("Calendar.setup:\n Flat specified but can't find parent."); + return false; + } + var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect); + cal.showsOtherMonths = params.showOthers; + cal.showsTime = params.showsTime; + cal.time24 = (params.timeFormat == "24"); + cal.params = params; + cal.weekNumbers = params.weekNumbers; + cal.setRange(params.range[0], params.range[1]); + cal.setDateStatusHandler(params.dateStatusFunc); + cal.getDateText = params.dateText; + if (params.ifFormat) { + cal.setDateFormat(params.ifFormat); + } + if (params.inputField && typeof params.inputField.value == "string") { + cal.parseDate(params.inputField.value); + } + cal.create(params.flat); + cal.show(); + return false; + } + + var triggerEl = params.button || params.displayArea || params.inputField; + triggerEl["on" + params.eventName] = function() { + var dateEl = params.inputField || params.displayArea; + var dateFmt = params.inputField ? params.ifFormat : params.daFormat; + var mustCreate = false; + var cal = window.calendar; + if (dateEl) + params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt); + if (!(cal && params.cache)) { + window.calendar = cal = new Calendar(params.firstDay, + params.date, + params.onSelect || onSelect, + params.onClose || function(cal) { cal.hide(); }); + cal.showsTime = params.showsTime; + cal.time24 = (params.timeFormat == "24"); + cal.weekNumbers = params.weekNumbers; + mustCreate = true; + } else { + if (params.date) + cal.setDate(params.date); + cal.hide(); + } + if (params.multiple) { + cal.multiple = {}; + for (var i = params.multiple.length; --i >= 0;) { + var d = params.multiple[i]; + var ds = d.print("%Y%m%d"); + cal.multiple[ds] = d; + } + } + cal.showsOtherMonths = params.showOthers; + cal.yearStep = params.step; + cal.setRange(params.range[0], params.range[1]); + cal.params = params; + cal.setDateStatusHandler(params.dateStatusFunc); + cal.getDateText = params.dateText; + cal.setDateFormat(dateFmt); + if (mustCreate) + cal.create(); + cal.refresh(); + if (!params.position) + cal.showAtElement(params.button || params.displayArea || params.inputField, params.align); + else + cal.showAt(params.position[0], params.position[1]); + return false; + }; + + return cal; +}; diff --git a/calendar/calendar-setup_stripped.js b/calendar/calendar-setup_stripped.js new file mode 100755 index 0000000..91c927f --- /dev/null +++ b/calendar/calendar-setup_stripped.js @@ -0,0 +1,21 @@ +/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ + * --------------------------------------------------------------------------- + * + * The DHTML Calendar + * + * Details and latest version at: + * http://dynarch.com/mishoo/calendar.epl + * + * This script is distributed under the GNU Lesser General Public License. + * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html + * + * This file defines helper functions for setting up the calendar. They are + * intended to help non-programmers get a working calendar on their site + * quickly. This script should not be seen as part of the calendar. It just + * shows you what one can do with the calendar, while in the same time + * providing a quick and simple method for setting it up. If you need + * exhaustive customization of the calendar creation process feel free to + * modify this code to suit your needs (this is recommended and much better + * than modifying calendar.js itself). + */ + Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&¶ms.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;}; \ No newline at end of file diff --git a/calendar/calendar-system.css b/calendar/calendar-system.css new file mode 100755 index 0000000..b224885 --- /dev/null +++ b/calendar/calendar-system.css @@ -0,0 +1,251 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border: 1px solid; + border-color: #fff #000 #000 #fff; + font-size: 11px; + cursor: default; + background: Window; + color: WindowText; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border: 1px solid; + border-color: #fff #000 #000 #fff; + font-size: 11px; + cursor: default; + background: Window; + color: WindowText; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border: 1px solid; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; + background: ButtonFace; +} + +.calendar .nav { + background: ButtonFace url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: ActiveCaption; + color: CaptionText; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid ButtonShadow; + padding: 2px; + text-align: center; + background: ButtonFace; + color: ButtonText; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border: 2px solid; + padding: 0px; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + border-width: 1px; + padding: 2px 0px 0px 2px; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid ButtonShadow; + background: ButtonFace; + color: ButtonText; +} + +.calendar tbody .rowhilite td { + background: Highlight; + color: HighlightText; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; + padding: 2px 2px 0px 2px; + background: ButtonFace; + color: ButtonText; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody td.disabled { color: GrayText; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: ButtonFace; + padding: 1px; + border: 1px solid; + border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow; + color: ButtonText; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #e4e0d8; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border: 1px solid; + border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight; + background: Menu; + color: MenuText; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + padding: 0px; + border: 1px solid #000; +} + +.calendar .combo .hilite { + background: Highlight; + color: HighlightText; +} + +.calendar td.time { + border-top: 1px solid ButtonShadow; + padding: 1px 0px; + text-align: center; + background-color: ButtonFace; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: Menu; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: Highlight; + color: HighlightText; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/calendar/calendar-tas.css b/calendar/calendar-tas.css new file mode 100755 index 0000000..c2f8721 --- /dev/null +++ b/calendar/calendar-tas.css @@ -0,0 +1,239 @@ +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #655; + font-size: 11px; + color: #000; + cursor: default; + background: #ffd; + font-family: tahoma,verdana,sans-serif; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC,EndColorStr=#FFFFFF); +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ + color:#363636; +} + +.calendar .nav { + background: #edc url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + background: #654; + color: #363636; + padding: 2px; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#dddccc); +} + +.calendar thead .headrow { /* Row containing navigation buttons */ + /*background: #3B86A0;*/ + color: #363636; + font-weight: bold; +filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#3b86a0); +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #655; + padding: 2px; + text-align: center; + color: #363636; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#DDDCCC,EndColorStr=#FFFFFF); +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background-color: #ffcc86; + color: #000; + border: 1px solid #b59345; + padding: 1px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background-color: #c77; + padding: 2px 0px 0px 2px; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: #fed; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #fed; +} + +.calendar tbody .rowhilite td { + background: #ddf; + +} + +.calendar tbody .rowhilite td.wn { + background: #efe; +} + +.calendar tbody td.hilite { /* Hovered cells */ + background: #ffe; + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + background: #ddc; + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.selected { /* Cell showing today date */ + font-weight: bold; + border: 1px solid #000; + padding: 1px 3px 1px 1px; + background: #fea; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { font-weight: bold; } + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #988; + color: #000; + +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + border-top: 1px solid #655; + background: #dcb; + color: #363636; + font-weight: bold; + filter: +progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#FFFFFF,EndColorStr=#DDDCCC); +} +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #faa; + border: 1px solid #f40; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #c77; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border: 1px solid #655; + background: #ffe; + color: #000; + font-size: smaller; + z-index: 100; +} + +.combo .label, +.combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.combo .label-IEfix { + width: 4em; +} + +.combo .hilite { + background: #fc8; +} + +.combo .active { + border-top: 1px solid #a64; + border-bottom: 1px solid #a64; + background: #fee; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #a88; + padding: 1px 0px; + text-align: center; + background-color: #fed; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #988; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #866; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/calendar/calendar-win2k-1.css b/calendar/calendar-win2k-1.css new file mode 100755 index 0000000..8c5d026 --- /dev/null +++ b/calendar/calendar-win2k-1.css @@ -0,0 +1,271 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #d4d0c8; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #d4d0c8; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #848078; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #f4f0e8; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #e4e0d8; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #c4c0b8; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #f4f0e8; +} + +.calendar tbody .rowhilite td { + background: #e4e0d8; +} + +.calendar tbody .rowhilite td.wn { + background: #d4d0c8; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + padding: 2px 2px 0px 2px; + background: #e4e0d8; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #f4f0e8; + padding: 1px; + border: 1px solid #000; + background: #848078; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #e4e0d8; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #e4e0d8; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #c4c0b8; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #048; + color: #fea; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #f4f0e8; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #766; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/calendar/calendar-win2k-2.css b/calendar/calendar-win2k-2.css new file mode 100755 index 0000000..6f37b7d --- /dev/null +++ b/calendar/calendar-win2k-2.css @@ -0,0 +1,271 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #d4c8d0; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #d4c8d0; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #847880; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #f4e8f0; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #e4d8e0; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #c4b8c0; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #f4e8f0; +} + +.calendar tbody .rowhilite td { + background: #e4d8e0; +} + +.calendar tbody .rowhilite td.wn { + background: #d4c8d0; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + padding: 2px 2px 0px 2px; + background: #e4d8e0; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #f4e8f0; + padding: 1px; + border: 1px solid #000; + background: #847880; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #e4d8e0; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #e4d8e0; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #d4c8d0; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #408; + color: #fea; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #f4f0e8; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #766; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/calendar/calendar-win2k-cold-1.css b/calendar/calendar-win2k-cold-1.css new file mode 100755 index 0000000..fa5c093 --- /dev/null +++ b/calendar/calendar-win2k-cold-1.css @@ -0,0 +1,265 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d0d4; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d0d4; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #788084; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #e8f0f4; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #d8e0e4; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #b8c0c4; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #e8f4f0; +} + +.calendar tbody .rowhilite td { + background: #d8e4e0; +} + +.calendar tbody .rowhilite td.wn { + background: #c8d4d0; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border: 1px solid; + border-color: #fff #000 #000 #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border: 1px solid; + border-color: #000 #fff #fff #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + padding: 2px 2px 0px 2px; + border: 1px solid; + border-color: #000 #fff #fff #000; + background: #d8e0e4; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #e8f0f4; + padding: 1px; + border: 1px solid #000; + background: #788084; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #d8e0e4; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #d8e0e4; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #c8d0d4; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #048; + color: #aef; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #e8f0f4; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #667; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/calendar/calendar-win2k-cold-2.css b/calendar/calendar-win2k-cold-2.css new file mode 100755 index 0000000..8e930c8 --- /dev/null +++ b/calendar/calendar-win2k-cold-2.css @@ -0,0 +1,271 @@ +/* The main calendar widget. DIV containing a table. */ + +.calendar { + position: relative; + display: none; + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d4d0; + font-family: tahoma,verdana,sans-serif; +} + +.calendar table { + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + font-size: 11px; + color: #000; + cursor: default; + background: #c8d4d0; + font-family: tahoma,verdana,sans-serif; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; + padding: 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar .nav { + background: transparent url(menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; + padding: 1px; + border: 1px solid #000; + background: #788480; + color: #fff; + text-align: center; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .daynames { /* Row containing the day names */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #000; + padding: 2px; + text-align: center; + background: #e8f4f0; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #f00; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + border-top: 2px solid #fff; + border-right: 2px solid #000; + border-bottom: 2px solid #000; + border-left: 2px solid #fff; + padding: 0px; + background-color: #d8e4e0; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + background-color: #b8c4c0; +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + width: 2em; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #aaa; +} +.calendar tbody .day.othermonth.oweekend { + color: #faa; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #000; + background: #e8f4f0; +} + +.calendar tbody .rowhilite td { + background: #d8e4e0; +} + +.calendar tbody .rowhilite td.wn { + background: #c8d4d0; +} + +.calendar tbody td.hilite { /* Hovered cells */ + padding: 1px 3px 1px 1px; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; + padding: 2px 2px 0px 2px; + background: #d8e4e0; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #f00; +} + +.calendar tbody td.today { /* Cell showing today date */ + font-weight: bold; + color: #00f; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + background: #e8f4f0; + padding: 1px; + border: 1px solid #000; + background: #788480; + color: #fff; + text-align: center; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + padding: 1px; + background: #d8e4e0; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + padding: 2px 0px 0px 2px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + width: 4em; + top: 0px; + left: 0px; + cursor: default; + border-top: 1px solid #fff; + border-right: 1px solid #000; + border-bottom: 1px solid #000; + border-left: 1px solid #fff; + background: #d8e4e0; + font-size: 90%; + padding: 1px; + z-index: 100; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .active { + background: #c8d4d0; + padding: 0px; + border-top: 1px solid #000; + border-right: 1px solid #fff; + border-bottom: 1px solid #fff; + border-left: 1px solid #000; +} + +.calendar .combo .hilite { + background: #048; + color: #aef; +} + +.calendar td.time { + border-top: 1px solid #000; + padding: 1px 0px; + text-align: center; + background-color: #e8f0f4; +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 3px 0px 4px; + border: 1px solid #889; + font-weight: bold; + background-color: #fff; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + border-color: #000; + background-color: #667; + color: #fff; +} + +.calendar td.time span.active { + border-color: #f00; + background-color: #000; + color: #0f0; +} diff --git a/calendar/calendar.js b/calendar/calendar.js new file mode 100755 index 0000000..9088e0e --- /dev/null +++ b/calendar/calendar.js @@ -0,0 +1,1806 @@ +/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo + * ----------------------------------------------------------- + * + * The DHTML Calendar, version 1.0 "It is happening again" + * + * Details and latest version at: + * www.dynarch.com/projects/calendar + * + * This script is developed by Dynarch.com. Visit us at www.dynarch.com. + * + * This script is distributed under the GNU Lesser General Public License. + * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html + */ + +// $Id: calendar.js,v 1.51 2005/03/07 16:44:31 mishoo Exp $ + +/** The Calendar object constructor. */ +Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) { + // member variables + this.activeDiv = null; + this.currentDateEl = null; + this.getDateStatus = null; + this.getDateToolTip = null; + this.getDateText = null; + this.timeout = null; + this.onSelected = onSelected || null; + this.onClose = onClose || null; + this.dragging = false; + this.hidden = false; + this.minYear = 1970; + this.maxYear = 2050; + this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; + this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; + this.isPopup = true; + this.weekNumbers = true; + this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc. + this.showsOtherMonths = false; + this.dateStr = dateStr; + this.ar_days = null; + this.showsTime = false; + this.time24 = true; + this.yearStep = 2; + this.hiliteToday = true; + this.multiple = null; + // HTML elements + this.table = null; + this.element = null; + this.tbody = null; + this.firstdayname = null; + // Combo boxes + this.monthsCombo = null; + this.yearsCombo = null; + this.hilitedMonth = null; + this.activeMonth = null; + this.hilitedYear = null; + this.activeYear = null; + // Information + this.dateClicked = false; + + // one-time initializations + if (typeof Calendar._SDN == "undefined") { + // table of short day names + if (typeof Calendar._SDN_len == "undefined") + Calendar._SDN_len = 3; + var ar = new Array(); + for (var i = 8; i > 0;) { + ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); + } + Calendar._SDN = ar; + // table of short month names + if (typeof Calendar._SMN_len == "undefined") + Calendar._SMN_len = 3; + ar = new Array(); + for (var i = 12; i > 0;) { + ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); + } + Calendar._SMN = ar; + } +}; + +// ** constants + +/// "static", needed for event handlers. +Calendar._C = null; + +/// detect a special case of "web browser" +Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && + !/opera/i.test(navigator.userAgent) ); + +Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) ); + +/// detect Opera browser +Calendar.is_opera = /opera/i.test(navigator.userAgent); + +/// detect KHTML-based browsers +Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent); + +// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate +// library, at some point. + +Calendar.getAbsolutePos = function(el) { + var SL = 0, ST = 0; + var is_div = /^div$/i.test(el.tagName); + if (is_div && el.scrollLeft) + SL = el.scrollLeft; + if (is_div && el.scrollTop) + ST = el.scrollTop; + var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; + if (el.offsetParent) { + var tmp = this.getAbsolutePos(el.offsetParent); + r.x += tmp.x; + r.y += tmp.y; + } + return r; +}; + +Calendar.isRelated = function (el, evt) { + var related = evt.relatedTarget; + if (!related) { + var type = evt.type; + if (type == "mouseover") { + related = evt.fromElement; + } else if (type == "mouseout") { + related = evt.toElement; + } + } + while (related) { + if (related == el) { + return true; + } + related = related.parentNode; + } + return false; +}; + +Calendar.removeClass = function(el, className) { + if (!(el && el.className)) { + return; + } + var cls = el.className.split(" "); + var ar = new Array(); + for (var i = cls.length; i > 0;) { + if (cls[--i] != className) { + ar[ar.length] = cls[i]; + } + } + el.className = ar.join(" "); +}; + +Calendar.addClass = function(el, className) { + Calendar.removeClass(el, className); + el.className += " " + className; +}; + +// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately. +Calendar.getElement = function(ev) { + var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; + while (f.nodeType != 1 || /^div$/i.test(f.tagName)) + f = f.parentNode; + return f; +}; + +Calendar.getTargetElement = function(ev) { + var f = Calendar.is_ie ? window.event.srcElement : ev.target; + while (f.nodeType != 1) + f = f.parentNode; + return f; +}; + +Calendar.stopEvent = function(ev) { + ev || (ev = window.event); + if (Calendar.is_ie) { + ev.cancelBubble = true; + ev.returnValue = false; + } else { + ev.preventDefault(); + ev.stopPropagation(); + } + return false; +}; + +Calendar.addEvent = function(el, evname, func) { + if (el.attachEvent) { // IE + el.attachEvent("on" + evname, func); + } else if (el.addEventListener) { // Gecko / W3C + el.addEventListener(evname, func, true); + } else { + el["on" + evname] = func; + } +}; + +Calendar.removeEvent = function(el, evname, func) { + if (el.detachEvent) { // IE + el.detachEvent("on" + evname, func); + } else if (el.removeEventListener) { // Gecko / W3C + el.removeEventListener(evname, func, true); + } else { + el["on" + evname] = null; + } +}; + +Calendar.createElement = function(type, parent) { + var el = null; + if (document.createElementNS) { + // use the XHTML namespace; IE won't normally get here unless + // _they_ "fix" the DOM2 implementation. + el = document.createElementNS("http://www.w3.org/1999/xhtml", type); + } else { + el = document.createElement(type); + } + if (typeof parent != "undefined") { + parent.appendChild(el); + } + return el; +}; + +// END: UTILITY FUNCTIONS + +// BEGIN: CALENDAR STATIC FUNCTIONS + +/** Internal -- adds a set of events to make some element behave like a button. */ +Calendar._add_evs = function(el) { + with (Calendar) { + addEvent(el, "mouseover", dayMouseOver); + addEvent(el, "mousedown", dayMouseDown); + addEvent(el, "mouseout", dayMouseOut); + if (is_ie) { + addEvent(el, "dblclick", dayMouseDblClick); + el.setAttribute("unselectable", true); + } + } +}; + +Calendar.findMonth = function(el) { + if (typeof el.month != "undefined") { + return el; + } else if (typeof el.parentNode.month != "undefined") { + return el.parentNode; + } + return null; +}; + +Calendar.findYear = function(el) { + if (typeof el.year != "undefined") { + return el; + } else if (typeof el.parentNode.year != "undefined") { + return el.parentNode; + } + return null; +}; + +Calendar.showMonthsCombo = function () { + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var mc = cal.monthsCombo; + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + if (cal.activeMonth) { + Calendar.removeClass(cal.activeMonth, "active"); + } + var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; + Calendar.addClass(mon, "active"); + cal.activeMonth = mon; + var s = mc.style; + s.display = "block"; + if (cd.navtype < 0) + s.left = cd.offsetLeft + "px"; + else { + var mcw = mc.offsetWidth; + if (typeof mcw == "undefined") + // Konqueror brain-dead techniques + mcw = 50; + s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; + } + s.top = (cd.offsetTop + cd.offsetHeight) + "px"; +}; + +Calendar.showYearsCombo = function (fwd) { + var cal = Calendar._C; + if (!cal) { + return false; + } + var cal = cal; + var cd = cal.activeDiv; + var yc = cal.yearsCombo; + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + if (cal.activeYear) { + Calendar.removeClass(cal.activeYear, "active"); + } + cal.activeYear = null; + var Y = cal.date.getFullYear() + (fwd ? 1 : -1); + var yr = yc.firstChild; + var show = false; + for (var i = 12; i > 0; --i) { + if (Y >= cal.minYear && Y <= cal.maxYear) { + yr.innerHTML = Y; + yr.year = Y; + yr.style.display = "block"; + show = true; + } else { + yr.style.display = "none"; + } + yr = yr.nextSibling; + Y += fwd ? cal.yearStep : -cal.yearStep; + } + if (show) { + var s = yc.style; + s.display = "block"; + if (cd.navtype < 0) + s.left = cd.offsetLeft + "px"; + else { + var ycw = yc.offsetWidth; + if (typeof ycw == "undefined") + // Konqueror brain-dead techniques + ycw = 50; + s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; + } + s.top = (cd.offsetTop + cd.offsetHeight) + "px"; + } +}; + +// event handlers + +Calendar.tableMouseUp = function(ev) { + var cal = Calendar._C; + if (!cal) { + return false; + } + if (cal.timeout) { + clearTimeout(cal.timeout); + } + var el = cal.activeDiv; + if (!el) { + return false; + } + var target = Calendar.getTargetElement(ev); + ev || (ev = window.event); + Calendar.removeClass(el, "active"); + if (target == el || target.parentNode == el) { + Calendar.cellClick(el, ev); + } + var mon = Calendar.findMonth(target); + var date = null; + if (mon) { + date = new Date(cal.date); + if (mon.month != date.getMonth()) { + date.setMonth(mon.month); + cal.setDate(date); + cal.dateClicked = false; + cal.callHandler(); + } + } else { + var year = Calendar.findYear(target); + if (year) { + date = new Date(cal.date); + if (year.year != date.getFullYear()) { + date.setFullYear(year.year); + cal.setDate(date); + cal.dateClicked = false; + cal.callHandler(); + } + } + } + with (Calendar) { + removeEvent(document, "mouseup", tableMouseUp); + removeEvent(document, "mouseover", tableMouseOver); + removeEvent(document, "mousemove", tableMouseOver); + cal._hideCombos(); + _C = null; + return stopEvent(ev); + } +}; + +Calendar.tableMouseOver = function (ev) { + var cal = Calendar._C; + if (!cal) { + return; + } + var el = cal.activeDiv; + var target = Calendar.getTargetElement(ev); + if (target == el || target.parentNode == el) { + Calendar.addClass(el, "hilite active"); + Calendar.addClass(el.parentNode, "rowhilite"); + } else { + if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) + Calendar.removeClass(el, "active"); + Calendar.removeClass(el, "hilite"); + Calendar.removeClass(el.parentNode, "rowhilite"); + } + ev || (ev = window.event); + if (el.navtype == 50 && target != el) { + var pos = Calendar.getAbsolutePos(el); + var w = el.offsetWidth; + var x = ev.clientX; + var dx; + var decrease = true; + if (x > pos.x + w) { + dx = x - pos.x - w; + decrease = false; + } else + dx = pos.x - x; + + if (dx < 0) dx = 0; + var range = el._range; + var current = el._current; + var count = Math.floor(dx / 10) % range.length; + for (var i = range.length; --i >= 0;) + if (range[i] == current) + break; + while (count-- > 0) + if (decrease) { + if (--i < 0) + i = range.length - 1; + } else if ( ++i >= range.length ) + i = 0; + var newval = range[i]; + el.innerHTML = newval; + + cal.onUpdateTime(); + } + var mon = Calendar.findMonth(target); + if (mon) { + if (mon.month != cal.date.getMonth()) { + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + Calendar.addClass(mon, "hilite"); + cal.hilitedMonth = mon; + } else if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + } else { + if (cal.hilitedMonth) { + Calendar.removeClass(cal.hilitedMonth, "hilite"); + } + var year = Calendar.findYear(target); + if (year) { + if (year.year != cal.date.getFullYear()) { + if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + Calendar.addClass(year, "hilite"); + cal.hilitedYear = year; + } else if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + } else if (cal.hilitedYear) { + Calendar.removeClass(cal.hilitedYear, "hilite"); + } + } + return Calendar.stopEvent(ev); +}; + +Calendar.tableMouseDown = function (ev) { + if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { + return Calendar.stopEvent(ev); + } +}; + +Calendar.calDragIt = function (ev) { + var cal = Calendar._C; + if (!(cal && cal.dragging)) { + return false; + } + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posX = ev.pageX; + posY = ev.pageY; + } + cal.hideShowCovered(); + var st = cal.element.style; + st.left = (posX - cal.xOffs) + "px"; + st.top = (posY - cal.yOffs) + "px"; + return Calendar.stopEvent(ev); +}; + +Calendar.calDragEnd = function (ev) { + var cal = Calendar._C; + if (!cal) { + return false; + } + cal.dragging = false; + with (Calendar) { + removeEvent(document, "mousemove", calDragIt); + removeEvent(document, "mouseup", calDragEnd); + tableMouseUp(ev); + } + cal.hideShowCovered(); +}; + +Calendar.dayMouseDown = function(ev) { + var el = Calendar.getElement(ev); + if (el.disabled) { + return false; + } + var cal = el.calendar; + cal.activeDiv = el; + Calendar._C = cal; + if (el.navtype != 300) with (Calendar) { + if (el.navtype == 50) { + el._current = el.innerHTML; + addEvent(document, "mousemove", tableMouseOver); + } else + addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); + addClass(el, "hilite active"); + addEvent(document, "mouseup", tableMouseUp); + } else if (cal.isPopup) { + cal._dragStart(ev); + } + if (el.navtype == -1 || el.navtype == 1) { + if (cal.timeout) clearTimeout(cal.timeout); + cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); + } else if (el.navtype == -2 || el.navtype == 2) { + if (cal.timeout) clearTimeout(cal.timeout); + cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); + } else { + cal.timeout = null; + } + return Calendar.stopEvent(ev); +}; + +Calendar.dayMouseDblClick = function(ev) { + Calendar.cellClick(Calendar.getElement(ev), ev || window.event); + if (Calendar.is_ie) { + document.selection.empty(); + } +}; + +Calendar.dayMouseOver = function(ev) { + var el = Calendar.getElement(ev); + if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { + return false; + } + if (el.ttip) { + if (el.ttip.substr(0, 1) == "_") { + el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); + } + el.calendar.tooltips.innerHTML = el.ttip; + } + if (el.navtype != 300) { + Calendar.addClass(el, "hilite"); + if (el.caldate) { + Calendar.addClass(el.parentNode, "rowhilite"); + } + } + return Calendar.stopEvent(ev); +}; + +Calendar.dayMouseOut = function(ev) { + with (Calendar) { + var el = getElement(ev); + if (isRelated(el, ev) || _C || el.disabled) + return false; + removeClass(el, "hilite"); + if (el.caldate) + removeClass(el.parentNode, "rowhilite"); + if (el.calendar) + el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; + return stopEvent(ev); + } +}; + +/** + * A generic "click" handler :) handles all types of buttons defined in this + * calendar. + */ +Calendar.cellClick = function(el, ev) { + var cal = el.calendar; + var closing = false; + var newdate = false; + var date = null; + if (typeof el.navtype == "undefined") { + if (cal.currentDateEl) { + Calendar.removeClass(cal.currentDateEl, "selected"); + Calendar.addClass(el, "selected"); + closing = (cal.currentDateEl == el); + if (!closing) { + cal.currentDateEl = el; + } + } + cal.date.setDateOnly(el.caldate); + date = cal.date; + var other_month = !(cal.dateClicked = !el.otherMonth); + if (!other_month && !cal.currentDateEl) + cal._toggleMultipleDate(new Date(date)); + else + newdate = !el.disabled; + // a date was clicked + if (other_month) + cal._init(cal.firstDayOfWeek, date); + } else { + if (el.navtype == 200) { + Calendar.removeClass(el, "hilite"); + cal.callCloseHandler(); + return; + } + date = new Date(cal.date); + if (el.navtype == 0) + date.setDateOnly(new Date()); // TODAY + // unless "today" was clicked, we assume no date was clicked so + // the selected handler will know not to close the calenar when + // in single-click mode. + // cal.dateClicked = (el.navtype == 0); + cal.dateClicked = false; + var year = date.getFullYear(); + var mon = date.getMonth(); + function setMonth(m) { + var day = date.getDate(); + var max = date.getMonthDays(m); + if (day > max) { + date.setDate(max); + } + date.setMonth(m); + }; + switch (el.navtype) { + case 400: + Calendar.removeClass(el, "hilite"); + var text = Calendar._TT["ABOUT"]; + if (typeof text != "undefined") { + text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; + } else { + // FIXME: this should be removed as soon as lang files get updated! + text = "Help and about box text is not translated into this language.\n" + + "If you know this language and you feel generous please update\n" + + "the corresponding file in \"lang\" subdir to match calendar-en.js\n" + + "and send it back to to get it into the distribution ;-)\n\n" + + "Thank you!\n" + + "http://dynarch.com/mishoo/calendar.epl\n"; + } + alert(text); + return; + case -2: + if (year > cal.minYear) { + date.setFullYear(year - 1); + } + break; + case -1: + if (mon > 0) { + setMonth(mon - 1); + } else if (year-- > cal.minYear) { + date.setFullYear(year); + setMonth(11); + } + break; + case 1: + if (mon < 11) { + setMonth(mon + 1); + } else if (year < cal.maxYear) { + date.setFullYear(year + 1); + setMonth(0); + } + break; + case 2: + if (year < cal.maxYear) { + date.setFullYear(year + 1); + } + break; + case 100: + cal.setFirstDayOfWeek(el.fdow); + return; + case 50: + var range = el._range; + var current = el.innerHTML; + for (var i = range.length; --i >= 0;) + if (range[i] == current) + break; + if (ev && ev.shiftKey) { + if (--i < 0) + i = range.length - 1; + } else if ( ++i >= range.length ) + i = 0; + var newval = range[i]; + el.innerHTML = newval; + cal.onUpdateTime(); + return; + case 0: + // TODAY will bring us here + if ((typeof cal.getDateStatus == "function") && + cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { + return false; + } + break; + } + if (!date.equalsTo(cal.date)) { + cal.setDate(date); + newdate = true; + } else if (el.navtype == 0) + newdate = closing = true; + } + if (newdate) { + ev && cal.callHandler(); + } + if (closing) { + Calendar.removeClass(el, "hilite"); + ev && cal.callCloseHandler(); + } +}; + +// END: CALENDAR STATIC FUNCTIONS + +// BEGIN: CALENDAR OBJECT FUNCTIONS + +/** + * This function creates the calendar inside the given parent. If _par is + * null than it creates a popup calendar inside the BODY element. If _par is + * an element, be it BODY, then it creates a non-popup calendar (still + * hidden). Some properties need to be set before calling this function. + */ +Calendar.prototype.create = function (_par) { + var parent = null; + if (! _par) { + // default parent is the document body, in which case we create + // a popup calendar. + parent = document.getElementsByTagName("body")[0]; + this.isPopup = true; + } else { + parent = _par; + this.isPopup = false; + } + this.date = this.dateStr ? new Date(this.dateStr) : new Date(); + + var table = Calendar.createElement("table"); + this.table = table; + table.cellSpacing = 0; + table.cellPadding = 0; + table.calendar = this; + Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); + + var div = Calendar.createElement("div"); + this.element = div; + div.className = "calendar"; + if (this.isPopup) { + div.style.position = "absolute"; + div.style.display = "none"; + } + div.appendChild(table); + + var thead = Calendar.createElement("thead", table); + var cell = null; + var row = null; + + var cal = this; + var hh = function (text, cs, navtype) { + cell = Calendar.createElement("td", row); + cell.colSpan = cs; + cell.className = "button"; + if (navtype != 0 && Math.abs(navtype) <= 2) + cell.className += " nav"; + Calendar._add_evs(cell); + cell.calendar = cal; + cell.navtype = navtype; + cell.innerHTML = "
" + text + "
"; + return cell; + }; + + row = Calendar.createElement("tr", thead); + var title_length = 6; + (this.isPopup) && --title_length; + (this.weekNumbers) && ++title_length; + + hh("?", 1, 400).ttip = Calendar._TT["INFO"]; + this.title = hh("", title_length, 300); + this.title.className = "title"; + if (this.isPopup) { + this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; + this.title.style.cursor = "move"; + hh("×", 1, 200).ttip = Calendar._TT["CLOSE"]; + } + + row = Calendar.createElement("tr", thead); + row.className = "headrow"; + + this._nav_py = hh("«", 1, -2); + this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; + + this._nav_pm = hh("‹", 1, -1); + this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; + + this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); + this._nav_now.ttip = Calendar._TT["GO_TODAY"]; + + this._nav_nm = hh("›", 1, 1); + this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; + + this._nav_ny = hh("»", 1, 2); + this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; + + // day names + row = Calendar.createElement("tr", thead); + row.className = "daynames"; + if (this.weekNumbers) { + cell = Calendar.createElement("td", row); + cell.className = "name wn"; + cell.innerHTML = Calendar._TT["WK"]; + } + for (var i = 7; i > 0; --i) { + cell = Calendar.createElement("td", row); + if (!i) { + cell.navtype = 100; + cell.calendar = this; + Calendar._add_evs(cell); + } + } + this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; + this._displayWeekdays(); + + var tbody = Calendar.createElement("tbody", table); + this.tbody = tbody; + + for (i = 6; i > 0; --i) { + row = Calendar.createElement("tr", tbody); + if (this.weekNumbers) { + cell = Calendar.createElement("td", row); + } + for (var j = 7; j > 0; --j) { + cell = Calendar.createElement("td", row); + cell.calendar = this; + Calendar._add_evs(cell); + } + } + + if (this.showsTime) { + row = Calendar.createElement("tr", tbody); + row.className = "time"; + + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = 2; + cell.innerHTML = Calendar._TT["TIME"] || " "; + + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = this.weekNumbers ? 4 : 3; + + (function(){ + function makeTimePart(className, init, range_start, range_end) { + var part = Calendar.createElement("span", cell); + part.className = className; + part.innerHTML = init; + part.calendar = cal; + part.ttip = Calendar._TT["TIME_PART"]; + part.navtype = 50; + part._range = []; + if (typeof range_start != "number") + part._range = range_start; + else { + for (var i = range_start; i <= range_end; ++i) { + var txt; + if (i < 10 && range_end >= 10) txt = '0' + i; + else txt = '' + i; + part._range[part._range.length] = txt; + } + } + Calendar._add_evs(part); + return part; + }; + var hrs = cal.date.getHours(); + var mins = cal.date.getMinutes(); + var t12 = !cal.time24; + var pm = (hrs > 12); + if (t12 && pm) hrs -= 12; + var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); + var span = Calendar.createElement("span", cell); + span.innerHTML = ":"; + span.className = "colon"; + var M = makeTimePart("minute", mins, 0, 59); + var AP = null; + cell = Calendar.createElement("td", row); + cell.className = "time"; + cell.colSpan = 2; + if (t12) + AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); + else + cell.innerHTML = " "; + + cal.onSetTime = function() { + var pm, hrs = this.date.getHours(), + mins = this.date.getMinutes(); + if (t12) { + pm = (hrs >= 12); + if (pm) hrs -= 12; + if (hrs == 0) hrs = 12; + AP.innerHTML = pm ? "pm" : "am"; + } + H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; + M.innerHTML = (mins < 10) ? ("0" + mins) : mins; + }; + + cal.onUpdateTime = function() { + var date = this.date; + var h = parseInt(H.innerHTML, 10); + if (t12) { + if (/pm/i.test(AP.innerHTML) && h < 12) + h += 12; + else if (/am/i.test(AP.innerHTML) && h == 12) + h = 0; + } + var d = date.getDate(); + var m = date.getMonth(); + var y = date.getFullYear(); + date.setHours(h); + date.setMinutes(parseInt(M.innerHTML, 10)); + date.setFullYear(y); + date.setMonth(m); + date.setDate(d); + this.dateClicked = false; + this.callHandler(); + }; + })(); + } else { + this.onSetTime = this.onUpdateTime = function() {}; + } + + var tfoot = Calendar.createElement("tfoot", table); + + row = Calendar.createElement("tr", tfoot); + row.className = "footrow"; + + cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); + cell.className = "ttip"; + if (this.isPopup) { + cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; + cell.style.cursor = "move"; + } + this.tooltips = cell; + + div = Calendar.createElement("div", this.element); + this.monthsCombo = div; + div.className = "combo"; + for (i = 0; i < Calendar._MN.length; ++i) { + var mn = Calendar.createElement("div"); + mn.className = Calendar.is_ie ? "label-IEfix" : "label"; + mn.month = i; + mn.innerHTML = Calendar._SMN[i]; + div.appendChild(mn); + } + + div = Calendar.createElement("div", this.element); + this.yearsCombo = div; + div.className = "combo"; + for (i = 12; i > 0; --i) { + var yr = Calendar.createElement("div"); + yr.className = Calendar.is_ie ? "label-IEfix" : "label"; + div.appendChild(yr); + } + + this._init(this.firstDayOfWeek, this.date); + parent.appendChild(this.element); +}; + +/** keyboard navigation, only for popup calendars */ +Calendar._keyEvent = function(ev) { + var cal = window._dynarch_popupCalendar; + if (!cal || cal.multiple) + return false; + (Calendar.is_ie) && (ev = window.event); + var act = (Calendar.is_ie || ev.type == "keypress"), + K = ev.keyCode; + if (ev.ctrlKey) { + switch (K) { + case 37: // KEY left + act && Calendar.cellClick(cal._nav_pm); + break; + case 38: // KEY up + act && Calendar.cellClick(cal._nav_py); + break; + case 39: // KEY right + act && Calendar.cellClick(cal._nav_nm); + break; + case 40: // KEY down + act && Calendar.cellClick(cal._nav_ny); + break; + default: + return false; + } + } else switch (K) { + case 32: // KEY space (now) + Calendar.cellClick(cal._nav_now); + break; + case 27: // KEY esc + act && cal.callCloseHandler(); + break; + case 37: // KEY left + case 38: // KEY up + case 39: // KEY right + case 40: // KEY down + if (act) { + var prev, x, y, ne, el, step; + prev = K == 37 || K == 38; + step = (K == 37 || K == 39) ? 1 : 7; + function setVars() { + el = cal.currentDateEl; + var p = el.pos; + x = p & 15; + y = p >> 4; + ne = cal.ar_days[y][x]; + };setVars(); + function prevMonth() { + var date = new Date(cal.date); + date.setDate(date.getDate() - step); + cal.setDate(date); + }; + function nextMonth() { + var date = new Date(cal.date); + date.setDate(date.getDate() + step); + cal.setDate(date); + }; + while (1) { + switch (K) { + case 37: // KEY left + if (--x >= 0) + ne = cal.ar_days[y][x]; + else { + x = 6; + K = 38; + continue; + } + break; + case 38: // KEY up + if (--y >= 0) + ne = cal.ar_days[y][x]; + else { + prevMonth(); + setVars(); + } + break; + case 39: // KEY right + if (++x < 7) + ne = cal.ar_days[y][x]; + else { + x = 0; + K = 40; + continue; + } + break; + case 40: // KEY down + if (++y < cal.ar_days.length) + ne = cal.ar_days[y][x]; + else { + nextMonth(); + setVars(); + } + break; + } + break; + } + if (ne) { + if (!ne.disabled) + Calendar.cellClick(ne); + else if (prev) + prevMonth(); + else + nextMonth(); + } + } + break; + case 13: // KEY enter + if (act) + Calendar.cellClick(cal.currentDateEl, ev); + break; + default: + return false; + } + return Calendar.stopEvent(ev); +}; + +/** + * (RE)Initializes the calendar to the given date and firstDayOfWeek + */ +Calendar.prototype._init = function (firstDayOfWeek, date) { + var today = new Date(), + TY = today.getFullYear(), + TM = today.getMonth(), + TD = today.getDate(); + this.table.style.visibility = "hidden"; + var year = date.getFullYear(); + if (year < this.minYear) { + year = this.minYear; + date.setFullYear(year); + } else if (year > this.maxYear) { + year = this.maxYear; + date.setFullYear(year); + } + this.firstDayOfWeek = firstDayOfWeek; + this.date = new Date(date); + var month = date.getMonth(); + var mday = date.getDate(); + var no_days = date.getMonthDays(); + + // calendar voodoo for computing the first day that would actually be + // displayed in the calendar, even if it's from the previous month. + // WARNING: this is magic. ;-) + date.setDate(1); + var day1 = (date.getDay() - this.firstDayOfWeek) % 7; + if (day1 < 0) + day1 += 7; + date.setDate(-day1); + date.setDate(date.getDate() + 1); + + var row = this.tbody.firstChild; + var MN = Calendar._SMN[month]; + var ar_days = this.ar_days = new Array(); + var weekend = Calendar._TT["WEEKEND"]; + var dates = this.multiple ? (this.datesCells = {}) : null; + for (var i = 0; i < 6; ++i, row = row.nextSibling) { + var cell = row.firstChild; + if (this.weekNumbers) { + cell.className = "day wn"; + cell.innerHTML = date.getWeekNumber(); + cell = cell.nextSibling; + } + row.className = "daysrow"; + var hasdays = false, iday, dpos = ar_days[i] = []; + for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { + iday = date.getDate(); + var wday = date.getDay(); + cell.className = "day"; + cell.pos = i << 4 | j; + dpos[j] = cell; + var current_month = (date.getMonth() == month); + if (!current_month) { + if (this.showsOtherMonths) { + cell.className += " othermonth"; + cell.otherMonth = true; + } else { + cell.className = "emptycell"; + cell.innerHTML = " "; + cell.disabled = true; + continue; + } + } else { + cell.otherMonth = false; + hasdays = true; + } + cell.disabled = false; + cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; + if (dates) + dates[date.print("%Y%m%d")] = cell; + if (this.getDateStatus) { + var status = this.getDateStatus(date, year, month, iday); + if (this.getDateToolTip) { + var toolTip = this.getDateToolTip(date, year, month, iday); + if (toolTip) + cell.title = toolTip; + } + if (status === true) { + cell.className += " disabled"; + cell.disabled = true; + } else { + if (/disabled/i.test(status)) + cell.disabled = true; + cell.className += " " + status; + } + } + if (!cell.disabled) { + cell.caldate = new Date(date); + cell.ttip = "_"; + if (!this.multiple && current_month + && iday == mday && this.hiliteToday) { + cell.className += " selected"; + this.currentDateEl = cell; + } + if (date.getFullYear() == TY && + date.getMonth() == TM && + iday == TD) { + cell.className += " today"; + cell.ttip += Calendar._TT["PART_TODAY"]; + } + if (weekend.indexOf(wday.toString()) != -1) + cell.className += cell.otherMonth ? " oweekend" : " weekend"; + } + } + if (!(hasdays || this.showsOtherMonths)) + row.className = "emptyrow"; + } + this.title.innerHTML = Calendar._MN[month] + ", " + year; + this.onSetTime(); + this.table.style.visibility = "visible"; + this._initMultipleDates(); + // PROFILE + // this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms"; +}; + +Calendar.prototype._initMultipleDates = function() { + if (this.multiple) { + for (var i in this.multiple) { + var cell = this.datesCells[i]; + var d = this.multiple[i]; + if (!d) + continue; + if (cell) + cell.className += " selected"; + } + } +}; + +Calendar.prototype._toggleMultipleDate = function(date) { + if (this.multiple) { + var ds = date.print("%Y%m%d"); + var cell = this.datesCells[ds]; + if (cell) { + var d = this.multiple[ds]; + if (!d) { + Calendar.addClass(cell, "selected"); + this.multiple[ds] = date; + } else { + Calendar.removeClass(cell, "selected"); + delete this.multiple[ds]; + } + } + } +}; + +Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { + this.getDateToolTip = unaryFunction; +}; + +/** + * Calls _init function above for going to a certain date (but only if the + * date is different than the currently selected one). + */ +Calendar.prototype.setDate = function (date) { + if (!date.equalsTo(this.date)) { + this._init(this.firstDayOfWeek, date); + } +}; + +/** + * Refreshes the calendar. Useful if the "disabledHandler" function is + * dynamic, meaning that the list of disabled date can change at runtime. + * Just * call this function if you think that the list of disabled dates + * should * change. + */ +Calendar.prototype.refresh = function () { + this._init(this.firstDayOfWeek, this.date); +}; + +/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */ +Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { + this._init(firstDayOfWeek, this.date); + this._displayWeekdays(); +}; + +/** + * Allows customization of what dates are enabled. The "unaryFunction" + * parameter must be a function object that receives the date (as a JS Date + * object) and returns a boolean value. If the returned value is true then + * the passed date will be marked as disabled. + */ +Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) { + this.getDateStatus = unaryFunction; +}; + +/** Customization of allowed year range for the calendar. */ +Calendar.prototype.setRange = function (a, z) { + this.minYear = a; + this.maxYear = z; +}; + +/** Calls the first user handler (selectedHandler). */ +Calendar.prototype.callHandler = function () { + if (this.onSelected) { + this.onSelected(this, this.date.print(this.dateFormat)); + } +}; + +/** Calls the second user handler (closeHandler). */ +Calendar.prototype.callCloseHandler = function () { + if (this.onClose) { + this.onClose(this); + } + this.hideShowCovered(); +}; + +/** Removes the calendar object from the DOM tree and destroys it. */ +Calendar.prototype.destroy = function () { + var el = this.element.parentNode; + el.removeChild(this.element); + Calendar._C = null; + window._dynarch_popupCalendar = null; +}; + +/** + * Moves the calendar element to a different section in the DOM tree (changes + * its parent). + */ +Calendar.prototype.reparent = function (new_parent) { + var el = this.element; + el.parentNode.removeChild(el); + new_parent.appendChild(el); +}; + +// This gets called when the user presses a mouse button anywhere in the +// document, if the calendar is shown. If the click was outside the open +// calendar this function closes it. +Calendar._checkCalendar = function(ev) { + var calendar = window._dynarch_popupCalendar; + if (!calendar) { + return false; + } + var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); + for (; el != null && el != calendar.element; el = el.parentNode); + if (el == null) { + // calls closeHandler which should hide the calendar. + window._dynarch_popupCalendar.callCloseHandler(); + return Calendar.stopEvent(ev); + } +}; + +/** Shows the calendar. */ +Calendar.prototype.show = function () { + var rows = this.table.getElementsByTagName("tr"); + for (var i = rows.length; i > 0;) { + var row = rows[--i]; + Calendar.removeClass(row, "rowhilite"); + var cells = row.getElementsByTagName("td"); + for (var j = cells.length; j > 0;) { + var cell = cells[--j]; + Calendar.removeClass(cell, "hilite"); + Calendar.removeClass(cell, "active"); + } + } + this.element.style.display = "block"; + this.hidden = false; + if (this.isPopup) { + window._dynarch_popupCalendar = this; + Calendar.addEvent(document, "keydown", Calendar._keyEvent); + Calendar.addEvent(document, "keypress", Calendar._keyEvent); + Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); + } + this.hideShowCovered(); +}; + +/** + * Hides the calendar. Also removes any "hilite" from the class of any TD + * element. + */ +Calendar.prototype.hide = function () { + if (this.isPopup) { + Calendar.removeEvent(document, "keydown", Calendar._keyEvent); + Calendar.removeEvent(document, "keypress", Calendar._keyEvent); + Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); + } + this.element.style.display = "none"; + this.hidden = true; + this.hideShowCovered(); +}; + +/** + * Shows the calendar at a given absolute position (beware that, depending on + * the calendar element style -- position property -- this might be relative + * to the parent's containing rectangle). + */ +Calendar.prototype.showAt = function (x, y) { + var s = this.element.style; + s.left = x + "px"; + s.top = y + "px"; + this.show(); +}; + +/** Shows the calendar near a given element. */ +Calendar.prototype.showAtElement = function (el, opts) { + var self = this; + var p = Calendar.getAbsolutePos(el); + if (!opts || typeof opts != "string") { + this.showAt(p.x, p.y + el.offsetHeight); + return true; + } + function fixPosition(box) { + if (box.x < 0) + box.x = 0; + if (box.y < 0) + box.y = 0; + var cp = document.createElement("div"); + var s = cp.style; + s.position = "absolute"; + s.right = s.bottom = s.width = s.height = "0px"; + document.body.appendChild(cp); + var br = Calendar.getAbsolutePos(cp); + document.body.removeChild(cp); + if (Calendar.is_ie) { + br.y += document.body.scrollTop; + br.x += document.body.scrollLeft; + } else { + br.y += window.scrollY; + br.x += window.scrollX; + } + var tmp = box.x + box.width - br.x; + if (tmp > 0) box.x -= tmp; + tmp = box.y + box.height - br.y; + if (tmp > 0) box.y -= tmp; + }; + this.element.style.display = "block"; + Calendar.continuation_for_the_fucking_khtml_browser = function() { + var w = self.element.offsetWidth; + var h = self.element.offsetHeight; + self.element.style.display = "none"; + var valign = opts.substr(0, 1); + var halign = "l"; + if (opts.length > 1) { + halign = opts.substr(1, 1); + } + // vertical alignment + switch (valign) { + case "T": p.y -= h; break; + case "B": p.y += el.offsetHeight; break; + case "C": p.y += (el.offsetHeight - h) / 2; break; + case "t": p.y += el.offsetHeight - h; break; + case "b": break; // already there + } + // horizontal alignment + switch (halign) { + case "L": p.x -= w; break; + case "R": p.x += el.offsetWidth; break; + case "C": p.x += (el.offsetWidth - w) / 2; break; + case "l": p.x += el.offsetWidth - w; break; + case "r": break; // already there + } + p.width = w; + p.height = h + 40; + self.monthsCombo.style.display = "none"; + fixPosition(p); + self.showAt(p.x, p.y); + }; + if (Calendar.is_khtml) + setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); + else + Calendar.continuation_for_the_fucking_khtml_browser(); +}; + +/** Customizes the date format. */ +Calendar.prototype.setDateFormat = function (str) { + this.dateFormat = str; +}; + +/** Customizes the tooltip date format. */ +Calendar.prototype.setTtDateFormat = function (str) { + this.ttDateFormat = str; +}; + +/** + * Tries to identify the date represented in a string. If successful it also + * calls this.setDate which moves the calendar to the given date. + */ +Calendar.prototype.parseDate = function(str, fmt) { + if (!fmt) + fmt = this.dateFormat; + this.setDate(Date.parseDate(str, fmt)); +}; + +Calendar.prototype.hideShowCovered = function () { + if (!Calendar.is_ie && !Calendar.is_opera) + return; + function getVisib(obj){ + var value = obj.style.visibility; + if (!value) { + if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C + if (!Calendar.is_khtml) + value = document.defaultView. + getComputedStyle(obj, "").getPropertyValue("visibility"); + else + value = ''; + } else if (obj.currentStyle) { // IE + value = obj.currentStyle.visibility; + } else + value = ''; + } + return value; + }; + + var tags = new Array("applet", "iframe", "select"); + var el = this.element; + + var p = Calendar.getAbsolutePos(el); + var EX1 = p.x; + var EX2 = el.offsetWidth + EX1; + var EY1 = p.y; + var EY2 = el.offsetHeight + EY1; + + for (var k = tags.length; k > 0; ) { + var ar = document.getElementsByTagName(tags[--k]); + var cc = null; + + for (var i = ar.length; i > 0;) { + cc = ar[--i]; + + p = Calendar.getAbsolutePos(cc); + var CX1 = p.x; + var CX2 = cc.offsetWidth + CX1; + var CY1 = p.y; + var CY2 = cc.offsetHeight + CY1; + + if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { + if (!cc.__msh_save_visibility) { + cc.__msh_save_visibility = getVisib(cc); + } + cc.style.visibility = cc.__msh_save_visibility; + } else { + if (!cc.__msh_save_visibility) { + cc.__msh_save_visibility = getVisib(cc); + } + cc.style.visibility = "hidden"; + } + } + } +}; + +/** Internal function; it displays the bar with the names of the weekday. */ +Calendar.prototype._displayWeekdays = function () { + var fdow = this.firstDayOfWeek; + var cell = this.firstdayname; + var weekend = Calendar._TT["WEEKEND"]; + for (var i = 0; i < 7; ++i) { + cell.className = "day name"; + var realday = (i + fdow) % 7; + if (i) { + cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); + cell.navtype = 100; + cell.calendar = this; + cell.fdow = realday; + Calendar._add_evs(cell); + } + if (weekend.indexOf(realday.toString()) != -1) { + Calendar.addClass(cell, "weekend"); + } + cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; + cell = cell.nextSibling; + } +}; + +/** Internal function. Hides all combo boxes that might be displayed. */ +Calendar.prototype._hideCombos = function () { + this.monthsCombo.style.display = "none"; + this.yearsCombo.style.display = "none"; +}; + +/** Internal function. Starts dragging the element. */ +Calendar.prototype._dragStart = function (ev) { + if (this.dragging) { + return; + } + this.dragging = true; + var posX; + var posY; + if (Calendar.is_ie) { + posY = window.event.clientY + document.body.scrollTop; + posX = window.event.clientX + document.body.scrollLeft; + } else { + posY = ev.clientY + window.scrollY; + posX = ev.clientX + window.scrollX; + } + var st = this.element.style; + this.xOffs = posX - parseInt(st.left); + this.yOffs = posY - parseInt(st.top); + with (Calendar) { + addEvent(document, "mousemove", calDragIt); + addEvent(document, "mouseup", calDragEnd); + } +}; + +// BEGIN: DATE OBJECT PATCHES + +/** Adds the number of days array to the Date object. */ +Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); + +/** Constants used for time computations */ +Date.SECOND = 1000 /* milliseconds */; +Date.MINUTE = 60 * Date.SECOND; +Date.HOUR = 60 * Date.MINUTE; +Date.DAY = 24 * Date.HOUR; +Date.WEEK = 7 * Date.DAY; + +Date.parseDate = function(str, fmt) { + var today = new Date(); + var y = 0; + var m = -1; + var d = 0; + var a = str.split(/\W+/); + var b = fmt.match(/%./g); + var i = 0, j = 0; + var hr = 0; + var min = 0; + for (i = 0; i < a.length; ++i) { + if (!a[i]) + continue; + switch (b[i]) { + case "%d": + case "%e": + d = parseInt(a[i], 10); + break; + + case "%m": + m = parseInt(a[i], 10) - 1; + break; + + case "%Y": + case "%y": + y = parseInt(a[i], 10); + (y < 100) && (y += (y > 29) ? 1900 : 2000); + break; + + case "%b": + case "%B": + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } + } + break; + + case "%H": + case "%I": + case "%k": + case "%l": + hr = parseInt(a[i], 10); + break; + + case "%P": + case "%p": + if (/pm/i.test(a[i]) && hr < 12) + hr += 12; + else if (/am/i.test(a[i]) && hr >= 12) + hr -= 12; + break; + + case "%M": + min = parseInt(a[i], 10); + break; + } + } + if (isNaN(y)) y = today.getFullYear(); + if (isNaN(m)) m = today.getMonth(); + if (isNaN(d)) d = today.getDate(); + if (isNaN(hr)) hr = today.getHours(); + if (isNaN(min)) min = today.getMinutes(); + if (y != 0 && m != -1 && d != 0) + return new Date(y, m, d, hr, min, 0); + y = 0; m = -1; d = 0; + for (i = 0; i < a.length; ++i) { + if (a[i].search(/[a-zA-Z]+/) != -1) { + var t = -1; + for (j = 0; j < 12; ++j) { + if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } + } + if (t != -1) { + if (m != -1) { + d = m+1; + } + m = t; + } + } else if (parseInt(a[i], 10) <= 12 && m == -1) { + m = a[i]-1; + } else if (parseInt(a[i], 10) > 31 && y == 0) { + y = parseInt(a[i], 10); + (y < 100) && (y += (y > 29) ? 1900 : 2000); + } else if (d == 0) { + d = a[i]; + } + } + if (y == 0) + y = today.getFullYear(); + if (m != -1 && d != 0) + return new Date(y, m, d, hr, min, 0); + return today; +}; + +/** Returns the number of days in the current month */ +Date.prototype.getMonthDays = function(month) { + var year = this.getFullYear(); + if (typeof month == "undefined") { + month = this.getMonth(); + } + if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { + return 29; + } else { + return Date._MD[month]; + } +}; + +/** Returns the number of day in the year. */ +Date.prototype.getDayOfYear = function() { + var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); + var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); + var time = now - then; + return Math.floor(time / Date.DAY); +}; + +/** Returns the number of the week in year, as defined in ISO 8601. */ +Date.prototype.getWeekNumber = function() { + var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); + var DoW = d.getDay(); + d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu + var ms = d.valueOf(); // GMT + d.setMonth(0); + d.setDate(4); // Thu in Week 1 + return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; +}; + +/** Checks date and time equality */ +Date.prototype.equalsTo = function(date) { + return ((this.getFullYear() == date.getFullYear()) && + (this.getMonth() == date.getMonth()) && + (this.getDate() == date.getDate()) && + (this.getHours() == date.getHours()) && + (this.getMinutes() == date.getMinutes())); +}; + +/** Set only the year, month, date parts (keep existing time) */ +Date.prototype.setDateOnly = function(date) { + var tmp = new Date(date); + this.setDate(1); + this.setFullYear(tmp.getFullYear()); + this.setMonth(tmp.getMonth()); + this.setDate(tmp.getDate()); +}; + +/** Prints the date in a string according to the given format. */ +Date.prototype.print = function (str) { + var m = this.getMonth(); + var d = this.getDate(); + var y = this.getFullYear(); + var wn = this.getWeekNumber(); + var w = this.getDay(); + var s = {}; + var hr = this.getHours(); + var pm = (hr >= 12); + var ir = (pm) ? (hr - 12) : hr; + var dy = this.getDayOfYear(); + if (ir == 0) + ir = 12; + var min = this.getMinutes(); + var sec = this.getSeconds(); + s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N] + s["%A"] = Calendar._DN[w]; // full weekday name + s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N] + s["%B"] = Calendar._MN[m]; // full month name + // FIXME: %c : preferred date and time representation for the current locale + s["%C"] = 1 + Math.floor(y / 100); // the century number + s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) + s["%e"] = d; // the day of the month (range 1 to 31) + // FIXME: %D : american date style: %m/%d/%y + // FIXME: %E, %F, %G, %g, %h (man strftime) + s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) + s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) + s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) + s["%k"] = hr; // hour, range 0 to 23 (24h format) + s["%l"] = ir; // hour, range 1 to 12 (12h format) + s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 + s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 + s["%n"] = "\n"; // a newline character + s["%p"] = pm ? "PM" : "AM"; + s["%P"] = pm ? "pm" : "am"; + // FIXME: %r : the time in am/pm notation %I:%M:%S %p + // FIXME: %R : the time in 24-hour notation %H:%M + s["%s"] = Math.floor(this.getTime() / 1000); + s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 + s["%t"] = "\t"; // a tab character + // FIXME: %T : the time in 24-hour notation (%H:%M:%S) + s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; + s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) + s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) + // FIXME: %x : preferred date representation for the current locale without the time + // FIXME: %X : preferred time representation for the current locale without the date + s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) + s["%Y"] = y; // year with the century + s["%%"] = "%"; // a literal '%' character + + var re = /%./g; + if (!Calendar.is_ie5 && !Calendar.is_khtml) + return str.replace(re, function (par) { return s[par] || par; }); + + var a = str.match(re); + for (var i = 0; i < a.length; i++) { + var tmp = s[a[i]]; + if (tmp) { + re = new RegExp(a[i], 'g'); + str = str.replace(re, tmp); + } + } + + return str; +}; + +Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; +Date.prototype.setFullYear = function(y) { + var d = new Date(this); + d.__msh_oldSetFullYear(y); + if (d.getMonth() != this.getMonth()) + this.setDate(28); + this.__msh_oldSetFullYear(y); +}; + +// END: DATE OBJECT PATCHES + + +// global object that remembers the calendar +window._dynarch_popupCalendar = null; diff --git a/calendar/calendar.php b/calendar/calendar.php new file mode 100755 index 0000000..5b9120d --- /dev/null +++ b/calendar/calendar.php @@ -0,0 +1,119 @@ +calendar_file = 'calendar_stripped.js'; + $this->calendar_setup_file = 'calendar-setup_stripped.js'; + } else { + $this->calendar_file = 'calendar.js'; + $this->calendar_setup_file = 'calendar-setup.js'; + } + $this->calendar_lang_file = 'lang/calendar-' . $lang . '.js'; + $this->calendar_theme_file = $theme.'.css'; + $this->calendar_lib_path = preg_replace('/\/+$/', '/', $calendar_lib_path); + $this->calendar_options = array('ifFormat' => '%Y/%m/%d', + 'daFormat' => '%Y/%m/%d'); + } + + function set_option($name, $value) { + $this->calendar_options[$name] = $value; + } + + function load_files() { + echo $this->get_load_files_code(); + } + + function get_load_files_code() { + $code = ( '' . NEWLINE ); + $code .= ( '' . NEWLINE ); + $code .= ( '' . NEWLINE ); + $code .= ( '' ); + return $code; + } + + function _make_calendar($other_options = array()) { + $js_options = $this->_make_js_hash(array_merge($this->calendar_options, $other_options)); + $code = ( '' ); + return $code; + } + + function make_input_field($cal_options = array(), $field_attributes = array()) { + $id = $this->_gen_id(); + $attrstr = $this->_make_html_attr(array_merge($field_attributes, + array('id' => $this->_field_id($id), + 'type' => 'text'))); + echo ''; + echo '' . + ''; + + $options = array_merge($cal_options, + array('inputField' => $this->_field_id($id), + 'button' => $this->_trigger_id($id))); + echo $this->_make_calendar($options); + } + + /// PRIVATE SECTION + + function _field_id($id) { return 'f-calendar-field-' . $id; } + function _trigger_id($id) { return 'f-calendar-trigger-' . $id; } + function _gen_id() { static $id = 0; return ++$id; } + + function _make_js_hash($array) { + $jstr = ''; + reset($array); + while (list($key, $val) = each($array)) { + if (is_bool($val)) + $val = $val ? 'true' : 'false'; + else if (!is_numeric($val)) + $val = '"'.$val.'"'; + if ($jstr) $jstr .= ','; + $jstr .= '"' . $key . '":' . $val; + } + return $jstr; + } + + function _make_html_attr($array) { + $attrstr = ''; + reset($array); + while (list($key, $val) = each($array)) { + $attrstr .= $key . '="' . $val . '" '; + } + return $attrstr; + } +}; + +?> \ No newline at end of file diff --git a/calendar/calendar.png b/calendar/calendar.png new file mode 100755 index 0000000..9ad750b Binary files /dev/null and b/calendar/calendar.png differ diff --git a/calendar/calendar_stripped.js b/calendar/calendar_stripped.js new file mode 100755 index 0000000..4fe03f1 --- /dev/null +++ b/calendar/calendar_stripped.js @@ -0,0 +1,14 @@ +/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo + * ----------------------------------------------------------- + * + * The DHTML Calendar, version 1.0 "It is happening again" + * + * Details and latest version at: + * www.dynarch.com/projects/calendar + * + * This script is developed by Dynarch.com. Visit us at www.dynarch.com. + * + * This script is distributed under the GNU Lesser General Public License. + * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html + */ + Calendar=function(firstDayOfWeek,dateStr,onSelected,onClose){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=onSelected||null;this.onClose=onClose||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof firstDayOfWeek=="number"?firstDayOfWeek:Calendar._FD;this.showsOtherMonths=false;this.dateStr=dateStr;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")Calendar._SDN_len=3;var ar=new Array();for(var i=8;i>0;){ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);}Calendar._SDN=ar;if(typeof Calendar._SMN_len=="undefined")Calendar._SMN_len=3;ar=new Array();for(var i=12;i>0;){ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);}Calendar._SMN=ar;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(el){var SL=0,ST=0;var is_div=/^div$/i.test(el.tagName);if(is_div&&el.scrollLeft)SL=el.scrollLeft;if(is_div&&el.scrollTop)ST=el.scrollTop;var r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){var tmp=this.getAbsolutePos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}return r;};Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}while(related){if(related==el){return true;}related=related.parentNode;}return false;};Calendar.removeClass=function(el,className){if(!(el&&el.className)){return;}var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}el.className=ar.join(" ");};Calendar.addClass=function(el,className){Calendar.removeClass(el,className);el.className+=" "+className;};Calendar.getElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.currentTarget;while(f.nodeType!=1||/^div$/i.test(f.tagName))f=f.parentNode;return f;};Calendar.getTargetElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.target;while(f.nodeType!=1)f=f.parentNode;return f;};Calendar.stopEvent=function(ev){ev||(ev=window.event);if(Calendar.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}return false;};Calendar.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Calendar.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Calendar.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS("http://www.w3.org/1999/xhtml",type);}else{el=document.createElement(type);}if(typeof parent!="undefined"){parent.appendChild(el);}return el;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(el){if(typeof el.month!="undefined"){return el;}else if(typeof el.parentNode.month!="undefined"){return el.parentNode;}return null;};Calendar.findYear=function(el){if(typeof el.year!="undefined"){return el;}else if(typeof el.parentNode.year!="undefined"){return el.parentNode;}return null;};Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var mc=cal.monthsCombo;if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}if(cal.activeMonth){Calendar.removeClass(cal.activeMonth,"active");}var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active");cal.activeMonth=mon;var s=mc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var mcw=mc.offsetWidth;if(typeof mcw=="undefined")mcw=50;s.left=(cd.offsetLeft+cd.offsetWidth-mcw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";};Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var yc=cal.yearsCombo;if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}if(cal.activeYear){Calendar.removeClass(cal.activeYear,"active");}cal.activeYear=null;var Y=cal.date.getFullYear()+(fwd?1:-1);var yr=yc.firstChild;var show=false;for(var i=12;i>0;--i){if(Y>=cal.minYear&&Y<=cal.maxYear){yr.innerHTML=Y;yr.year=Y;yr.style.display="block";show=true;}else{yr.style.display="none";}yr=yr.nextSibling;Y+=fwd?cal.yearStep:-cal.yearStep;}if(show){var s=yc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var ycw=yc.offsetWidth;if(typeof ycw=="undefined")ycw=50;s.left=(cd.offsetLeft+cd.offsetWidth-ycw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false;}if(cal.timeout){clearTimeout(cal.timeout);}var el=cal.activeDiv;if(!el){return false;}var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(!cal){return;}var el=cal.activeDiv;var target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el){Calendar.addClass(el,"hilite active");Calendar.addClass(el.parentNode,"rowhilite");}else{if(typeof el.navtype=="undefined"||(el.navtype!=50&&(el.navtype==0||Math.abs(el.navtype)>2)))Calendar.removeClass(el,"active");Calendar.removeClass(el,"hilite");Calendar.removeClass(el.parentNode,"rowhilite");}ev||(ev=window.event);if(el.navtype==50&&target!=el){var pos=Calendar.getAbsolutePos(el);var w=el.offsetWidth;var x=ev.clientX;var dx;var decrease=true;if(x>pos.x+w){dx=x-pos.x-w;decrease=false;}else dx=pos.x-x;if(dx<0)dx=0;var range=el._range;var current=el._current;var count=Math.floor(dx/10)%range.length;for(var i=range.length;--i>=0;)if(range[i]==current)break;while(count-->0)if(decrease){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();}var mon=Calendar.findMonth(target);if(mon){if(mon.month!=cal.date.getMonth()){if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}Calendar.addClass(mon,"hilite");cal.hilitedMonth=mon;}else if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}}else{if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}var year=Calendar.findYear(target);if(year){if(year.year!=cal.date.getFullYear()){if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}Calendar.addClass(year,"hilite");cal.hilitedYear=year;}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}return Calendar.stopEvent(ev);};Calendar.tableMouseDown=function(ev){if(Calendar.getTargetElement(ev)==Calendar.getElement(ev)){return Calendar.stopEvent(ev);}};Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!(cal&&cal.dragging)){return false;}var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posX=ev.pageX;posY=ev.pageY;}cal.hideShowCovered();var st=cal.element.style;st.left=(posX-cal.xOffs)+"px";st.top=(posY-cal.yOffs)+"px";return Calendar.stopEvent(ev);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}cal.hideShowCovered();};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300)with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver);}else addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp);}else if(cal.isPopup){cal._dragStart(ev);}if(el.navtype==-1||el.navtype==1){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else if(el.navtype==-2||el.navtype==2){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);if(Calendar.isRelated(el,ev)||Calendar._C||el.disabled){return false;}if(el.ttip){if(el.ttip.substr(0,1)=="_"){el.ttip=el.caldate.print(el.calendar.ttDateFormat)+el.ttip.substr(1);}el.calendar.tooltips.innerHTML=el.ttip;}if(el.navtype!=300){Calendar.addClass(el,"hilite");if(el.caldate){Calendar.addClass(el.parentNode,"rowhilite");}}return Calendar.stopEvent(ev);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled)return false;removeClass(el,"hilite");if(el.caldate)removeClass(el.parentNode,"rowhilite");if(el.calendar)el.calendar.tooltips.innerHTML=_TT["SEL_DATE"];return stopEvent(ev);}};Calendar.cellClick=function(el,ev){var cal=el.calendar;var closing=false;var newdate=false;var date=null;if(typeof el.navtype=="undefined"){if(cal.currentDateEl){Calendar.removeClass(cal.currentDateEl,"selected");Calendar.addClass(el,"selected");closing=(cal.currentDateEl==el);if(!closing){cal.currentDateEl=el;}}cal.date.setDateOnly(el.caldate);date=cal.date;var other_month=!(cal.dateClicked=!el.otherMonth);if(!other_month&&!cal.currentDateEl)cal._toggleMultipleDate(new Date(date));else newdate=!el.disabled;if(other_month)cal._init(cal.firstDayOfWeek,date);}else{if(el.navtype==200){Calendar.removeClass(el,"hilite");cal.callCloseHandler();return;}date=new Date(cal.date);if(el.navtype==0)date.setDateOnly(new Date());cal.dateClicked=false;var year=date.getFullYear();var mon=date.getMonth();function setMonth(m){var day=date.getDate();var max=date.getMonthDays(m);if(day>max){date.setDate(max);}date.setMonth(m);};switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT["ABOUT"];if(typeof text!="undefined"){text+=cal.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{text="Help and about box text is not translated into this language.\n"+"If you know this language and you feel generous please update\n"+"the corresponding file in \"lang\" subdir to match calendar-en.js\n"+"and send it back to to get it into the distribution ;-)\n\n"+"Thank you!\n"+"http://dynarch.com/mishoo/calendar.epl\n";}alert(text);return;case-2:if(year>cal.minYear){date.setFullYear(year-1);}break;case-1:if(mon>0){setMonth(mon-1);}else if(year-->cal.minYear){date.setFullYear(year);setMonth(11);}break;case 1:if(mon<11){setMonth(mon+1);}else if(year=0;)if(range[i]==current)break;if(ev&&ev.shiftKey){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();return;case 0:if((typeof cal.getDateStatus=="function")&&cal.getDateStatus(date,date.getFullYear(),date.getMonth(),date.getDate())){return false;}break;}if(!date.equalsTo(cal.date)){cal.setDate(date);newdate=true;}else if(el.navtype==0)newdate=closing=true;}if(newdate){ev&&cal.callHandler();}if(closing){Calendar.removeClass(el,"hilite");ev&&cal.callCloseHandler();}};Calendar.prototype.create=function(_par){var parent=null;if(!_par){parent=document.getElementsByTagName("body")[0];this.isPopup=true;}else{parent=_par;this.isPopup=false;}this.date=this.dateStr?new Date(this.dateStr):new Date();var table=Calendar.createElement("table");this.table=table;table.cellSpacing=0;table.cellPadding=0;table.calendar=this;Calendar.addEvent(table,"mousedown",Calendar.tableMouseDown);var div=Calendar.createElement("div");this.element=div;div.className="calendar";if(this.isPopup){div.style.position="absolute";div.style.display="none";}div.appendChild(table);var thead=Calendar.createElement("thead",table);var cell=null;var row=null;var cal=this;var hh=function(text,cs,navtype){cell=Calendar.createElement("td",row);cell.colSpan=cs;cell.className="button";if(navtype!=0&&Math.abs(navtype)<=2)cell.className+=" nav";Calendar._add_evs(cell);cell.calendar=cal;cell.navtype=navtype;cell.innerHTML="
"+text+"
";return cell;};row=Calendar.createElement("tr",thead);var title_length=6;(this.isPopup)&&--title_length;(this.weekNumbers)&&++title_length;hh("?",1,400).ttip=Calendar._TT["INFO"];this.title=hh("",title_length,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT["DRAG_TO_MOVE"];this.title.style.cursor="move";hh("×",1,200).ttip=Calendar._TT["CLOSE"];}row=Calendar.createElement("tr",thead);row.className="headrow";this._nav_py=hh("«",1,-2);this._nav_py.ttip=Calendar._TT["PREV_YEAR"];this._nav_pm=hh("‹",1,-1);this._nav_pm.ttip=Calendar._TT["PREV_MONTH"];this._nav_now=hh(Calendar._TT["TODAY"],this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT["GO_TODAY"];this._nav_nm=hh("›",1,1);this._nav_nm.ttip=Calendar._TT["NEXT_MONTH"];this._nav_ny=hh("»",1,2);this._nav_ny.ttip=Calendar._TT["NEXT_YEAR"];row=Calendar.createElement("tr",thead);row.className="daynames";if(this.weekNumbers){cell=Calendar.createElement("td",row);cell.className="name wn";cell.innerHTML=Calendar._TT["WK"];}for(var i=7;i>0;--i){cell=Calendar.createElement("td",row);if(!i){cell.navtype=100;cell.calendar=this;Calendar._add_evs(cell);}}this.firstdayname=(this.weekNumbers)?row.firstChild.nextSibling:row.firstChild;this._displayWeekdays();var tbody=Calendar.createElement("tbody",table);this.tbody=tbody;for(i=6;i>0;--i){row=Calendar.createElement("tr",tbody);if(this.weekNumbers){cell=Calendar.createElement("td",row);}for(var j=7;j>0;--j){cell=Calendar.createElement("td",row);cell.calendar=this;Calendar._add_evs(cell);}}if(this.showsTime){row=Calendar.createElement("tr",tbody);row.className="time";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;cell.innerHTML=Calendar._TT["TIME"]||" ";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=this.weekNumbers?4:3;(function(){function makeTimePart(className,init,range_start,range_end){var part=Calendar.createElement("span",cell);part.className=className;part.innerHTML=init;part.calendar=cal;part.ttip=Calendar._TT["TIME_PART"];part.navtype=50;part._range=[];if(typeof range_start!="number")part._range=range_start;else{for(var i=range_start;i<=range_end;++i){var txt;if(i<10&&range_end>=10)txt='0'+i;else txt=''+i;part._range[part._range.length]=txt;}}Calendar._add_evs(part);return part;};var hrs=cal.date.getHours();var mins=cal.date.getMinutes();var t12=!cal.time24;var pm=(hrs>12);if(t12&&pm)hrs-=12;var H=makeTimePart("hour",hrs,t12?1:0,t12?12:23);var span=Calendar.createElement("span",cell);span.innerHTML=":";span.className="colon";var M=makeTimePart("minute",mins,0,59);var AP=null;cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;if(t12)AP=makeTimePart("ampm",pm?"pm":"am",["am","pm"]);else cell.innerHTML=" ";cal.onSetTime=function(){var pm,hrs=this.date.getHours(),mins=this.date.getMinutes();if(t12){pm=(hrs>=12);if(pm)hrs-=12;if(hrs==0)hrs=12;AP.innerHTML=pm?"pm":"am";}H.innerHTML=(hrs<10)?("0"+hrs):hrs;M.innerHTML=(mins<10)?("0"+mins):mins;};cal.onUpdateTime=function(){var date=this.date;var h=parseInt(H.innerHTML,10);if(t12){if(/pm/i.test(AP.innerHTML)&&h<12)h+=12;else if(/am/i.test(AP.innerHTML)&&h==12)h=0;}var d=date.getDate();var m=date.getMonth();var y=date.getFullYear();date.setHours(h);date.setMinutes(parseInt(M.innerHTML,10));date.setFullYear(y);date.setMonth(m);date.setDate(d);this.dateClicked=false;this.callHandler();};})();}else{this.onSetTime=this.onUpdateTime=function(){};}var tfoot=Calendar.createElement("tfoot",table);row=Calendar.createElement("tr",tfoot);row.className="footrow";cell=hh(Calendar._TT["SEL_DATE"],this.weekNumbers?8:7,300);cell.className="ttip";if(this.isPopup){cell.ttip=Calendar._TT["DRAG_TO_MOVE"];cell.style.cursor="move";}this.tooltips=cell;div=Calendar.createElement("div",this.element);this.monthsCombo=div;div.className="combo";for(i=0;i0;--i){var yr=Calendar.createElement("div");yr.className=Calendar.is_ie?"label-IEfix":"label";div.appendChild(yr);}this._init(this.firstDayOfWeek,this.date);parent.appendChild(this.element);};Calendar._keyEvent=function(ev){var cal=window._dynarch_popupCalendar;if(!cal||cal.multiple)return false;(Calendar.is_ie)&&(ev=window.event);var act=(Calendar.is_ie||ev.type=="keypress"),K=ev.keyCode;if(ev.ctrlKey){switch(K){case 37:act&&Calendar.cellClick(cal._nav_pm);break;case 38:act&&Calendar.cellClick(cal._nav_py);break;case 39:act&&Calendar.cellClick(cal._nav_nm);break;case 40:act&&Calendar.cellClick(cal._nav_ny);break;default:return false;}}else switch(K){case 32:Calendar.cellClick(cal._nav_now);break;case 27:act&&cal.callCloseHandler();break;case 37:case 38:case 39:case 40:if(act){var prev,x,y,ne,el,step;prev=K==37||K==38;step=(K==37||K==39)?1:7;function setVars(){el=cal.currentDateEl;var p=el.pos;x=p&15;y=p>>4;ne=cal.ar_days[y][x];};setVars();function prevMonth(){var date=new Date(cal.date);date.setDate(date.getDate()-step);cal.setDate(date);};function nextMonth(){var date=new Date(cal.date);date.setDate(date.getDate()+step);cal.setDate(date);};while(1){switch(K){case 37:if(--x>=0)ne=cal.ar_days[y][x];else{x=6;K=38;continue;}break;case 38:if(--y>=0)ne=cal.ar_days[y][x];else{prevMonth();setVars();}break;case 39:if(++x<7)ne=cal.ar_days[y][x];else{x=0;K=40;continue;}break;case 40:if(++ythis.maxYear){year=this.maxYear;date.setFullYear(year);}this.firstDayOfWeek=firstDayOfWeek;this.date=new Date(date);var month=date.getMonth();var mday=date.getDate();var no_days=date.getMonthDays();date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;if(day1<0)day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.tbody.firstChild;var MN=Calendar._SMN[month];var ar_days=this.ar_days=new Array();var weekend=Calendar._TT["WEEKEND"];var dates=this.multiple?(this.datesCells={}):null;for(var i=0;i<6;++i,row=row.nextSibling){var cell=row.firstChild;if(this.weekNumbers){cell.className="day wn";cell.innerHTML=date.getWeekNumber();cell=cell.nextSibling;}row.className="daysrow";var hasdays=false,iday,dpos=ar_days[i]=[];for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(iday+1)){iday=date.getDate();var wday=date.getDay();cell.className="day";cell.pos=i<<4|j;dpos[j]=cell;var current_month=(date.getMonth()==month);if(!current_month){if(this.showsOtherMonths){cell.className+=" othermonth";cell.otherMonth=true;}else{cell.className="emptycell";cell.innerHTML=" ";cell.disabled=true;continue;}}else{cell.otherMonth=false;hasdays=true;}cell.disabled=false;cell.innerHTML=this.getDateText?this.getDateText(date,iday):iday;if(dates)dates[date.print("%Y%m%d")]=cell;if(this.getDateStatus){var status=this.getDateStatus(date,year,month,iday);if(this.getDateToolTip){var toolTip=this.getDateToolTip(date,year,month,iday);if(toolTip)cell.title=toolTip;}if(status===true){cell.className+=" disabled";cell.disabled=true;}else{if(/disabled/i.test(status))cell.disabled=true;cell.className+=" "+status;}}if(!cell.disabled){cell.caldate=new Date(date);cell.ttip="_";if(!this.multiple&¤t_month&&iday==mday&&this.hiliteToday){cell.className+=" selected";this.currentDateEl=cell;}if(date.getFullYear()==TY&&date.getMonth()==TM&&iday==TD){cell.className+=" today";cell.ttip+=Calendar._TT["PART_TODAY"];}if(weekend.indexOf(wday.toString())!=-1)cell.className+=cell.otherMonth?" oweekend":" weekend";}}if(!(hasdays||this.showsOtherMonths))row.className="emptyrow";}this.title.innerHTML=Calendar._MN[month]+", "+year;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates();};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var i in this.multiple){var cell=this.datesCells[i];var d=this.multiple[i];if(!d)continue;if(cell)cell.className+=" selected";}}};Calendar.prototype._toggleMultipleDate=function(date){if(this.multiple){var ds=date.print("%Y%m%d");var cell=this.datesCells[ds];if(cell){var d=this.multiple[ds];if(!d){Calendar.addClass(cell,"selected");this.multiple[ds]=date;}else{Calendar.removeClass(cell,"selected");delete this.multiple[ds];}}}};Calendar.prototype.setDateToolTipHandler=function(unaryFunction){this.getDateToolTip=unaryFunction;};Calendar.prototype.setDate=function(date){if(!date.equalsTo(this.date)){this._init(this.firstDayOfWeek,date);}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date);};Calendar.prototype.setFirstDayOfWeek=function(firstDayOfWeek){this._init(firstDayOfWeek,this.date);this._displayWeekdays();};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(unaryFunction){this.getDateStatus=unaryFunction;};Calendar.prototype.setRange=function(a,z){this.minYear=a;this.maxYear=z;};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat));}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this);}this.hideShowCovered();};Calendar.prototype.destroy=function(){var el=this.element.parentNode;el.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null;};Calendar.prototype.reparent=function(new_parent){var el=this.element;el.parentNode.removeChild(el);new_parent.appendChild(el);};Calendar._checkCalendar=function(ev){var calendar=window._dynarch_popupCalendar;if(!calendar){return false;}var el=Calendar.is_ie?Calendar.getElement(ev):Calendar.getTargetElement(ev);for(;el!=null&&el!=calendar.element;el=el.parentNode);if(el==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(ev);}};Calendar.prototype.show=function(){var rows=this.table.getElementsByTagName("tr");for(var i=rows.length;i>0;){var row=rows[--i];Calendar.removeClass(row,"rowhilite");var cells=row.getElementsByTagName("td");for(var j=cells.length;j>0;){var cell=cells[--j];Calendar.removeClass(cell,"hilite");Calendar.removeClass(cell,"active");}}this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar);}this.hideShowCovered();};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar);}this.element.style.display="none";this.hidden=true;this.hideShowCovered();};Calendar.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px";s.top=y+"px";this.show();};Calendar.prototype.showAtElement=function(el,opts){var self=this;var p=Calendar.getAbsolutePos(el);if(!opts||typeof opts!="string"){this.showAt(p.x,p.y+el.offsetHeight);return true;}function fixPosition(box){if(box.x<0)box.x=0;if(box.y<0)box.y=0;var cp=document.createElement("div");var s=cp.style;s.position="absolute";s.right=s.bottom=s.width=s.height="0px";document.body.appendChild(cp);var br=Calendar.getAbsolutePos(cp);document.body.removeChild(cp);if(Calendar.is_ie){br.y+=document.body.scrollTop;br.x+=document.body.scrollLeft;}else{br.y+=window.scrollY;br.x+=window.scrollX;}var tmp=box.x+box.width-br.x;if(tmp>0)box.x-=tmp;tmp=box.y+box.height-br.y;if(tmp>0)box.y-=tmp;};this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var w=self.element.offsetWidth;var h=self.element.offsetHeight;self.element.style.display="none";var valign=opts.substr(0,1);var halign="l";if(opts.length>1){halign=opts.substr(1,1);}switch(valign){case "T":p.y-=h;break;case "B":p.y+=el.offsetHeight;break;case "C":p.y+=(el.offsetHeight-h)/2;break;case "t":p.y+=el.offsetHeight-h;break;case "b":break;}switch(halign){case "L":p.x-=w;break;case "R":p.x+=el.offsetWidth;break;case "C":p.x+=(el.offsetWidth-w)/2;break;case "l":p.x+=el.offsetWidth-w;break;case "r":break;}p.width=w;p.height=h+40;self.monthsCombo.style.display="none";fixPosition(p);self.showAt(p.x,p.y);};if(Calendar.is_khtml)setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10);else Calendar.continuation_for_the_fucking_khtml_browser();};Calendar.prototype.setDateFormat=function(str){this.dateFormat=str;};Calendar.prototype.setTtDateFormat=function(str){this.ttDateFormat=str;};Calendar.prototype.parseDate=function(str,fmt){if(!fmt)fmt=this.dateFormat;this.setDate(Date.parseDate(str,fmt));};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera)return;function getVisib(obj){var value=obj.style.visibility;if(!value){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml)value=document.defaultView. getComputedStyle(obj,"").getPropertyValue("visibility");else value='';}else if(obj.currentStyle){value=obj.currentStyle.visibility;}else value='';}return value;};var tags=new Array("applet","iframe","select");var el=this.element;var p=Calendar.getAbsolutePos(el);var EX1=p.x;var EX2=el.offsetWidth+EX1;var EY1=p.y;var EY2=el.offsetHeight+EY1;for(var k=tags.length;k>0;){var ar=document.getElementsByTagName(tags[--k]);var cc=null;for(var i=ar.length;i>0;){cc=ar[--i];p=Calendar.getAbsolutePos(cc);var CX1=p.x;var CX2=cc.offsetWidth+CX1;var CY1=p.y;var CY2=cc.offsetHeight+CY1;if(this.hidden||(CX1>EX2)||(CX2EY2)||(CY229)?1900:2000);break;case "%b":case "%B":for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}break;case "%H":case "%I":case "%k":case "%l":hr=parseInt(a[i],10);break;case "%P":case "%p":if(/pm/i.test(a[i])&&hr<12)hr+=12;else if(/am/i.test(a[i])&&hr>=12)hr-=12;break;case "%M":min=parseInt(a[i],10);break;}}if(isNaN(y))y=today.getFullYear();if(isNaN(m))m=today.getMonth();if(isNaN(d))d=today.getDate();if(isNaN(hr))hr=today.getHours();if(isNaN(min))min=today.getMinutes();if(y!=0&&m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);y=0;m=-1;d=0;for(i=0;i31&&y==0){y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);}else if(d==0){d=a[i];}}if(y==0)y=today.getFullYear();if(m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);return today;};Date.prototype.getMonthDays=function(month){var year=this.getFullYear();if(typeof month=="undefined"){month=this.getMonth();}if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&month==1){return 29;}else{return Date._MD[month];}};Date.prototype.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new Date(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};Date.prototype.getWeekNumber=function(){var d=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};Date.prototype.equalsTo=function(date){return((this.getFullYear()==date.getFullYear())&&(this.getMonth()==date.getMonth())&&(this.getDate()==date.getDate())&&(this.getHours()==date.getHours())&&(this.getMinutes()==date.getMinutes()));};Date.prototype.setDateOnly=function(date){var tmp=new Date(date);this.setDate(1);this.setFullYear(tmp.getFullYear());this.setMonth(tmp.getMonth());this.setDate(tmp.getDate());};Date.prototype.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Calendar._SDN[w];s["%A"]=Calendar._DN[w];s["%b"]=Calendar._SMN[m];s["%B"]=Calendar._MN[m];s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?"PM":"AM";s["%P"]=pm?"pm":"am";s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";var re=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml)return str.replace(re,function(par){return s[par]||par;});var a=str.match(re);for(var i=0;i + +How to include additional info in day cells + + + + + + + + +

How to include additional info in day cells

+ +
+ + + +

The idea is simple:

+ +
    +
  1. +

    Define a callback that takes two parameters like this:

    +
    function getDateText(date, d)
    +

    + This function will receive the date object as the first + parameter and the current date number (1..31) as the second (you + can get it as well by calling date.getDate() but since it's very + probably useful I thought I'd pass it too so that we can avoid a + function call). +

    +

    + This function must return the text to be inserted in + the cell of the passed date. That is, one should at least + "return d;". +

    +
  2. +
  3. + Pass the above function as the "dateText" parameter to + Calendar.setup. +
  4. +
+ +

+ The function could simply look like: +

+ +
  function getDateText(date, d) {
+    if (d == 12) {
+      return "12th";
+    } else if (d == 13) {
+      return "bad luck";
+    } /* ... etc ... */
+  }
+ +

+ but it's easy to imagine that this approach sucks. For a better + way, see the source of this page and note the usage of an externally + defined "dateText" object which maps "date" to "date info", also + taking into account the year and month. This object can be easily + generated from a database, and the getDateText function becomes + extremely simple (and static). +

+ +

+ Cheers! +

+ +
+
mishoo
+ Last modified: Sat Mar 5 17:18:06 EET 2005 + diff --git a/calendar/doc/html/field-button.jpg b/calendar/doc/html/field-button.jpg new file mode 100755 index 0000000..ecbe9d8 Binary files /dev/null and b/calendar/doc/html/field-button.jpg differ diff --git a/calendar/doc/html/reference-Z-S.css b/calendar/doc/html/reference-Z-S.css new file mode 100755 index 0000000..02a6f88 --- /dev/null +++ b/calendar/doc/html/reference-Z-S.css @@ -0,0 +1,193 @@ + + body { + color: black; + /* background-color: #e5e5e5;*/ + background-color: #ffffff; + /*background-color: beige;*/ + margin-top: 2em; + margin-left: 8%; + margin-right: 8%; + } + + h1,h2,h3,h4,h5,h6 { + margin-top: .5em; + } + + .title { + font-size: 200%; + font-weight: normal; + } + + .partheading { + font-size: 100%; + } + + .chapterheading { + font-size: 100%; + } + + .beginsection { + font-size: 110%; + } + + .tiny { + font-size: 40%; + } + + .scriptsize { + font-size: 60%; + } + + .footnotesize { + font-size: 75%; + } + + .small { + font-size: 90%; + } + + .normalsize { + font-size: 100%; + } + + .large { + font-size: 120%; + } + + .largecap { + font-size: 150%; + } + + .largeup { + font-size: 200%; + } + + .huge { + font-size: 300%; + } + + .hugecap { + font-size: 350%; + } + + pre { + margin-left: 2em; + } + + blockquote { + margin-left: 2em; + } + + ol { + list-style-type: decimal; + } + + ol ol { + list-style-type: lower-alpha; + } + + ol ol ol { + list-style-type: lower-roman; + } + + ol ol ol ol { + list-style-type: upper-alpha; + } + + /* + .verbatim { + color: #4d0000; + } + */ + + tt i { + font-family: serif; + } + + .verbatim em { + font-family: serif; + } + + .scheme em { + font-family: serif; + color: black; + } + + .scheme { + color: brown; + } + + .scheme .keyword { + color: #990000; + font-weight: bold; + } + + .scheme .builtin { + color: #990000; + } + + .scheme .variable { + color: navy; + } + + .scheme .global { + color: purple; + } + + .scheme .selfeval { + color: green; + } + + .scheme .comment { + color: teal; + } + + .schemeresponse { + color: green; + } + + .navigation { + color: red; + text-align: right; + font-size: medium; + font-style: italic; + } + + .disable { + /* color: #e5e5e5; */ + color: gray; + } + + .smallcaps { + font-size: 75%; + } + + .smallprint { + color: gray; + font-size: 75%; + text-align: right; + } + + /* + .smallprint hr { + text-align: left; + width: 40%; + } + */ + + .footnoterule { + text-align: left; + width: 40%; + } + + .colophon { + color: gray; + font-size: 80%; + text-align: right; + } + + .colophon a { + color: gray; + } + + \ No newline at end of file diff --git a/calendar/doc/html/reference.css b/calendar/doc/html/reference.css new file mode 100755 index 0000000..42e9283 --- /dev/null +++ b/calendar/doc/html/reference.css @@ -0,0 +1,34 @@ +html { margin: 0px; padding: 0px; background-color: #08f; color: #444; font-family: georgia,serif; } +body { margin: 2em 8%; background-color: #fff; padding: 1em; border: 2px ridge #048; } + +a:link, a:visited { text-decoration: none; color: #00f; } +a:hover { color: #f00; text-decoration: underline; } +a:active { color: #f84; } + +h1, h2, h3, h4, h5, h6 { font-family: tahoma,verdana,sans-serif; } + +h2, h3 { font-weight: normal; } + +h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover { text-decoration: none; } + +h1 { font-size: 170%; border: 2px ridge #048; letter-spacing: 2px; color: #000; margin-left: -2em; margin-right: -2em; +background-color: #fff; padding: 2px 1em; background-color: #def; } +h2 { font-size: 140%; color: #222; } +h3 { font-size: 120%; color: #444; } + +h1.title { font-size: 300%; font-family: georgia,serif; font-weight: normal; color: #846; letter-spacing: -1px; +border: none; +padding: none; +background-color: #fff; +border-bottom: 3px double #624; padding-bottom: 2px; margin-left: 8%; margin-right: 8%; } + +.colophon { padding-top: 2em; color: #999; font-size: 90%; font-family: georgia,"times new roman",serif; } +.colophon a:link, .colophon a:visited { color: #755; } +.colophon a:hover { color: #422; text-decoration: underline; } + +.footnote { font-size: 90%; font-style: italic; font-family: georgia,"times new roman",serif; margin: 0px 3em; } +.footnote sup { font-size: 120%; padding: 0px 0.3em; position: relative; top: -0.2em; } + +.small { font-size: 90%; } + +.verbatim { background-color: #eee; padding: 0.2em 1em; border: 1px solid #aaa; } diff --git a/calendar/doc/html/reference.html b/calendar/doc/html/reference.html new file mode 100755 index 0000000..2723533 --- /dev/null +++ b/calendar/doc/html/reference.html @@ -0,0 +1,1738 @@ + + + + + +DHTML Calendar Widget + + + + + + +

+

+

+

+

+

+

+

+

+

+

+

+

+ + + + +

+

+ + +

+

+

+

+

+



DHTML Calendar Widget

+

+
+Mihai Bazon, <mihai_bazon@yahoo.com>
+© Dynarch.com 2002-2005, www.dynarch.com

March 7, 2005

+

+

+calendar version: 1.0 ``It is happening again'' +

+
+

+

+$Id: reference.tex,v 1.23 2005/03/05 11:37:14 mishoo Exp $ +

+
+
+ +
+ +
+ +

Contents

+

+

+    1  Overview
+        1.1  How does this thing work?
+        1.2  Project files
+        1.3  License
+

+

+    2  Quick startup
+        2.1  Installing a popup calendar
+        2.2  Installing a flat calendar
+        2.3  Calendar.setup in detail
+

+

+    3  Recipes
+        3.1  Popup calendars
+            3.1.1  Simple text field with calendar attached to a button
+            3.1.2  Simple field with calendar attached to an image
+            3.1.3  Hidden field, plain text triggers
+            3.1.4  2 Linked fields, no trigger buttons
+        3.2  Flat calendars
+        3.3  Highlight special dates
+        3.4  Select multiple dates
+

+

+    4  The Calendar object overview
+        4.1  Creating a calendar
+        4.2  Order does matter ;-)
+        4.3  Caching the object
+        4.4  Callback functions
+

+

+    5  The Calendar object API reference
+        5.1  Calendar constructor
+        5.2  Useful member variables (properties)
+        5.3  Public methods
+            5.3.1  Calendar.create
+            5.3.2  Calendar.callHandler
+            5.3.3  Calendar.callCloseHandler
+            5.3.4  Calendar.hide
+            5.3.5  Calendar.setDateFormat
+            5.3.6  Calendar.setTtDateFormat
+            5.3.7  Calendar.setDisabledHandler
+            5.3.8  Calendar.setDateStatusHandler
+            5.3.9  Calendar.show
+            5.3.10  Calendar.showAt
+            5.3.11  Calendar.showAtElement
+            5.3.12  Calendar.setDate
+            5.3.13  Calendar.setFirstDayOfWeek
+            5.3.14  Calendar.parseDate
+            5.3.15  Calendar.setRange
+

+

+    6  Side effects
+

+

+    7  Credits
+

+

+

+

+

+ +

1  Overview

+

The DHTML Calendar widget1 +is an (HTML) user interface element that gives end-users a friendly way to +select date and time. It works in a web browser. The first versions only provided +support for popup calendars, while starting with version 0.9 it also supports +``flat'' display. A ``flat'' calendar is a calendar that stays visible in the +page all the time. In this mode it could be very useful for ``blog'' pages and +other pages that require the calendar to be always present.

+

+The calendar is compatible with most popular browsers nowadays. While it's +created using web standards and it should generally work with any compliant +browser, the following browsers were found to work: Mozilla/Firefox (the +development platform), Netscape 6.0 or better, all other Gecko-based browsers, +Internet Explorer 5.0 or better for Windows2, Opera 73, Konqueror 3.1.2 and Apple Safari for +MacOSX.

+

+You can find the latest info and version at the calendar homepage:

+

+

+ +

+

+ +

1.1  How does this thing work?

+

DHTML is not ``another kind of HTML''. It's merely a naming convention. DHTML +refers to the combination of HTML, CSS, JavaScript and DOM. DOM (Document +Object Model) is a set of interfaces that glues the other three together. In +other words, DOM allows dynamic modification of an HTML page through a program. +JavaScript is our programming language, since that's what browsers like. CSS +is a way to make it look good ;-). So all this soup is generically known as +DHTML.

+

+Using DOM calls, the program dynamically creates a <table> element +that contains a calendar for the given date and then inserts it in the document +body. Then it shows this table at a specified position. Usually the position +is related to some element in which the date needs to be displayed/entered, +such as an input field.

+

+By assigning a certain CSS class to the table we can control the look of the +calendar through an external CSS file; therefore, in order to change the +colors, backgrounds, rollover effects and other stuff, you can only change a +CSS file -- modification of the program itself is not necessary.

+

+

+ +

1.2  Project files

+

Here's a description of the project files, excluding documentation and example +files.

+

+

+

    +

    +
  • the main program file (calendar.js). This defines all the logic +behind the calendar widget.

    +

    +

    +
  • the CSS files (calendar-*.css). Loading one of them is +necessary in order to see the calendar as intended.

    +

    +

    +
  • the language definition files (lang/calendar-*.js). They are +plain JavaScript files that contain all texts that are displayed by the +calendar. Loading one of them is necessary.

    +

    +

    +
  • helper functions for quick setup of the calendar +(calendar-setup.js). You can do fine without it, but starting with +version 0.9.3 this is the recommended way to setup a calendar.

    +

    +

    +

+

+

+ +

1.3  License

+

+
+ +© Dynarch.com 2002-2005, +www.dynarch.com +Author: Mihai Bazon +
+

+The calendar is released under the +GNU Lesser General Public License.

+

+

+ +

2  Quick startup

+

+

+Installing the calendar used to be quite a task until version 0.9.3. Starting +with 0.9.3 I have included the file calendar-setup.js whose goal is to +assist you to setup a popup or flat calendar in minutes. You are +encouraged to modify this file and not calendar.js if you need +extra customization, but you're on your own.

+

+First you have to include the needed scripts and style-sheet. Make sure you do +this in your document's <head> section, also make sure you put the +correct paths to the scripts.

+

+

+
<style type="text/css">@import url(calendar-win2k-1.css);</style>
+<script type="text/javascript" src="calendar.js"></script>
+<script type="text/javascript" src="lang/calendar-en.js"></script>
+<script type="text/javascript" src="calendar-setup.js"></script>
+

+

+

+ +

2.1  Installing a popup calendar

+

+

+Now suppose you have the following HTML:

+

+

+
<form ...>
+  <input type="text" id="data" name="data" />
+  <button id="trigger">...</button>
+</form>
+

+

+You want the button to popup a calendar widget when clicked? Just +insert the following code immediately after the HTML form:

+

+

+
<script type="text/javascript">
+  Calendar.setup(
+    {
+      inputField  : "data",         // ID of the input field
+      ifFormat    : "%m %d, %Y",    // the date format
+      button      : "trigger"       // ID of the button
+    }
+  );
+</script>
+

+

+The Calendar.setup function, defined in calendar-setup.js +takes care of ``patching'' the button to display a calendar when clicked. The +calendar is by default in single-click mode and linked with the given input +field, so that when the end-user selects a date it will update the input field +with the date in the given format and close the calendar. If you are a +long-term user of the calendar you probably remember that for doing this you +needed to write a couple functions and add an ``onclick'' handler for the +button by hand.

+

+By looking at the example above we can see that the function +Calendar.setup receives only one parameter: a JavaScript object. +Further, that object can have lots of properties that tell to the setup +function how would we like to have the calendar. For instance, if we would +like a calendar that closes at double-click instead of single-click we would +also include the following: singleClick:false.

+

+For a list of all supported parameters please see the section +2.3.

+

+

+ +

2.2  Installing a flat calendar

+

+

+Here's how to configure a flat calendar, using the same Calendar.setup +function. First, you should have an empty element with an ID. This element +will act as a container for the calendar. It can be any block-level element, +such as DIV, TABLE, etc. We will use a DIV in this example.

+

+

+
<div id="calendar-container"></div>
+

+

+Then there is the JavaScript code that sets up the calendar into the +``calendar-container'' DIV. The code can occur anywhere in HTML +after the DIV element.

+

+

+
<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php"
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+

+

+

+ +

2.3  Calendar.setup in detail

+

+

+Following there is the complete list of properties interpreted by +Calendar.setup. All of them have default values, so you can pass only those +which you would like to customize. Anyway, you must pass at least one +of inputField, displayArea or button, for a popup +calendar, or flat for a flat calendar. Otherwise you will get a +warning message saying that there's nothing to setup.

+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
property type description default +
inputField +string The ID of your input field. +null +
displayArea +string This is the ID of a <span>, <div>, or any other element that you would like to use to display the current date. This is generally useful only if the input field is hidden, as an area to display the date. +null +
button +string The ID of the calendar ``trigger''. This is an element (ordinarily a button or an image) that will dispatch a certain event (usually ``click'') to the function that creates and displays the calendar. +null +
eventName +string The name of the event that will trigger the calendar. The name should be without the ``on'' prefix, such as ``click'' instead of ``onclick''. Virtually all users will want to let this have the default value (``click''). Anyway, it could be useful if, say, you want the calendar to appear when the input field is focused and have no trigger button (in this case use ``focus'' as the event name). +``click'' +
ifFormat +string The format string that will be used to enter the date in the input field. This format will be honored even if the input field is hidden. +``%Y/%m/%d'' +
daFormat +string Format of the date displayed in the displayArea (if specified). +``%Y/%m/%d'' +
singleClick +boolean Wether the calendar is in ``single-click mode'' or ``double-click mode''. If true (the default) the calendar will be created in single-click mode. +true +
disableFunc +function A function that receives a JS Date object. It should return +true if that date has to be disabled, false otherwise. +DEPRECATED (see below). +null +
dateStatusFunc +function A function that receives a JS Date object and returns a boolean +or a string. This function allows one to set a certain CSS class to some +date, therefore making it look different. If it returns true then +the date will be disabled. If it returns false nothing special +happens with the given date. If it returns a string then that will be taken +as a CSS class and appended to the date element. If this string is +``disabled'' then the date is also disabled (therefore is like returning +true). For more information please also refer to section +5.3.8. +null +
firstDay +integer Specifies which day is to be displayed as the first day of +week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday, ..., 6 +means Saturday. The end user can easily change this too, by clicking on the +day name in the calendar header. +0 +
weekNumbers +boolean If ``true'' then the calendar will display week numbers. +true +
align +string Alignment of the calendar, relative to the reference element. The +reference element is dynamically chosen like this: if a displayArea is +specified then it will be the reference element. Otherwise, the input field +is the reference element. For the meaning of the alignment characters +please section 5.3.11. +``Bl'' +
range +array An array having exactly 2 elements, integers. (!) The first [0] element is the minimum year that is available, and the second [1] element is the maximum year that the calendar will allow. +[1900, 2999] +
flat +string If you want a flat calendar, pass the ID of the parent object in +this property. If not, pass null here (or nothing at all as +null is the default value). +null +
flatCallback +function You should provide this function if the calendar is flat. It +will be called when the date in the calendar is changed with a reference to +the calendar object. See section 2.2 for an example +of how to setup a flat calendar. +null +
onSelect +function If you provide a function handler here then you have to manage +the ``click-on-date'' event by yourself. Look in the calendar-setup.js and +take as an example the onSelect handler that you can see there. +null +
onClose +function This handler will be called when the calendar needs to close. +You don't need to provide one, but if you do it's your responsibility to +hide/destroy the calendar. You're on your own. Check the calendar-setup.js +file for an example. +null +
onUpdate +function If you supply a function handler here, it will be called right +after the target field is updated with a new date. You can use this to +chain 2 calendars, for instance to setup a default date in the second just +after a date was selected in the first. +null +
date +date This allows you to setup an initial date where the calendar will be +positioned to. If absent then the calendar will open to the today date. +null +
showsTime +boolean If this is set to true then the calendar will also +allow time selection. +false +
timeFormat +string Set this to ``12'' or ``24'' to configure the way that the +calendar will display time. +``24'' +
electric +boolean Set this to ``false'' if you want the calendar to update the +field only when closed (by default it updates the field at each date change, +even if the calendar is not closed) true +
position +array Specifies the [x, y] position, relative to page's top-left corner, +where the calendar will be displayed. If not passed then the position will +be computed based on the ``align'' parameter. Defaults to ``null'' (not +used). null +
cache +boolean Set this to ``true'' if you want to cache the calendar object. +This means that a single calendar object will be used for all fields that +require a popup calendar false +
showOthers +boolean If set to ``true'' then days belonging to months overlapping +with the currently displayed month will also be displayed in the calendar +(but in a ``faded-out'' color) false + +
+ +

+

+ +

3  Recipes

+

This section presents some common ways to setup a calendar using the +Calendar.setup function detailed in the previous section.

+

+We don't discuss here about loading the JS or CSS code -- so make sure you +add the proper <script> and <style> or <link> elements in your +HTML code. Also, when we present input fields, please note that they should +be embedded in some form in order for data to be actually sent to server; we +don't discuss these things here because they are not related to our +calendar.

+

+

+ +

3.1  Popup calendars

+

These samples can be found in the file “simple-1.html” from the +calendar package.

+

+

+ +

3.1.1  Simple text field with calendar attached to a button

+

+

+This piece of code will create a calendar for a simple input field with a +button that will open the calendar when clicked.

+

+

+
<input type="text" name="date" id="f_date_b"
+       /><button type="reset" id="f_trigger_b"
+       >...</button>
+<script type="text/javascript">
+    Calendar.setup({
+        inputField     :    "f_date_b",           //*
+        ifFormat       :    "%m/%d/%Y %I:%M %p",
+        showsTime      :    true,
+        button         :    "f_trigger_b",        //*
+        step           :    1
+    });
+</script>
+

+

+Note that this code does more actually; the only required fields are +those marked with “//*” -- that is, the ID of the input field and the ID of +the button need to be passed to Calendar.setup in order for the +calendar to be properly assigned to this input field. As one can easily +guess from the argument names, the other arguments configure a certain date +format, instruct the calendar to also include a time selector and display +every year in the drop-down boxes (the “step” parameter) -- instead of showing +every other year as the default calendar does.

+

+

+ +

3.1.2  Simple field with calendar attached to an image

+

Same as the above, but the element that triggers the calendar is this time +an image, not a button.

+

+

+
<input type="text" name="date" id="f_date_c" readonly="1" />
+<img src="img.gif" id="f_trigger_c"
+     style="cursor: pointer; border: 1px solid red;"
+     title="Date selector"
+     onmouseover="this.style.background='red';"
+     onmouseout="this.style.background=''" />
+<script type="text/javascript">
+    Calendar.setup({
+        inputField     :    "f_date_c",
+        ifFormat       :    "%B %e, %Y",
+        button         :    "f_trigger_c",
+        align          :    "Tl",
+        singleClick    :    false
+    });
+</script>
+

+

+Note that the same 2 parameters are required as in the previous case; the +difference is that the 'button' parameter now gets the ID of the image +instead of the ID of the button. But the event is the same: at 'onclick' on +the element that is passed as 'button', the calendar will be shown.

+

+The above code additionally sets an alignment mode -- the parameters are +described in 5.3.11.

+

+

+ +

3.1.3  Hidden field, plain text triggers

+

Sometimes, to assure that the date is well formatted, you might want not to +allow the end user to write a date manually. This can easily be achieved +with an input field by setting its readonly attribute, which is +defined by the HTML4 standard; however, here's an even nicer approach: our +calendar widget allows you to use a hidden field as the way to pass data to +server, and a “display area” to show the end user the selected date. The +“display area” can be any HTML element, such as a DIV or a SPAN or +whatever -- we will use a SPAN in our sample.

+

+

+
<input type="hidden" name="date" id="f_date_d" />
+
+<p>Your birthday:
+   <span style="background-color: #ff8; cursor: default;"
+         onmouseover="this.style.backgroundColor='#ff0';"
+         onmouseout="this.style.backgroundColor='#ff8';"
+         id="show_d"
+   >Click to open date selector</span>.</p>
+
+<script type="text/javascript">
+    Calendar.setup({
+        inputField     :    "f_date_d",
+        ifFormat       :    "%Y/%d/%m",
+        displayArea    :    "show_d",
+        daFormat       :    "%A, %B %d, %Y",
+    });
+</script>
+

+

+The above code will configure a calendar attached to the hidden field and to +the SPAN having the id=“show_d”. When the SPAN element is clicked, the +calendar opens and allows the end user to chose a date. When the date is +chosen, the input field will be updated with the value in the format +“%Y/%d/%m”, and the SPAN element will display the date in a +friendlier format (defined by “daFormat”).

+

+Beware that using this approach will make your page unfunctional in browsers +that do not support JavaScript or our calendar.

+

+

+ +

3.1.4  2 Linked fields, no trigger buttons

+

Supposing you want to create 2 fields that hold an interval of exactly one +week. The first is the starting date, and the second is the ending date. +You want the fields to be automatically updated when some date is clicked in +one or the other, in order to keep exactly one week difference between them.

+

+

+
<input type="text" name="date" id="f_date_a" />
+<input type="text" name="date" id="f_calcdate" />
+
+<script type="text/javascript">
+    function catcalc(cal) {
+        var date = cal.date;
+        var time = date.getTime()
+        // use the _other_ field
+        var field = document.getElementById("f_calcdate");
+        if (field == cal.params.inputField) {
+            field = document.getElementById("f_date_a");
+            time -= Date.WEEK; // substract one week
+        } else {
+            time += Date.WEEK; // add one week
+        }
+        var date2 = new Date(time);
+        field.value = date2.print("%Y-%m-%d %H:%M");
+    }
+    Calendar.setup({
+        inputField     :    "f_date_a",
+        ifFormat       :    "%Y-%m-%d %H:%M",
+        showsTime      :    true,
+        timeFormat     :    "24",
+        onUpdate       :    catcalc
+    });
+    Calendar.setup({
+        inputField     :    "f_calcdate",
+        ifFormat       :    "%Y-%m-%d %H:%M",
+        showsTime      :    true,
+        timeFormat     :    "24",
+        onUpdate       :    catcalc
+    });
+</script>
+

+

+The above code will configure 2 input fields with calendars attached, as +usual. The first thing to note is that there's no trigger button -- in such +case, the calendar will popup when one clicks into the input field. Using +the onUpdate parameter, we pass a reference to a function of ours +that will get called after a date was selected. In that function we +determine what field was updated and we compute the date in the other input +field such that it keeps a one week difference between the two. Enjoy! :-)

+

+

+ +

3.2  Flat calendars

+

This sample can be found in “simple-2.html”. It will configure a +flat calendar that is always displayed in the page, in the DIV having the +id=“calendar-container”. When a date is clicked our function hander gets +called (dateChanged) and it will compute an URL to jump to based on +the selected date, then use window.location to visit the new link.

+

+

+
<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php"
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+

+

+

+ +

3.3  Highlight special dates

+

So you want to display certain dates in a different color, or with bold +font, or whatever, right? Well, no problem -- our calendar can do this as +well. It doesn't matter if it's a flat or popup calendar -- we'll use a flat +one for this sample. The idea, however, is that you need to have the dates +in an array or a JavaScript object -- whatever is suitable for your way of +thinking -- and use it from a function that returns a value, telling the +calendar what kind of date is the passed one.

+

+Too much talking, here's the code ;-)

+

+

+
<!-- this goes into the <head> tag -->
+<style type="text/css">
+  .special { background-color: #000; color: #fff; }
+</style>
+
+<!-- and the rest inside the <body> -->
+<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  var SPECIAL_DAYS = {
+    0 : [ 13, 24 ],		// special days in January
+    2 : [ 1, 6, 8, 12, 18 ],	// special days in March
+    8 : [ 21, 11 ]		// special days in September
+  };
+
+  function dateIsSpecial(year, month, day) {
+    var m = SPECIAL_DAYS[month];
+    if (!m) return false;
+    for (var i in m) if (m[i] == day) return true;
+    return false;
+  };
+
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php"
+    }
+  };
+
+  function ourDateStatusFunc(date, y, m, d) {
+    if (dateIsSpecial(y, m, d))
+      return "special"
+    else
+      return false; // other dates are enabled
+      // return true if you want to disable other dates
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged,          // our callback function
+      dateStatusFunc : ourDateStatusFunc
+    }
+  );
+</script>
+

+

+So the above code creates a normal flat calendar, like in the previous +sample. We hook into it with the function “ourDateStatusFunc”, +which receives a date object as the first argument, and also the year, +month, date as the next 3 arguments (normally, you can extract year, month, +date from the first parameter too, but we pass them separately for +convenience, as it's very likely that they are going to be used in this +function).

+

+So, this function receives a date. It can return false if you want +no special action to be taken on that date, true if that date +should be disabled (unselectable), or a string if you want to assign a +special CSS class to that date. We return “special” for the dates that we +want to highlight -- and note that we defined a “special” look for them in +the CSS section.

+

+I used a simple approach here to define what dates are special. There's a +JavaScript object (the SPECIAL_DAYS global variable) which holds an array +of dates for each month. Month numbers start at zero (January). Months +that don't contain special dates can be absent from this object. Note that +the way to implement this is completely separated from the calendar +code -- therefore, feel free to use your imagination if you have better +ideas. :-)

+

+

+ +

3.4  Select multiple dates

+

Starting version 1.0, the calendar is able to handle multiple dates +selection. You just need to pass the “multiple” parameter to +Calendar.setup and add some special code that interprets the +selection once the calendar is closed.

+

+

+
<a id="trigger" href="#">[open calendar...]</a>
+<div id="output"></div>
+<script type="text/javascript">//<![CDATA[
+    // the default multiple dates selected,
+    // first time the calendar is displayed
+    var MA = [];
+
+    function closed(cal) {
+
+      // here we'll write the output; this is only for example.  You
+      // will normally fill an input field or something with the dates.
+      var el = document.getElementById("output");
+
+      // reset initial content.
+      el.innerHTML = ""
+
+      // Reset the "MA", in case one triggers the calendar again.
+      // CAREFUL!  You don't want to do "MA = [];".  We need to modify
+      // the value of the current array, instead of creating a new one.
+      // Calendar.setup is called only once! :-)  So be careful.
+      MA.length = 0;
+
+      // walk the calendar's multiple dates selection hash
+      for (var i in cal.multiple) {
+        var d = cal.multiple[i];
+        // sometimes the date is not actually selected,
+        // so let's check
+        if (d) {
+          // OK, selected.  Fill an input field or something.
+          el.innerHTML += d.print("%A, %Y %B %d") + "<br />"
+          // and push it in the "MA", in case one triggers the calendar again.
+          MA[MA.length] = d;
+        }
+      }
+      cal.hide();
+      return true;
+    };
+
+    Calendar.setup({
+      align      : "BR",
+      showOthers : true,
+      multiple   : MA, // pass the initial or computed array of multiple dates
+      onClose    : closed,
+      button     : "trigger"
+    });
+//]]></script>
+

+

+The above code creates a popup calendar and passes to it an array of dates, +which is initially empty, in the “multiple” argument. When the calendar is +closed it will call our “closed” function handler; in this handler +we determine what dates were actually selected, inspecting the +“cal.multiple” property, we display them in a DIV element right +next to the <a> element that opens the calendar, and we reinitialize the +global array of selected dates (which will be used if the end user opens the +calendar again). I guess the code speaks for itself, right? :-)

+

+

+ +

4  The Calendar object overview

+

+

+Basically you should be able to setup the calendar with the function presented +in the previous section. However, if for some reason Calendar.setup +doesn't provide all the functionality that you need and you want to tweak into +the process of creating and configuring the calendar ``by hand'', then this +section is the way to go.

+

+The file calendar.js implements the functionality of the calendar. +All (well, almost all) functions and variables are embedded in the JavaScript +object ``Calendar''.

+

+You can instantiate a Calendar object by calling the constructor, like +this: var cal = new Calendar(...). We will discuss the parameters +later. After creating the object, the variable cal will contain a +reference to it. You can use this reference to access further options of the +calendar, for instance:

+

+

+
cal.weekNumbers = false; // do not display week numbers
+cal.showsTime = true;    // include a time selector
+cal.setDateFormat("%Y.%m.%d %H:%M"); // set this format: 2003.12.31 23:59
+cal.setDisabledHandler(function(date, year, month, day) {
+  // verify date and return true if it has to be disabled
+  // ``date'' is a JS Date object, but if you only need the
+  // year, month and/or day you can get them separately as
+  // next 3 parameters, as you can see in the declaration
+  if (year == 2004) {
+    // disable all dates from 2004
+    return true;
+  }
+  return false;
+});
+

+

+etc. Prior to version +0.9.3 this was the only way to configure it. The Calendar.setup +function, documented in section 2, basically does the same +things (actually more) in order to setup the calendar, based on the parameters +that you provided.

+

+

+ +

4.1  Creating a calendar

+

The calendar is created by following some steps (even the function +Calendar.setup, described in section 2, does the +same). While you can skip optional (marked ``opt'') steps if you're happy with +the defaults, please respect the order below.

+

+

+

    +

    +
  1. Instantiate a Calendar object. Details about this in +section 5.1.

    +

    +

    +
  2. opt   Set the weekNumbers property to false if you don't want +the calendar to display week numbers.

    +

    +

    +
  3. opt   Set the showsTime property to true if you +want the calendar to also provide a time selector.

    +

    +

    +
  4. opt   Set the time24 property to false if you want +the time selector to be in 12-hour format. Default is 24-hour format. This +property only has effect if you also set showsTime to +true.

    +

    +

    +
  5. opt   Set the range of years available for selection (see section +5.3.15). The default range is [1970..2050].

    +

    +

    +
  6. opt   Set the getDateStatus property. You should pass +here a function that receives a JavaScript Date object and returns +true if the given date should be disabled, false otherwise (details in +section 5.3.7).

    +

    +

    +
  7. opt   Set a date format. Your handler function, passed to the +calendar constructor, will be called when a date is selected with a reference +to the calendar and a date string in this format.

    +

    +

    +
  8. Create the HTML elements related to the calendar. This step +practically puts the calendar in your HTML page. You simply call +Calendar.create(). You can give an optional parameter if you wanna +create a flat calendar (details in section 5.3.1).

    +

    +

    +
  9. opt   Initialize the calendar to a certain date, for instance from +the input field.

    +

    +

    +
  10. Show the calendar (details in section 5.3.9).

    +

    +

    +

+

+

+ +

4.2  Order does matter ;-)

+

As you could see in the previous section, there are more steps to be followed +in order to setup the calendar. This happens because there are two different +things that need to be accomplished: first there is the JavaScript object, that +is created with new Calendar(...). Secondly there are the HTML +elements that actually lets you see and manipulate the calendar.

+

+

+[ Those that did UI4 programming, no matter in what +language and on what platform, may be familiar with this concept. First there +is the object in memory that lets you manipulate the UI element, and secondly +there is the UI element (known as ``control'', ``window'', ``widget'', etc.), +also in memory but you don't usually access it directly. ] +

+By instantiating the calendar we create the JavaScript object. It lets us +configure some properties and it also knows how to create the UI element (the +HTML elements actually) that will eventually be what the end-user sees on +screen. Creation of the HTML element is accomplished by the function +Calendar.create. It knows how to create popup or flat calendars. +This function is described in section 5.3.1.

+

+Some properties need to be set prior to creating the HTML elements, because +otherwise they wouldn't have any effect. Such a property is +weekNumbers -- it has the default value ``true'', and if you don't +want the calendar to display the week numbers you have to set it to false. If, +however, you do that after calling Calendar.create the calendar +would still display the week numbers, because the HTML elements are already +created (including the <td>-s in the <table> element that +should contain the week numbers). For this reason the order of the steps above +is important.

+

+Another example is when you want to show the calendar. The ``create'' function +does create the HTML elements, but they are initially hidden (have the style +``display: none'') unless the calendar is a flat calendar that should be always +visible in the page. Obviously, the Calendar.show function should be +called after calling Calendar.create.

+

+

+ +

4.3  Caching the object

+

Suppose the end-user has popped up a calendar and selects a date. The calendar +then closes. What really happens now?

+

+There are two approaches. The first (used in very old versions of the +calendar) was to drop completely the Calendar object and when the end-user pops +up the calendar again to create another one. This approach is bad for more +reasons:

+

+

+

    +

    +
  • creating the JavaScript object and HTML elements is time-consuming

    +

    +

    +
  • we may loose some end-user preferences (i.e. he might prefer to have +Monday for the first day of week and probably already clicked it the first time +when the calendar was opened, but now he has to do it again)

    +

    +

    +

+

+The second approach, implemented by the Calendar.setup function, is to +cache the JavaScript object. It does this by checking the global variable +window.calendar and if it is not null it assumes it is the created +Calendar object. When the end-user closes the calendar, our code will only +call ``hide'' on it, therefore keeping the JavaScript object and the +HTML elements in place.

+

+CAVEAT:     Since time selection support was introduced, this +``object caching'' mechanism has the following drawback: if you once created +the calendar with the time selection support, then other items that may not +require this functionality will still get a calendar with the time selection +support enabled. And reciprocal. ;-) Hopefully this will be corrected in a +later version, but for now it doesn't seem such a big problem.

+

+

+ +

4.4  Callback functions

+

You might rightfully wonder how is the calendar related to the input field? +Who tells it that it has to update that input field when a date is +selected, or that it has to jump to that URL when a date is clicked in +flat mode?

+

+All this magic is done through callback functions. The calendar doesn't know +anything about the existence of an input field, nor does it know where to +redirect the browser when a date is clicked in flat mode. It just calls your +callback when a particular event is happening, and you're responsible to handle +it from there. For a general purpose library I think this is the best model of +making a truly reusable thing.

+

+The calendar supports the following user callbacks:

+

+

+

    +

    +
  • onSelect   -- this gets called when the end-user changes the date in the +calendar. Documented in section 5.1.

    +

    +

    +
  • onClose   -- this gets called when the calendar should close. It's +user's responsibility to close the calendar. Details in section +5.1.

    +

    +

    +
  • getDateStatus   -- this function gets called for any day in a month, +just before displaying the month. It is called with a JavaScript Date +object and should return true if that date should be disabled, false +if it's an ordinary date and no action should be taken, or it can return a +string in which case the returned value will be appended to the element's CSS +class (this way it provides a powerful way to make some dates ``special'', +i.e. highlight them differently). Details in section +5.3.8.

    +

    +

    +

+

+

+ +

5  The Calendar object API reference

+

+

+

+ +

5.1  Calendar constructor

+

+

+Synopsis:

+

+

+
var calendar = Calendar(firstDayOfWeek, date, onSelect, onClose);
+

+

+Parameters are as follows:

+

+

+

    +

    +
  • firstDayOfWeek   -- specifies which day is to be displayed as the first +day of week. Possible values are 0 to 6; 0 means Sunday, 1 means Monday, +..., 6 means Saturday.

    +

    +

    +
  • date   -- a JavaScript Date object or null. If null +is passed then the calendar will default to today date. Otherwise it will +initialize on the given date.

    +

    +

    +
  • onSelect   -- your callback for the ``onChange'' event. See above.

    +

    +

    +
  • onClose   -- your callback for the ``onClose'' event. See above.

    +

    +

    +

+

+

+ +

The onSelect event

+

+

+Here is a typical implementation of this function:

+

+

+
function onSelect(calendar, date) {
+  var input_field = document.getElementById("date");
+  input_field.value = date;
+};
+

+

+date is in the format selected with calendar.setDateFormat +(see section 5.3.5). This code simply updates the +input field. If you want the calendar to be in single-click mode then you +should also close the calendar after you updated the input field, so we come to +the following version:

+

+

+
function onSelect(calendar, date) {
+  var input_field = document.getElementById("date");
+  input_field.value = date;
+  if (calendar.dateClicked) {
+    calendar.callCloseHandler(); // this calls "onClose" (see above)
+  }
+};
+

+

+Note that we checked the member variable dateClicked and +only hide the calendar if it's true. If this variable is false it +means that no date was actually selected, but the user only changed the +month/year using the navigation buttons or the menus. We don't want to hide +the calendar in that case.

+

+

+ +

The onClose event

+

+

+This event is triggered when the calendar should close. It should hide or +destroy the calendar object -- the calendar itself just triggers the event, but +it won't close itself.

+

+A typical implementation of this function is the following:

+

+

+
function onClose(calendar) {
+  calendar.hide();
+  // or calendar.destroy();
+};
+

+

+

+ +

5.2  Useful member variables (properties)

+

+

+After creating the Calendar object you can access the following properties:

+

+

+

    +

    +
  • date -- is a JavaScript Date object. It will always +reflect the date shown in the calendar (yes, even if the calendar is hidden).

    +

    +

    +
  • isPopup -- if this is true then the current Calendar object is +a popup calendar. Otherwise (false) we have a flat calendar. This variable is +set from Calendar.create and has no meaning before this function was +called.

    +

    +

    +
  • dateClicked -- particularly useful in the onSelect +handler, this variable tells us if a date was really clicked. That's because +the onSelect handler is called even if the end-user only changed the +month/year but did not select a date. We don't want to close the calendar in +that case.

    +

    +

    +
  • weekNumbers -- if true (default) then the calendar +displays week numbers. If you don't want week numbers you have to set this +variable to false before calling Calendar.create.

    +

    +

    +
  • showsTime - if you set this to true (it is +false by default) then the calendar will also include a time selector.

    +

    +

    +
  • time24 - if you set this to false then the time +selector will be in 12-hour format. It is in 24-hour format by default.

    +

    +

    +
  • firstDayOfWeek -- specifies the first day of week (0 to 6, pass +0 for Sunday, 1 for Monday, ..., 6 for Saturday). This variable is set from +constructor, but you still have a chance to modify it before calling +Calendar.create.

    +

    +

    +

+

+There are lots of other member variables, but one should access them only +through member functions so I won't document them here.

+

+

+ +

5.3  Public methods

+

+ +

5.3.1  Calendar.create

+

+

+This function creates the afferent HTML elements that are needed to display the +calendar. You should call it after setting the calendar properties. Synopsis: +

+
calendar.create(); // creates a popup calendar
+  // -- or --
+calendar.create(document.getElementById(parent_id)); // makes a flat calendar
+

+

+It can create a popup calendar or a flat calendar. If the ``parent'' argument +is present (it should be a reference -- not ID -- to an HTML element) then +a flat calendar is created and it is inserted in the given element.

+

+At any moment, given a reference to a calendar object, we can inspect if it's a +popup or a flat calendar by checking the boolean member variable +isPopup:

+

+

+
if (calendar.isPopup) {
+   // this is a popup calendar
+} else {
+   // this is a flat calendar
+}
+

+

+

+ +

5.3.2  Calendar.callHandler

+

+

+This function calls the first user callback (the +onSelect handler) with the required parameters.

+

+

+ +

5.3.3  Calendar.callCloseHandler

+

+

+This function calls the second user callback (the +onClose handler). It's useful when you want to have a +``single-click'' calendar -- just call this in your onSelect handler, +if a date was clicked.

+

+

+ +

5.3.4  Calendar.hide

+

+

+Call this function to hide the calendar. The calendar object and HTML elements +will not be destroyed, thus you can later call one of the show +functions on the same element.

+

+

+ +

5.3.5  Calendar.setDateFormat

+

+

+This function configures the format in which the calendar reports the date to +your ``onSelect'' handler. Call it like this:

+

+

+
calendar.setDateFormat("%y/%m/%d");
+

+

+As you can see, it receives only one parameter, the required format. The magic +characters are the following:

+

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
%a abbreviated weekday name
%A full weekday name
%b abbreviated month name
%B full month name
%C century number
%d the day of the month ( 00 .. 31 )
%e the day of the month ( 0 .. 31 )
%H hour ( 00 .. 23 )
%I hour ( 01 .. 12 )
%j day of the year ( 000 .. 366 )
%k hour ( 0 .. 23 )
%l hour ( 1 .. 12 )
%m month ( 01 .. 12 )
%M minute ( 00 .. 59 )
%n a newline character
%p ``PM'' or ``AM''
%P ``pm'' or ``am''
%S second ( 00 .. 59 )
%s number of seconds since Epoch (since Jan 01 1970 00:00:00 UTC)
%t a tab character
%U, %W, %V the week number
%u the day of the week ( 1 .. 7, 1 = MON )
%w the day of the week ( 0 .. 6, 0 = SUN )
%y year without the century ( 00 .. 99 )
%Y year including the century ( ex. 1979 )
%% a literal % character +

+There are more algorithms for computing the week number. All +three specifiers currently implement the same one, as defined by ISO 8601: +``the week 01 is the week that has the Thursday in the current year, which is +equivalent to the week that contains the fourth day of January. Weeks start on +Monday.''

+

+

+ +

5.3.6  Calendar.setTtDateFormat

+

+

+Has the same prototype as Calendar.setDateFormat, but refers to the +format of the date displayed in the ``status bar'' when the mouse is over some +date.

+

+

+ +

5.3.7  Calendar.setDisabledHandler

+

+

+This function allows you to specify a callback function that checks if a +certain date must be disabled by the calendar. You are responsible to write +the callback function. Synopsis:

+

+

+
function disallowDate(date) {
+  // date is a JS Date object
+  if (  date.getFullYear() == 2003 &&
+        date.getMonth()    == 6 /* July, it's zero-based */ &&
+        date.getDate()     == 5  ) {
+    return true; // disable July 5 2003
+  }
+  return false; // enable other dates
+};
+
+calendar.setDisabledHandler(disallowDate);
+

+

+If you change this function in ``real-time'', meaning, without creating a new +calendar, then you have to call calendar.refresh() to make it +redisplay the month and take into account the new disabledHandler. +Calendar.setup does this, so you have no such trouble with it.

+

+Note that disallowDate should be very fast, as it is called for each +date in the month. Thus, it gets called, say, 30 times before displaying the +calendar, and 30 times when the month is changed. Tests I've done so far show +that it's still good, but in the future I might switch it to a different design +(for instance, to call it once per month and to return an array of dates that +must be disabled).

+

+This function should be considered deprecated in the favor of +Calendar.setDateStatusHandler, described below.

+

+

+ +

5.3.8  Calendar.setDateStatusHandler

+

+

+This function obsoletes Calendar.setDisabledHandler. You call it with +a function parameter, but this function can return a boolean +or a string. If the return value is a boolean (true or +false) then it behaves just like setDisabledHandler, +therefore disabling the date if the return value is true.

+

+If the returned value is a string then the given date will gain an additional +CSS class, namely the returned value. You can use this to highlight some dates +in some way. Note that you are responsible for defining the CSS class that you +return. If you return the string ``disabled'' then that date will be disabled, +just as if you returned true.

+

+Here is a simple scenario that shows what you can do with this function. The +following should be present in some of your styles, or in the document head in +a STYLE tag (but put it after the place where the calendar styles were +loaded):

+

+

+
.special { background-color: #000; color: #fff; }
+

+

+And you would use the following code before calling Calendar.create():

+

+

+
// this table holds your special days, so that we can automatize
+// things a bit:
+var SPECIAL_DAYS = {
+    0 : [ 13, 24 ],             // special days in January
+    2 : [ 1, 6, 8, 12, 18 ],    // special days in March
+    8 : [ 21, 11 ],             // special days in September
+   11 : [ 25, 28 ]              // special days in December
+};
+
+// this function returns true if the passed date is special
+function dateIsSpecial(year, month, day) {
+    var m = SPECIAL_DAYS[month];
+    if (!m) return false;
+    for (var i in m) if (m[i] == day) return true;
+    return false;
+}
+
+// this is the actual date status handler.  Note that it receives the
+// date object as well as separate values of year, month and date, for
+// your confort.
+function dateStatusHandler(date, y, m, d) {
+    if (dateIsSpecial(y, m, d)) return ``special'';
+    else return false;
+    // return true above if you want to disable other dates
+}
+
+// configure it to the calendar
+calendar.setDateStatusHandler(dateStatusHandler);
+

+

+The above code adds the ``special'' class name to some dates that are defined +in the SPECIAL_DAYS table. Other dates will simply be displayed as default, +enabled.

+

+

+ +

5.3.9  Calendar.show

+

+

+Call this function do show the calendar. It basically sets the CSS ``display'' +property to ``block''. It doesn't modify the calendar position.

+

+This function only makes sense when the calendar is in popup mode.

+

+

+ +

5.3.10  Calendar.showAt

+

+

+Call this to show the calendar at a certain (x, y) position. Prototype:

+

+

+
calendar.showAt(x, y);
+

+

+The parameters are absolute coordinates relative to the top left +corner of the page, thus they are page coordinates not screen +coordinates.

+

+After setting the given coordinates it calls Calendar.show. This function only +makes sense when the calendar is in popup mode.

+

+

+ +

5.3.11  Calendar.showAtElement

+

+

+This function is useful if you want to display the calendar near some element. +You call it like this:

+

+

+
calendar.showAtElement(element, align);
+

+

+where element is a reference to your element (for instance it can be the input +field that displays the date) and align is an optional parameter, of type string, +containing one or two characters. For instance, if you pass "Br" as +align, the calendar will appear below the element and with its right +margin continuing the element's right margin.

+

+As stated above, align may contain one or two characters. The first character +dictates the vertical alignment, relative to the element, and the second +character dictates the horizontal alignment. If the second character is +missing it will be assumed "l" (the left margin of the calendar will +be at the same horizontal position as the left margin of the element).

+

+The characters given for the align parameters are case sensitive. This +function only makes sense when the calendar is in popup mode. After computing +the position it uses Calendar.showAt to display the calendar there.

+

+

+ +

Vertical alignment

+

The first character in ``align'' can take one of the following values:

+

+

+

    +

    +
  • T -- completely above the reference element (bottom margin of +the calendar aligned to the top margin of the element).

    +

    +

    +
  • t -- above the element but may overlap it (bottom margin of the calendar aligned to +the bottom margin of the element).

    +

    +

    +
  • c -- the calendar displays vertically centered to the reference +element. It might overlap it (that depends on the horizontal alignment).

    +

    +

    +
  • b -- below the element but may overlap it (top margin of the calendar aligned to +the top margin of the element).

    +

    +

    +
  • B -- completely below the element (top margin of the calendar +aligned to the bottom margin of the element).

    +

    +

    +

+

+

+ +

Horizontal alignment

+

The second character in ``align'' can take one of the following values:

+

+

+

    +

    +
  • L -- completely to the left of the reference element (right +margin of the calendar aligned to the left margin of the element).

    +

    +

    +
  • l -- to the left of the element but may overlap it (left margin +of the calendar aligned to the left margin of the element).

    +

    +

    +
  • c -- horizontally centered to the element. Might overlap it, +depending on the vertical alignment.

    +

    +

    +
  • r -- to the right of the element but may overlap it (right +margin of the calendar aligned to the right margin of the element).

    +

    +

    +
  • R -- completely to the right of the element (left margin of the +calendar aligned to the right margin of the element).

    +

    +

    +

+

+

+ +

Default values

+

If the ``align'' parameter is missing the calendar will choose +``Br''.

+

+

+ +

5.3.12  Calendar.setDate

+

+

+Receives a JavaScript Date object. Sets the given date in the +calendar. If the calendar is visible the new date is displayed immediately.

+

+

+
calendar.setDate(new Date()); // go today
+

+

+

+ +

5.3.13  Calendar.setFirstDayOfWeek

+

+

+Changes the first day of week. The parameter has to be a numeric value ranging +from 0 to 6. Pass 0 for Sunday, 1 for Monday, ..., 6 for Saturday.

+

+

+
calendar.setFirstDayOfWeek(5); // start weeks on Friday
+

+

+

+ +

5.3.14  Calendar.parseDate

+

+

+Use this function to parse a date given as string and to move the calendar to +that date.

+

+The algorithm tries to parse the date according to the format that was +previously set with Calendar.setDateFormat; if that fails, it still +tries to get some valid date out of it (it doesn't read your thoughts, though).

+

+

+
calendar.parseDate("2003/07/06");
+

+

+

+ +

5.3.15  Calendar.setRange

+

+

+Sets the range of years that are allowed in the calendar. Synopsis:

+

+

+
calendar.setRange(1970, 2050);
+

+

+

+ +

6  Side effects

+

The calendar code was intentionally embedded in an object to make it have as +less as possible side effects. However, there are some -- not harmful, after +all. Here is a list of side effects; you can count they already happened after +calendar.js was loaded.

+

+

+

    +

    +
  1. The global variable window.calendar will be set to null. This +variable is used by the calendar code, especially when doing drag & drop for +moving the calendar. In the future I might get rid of it, but for now it +didn't harm anyone.

    +

    +

    +
  2. The JavaScript Date object is modified. We add some properties +and functions that are very useful to our calendar. It made more sense to add +them directly to the Date object than to the calendar itself. +Complete list:

    +

    +

    +

      +

      +
    1. Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); +

      +
    2. Date.SECOND = 1000 /* milliseconds */; +

      +
    3. Date.MINUTE = 60 * Date.SECOND; +

      +
    4. Date.HOUR = 60 * Date.MINUTE; +

      +
    5. Date.DAY = 24 * Date.HOUR; +

      +
    6. Date.WEEK = 7 * Date.DAY;

      +

      +

      +
    7. Date.prototype.getMonthDays(month) -- returns the number of days +of the given month, or of the current date object if no month was given.

      +

      +

      +
    8. Date.prototype.getWeekNumber() -- returns the week number of the +date in the current object.

      +

      +

      +
    9. Date.prototype.equalsTo(other_date) -- compare the current date +object with other_date and returns true if the dates are +equal. It ignores time.

      +

      +

      +
    10. Date.prototype.print(format) -- returns a string with the +current date object represented in the given format. It implements the format +specified in section 5.3.5.

      +

      +

      +

    +

    +

    +

+

+

+ +

7  Credits

+

The following people either sponsored, donated money to the project or bought +commercial licenses (listed in reverse chronological order). Your name could +be here too! If you wish to sponsor the project (for instance request a +feature and pay me for implementing it) or donate some money please +please contact me at mihai_bazon@yahoo.com.

+

+

+

+

+

+
+ +Thank you!
+ -- mihai_bazon@yahoo.com +
+

+

+

+

1 +by the term ``widget'' I understand a single element of user interface. +But that's in Linux world. For those that did lots of Windows +programming the term ``control'' might be more familiar +

+

2 people report that the calendar does +not work with IE5/Mac. However, this browser was discontinued and we +believe that supporting it doesn't worth the efforts, given the fact that +it has the worst, buggiest implementation for DOM I've ever seen.

+

3 under Opera 7 the calendar still lacks some functionality, such as +keyboard navigation; also Opera doesn't seem to allow disabling text +selection when one drags the mouse on the page; despite all that, the +calendar is still highly functional under Opera 7 and looks as good as +in other supported browsers.

+

4 user interface

+
+
+Last modified: Saturday, March 5th, 2005
+HTML conversion by TeX2page 2004-09-11
+
+ + diff --git a/calendar/doc/reference.pdf b/calendar/doc/reference.pdf new file mode 100755 index 0000000..a09497f Binary files /dev/null and b/calendar/doc/reference.pdf differ diff --git a/calendar/img.gif b/calendar/img.gif new file mode 100755 index 0000000..cd2c4a5 Binary files /dev/null and b/calendar/img.gif differ diff --git a/calendar/index.html b/calendar/index.html new file mode 100755 index 0000000..35b7415 --- /dev/null +++ b/calendar/index.html @@ -0,0 +1,330 @@ + + + + + + + +The Coolest DHTML Calendar - Online Demo + + + + + + + + + + + + + + + + + + + + + + + + + + + +

jscalendar-1.0 +"It is happening again"

+ +

+

+Theme:
+Aqua +| +winter +| +blue +| +summer +| +green +
+win2k-1 +| +win2k-2 +| +win2k-cold-1 +| +win2k-cold-2 +
+system + +
+Release notes. +
+Set it up in minutes: + popup calendar, + flat calendar. +Other samples: + special days, + day info, + multiple dates selection +
+Documentation: + HTML, + PDF. +
+

+ +
+ +
+ + + + + + + + +
+ +
+
+Popup examples +
+ +
+ +Date #1: %Y-%m-%d [%W] %H:%M -- single +click
+ +Date #2: %a, %b %e, %Y [%I:%M %p] +-- double click + +

+ + +this select should hide when the calendar is above it. +

+ +Date #3: %d/%m/%Y +-- single click +
+ +Date #4: %A, %B %e, %Y -- +double click + +
+ +

This is release 1.0. Works on MSIE/Win 5.0 or better (really), +Opera 7+, Mozilla, Firefox, Netscape 6.x, 7.0 and all other Gecko-s, +Konqueror and Safari.

+ +

Keyboard navigation

+ +

Starting with version 0.9.2, you can also use the keyboard to select +dates (only for popup calendars; does not work with Opera +7 or Konqueror/Safari). The following keys are available:

+ +
    + +
  • , , + , -- select date
  • +
  • CTRL + , + -- select month
  • +
  • CTRL + , + -- select year
  • +
  • SPACE -- go to today date
  • +
  • ENTER -- accept the currently selected date
  • +
  • ESC -- cancel selection
  • + +
+ +
+ +
+ Flat calendar +
+ +

A non-popup version will appear below as soon + as the page is loaded. Note that it doesn't show the week number.

+ + +
+
 
+ +

+ The example above uses the setDisabledHandler() member function + to setup a handler that would only enable days withing a range of 10 days, + forward or backward, from the current date. +

+ + + +
+ +
dynarch.com 2002-2005
+Author: Mihai +Bazon
Distributed under the GNU LGPL.
+ +

If you use this script on a public page we +would love it if you would let us +know.

+ + diff --git a/calendar/lang/calendar-en.js b/calendar/lang/calendar-en.js new file mode 100755 index 0000000..0dbde79 --- /dev/null +++ b/calendar/lang/calendar-en.js @@ -0,0 +1,127 @@ +// ** I18N + +// Calendar EN language +// Author: Mihai Bazon, +// Encoding: any +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + "Sunday"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat", + "Sun"); + +// First day of the week. "0" means display Sunday first, "1" means display +// Monday first, etc. +Calendar._FD = 0; + +// full month names +Calendar._MN = new Array +("January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December"); + +// short month names +Calendar._SMN = new Array +("Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "About the calendar"; + +Calendar._TT["ABOUT"] = +"DHTML Date/Time Selector\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"For latest version visit: http://www.dynarch.com/projects/calendar/\n" + +"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + +"\n\n" + +"Date selection:\n" + +"- Use the \xab, \xbb buttons to select year\n" + +"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" + +"- Hold mouse button on any of the above buttons for faster selection."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Time selection:\n" + +"- Click on any of the time parts to increase it\n" + +"- or Shift-click to decrease it\n" + +"- or click and drag for faster selection."; + +Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)"; +Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)"; +Calendar._TT["GO_TODAY"] = "Go Today"; +Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)"; +Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)"; +Calendar._TT["SEL_DATE"] = "Select date"; +Calendar._TT["DRAG_TO_MOVE"] = "Drag to move"; +Calendar._TT["PART_TODAY"] = " (today)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Display %s first"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Close"; +Calendar._TT["TODAY"] = "Today"; +Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d"; +Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e"; + +Calendar._TT["WK"] = "wk"; +Calendar._TT["TIME"] = "Time:"; diff --git a/calendar/lang/calendar-es.js b/calendar/lang/calendar-es.js new file mode 100755 index 0000000..19c1b30 --- /dev/null +++ b/calendar/lang/calendar-es.js @@ -0,0 +1,129 @@ +// ** I18N + +// Calendar ES (spanish) language +// Author: Mihai Bazon, +// Updater: Servilio Afre Puentes +// Updated: 2004-06-03 +// Encoding: utf-8 +// Distributed under the same terms as the calendar itself. + +// For translators: please use UTF-8 if possible. We strongly believe that +// Unicode is the answer to a real internationalized world. Also please +// include your contact information in the header, as can be seen above. + +// full day names +Calendar._DN = new Array +("Domingo", + "Lunes", + "Martes", + "Mircoles", + "Jueves", + "Viernes", + "Sbado", + "Domingo"); + +// Please note that the following array of short day names (and the same goes +// for short month names, _SMN) isn't absolutely necessary. We give it here +// for exemplification on how one can customize the short day names, but if +// they are simply the first N letters of the full name you can simply say: +// +// Calendar._SDN_len = N; // short day name length +// Calendar._SMN_len = N; // short month name length +// +// If N = 3 then this is not needed either since we assume a value of 3 if not +// present, to be compatible with translation files that were written before +// this feature. + +// short day names +Calendar._SDN = new Array +("Dom", + "Lun", + "Mar", + "Mi", + "Jue", + "Vie", + "Sb", + "Dom"); + +// First day of the week. "0" means display Sunday first, "1" means display +// Monday first, etc. +Calendar._FD = 1; + +// full month names +Calendar._MN = new Array +("Enero", + "Febrero", + "Marzo", + "Abril", + "Mayo", + "Junio", + "Julio", + "Agosto", + "Septiembre", + "Octubre", + "Noviembre", + "Diciembre"); + +// short month names +Calendar._SMN = new Array +("Ene", + "Feb", + "Mar", + "Abr", + "May", + "Jun", + "Jul", + "Ago", + "Sep", + "Oct", + "Nov", + "Dic"); + +// tooltips +Calendar._TT = {}; +Calendar._TT["INFO"] = "Acerca del calendario"; + +Calendar._TT["ABOUT"] = +"Selector DHTML de Fecha/Hora\n" + +"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-) +"Para conseguir la ltima versin visite: http://www.dynarch.com/projects/calendar/\n" + +"Distribuido bajo licencia GNU LGPL. Visite http://gnu.org/licenses/lgpl.html para ms detalles." + +"\n\n" + +"Seleccin de fecha:\n" + +"- Use los botones \xab, \xbb para seleccionar el ao\n" + +"- Use los botones " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " para seleccionar el mes\n" + +"- Mantenga pulsado el ratn en cualquiera de estos botones para una seleccin rpida."; +Calendar._TT["ABOUT_TIME"] = "\n\n" + +"Seleccin de hora:\n" + +"- Pulse en cualquiera de las partes de la hora para incrementarla\n" + +"- o pulse las maysculas mientras hace clic para decrementarla\n" + +"- o haga clic y arrastre el ratn para una seleccin ms rpida."; + +Calendar._TT["PREV_YEAR"] = "Ao anterior (mantener para men)"; +Calendar._TT["PREV_MONTH"] = "Mes anterior (mantener para men)"; +Calendar._TT["GO_TODAY"] = "Ir a hoy"; +Calendar._TT["NEXT_MONTH"] = "Mes siguiente (mantener para men)"; +Calendar._TT["NEXT_YEAR"] = "Ao siguiente (mantener para men)"; +Calendar._TT["SEL_DATE"] = "Seleccionar fecha"; +Calendar._TT["DRAG_TO_MOVE"] = "Arrastrar para mover"; +Calendar._TT["PART_TODAY"] = " (hoy)"; + +// the following is to inform that "%s" is to be the first day of week +// %s will be replaced with the day name. +Calendar._TT["DAY_FIRST"] = "Hacer %s primer da de la semana"; + +// This may be locale-dependent. It specifies the week-end days, as an array +// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1 +// means Monday, etc. +Calendar._TT["WEEKEND"] = "0,6"; + +Calendar._TT["CLOSE"] = "Cerrar"; +Calendar._TT["TODAY"] = "Hoy"; +Calendar._TT["TIME_PART"] = "(Mayscula-)Clic o arrastre para cambiar valor"; + +// date formats +Calendar._TT["DEF_DATE_FORMAT"] = "%d/%m/%Y"; +Calendar._TT["TT_DATE_FORMAT"] = "%A, %e de %B de %Y"; + +Calendar._TT["WK"] = "sem"; +Calendar._TT["TIME"] = "Hora:"; diff --git a/calendar/menuarrow.gif b/calendar/menuarrow.gif new file mode 100755 index 0000000..ed2dee0 Binary files /dev/null and b/calendar/menuarrow.gif differ diff --git a/calendar/menuarrow2.gif b/calendar/menuarrow2.gif new file mode 100755 index 0000000..40c0aad Binary files /dev/null and b/calendar/menuarrow2.gif differ diff --git a/calendar/multiple-dates.html b/calendar/multiple-dates.html new file mode 100755 index 0000000..caf1920 --- /dev/null +++ b/calendar/multiple-dates.html @@ -0,0 +1,82 @@ + + + Sample for the multiple dates feature + + + + + + + + + + + + + + +

Sample for the multiple dates feature

+ +

+ Starting version 0.9.7, + the calendar is able to handle multiple dates selection, in either + flat or popup form. For this to happen one needs to pass the + "multiple: true" parameter to + Calendar.setup and to install an onUpdate + handler that watches for modifications. +

+ + [open calendar...] + +
+ + + +
+
mishoo
+ Last modified: Thu Mar 3 20:17:42 EET 2005 + diff --git a/calendar/release-notes.html b/calendar/release-notes.html new file mode 100755 index 0000000..9addddb --- /dev/null +++ b/calendar/release-notes.html @@ -0,0 +1,435 @@ + + + + jscalendar release notes + + + + + +
+ The Coolest DHTML Calendar
+ © Dynarch.com 2002 and later. +
+

jscalendar release notes

+ +

This release compiled at Monday, 7 Mar 2005 (19:06).

+ +

1.0

+ +
    + +
  • + Added support for multiple dates selection. In this mode the + calendar will allow the user to select more than one date, and + will maintain an array of selected dates that can be + investigated from your custom handlers. Sample in multiple-dates.html. +
  • + +
  • + Support for “day info”. Using this feature you can display + custom information for certain dates. Sample in dayinfo.html. Note that if the text + is really big the calendar layout might appear somehow broken; + this is something that should be easy to fix in the CSS file. +
  • + +
  • + Clicking on “Today” will now close the calendar if the current + date is already selected. +
  • + +
  • + The “first day of week” setting can now be defined in the + language file--after all, it is locale-specific. The new + parameter is “Calendar._FD”. Language files should be + updated, but the calendar will not complain nor fail to + function if the parameter is not present. +
  • + +
  • + Some fixes to make the thing work in Safari. It now seems to + be properly supported, please let me know if you encounter any + problems. +
  • + +
  • + New skin: Aqua theme, appropriate for MacOSX fan sites :-) + This theme is located in “skins/aqua/theme.css” (in the + future, all themes will go to this directory). +
  • + +
  • + Bug fixes. +
      +
    • + Keyboard operation now functions normally when the + calendar is displaying days from adjacent months; it might + even work correctly for months containing disabled dates + :). This fix was originally developed under contract for + The + Zapatec Calendar. Zapatec kindly allowed us to + include the bugfixes back in the open source calendar. +
    • +
    • + Fixed the time selection bug: the previous version would + reset the time to current time when a new date was + clicked. +
    • +
    • + Parsing hours like "12:XX pm" would wrongfully replace + "pm" with "am"--fixed. +
    • +
    • + Fixed critical bugs in parseDate function that would + initialize the calendar with 'NaN' values in all cells if + the string to be parsed is not a valid date. +
    • +
    • + The golbal variable that we are using was renamed to + “_dynarch_popupCalendar” to minimize the risk of name + clashes. It's still difficult to get rid of it. +
    • +
    • + Added z-index property to drop-down menus style. +
    • +
    • + The calendar will update an input field even in flat mode, + if an input field was passed. Also, the “showOthers” + parameter will be effective in both popup and flat mode. +
    • +
    • + Others, probably. +
    • +
    +
  • + +
  • + Documentation & sample files updated. +
  • + +
+ +

0.9.6

+ +
    + +
  • + "Smart" (TM :-) positioning algorithm. The new algorithm will + try to keep the calendar in the browser view, which is helpful + in situations when the input field is near the bottom or the + right edge. This code is only tested with IE and Mozilla, but + it should work with other browsers too. Many thanks to Sunny Chowdhury for sponsoring + this feature! +
  • + +
  • + Support for IE5/Win is back. I also want to thank Janusz + Piwowarski for keeping his eye on the CVS ;-) He reviewed my + IE5-related changes and sent me a much cleaner patch. +
  • + +
  • + The calendar will now allow any day of week to be "the first + day of week". This was requested long time ago, by someone + whose name I forgot (sorry). The reason was that in certain + countries weeks start on Saturday. So I thought that instead + of having a "mondayFirst" and a "saturdayFirst" parameter, + :-), it's better to have a "firstDayOfWeek" parameter; now + it's present and its meaning is: "0 for Sunday", "1 for + Monday", "2 for Tuesday", etc. The equivalent parameter for + Calendar.setup is "firstDay". The end user can also change + it very easy: click on the day name in the calendar display. +
  • + +
  • + The above feature triggered one important change: the + notion of "weekend" is now defined in the language file. + Added parameters: + +
    +          Calendar._TT["WEEKEND"] = "0,6";
    +          Calendar._TT["DAY_FIRST"] = "Display %s first";
    + + "WEEKEND" specifies a string with comma-separated numbers from + 0 to 7; they define what days are marked as "weekend". 5 and + 6 mean, of course, "Sunday" and "Saturday". Day first is the + tooltip displayed when a day name is hovered; "%s" will get + replaced with the day name. Updated languages are "en" and + "ro", which I maintain. Please note that languages wich are + not updated will not work. If yours is one of them, + please consider fixing it and sending me the fix so that I can + include it in the distro. +
  • + +
  • + The calendar can now display days from the months adjacent to + the currently displayed one. This is optional, of course, and + the parameter name is "showsOtherMonths" (or "showOthers" in + Calendar.setup). All theme files were updated. +
  • + +
  • + Displays "Time:" near the time selector, only if defined in + the language file. +
  • + +
  • + Some bugs fixed in the date parsing code (which has also been + rewritten a little bit cleaner). +
  • + +
  • + Calendar.setup will now configure the calendar to trigger the + input fields' "onchange" event, if specified, when a date is + selected. +
  • + +
  • + New parameter in Calendar.setup: "cache" (defaults to + false). If set to true then the popup calendar object + will be "cached", meaning, it will be created only once, no + matter how many input fields are there in the page. Sometimes + this is not desirable, which is why I've added this + parameter. Please note that it defaults to "false" (thus the + default behavior has changed). +
  • + +
  • + Added a simple PHP wrapper. It provides code which loads all + the required scripts and theme file, and one function which + creates and configures an input field for date input. It + takes care of creating and assigning unique ID-s for the + calendar fields and it also creates the "Calendar.setup" code. + Functions to create more specialized fields can be added very + easily. This feature was requested by the FreeMED.org project + (thanks for donating!). +
  • + +
+ +

Wow, there were quite some changes :-D Enjoy it!

+ +

0.9.5

+ +

+ This release's primary goal is to fix a wrong license statement which + can be found in some files from 0.9.4. For instance in README or + calendar.js, the statement was that the code is distributed under the + GNU GPL; that's because I had plans to change the license, then + changed my mind but unfortunately I committed files so. I am sorry + for this inconvenience, please use the latest (0.9.5) release which is + fully covered by LGPL. +

+ +

Other changes:

+ +
    + +
  • + Fixed an annoying bug that prevented the calendar to display + correctly when it was configured for an input field inside a + scrolling area. Many thanks to Ian Barrack (Simban.com) who pointed it up and + donated quite some money for the Calendar project! +
  • + +
  • + All examples use UTF-8 now; the translations may not be all + up-to-date, but I strongly suggest everyone to use + UTF-8; other encodings are a plain mess. So far I know for sure + that Romanian translation will work with UTF-8 and not + anymore with ISO-8859-2. Other translations are probably + usable under UTF-8, but if your preferred language isn't... ;-) + please make it and send it to me for inclusion. +
  • + +
  • + Fixed small bug in the documentation (one footnote didn't appear + where it should have). +
  • + +
  • + Updated translations: DE, ES, HU, IT, RO. Thanks to everyone who + sent translations! +
  • + +
+ +

0.9.4

+ +

New stuff

+ +
    + +
  • Supports time selection. Yes. ;-) This work has been largely + sponsored by Himanshukumar Shah (thank you!). See + the docs and example files for details on how to setup.
  • + +
  • Easy to link 2 or more fields by using the new + onUpdate parameter of Calendar.setup. This + is useful, say, to automatically set a value in a second field based + on the value selected in the first field. See the documentation and + first sample in simple-1.html.
  • + +
  • Other Calendar.setup low-level parameters, for those + wanting to have the complete control: onSelect and + onClose. The handlers are called when something is + selected in the calendar or when the calendar is closed.
  • + +
  • The translation files can optionally include the short day names + and the short month names. That's because in some languages, like + German, the short form is not the first 3 letters of the entire name + but only the first 2. Also in other languages short names can't be + as easily derived from the full name by just calling substr, so this + patch solves the problem.
  • + +
  • Implemented a nice way to make some dates "special" (look + different). Specifically, the setDisabledHandler method + was replaced with the more general setDateStatusHandler + method (the old one is still available for backwards compatibility but + will be removed). More details about this in the + documentation. Also see simple-3.html + for a live sample.
  • + +
  • Date parsing and formatting engine is now rewritten and supports a + subset of strftime format specifiers from ANSI C. This + makes it possible to use dates like "YYYYMMDD" (the corresponding + format for this would be "%Y%m%d"). Details in the documentation. + Please note that the new engine is not compatibile with older + calendar releases!
  • + +
  • Along with the new date parser I workarounded an unpleasant crash + that occurred in IE when certain accented characters appeared in the + texts. I think German was one of the language with such problems, and + the workaround was to use the letter without an accent. Well, now you + can translate to whatever you want.
  • + +
  • "Fixes" (I mean, "horrible workarounds") for Konqueror (and + hopefully Safari). Unfortunately, this otherwise excellent browser + still has some bugs that keep the calendar from working + exactly as it should.. But they're going to be fixed, + right? ;-)
  • + +
  • CSS themes got pretty much modified too so if you wrote your theme + you need to update it. Aside for the time selector support, the CSS + themes contain a simple hack that makes the navigation buttons show + a little arrow in the lower-right corner which indicates that if one + holds the mouse a menu will appear.
  • + +
+ +

Translation files

+ +

The translation files need to be updated in order for the calendar to + work properly. Currently the only updated files are calendar-en.js + (main file) and calendar-ro.js (well, yes, I am a Romanian ;-).

+ +

Specifically, they need the following:

+ +
    + +
  • Correct date format, according with the new format specifiers + introduced in 0.9.4. Details about the available format specifiers + in the documentation
  • + +
  • Short day or month names, if required. If they can be + derived by taking the first N letters of the full name then a simple + Calendar._SDN_len = N or Calendar._SMN_len = N will suffice. If N + is 3 then nothing needs to be done as we take it for granted if no + other option is offered ;-)
  • + +
  • We have some new texts that shows short usage information as well + as copyright information.
  • + +
+ +

If your favorite language is not there yet, or it is but not updated + according to the main calendar-en.js file, then please consider + translating calendar-en.js and send the translation back to me so that + I include it in the official distribution.

+ +

Bug status

+ +

Check SourceForge, + I didn't keep track. However, there were a lot of bugfixes.

+ +

0.9.3

+ +

New stuff

+ +
    + +
  • Opera 7 compatibility — keyboard navigation is + still not available; text selection can't be disabled, leading to an + ugly effect when walking through the month/year menus.
  • + +
  • Ability to align the calendar relative to the input field (or any + other element). Vertical: top, center, bottom. Horizontal: left, + center, right. This is established as a new parameter for + showAtElement.
  • + +
  • Added dateClicked property (boolean). This can be + inspected in the "onSelect" handler to determine if a date was + really clicked or the user only changed month/year using the menus. + You need to check this for "single-click" calendars and + only close/hide the calendar if it's true.
  • + +
  • Full documentation in HTML + and PDF format is now available in the + distribution archive.
  • + +
  • New language definition files: HU, HR, PT, ZH. Thanks those who + submitted!
  • + +
+ +

Bug status

+ +

This covers only those bugs that have been reported at SourceForge.

+ +
    + +
  1. #703,238 — fixed
  2. +
  3. #703,814 — fixed
  4. +
  5. #716,777 — closed (was fixed already in 0.9.2-1)
  6. +
  7. #723,335 — fixed
  8. +
  9. #715,122 — feature request; implemented.
  10. +
  11. #721,206 — fixed (added "refresh()" function)
  12. +
  13. #721,833 — fixed (bug concerning the "yy" format + parsing)
  14. +
  15. #721,833 — won't fix (we won't set the time to + midnight; time might actually be useful when we implement support + for time selection). + +
+ +
+
Mihai Bazon
+ + +Last modified on Wed Oct 29 02:37:07 2003 + + + + + + diff --git a/calendar/simple-1.html b/calendar/simple-1.html new file mode 100755 index 0000000..7a182e4 --- /dev/null +++ b/calendar/simple-1.html @@ -0,0 +1,242 @@ + + + +Simple calendar setups [popup calendar] + + + + + + + + + + + + + + + + + +

DHTML Calendar — for the impatient

+ +
+

+ This page lists some common setups for the popup calendar. In + order to see how to do any of them please see the source of this + page. For each example it's structured like this: there's the + <form> that contains the input field, and following there is + the JavaScript snippet that setups that form. An example of + flat calendar is available in another page. +

+

+ The code in this page uses a helper function defined in + "calendar-setup.js". With it you can setup the calendar in + minutes. If you're not that impatient, ;-) complete documenation is + available. +

+
+ + + +
+ +

Basic setup: one input per calendar. Clicking in the input field +activates the calendar. The date format is "%m/%d/%Y %I:%M %p". The +calendar defaults to "single-click mode".

+ +

The example below has been updated to show you how to create "linked" +fields. Basically, when some field is filled with a date, the other +is updated so that the difference between them remains one week. The +property useful here is "onUpdate".

+ +
+ + +
+ + + + + +
+ +

Input field with a trigger button. Clicking the button activates +the calendar. Note that this one needs double-click (singleClick parameter +is explicitely set to false). Also demonstrates the "step" parameter +introduced in 0.9.6 (show all years in drop-down boxes, instead of every +other year as default).

+ +
+ +
+ + + + + +
+ +

Input field with a trigger image. Note that the Calendar.setup +function doesn't care if the trigger is a button, image, or anything else. +Also in this example we setup a different alignment, just to show how it's +done. The input field is read-only (that is set from HTML).

+ +
+ + + +
+
+ + + + + +
+ +

Hidden field, display area. The calendar now puts the date into 2 +elements: one is an input field of type "hidden"—so that the user +can't directly see or modify it— and one is a <span> element in +which the date is displayed. Note that if the trigger is not specified the +calendar will use the displayArea (or inputField as in the first example). +The display area can have it's own format. This is useful if, for instance, +we need to store one format in the database (thus pass it in the input +field) but we wanna show a friendlier format to the end-user.

+ +
+ +
+ +

Your birthday: + Click to open date selector.

+ + + + + +
+ +

Hidden field, display area, trigger image. Very similar to the +previous example. The difference is that we also have a trigger image.

+ +
+ +
+ +

Your birthday: -- not entered -- .

+ + + + + +
+ +

Hidden field, display area. Very much like the previous examples, +but we now disable some dates (all weekends, that is, Saturdays and +Sundays).

+ +
+ +
+ +

Your birthday: + Click to open date selector.

+ + + + + + diff --git a/calendar/simple-2.html b/calendar/simple-2.html new file mode 100755 index 0000000..b55bae8 --- /dev/null +++ b/calendar/simple-2.html @@ -0,0 +1,108 @@ + + + + + +Simple calendar setup [flat calendar] + + + + + + + + + + + + + + + + + +

DHTML Calendar — for the impatient

+ +
+

+ This page demonstrates how to setup a flat calendar. Examples of + popup calendars are available in another page. +

+

+ The code in this page uses a helper function defined in + "calendar-setup.js". With it you can setup the calendar in + minutes. If you're not that impatient, ;-) complete documenation is + available. +

+
+ + + +
+ +
+ + + +

The positioning of the DIV that contains the calendar is entirely your +job. For instance, the "calendar-container" DIV from this page has the +following style: "float: right; margin-left: 1em; margin-bottom: 1em".

+ +

Following there is the code that has been used to create this calendar. +You can find the full description of the Calendar.setup() function +in the calendar documenation.

+ +
<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+ + + diff --git a/calendar/simple-3.html b/calendar/simple-3.html new file mode 100755 index 0000000..c096e87 --- /dev/null +++ b/calendar/simple-3.html @@ -0,0 +1,130 @@ + + + + + +Simple calendar setup [flat calendar] + + + + + + + + + + + + + + + + + + + +

DHTML Calendar — for the impatient

+ +
+

+ This page demonstrates how to setup a flat calendar. Examples of + popup calendars are available in another page. +

+

+ The code in this page uses a helper function defined in + "calendar-setup.js". With it you can setup the calendar in + minutes. If you're not that impatient, ;-) complete documenation is + available. +

+
+ + + +
+ +
+ + + +

The positioning of the DIV that contains the calendar is entirely your +job. For instance, the "calendar-container" DIV from this page has the +following style: "float: right; margin-left: 1em; margin-bottom: 1em".

+ +

Following there is the code that has been used to create this calendar. +You can find the full description of the Calendar.setup() function +in the calendar documenation.

+ +
<div style="float: right; margin-left: 1em; margin-bottom: 1em;"
+id="calendar-container"></div>
+
+<script type="text/javascript">
+  function dateChanged(calendar) {
+    // Beware that this function is called even if the end-user only
+    // changed the month/year.  In order to determine if a date was
+    // clicked you can use the dateClicked property of the calendar:
+    if (calendar.dateClicked) {
+      // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
+      var y = calendar.date.getFullYear();
+      var m = calendar.date.getMonth();     // integer, 0..11
+      var d = calendar.date.getDate();      // integer, 1..31
+      // redirect...
+      window.location = "/" + y + "/" + m + "/" + d + "/index.php";
+    }
+  };
+
+  Calendar.setup(
+    {
+      flat         : "calendar-container", // ID of the parent element
+      flatCallback : dateChanged           // our callback function
+    }
+  );
+</script>
+ + + diff --git a/calendar/skins/aqua/active-bg.gif b/calendar/skins/aqua/active-bg.gif new file mode 100755 index 0000000..d608c54 Binary files /dev/null and b/calendar/skins/aqua/active-bg.gif differ diff --git a/calendar/skins/aqua/dark-bg.gif b/calendar/skins/aqua/dark-bg.gif new file mode 100755 index 0000000..1dea48a Binary files /dev/null and b/calendar/skins/aqua/dark-bg.gif differ diff --git a/calendar/skins/aqua/hover-bg.gif b/calendar/skins/aqua/hover-bg.gif new file mode 100755 index 0000000..fbf94fc Binary files /dev/null and b/calendar/skins/aqua/hover-bg.gif differ diff --git a/calendar/skins/aqua/menuarrow.gif b/calendar/skins/aqua/menuarrow.gif new file mode 100755 index 0000000..40c0aad Binary files /dev/null and b/calendar/skins/aqua/menuarrow.gif differ diff --git a/calendar/skins/aqua/normal-bg.gif b/calendar/skins/aqua/normal-bg.gif new file mode 100755 index 0000000..bdb5068 Binary files /dev/null and b/calendar/skins/aqua/normal-bg.gif differ diff --git a/calendar/skins/aqua/rowhover-bg.gif b/calendar/skins/aqua/rowhover-bg.gif new file mode 100755 index 0000000..7715342 Binary files /dev/null and b/calendar/skins/aqua/rowhover-bg.gif differ diff --git a/calendar/skins/aqua/status-bg.gif b/calendar/skins/aqua/status-bg.gif new file mode 100755 index 0000000..857108c Binary files /dev/null and b/calendar/skins/aqua/status-bg.gif differ diff --git a/calendar/skins/aqua/theme.css b/calendar/skins/aqua/theme.css new file mode 100755 index 0000000..3f259cc --- /dev/null +++ b/calendar/skins/aqua/theme.css @@ -0,0 +1,236 @@ +/* Distributed as part of The Coolest DHTML Calendar + Author: Mihai Bazon, www.bazon.net/mishoo + Copyright Dynarch.com 2005, www.dynarch.com +*/ + +/* The main calendar widget. DIV containing a table. */ + +div.calendar { position: relative; } + +.calendar, .calendar table { + border: 1px solid #bdb2bf; + font-size: 11px; + color: #000; + cursor: default; + background: url(../../../jscalendar-1.0/skins/aqua/normal-bg.gif); + font-family: "trebuchet ms",verdana,tahoma,sans-serif; +} + +.calendar { + border-color: #797979; +} + +/* Header part -- contains navigation buttons and day names. */ + +.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */ + text-align: center; /* They are the navigation buttons */ + padding: 2px; /* Make the buttons seem like they're pressing */ + background: url(../../../jscalendar-1.0/skins/aqua/title-bg.gif) repeat-x 0 100%; color: #000; + font-weight: bold; +} + +.calendar .nav { + font-family: verdana,tahoma,sans-serif; +} + +.calendar .nav div { + background: transparent url(../../../jscalendar-1.0/skins/aqua/menuarrow.gif) no-repeat 100% 100%; +} + +.calendar thead tr { background: url(../../../jscalendar-1.0/skins/aqua/title-bg.gif) repeat-x 0 100%; color: #000; } + +.calendar thead .title { /* This holds the current "month, year" */ + font-weight: bold; /* Pressing it will take you to the current date */ + text-align: center; + padding: 2px; + background: url(../../../jscalendar-1.0/skins/aqua/title-bg.gif) repeat-x 0 100%; color: #000; +} + +.calendar thead .headrow { /* Row containing navigation buttons */ +} + +.calendar thead .name { /* Cells containing the day names */ + border-bottom: 1px solid #797979; + padding: 2px; + text-align: center; + color: #000; +} + +.calendar thead .weekend { /* How a weekend day name shows in header */ + color: #c44; +} + +.calendar thead .hilite { /* How do the buttons in header appear when hover */ + background: url(../../../jscalendar-1.0/skins/aqua/hover-bg.gif); + border-bottom: 1px solid #797979; + padding: 2px 2px 1px 2px; +} + +.calendar thead .active { /* Active (pressed) buttons in header */ + background: url(../../../jscalendar-1.0/skins/aqua/active-bg.gif); color: #fff; + padding: 3px 1px 0px 3px; + border-bottom: 1px solid #797979; +} + +.calendar thead .daynames { /* Row containing the day names */ + background: url(../../../jscalendar-1.0/skins/aqua/dark-bg.gif); +} + +/* The body part -- contains all the days in month. */ + +.calendar tbody .day { /* Cells containing month days dates */ + font-family: verdana,tahoma,sans-serif; + width: 2em; + color: #000; + text-align: right; + padding: 2px 4px 2px 2px; +} +.calendar tbody .day.othermonth { + font-size: 80%; + color: #999; +} +.calendar tbody .day.othermonth.oweekend { + color: #f99; +} + +.calendar table .wn { + padding: 2px 3px 2px 2px; + border-right: 1px solid #797979; + background: url(../../../jscalendar-1.0/skins/aqua/dark-bg.gif); +} + +.calendar tbody .rowhilite td, +.calendar tbody .rowhilite td.wn { + background: url(../../../jscalendar-1.0/skins/aqua/rowhover-bg.gif); +} + +.calendar tbody td.today { font-weight: bold; /* background: url("today-bg.gif") no-repeat 70% 50%; */ } + +.calendar tbody td.hilite { /* Hovered cells */ + background: url(../../../jscalendar-1.0/skins/aqua/hover-bg.gif); + padding: 1px 3px 1px 1px; + border: 1px solid #bbb; +} + +.calendar tbody td.active { /* Active (pressed) cells */ + padding: 2px 2px 0px 2px; +} + +.calendar tbody td.weekend { /* Cells showing weekend days */ + color: #c44; +} + +.calendar tbody td.selected { /* Cell showing selected date */ + font-weight: bold; + border: 1px solid #797979; + padding: 1px 3px 1px 1px; + background: url(../../../jscalendar-1.0/skins/aqua/active-bg.gif); color: #fff; +} + +.calendar tbody .disabled { color: #999; } + +.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */ + visibility: hidden; +} + +.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */ + display: none; +} + +/* The footer part -- status bar and "Close" button */ + +.calendar tfoot .footrow { /* The in footer (only one right now) */ + text-align: center; + background: #565; + color: #fff; +} + +.calendar tfoot .ttip { /* Tooltip (status bar) cell */ + padding: 2px; + background: url(../../../jscalendar-1.0/skins/aqua/status-bg.gif) repeat-x 0 0; color: #000; +} + +.calendar tfoot .hilite { /* Hover style for buttons in footer */ + background: #afa; + border: 1px solid #084; + color: #000; + padding: 1px; +} + +.calendar tfoot .active { /* Active (pressed) style for buttons in footer */ + background: #7c7; + padding: 2px 0px 0px 2px; +} + +/* Combo boxes (menus that display months/years for direct selection) */ + +.calendar .combo { + position: absolute; + display: none; + top: 0px; + left: 0px; + width: 4em; + cursor: default; + border-width: 0 1px 1px 1px; + border-style: solid; + border-color: #797979; + background: url(../../../jscalendar-1.0/skins/aqua/normal-bg.gif); color: #000; + z-index: 100; + font-size: 90%; +} + +.calendar .combo .label, +.calendar .combo .label-IEfix { + text-align: center; + padding: 1px; +} + +.calendar .combo .label-IEfix { + width: 4em; +} + +.calendar .combo .hilite { + background: url(../../../jscalendar-1.0/skins/aqua/hover-bg.gif); color: #000; +} + +.calendar .combo .active { + background: url(../../../jscalendar-1.0/skins/aqua/active-bg.gif); color: #fff; + font-weight: bold; +} + +.calendar td.time { + border-top: 1px solid #797979; + padding: 1px 0px; + text-align: center; + background: url(../../../jscalendar-1.0/skins/aqua/dark-bg.gif); +} + +.calendar td.time .hour, +.calendar td.time .minute, +.calendar td.time .ampm { + padding: 0px 5px 0px 6px; + font-weight: bold; + background: url(../../../jscalendar-1.0/skins/aqua/normal-bg.gif); color: #000; +} + +.calendar td.time .hour, +.calendar td.time .minute { + font-family: monospace; +} + +.calendar td.time .ampm { + text-align: center; +} + +.calendar td.time .colon { + padding: 0px 2px 0px 3px; + font-weight: bold; +} + +.calendar td.time span.hilite { + background: url(../../../jscalendar-1.0/skins/aqua/hover-bg.gif); color: #000; +} + +.calendar td.time span.active { + background: url(../../../jscalendar-1.0/skins/aqua/active-bg.gif); color: #fff; +} diff --git a/calendar/skins/aqua/title-bg.gif b/calendar/skins/aqua/title-bg.gif new file mode 100755 index 0000000..6a541b3 Binary files /dev/null and b/calendar/skins/aqua/title-bg.gif differ diff --git a/calendar/skins/aqua/today-bg.gif b/calendar/skins/aqua/today-bg.gif new file mode 100755 index 0000000..7161538 Binary files /dev/null and b/calendar/skins/aqua/today-bg.gif differ diff --git a/calendar/test-position.html b/calendar/test-position.html new file mode 100755 index 0000000..c2d8b81 --- /dev/null +++ b/calendar/test-position.html @@ -0,0 +1,42 @@ + + + + + JS Calendar (positioning test) + + + + + + + + + + + + +
+ + + + + + + +
+ + + diff --git a/calendar/test.php b/calendar/test.php new file mode 100755 index 0000000..7a228fa --- /dev/null +++ b/calendar/test.php @@ -0,0 +1,117 @@ + + + + + +Test for calendar.php + + + section; it will "echo" code that loads the calendar +// scripts and theme file. +$calendar->load_files(); + +?> + + + + + + + + +

Form submitted

+ + $val) { + echo htmlspecialchars($key) . ' = ' . htmlspecialchars($val) . '
'; +} ?> + + + +

Calendar.php test

+ +
+ Select language: +
+ NOTE: as of this release, 0.9.6, only "EN" and "RO", which I + maintain, function correctly. Other language files do not work + because they need to be updated. If you update some language file, + please consider sending it back to me so that I can include it in the + calendar distribution. +
+
+ +
+ + + + + + + +
+ Date 1: + + make_input_field( + // calendar options go here; see the documentation and/or calendar-setup.js + array('firstDay' => 1, // show Monday first + 'showsTime' => true, + 'showOthers' => true, + 'ifFormat' => '%Y-%m-%d %I:%M %P', + 'timeFormat' => '12'), + // field attributes go here + array('style' => 'width: 15em; color: #840; background-color: #ff8; border: 1px solid #000; text-align: center', + 'name' => 'date1', + 'value' => strftime('%Y-%m-%d %I:%M %P', strtotime('now')))); ?> +
+ +
+ + +
+ + + + + diff --git a/db/conexion.php b/db/conexion.php new file mode 100755 index 0000000..baa0468 --- /dev/null +++ b/db/conexion.php @@ -0,0 +1,71 @@ +"); +} */ + +// namespace db; // No definido. + +// Class +use mysqli; + +// Se defina las Clases para que la puedan usar las funciones internas de los archivos inc_..._.php // Se escriben en PascalCase +class Database +{ // ATRIBUTOS + protected $db_username = "mich"; + protected $db_password = "*********"; + protected $db_name = "nextglass"; + protected $db_host = "localhost"; + + protected $conn; + + // CONSTRUCTOR + public function __construct() { + $this->getConnection(); + } + + // METODO getConnection() para obtener la conexion. Se escriben en camelCase + public function getConnection() + { + // $this->conn = null; // Es el Constructor ??? + try { + $this->conn = new mysqli($this->db_host, $this->db_username, $this->db_password, $this->db_name); + + // Verifica si la conexion tiene errores. + if ($this->conn->connect_error) { + throw new Exception("Connection failed: " . $this->conn->connect_error); + } + } catch (Exception $e) { + echo "Error de conexión: " . $e->getMessage(); + } + return $this->conn; + } + + + // METODO para cerrar la conexion. + public function closeConnection() { + if ($this->conn) { + $this->conn->close(); + } + } +} + +// El OBJETO es $db instanciado (creado) por la clase Database (la clase es como una plantilla) +$db = new Database(); // Class Database +$conn = $db->getConnection(); // Metodo getConnection() + +// Debug Clases +/* if ($conn) { echo "Conexion exitosa a la base de datos"; +} else { echo "Error al conectar a la base de datos"; } */ + + // EJEMPLO SQL: funciona->cambiar nombre de tabla y campos +/* $sql = "SELECT * FROM [nombre de tabla] "; +$res = $conn->query($sql); +$row = $res->fetch_assoc(); +$num = $res->num_rows; +echo '
'.$num; +// debug +echo "
".$sql."

num: ".$num."
\$row[cambiar]: ".$row['cambiar_nombre_de_campo']."
"; + */ + +// Recuerda cerrar la conexion cuando termines. +// $db->closeConnection(); diff --git a/db/index.php b/db/index.php new file mode 100755 index 0000000..a704118 --- /dev/null +++ b/db/index.php @@ -0,0 +1,25 @@ + + + + + + + + + + + + +
+ + + + + +
+

Area + Restringida

+
+
+ + \ No newline at end of file diff --git a/empleados.php b/empleados.php new file mode 100755 index 0000000..4d1360b --- /dev/null +++ b/empleados.php @@ -0,0 +1,689 @@ + + + + + + + + + + Empleados + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + '.$nombre_archivo; + //echo '
'.$imagen_home; + + + // si la imagen se carg� correctamente inserta los datos en la tabla + move_uploaded_file($_FILES['file']['tmp_name'], $nombre_archivo2); + ///////////////////////////////////////////////////// + //// RESIZE_IMAGE + $image = "images/empleados/" . $imagen_home; + + if (!$max_width) + $max_width = 200; + if (!$max_height) + $max_height = 200; + $size = GetImageSize($image); + $width = $size[0]; + $height = $size[1]; + + $x_ratio = $max_width / $width; + $y_ratio = $max_height / $height; + + if (($width <= $max_width) && ($height <= $max_height)) { + $tn_width = $width; + $tn_height = $height; + } else if (($x_ratio * $height) < $max_height) { + $tn_height = ceil($x_ratio * $height); + $tn_width = $max_width; + } else { + $tn_width = ceil($y_ratio * $width); + $tn_height = $max_height; + } + + + //////////////// + //echo $imagen; + $origen = "images/empleados/" . $imagen_home; + $destino = "images/empleados/" . $imagen_home; + + + $destino_temporal = tempnam("tmp/", "tmp"); + + redimensionar_jpeg($origen, $destino_temporal, $tn_width, $tn_height, 100); + + // guardamos la imagen + $fp = fopen($destino, "w"); + fputs($fp, fread(fopen($destino_temporal, "r"), filesize($destino_temporal))); + fclose($fp); + + // mostramos la imagen + //echo ""; + ////////////////////////////////////////// + } + + $s = $_POST['codigo']; + + $code = sprintf("*E%05s*", $s); // el relleno con ceros funciona con cadenas tambien + + $sql = " INSERT INTO empleados VALUES ('" . $_POST['codigo'] . "'"; + $sql .= ", UPPER('" . $_POST['nombre'] . "')"; + $sql .= ", UPPER('" . $_POST['apellido'] . "')"; + $sql .= ", '" . $_POST['dni'] . "'"; + $sql .= ", '" . $_POST['grupo'] . "'"; + $sql .= ", '" . $code . "'"; + $sql .= ", '" . $imagen_home . "'"; + $sql .= ", '1'"; + $sql .= " ) "; + $res = $conn->query($sql); + // Debug echo $sql; + echo '
Registro Ingresado.
'; + } + + /////////////////////////////////////////////////////////////////////////////////// + //BAJA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + if ($_POST['borraremp'] == 'Si') { + $sql_p = "UPDATE empleados SET publico_e= '0' WHERE empleado_id = " . $_POST['id_baja']; + $res_p = $conn->query($sql_p); + //echo $sql_p; + + echo '
Registro Borrado.
'; + } + + + + + + //MODIFICACION ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + if ($_POST['modificar'] == 'Modificar') { + + if ($_FILES['file']['name'] != '') { + $imagen_home = $_FILES['file']['name']; + // debug + $nombre_archivo2 = "images/empleados/" . $imagen_home; // agrega el ID al nombre de la imagen + ///echo '
'.$imagen_home; + + if (move_uploaded_file($_FILES['file']['tmp_name'], $nombre_archivo2)) { + ///////////////////////////////////////////////////// + //// RESIZE_IMAGE + $image = "images/empleados/" . $imagen_home; + + if (!$max_width) + $max_width = 200; + if (!$max_height) + $max_height = 200; + $size = GetImageSize($image); + $width = $size[0]; + $height = $size[1]; + + $x_ratio = $max_width / $width; + $y_ratio = $max_height / $height; + + if (($width <= $max_width) && ($height <= $max_height)) { + $tn_width = $width; + $tn_height = $height; + } else if (($x_ratio * $height) < $max_height) { + $tn_height = ceil($x_ratio * $height); + $tn_width = $max_width; + } else { + $tn_width = ceil($y_ratio * $width); + $tn_height = $max_height; + } + + + //////////////// + //echo $imagen; + $origen = "images/empleados/" . $imagen_home; + $destino = "images/empleados/" . $imagen_home; + + + $destino_temporal = tempnam("tmp/", "tmp"); + + redimensionar_jpeg($origen, $destino_temporal, $tn_width, $tn_height, 100); + + // guardamos la imagen + $fp = fopen($destino, "w"); + fputs($fp, fread(fopen($destino_temporal, "r"), filesize($destino_temporal))); + fclose($fp); + + // mostramos la imagen + //echo ""; + //////////////////////////////////////////Borra imagen anterior + if ($_POST['imagen_e'] != '') { + + $archi = "images/empleados/" . $_POST['imagen_e']; + if (file_exists($archi)) { + unlink($archi); + clearstatcache(); + } + } + } + } else { + $imagen_home = $_POST['imagen_e']; + } + + + $s = $_POST['codigo']; + $code = sprintf("*E%05s*", $s); // el relleno con ceros funciona con cadenas tambien + + $sql_m = " UPDATE empleados SET nombre_e = UPPER('" . $_POST['nombre'] . "'), + apellido_e = UPPER('" . $_POST['apellido'] . "'), dni_e='" . $_POST['dni'] . "', grupo_e='" . $_POST['grupo'] . "' , + code_e='" . $code . "' , imagen_e='" . $imagen_home . "' WHERE empleado_id = " . $_POST['id_m']; + $res_m = $conn->query($sql_m); + //echo $sql_m; + echo '
Registro Modificado.
'; + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + ?> + + +
Id:
+ +
Buscar "Empleado" por Nombre:
+ +
+   +
+ +
+ + + + +
+
+
+   Confirma la BAJA del empleado:
+   
+ +
+
+ + + + + +
+ + + +
+
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + +
   
 
  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CODIGO DE EMPLEADO : + query($sql_max); + $row_max = $res_max->fetch_array(); + $id_empleado = $row_max['m'] + 1; ?> + + +   
Nombre:Apellido:
DNI:Grupo:
  
Imagen:
  
+
+
+
+
 
 
+
+ query($sql_empleado); + $row_empleado = $res_empleado->fetch_assoc(); + ?> +
+ + + + + + + + + + + + + + + + + + + + + +
   
 
  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CODIGO DE EMPLEADO : + +   
Nombre: + + Apellido:
DNI:Grupo: + +
  
Borrar Empleado:   
  
Imagen: + + '; + } ?> + +
Código de Barra: + &style=452&type=C128B&width=200&height=75&xres=2&font=5'> +
+
+

+
 
 
+
+ +

+ +
+ query($sql); + $num = $res->num_rows; + // Debug echo $sql.'
num_rows:'.$num; + ?> +

+ + + + +
+ + + + + + + + + fetch_assoc(); + + if (($i % 2) == 0) { + $fondo = "#FFFFFF"; + } else { + $fondo = "#E6E6E6"; + } + + ?> + + + + + + + + + + + + +
CódigoNombreApellidoDNIGrupo
  + +        
+
+
' . $res->num_rows . ' Resultados
'; + ?> + + '; + } + /////////////////////////////////////////////////////////////////// + function redimensionar_jpeg($img_original, $img_nueva, $img_nueva_anchura, $img_nueva_altura, $img_nueva_calidad) + { + // crear una imagen desde el original + $img = ImageCreateFromJPEG($img_original); + //////////////// + $white = ImageColorAllocate($img, 255, 255, 255); + // crear una imagen nueva + $thumb = imagecreatetruecolor($img_nueva_anchura, $img_nueva_altura); + ///////////////////////////// + ImageString($img, 5, 5, 0, '', $white); + // redimensiona la imagen original copiandola en la imagen + ImageCopyResized($thumb, $img, 0, 0, 0, 0, $img_nueva_anchura, $img_nueva_altura, ImageSX($img), ImageSY($img)); + // guardar la nueva imagen redimensionada donde indicia $img_nueva + ImageJPEG($thumb, $img_nueva, $img_nueva_calidad); + ImageDestroy($img); + } + //////////////////////////////////////////////////// + ?> + + + + \ No newline at end of file diff --git a/filtro.php b/filtro.php new file mode 100755 index 0000000..a3485fc --- /dev/null +++ b/filtro.php @@ -0,0 +1,255 @@ + + + + + + + + +Listados + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
  Formulario De Impresión
+ + + + + + + + + +

+ + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
Seleccion de Tipo de Listado:
Empleados
Autos
Operaciones
Acciones
+
+
+

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
Listado de Procesos:
+ +  Orden de Blindaje
  
Listado de Empleados:
+
  
+ + + + + + + + + + +
Desde:Hasta:
+ + + + + + + + + + Borrar fechas +
  
+ + + + + + + + + + + + + + + +
Ordenado por:
OB y Operación
Empleados
 
+ +

+
+ + + +
 
+

 

+'; +} ?> + + + diff --git a/home.php b/home.php new file mode 100755 index 0000000..c035192 --- /dev/null +++ b/home.php @@ -0,0 +1,222 @@ + + + + + + + + + + + +CAPTACION DE PROCESOS + + + + + + + + + +
+Vehículo: '.$_POST['vehiculo'].'
Proceso: '.$_POST['proceso']; + //SELLECCINA vehic, empleados, operaciones DE SUS RESPECTIVAS TABLAS + $sql = "SELECT altas.alta_id, altas.marca, altas.modelo, altas.code_a, + empleados.empleado_id, empleados.nombre_e, empleados.apellido_e, + operaciones.operaciones_id, operaciones.nombre_o + FROM altas, empleados, operaciones + WHERE altas.code_a = '$_POST[vehiculo]' + AND empleados.empleado_id = '$_POST[empleado]' + AND operaciones.operaciones_id = '$_POST[proceso]' "; + + //debug + echo '

'.$sql.'
'; + + $res = $conn->query($sql); + $row = mysqli_fetch_assoc($res); + //$numfields = mysqli_num_fields($res); // Cantidad de campos de ESTA consulta SQL. + $num = mysqli_num_rows($res); + + //debug echo '
'.$row[code_a].'
'.$row[marca].' '.$row[modelo].' - '.$row[nombre_e].' '.$row[apellido_e].' - '.$row[nombre_o]; + + //MUESTRA MENSAJE DE ERROR SI ALGUNO DE LOS DATOS NO CORRESPONDE A UN REGISTRO EN LA BASE DE DATOS + //DEBBUG echo '
mysqli_num_rows($res):'.mysqli_num_rows($res).'

'; + if ($num == 0) { + echo ""; + } elseif ($num > 0) { // ACTUALIZA LOS DATOS DE UN REGISTRO EXISTENTE DE procesos + + $sql_proc = " SELECT * FROM procesos WHERE auto = $row[alta_id] AND empleado = $row[empleado_id] + AND operacion = $row[operaciones_id] AND fin = '0000-00-00 00:00:00' "; + + $res_proc = $conn->query($sql_proc); + $num_proc = mysqli_num_rows($res_proc); + //debugg + echo 'cantidad de procesos: '.$num_proc; + if ($num_proc > 0) { + + $sql_proc_update = " UPDATE procesos SET fin = '" . date('Y-m-d H:i:s') . "' + WHERE auto = $row[alta_id] AND empleado = $row[empleado_id] + AND operacion = $row[operaciones_id] AND fin = '0000-00-00 00:00:00' "; + + //debug echo '

'.$sql_proc_update; + $res_proc_pdate = $conn->query($sql_proc_update); + + //debug echo '

Affected Rows UPDATE: '.mysql_affected_rows(); + echo '
PROCESO FINALIZADO:'; + } else { //INSERTA UN NUEVO REGISTRO DE PROCESO + echo '
PROCESO NUEVO: '; + //debug echo '
Affectes rows ES CERO'; + $sql_proc_nuevo = " INSERT INTO procesos VALUES (NULL,'" . $row['empleado_id'] . "'"; + $sql_proc_nuevo .= ", $row[alta_id] "; + $sql_proc_nuevo .= ", $row[operaciones_id] "; + $sql_proc_nuevo .= ", '" . date('Y-m-d') . "' "; + $sql_proc_nuevo .= ", '" . date('Y-m-d H:i:s') . "' "; + $sql_proc_nuevo .= ", 0 "; + $sql_proc_nuevo .= ", '" . $code . "' "; + $sql_proc_nuevo .= ", 1 "; + $sql_proc_nuevo .= " ) "; + + $res_proc_nuevo = $conn->query($sql_proc_nuevo); + + //debug echo '
'.$sql_proc_nuevo.'
Affected rows INSERT: '. mysql_affected_rows(); + + } + + echo " ".$row['nombre_o']."    |    VEHICULO: ".$row['marca']." ".$row['modelo']."   |   EMPLEADO: " + .$row['nombre_e']." ".$row['apellido_e'].""; + +/* echo ' ' . $row['nombre_o'] . '    |    VEHICULO: ' . $row[marca] . ' ' . $row[modelo] . '   |   EMPLEADO: ' + . $row[nombre_e] . ' ' . $row[apellido_e] . ''; */ + } +} // FIN DE Grabar + +?> + +
+ + + + +
+ + + + + + + + + + +
+ + + + + + + + + + +
+ +   + +
+
 
+ +

Empleado:
+ +

+

Vehículo:
+ +

+

Proceso:
+
+

+ + + + + + +
+ + + +
+
+
+
+
+ + + \ No newline at end of file diff --git a/images/SugarCRM_logo.gif b/images/SugarCRM_logo.gif new file mode 100755 index 0000000..1a0da9e Binary files /dev/null and b/images/SugarCRM_logo.gif differ diff --git a/images/Thumbs.db b/images/Thumbs.db new file mode 100755 index 0000000..c338494 Binary files /dev/null and b/images/Thumbs.db differ diff --git a/images/Ym2.png b/images/Ym2.png new file mode 100755 index 0000000..3ba9927 Binary files /dev/null and b/images/Ym2.png differ diff --git a/images/admin.png b/images/admin.png new file mode 100755 index 0000000..f50826d Binary files /dev/null and b/images/admin.png differ diff --git a/images/b_drop.png b/images/b_drop.png new file mode 100755 index 0000000..6fc4d3b Binary files /dev/null and b/images/b_drop.png differ diff --git a/images/b_edit.png b/images/b_edit.png new file mode 100755 index 0000000..05711a0 Binary files /dev/null and b/images/b_edit.png differ diff --git a/images/background.gif b/images/background.gif new file mode 100755 index 0000000..9c42725 Binary files /dev/null and b/images/background.gif differ diff --git a/images/bar_amarillo.gif b/images/bar_amarillo.gif new file mode 100755 index 0000000..eb6d9c4 Binary files /dev/null and b/images/bar_amarillo.gif differ diff --git a/images/bar_azul.gif b/images/bar_azul.gif new file mode 100755 index 0000000..42d32bb Binary files /dev/null and b/images/bar_azul.gif differ diff --git a/images/bar_celeste.gif b/images/bar_celeste.gif new file mode 100755 index 0000000..44d8665 Binary files /dev/null and b/images/bar_celeste.gif differ diff --git a/images/bar_naranja.gif b/images/bar_naranja.gif new file mode 100755 index 0000000..d9464b7 Binary files /dev/null and b/images/bar_naranja.gif differ diff --git a/images/bar_turquesa.gif b/images/bar_turquesa.gif new file mode 100755 index 0000000..4fa14d4 Binary files /dev/null and b/images/bar_turquesa.gif differ diff --git a/images/bar_verdeclaro.gif b/images/bar_verdeclaro.gif new file mode 100755 index 0000000..789f7ab Binary files /dev/null and b/images/bar_verdeclaro.gif differ diff --git a/images/bar_verdeoscuro.gif b/images/bar_verdeoscuro.gif new file mode 100755 index 0000000..9d6f2dc Binary files /dev/null and b/images/bar_verdeoscuro.gif differ diff --git a/images/bar_violeta.gif b/images/bar_violeta.gif new file mode 100755 index 0000000..d71ec7c Binary files /dev/null and b/images/bar_violeta.gif differ diff --git a/images/bg.png b/images/bg.png new file mode 100755 index 0000000..8831ec2 Binary files /dev/null and b/images/bg.png differ diff --git a/images/bg_footer.jpg b/images/bg_footer.jpg new file mode 100755 index 0000000..ad67a61 Binary files /dev/null and b/images/bg_footer.jpg differ diff --git a/images/bg_menu.gif b/images/bg_menu.gif new file mode 100755 index 0000000..4533a5d Binary files /dev/null and b/images/bg_menu.gif differ diff --git a/images/bg_menu.jpg b/images/bg_menu.jpg new file mode 100755 index 0000000..0f45ed6 Binary files /dev/null and b/images/bg_menu.jpg differ diff --git a/images/bg_menu_inf.gif b/images/bg_menu_inf.gif new file mode 100755 index 0000000..7957da2 Binary files /dev/null and b/images/bg_menu_inf.gif differ diff --git a/images/bg_tbar.gif b/images/bg_tbar.gif new file mode 100755 index 0000000..b39e4a0 Binary files /dev/null and b/images/bg_tbar.gif differ diff --git a/images/bg_tbar.jpg b/images/bg_tbar.jpg new file mode 100755 index 0000000..a1ddc81 Binary files /dev/null and b/images/bg_tbar.jpg differ diff --git a/images/bgimage.gif b/images/bgimage.gif new file mode 100755 index 0000000..de3d8d9 Binary files /dev/null and b/images/bgimage.gif differ diff --git a/images/borde_der.jpg b/images/borde_der.jpg new file mode 100755 index 0000000..10bf7bd Binary files /dev/null and b/images/borde_der.jpg differ diff --git a/images/borde_i.jpg b/images/borde_i.jpg new file mode 100755 index 0000000..6cba74b Binary files /dev/null and b/images/borde_i.jpg differ diff --git a/images/borde_iz.jpg b/images/borde_iz.jpg new file mode 100755 index 0000000..ef80638 Binary files /dev/null and b/images/borde_iz.jpg differ diff --git a/images/borde_s.jpg b/images/borde_s.jpg new file mode 100755 index 0000000..acb39da Binary files /dev/null and b/images/borde_s.jpg differ diff --git a/images/btn_borrar_azul.jpg b/images/btn_borrar_azul.jpg new file mode 100755 index 0000000..e6fedf5 Binary files /dev/null and b/images/btn_borrar_azul.jpg differ diff --git a/images/btn_guardar_azul.jpg b/images/btn_guardar_azul.jpg new file mode 100755 index 0000000..35a508e Binary files /dev/null and b/images/btn_guardar_azul.jpg differ diff --git a/images/btn_ingresar.jpg b/images/btn_ingresar.jpg new file mode 100755 index 0000000..c90727e Binary files /dev/null and b/images/btn_ingresar.jpg differ diff --git a/images/bullet_arrow_down.gif b/images/bullet_arrow_down.gif new file mode 100755 index 0000000..7418bd0 Binary files /dev/null and b/images/bullet_arrow_down.gif differ diff --git a/images/button_cancel.jpg b/images/button_cancel.jpg new file mode 100755 index 0000000..bd613da Binary files /dev/null and b/images/button_cancel.jpg differ diff --git a/images/button_ok.jpg b/images/button_ok.jpg new file mode 100755 index 0000000..8a18352 Binary files /dev/null and b/images/button_ok.jpg differ diff --git a/images/calendar.png b/images/calendar.png new file mode 100755 index 0000000..9ad750b Binary files /dev/null and b/images/calendar.png differ diff --git a/images/calendar16.gif b/images/calendar16.gif new file mode 100755 index 0000000..8693aed Binary files /dev/null and b/images/calendar16.gif differ diff --git a/images/calendar16.png b/images/calendar16.png new file mode 100755 index 0000000..b28af37 Binary files /dev/null and b/images/calendar16.png differ diff --git a/images/calendar48.jpg b/images/calendar48.jpg new file mode 100755 index 0000000..fbdb2fb Binary files /dev/null and b/images/calendar48.jpg differ diff --git a/images/calendario.gif b/images/calendario.gif new file mode 100755 index 0000000..cd2c4a5 Binary files /dev/null and b/images/calendario.gif differ diff --git a/images/comment_add0.png b/images/comment_add0.png new file mode 100755 index 0000000..75e78de Binary files /dev/null and b/images/comment_add0.png differ diff --git a/images/cuotas_impagas.png b/images/cuotas_impagas.png new file mode 100755 index 0000000..cc5891a Binary files /dev/null and b/images/cuotas_impagas.png differ diff --git a/images/emp.jpg b/images/emp.jpg new file mode 100755 index 0000000..5b47e3d Binary files /dev/null and b/images/emp.jpg differ diff --git a/images/emp_alta.jpg b/images/emp_alta.jpg new file mode 100755 index 0000000..a39155e Binary files /dev/null and b/images/emp_alta.jpg differ diff --git a/images/emp_alta_on.jpg b/images/emp_alta_on.jpg new file mode 100755 index 0000000..2e27316 Binary files /dev/null and b/images/emp_alta_on.jpg differ diff --git a/images/emp_mod.jpg b/images/emp_mod.jpg new file mode 100755 index 0000000..9d289d3 Binary files /dev/null and b/images/emp_mod.jpg differ diff --git a/images/emp_mod_on.jpg b/images/emp_mod_on.jpg new file mode 100755 index 0000000..19177f6 Binary files /dev/null and b/images/emp_mod_on.jpg differ diff --git a/images/empleados/Thumbs.db b/images/empleados/Thumbs.db new file mode 100755 index 0000000..0394d81 Binary files /dev/null and b/images/empleados/Thumbs.db differ diff --git a/images/empleados/img-financeAndInsurance-thumb.jpg b/images/empleados/img-financeAndInsurance-thumb.jpg new file mode 100755 index 0000000..eb445df Binary files /dev/null and b/images/empleados/img-financeAndInsurance-thumb.jpg differ diff --git a/images/empleados/img-higherEducation-thumb.jpg b/images/empleados/img-higherEducation-thumb.jpg new file mode 100755 index 0000000..2d5710e Binary files /dev/null and b/images/empleados/img-higherEducation-thumb.jpg differ diff --git a/images/empleados/img-internetAndIp-thumb.jpg b/images/empleados/img-internetAndIp-thumb.jpg new file mode 100755 index 0000000..3e84336 Binary files /dev/null and b/images/empleados/img-internetAndIp-thumb.jpg differ diff --git a/images/empleados/img-networking-thumb.jpg b/images/empleados/img-networking-thumb.jpg new file mode 100755 index 0000000..75bb16a Binary files /dev/null and b/images/empleados/img-networking-thumb.jpg differ diff --git a/images/empleados/thumb_male.jpg b/images/empleados/thumb_male.jpg new file mode 100755 index 0000000..ad07999 Binary files /dev/null and b/images/empleados/thumb_male.jpg differ diff --git a/images/esq_id.jpg b/images/esq_id.jpg new file mode 100755 index 0000000..53cdf46 Binary files /dev/null and b/images/esq_id.jpg differ diff --git a/images/esq_ii.jpg b/images/esq_ii.jpg new file mode 100755 index 0000000..87ce289 Binary files /dev/null and b/images/esq_ii.jpg differ diff --git a/images/esq_menu.jpg b/images/esq_menu.jpg new file mode 100755 index 0000000..34e805a Binary files /dev/null and b/images/esq_menu.jpg differ diff --git a/images/esq_menu_D.jpg b/images/esq_menu_D.jpg new file mode 100755 index 0000000..ad12030 Binary files /dev/null and b/images/esq_menu_D.jpg differ diff --git a/images/esq_sd.jpg b/images/esq_sd.jpg new file mode 100755 index 0000000..d186369 Binary files /dev/null and b/images/esq_sd.jpg differ diff --git a/images/esq_si.jpg b/images/esq_si.jpg new file mode 100755 index 0000000..6f90365 Binary files /dev/null and b/images/esq_si.jpg differ diff --git a/images/fecha_borde_D.html b/images/fecha_borde_D.html new file mode 100755 index 0000000..66107de --- /dev/null +++ b/images/fecha_borde_D.html @@ -0,0 +1,12 @@ + + + + captacion de proceso + + + + + + + + diff --git a/images/fecha_borde_D.jpg b/images/fecha_borde_D.jpg new file mode 100755 index 0000000..d398c30 Binary files /dev/null and b/images/fecha_borde_D.jpg differ diff --git a/images/fecha_borde_L.html b/images/fecha_borde_L.html new file mode 100755 index 0000000..6ccfa58 --- /dev/null +++ b/images/fecha_borde_L.html @@ -0,0 +1,12 @@ + + + + captacion de proceso + + + + + + + + diff --git a/images/fecha_borde_L.jpg b/images/fecha_borde_L.jpg new file mode 100755 index 0000000..2c7aa90 Binary files /dev/null and b/images/fecha_borde_L.jpg differ diff --git a/images/fecha_fondo.html b/images/fecha_fondo.html new file mode 100755 index 0000000..22e38c7 --- /dev/null +++ b/images/fecha_fondo.html @@ -0,0 +1,12 @@ + + + + captacion de proceso + + + + + + + + diff --git a/images/fecha_fondo.jpg b/images/fecha_fondo.jpg new file mode 100755 index 0000000..40e54fc Binary files /dev/null and b/images/fecha_fondo.jpg differ diff --git a/images/filtro.gif b/images/filtro.gif new file mode 100755 index 0000000..cc6ca42 Binary files /dev/null and b/images/filtro.gif differ diff --git a/images/fnd_button.gif b/images/fnd_button.gif new file mode 100755 index 0000000..984d13b Binary files /dev/null and b/images/fnd_button.gif differ diff --git a/images/fnd_button_azul.gif b/images/fnd_button_azul.gif new file mode 100755 index 0000000..2072558 Binary files /dev/null and b/images/fnd_button_azul.gif differ diff --git a/images/fnd_button_azul.html b/images/fnd_button_azul.html new file mode 100755 index 0000000..1b4cd8f --- /dev/null +++ b/images/fnd_button_azul.html @@ -0,0 +1,12 @@ + + + + captacion de proceso + + + + + + + + diff --git a/images/fnd_button_azul.jpg b/images/fnd_button_azul.jpg new file mode 100755 index 0000000..798f8ff Binary files /dev/null and b/images/fnd_button_azul.jpg differ diff --git a/images/fnd_button_rojo.html b/images/fnd_button_rojo.html new file mode 100755 index 0000000..9d2947e --- /dev/null +++ b/images/fnd_button_rojo.html @@ -0,0 +1,12 @@ + + + + captacion de proceso + + + + + + + + diff --git a/images/fnd_button_rojo.jpg b/images/fnd_button_rojo.jpg new file mode 100755 index 0000000..272d776 Binary files /dev/null and b/images/fnd_button_rojo.jpg differ diff --git a/images/fondo_captacion.jpg b/images/fondo_captacion.jpg new file mode 100755 index 0000000..5d2b07c Binary files /dev/null and b/images/fondo_captacion.jpg differ diff --git a/images/footer70.jpg b/images/footer70.jpg new file mode 100755 index 0000000..e917d10 Binary files /dev/null and b/images/footer70.jpg differ diff --git a/images/green_bullet.jpg b/images/green_bullet.jpg new file mode 100755 index 0000000..1742abd Binary files /dev/null and b/images/green_bullet.jpg differ diff --git a/images/iconfinder.jpg b/images/iconfinder.jpg new file mode 100755 index 0000000..25ddff8 Binary files /dev/null and b/images/iconfinder.jpg differ diff --git a/images/icono_admin.jpg b/images/icono_admin.jpg new file mode 100755 index 0000000..e75cb49 Binary files /dev/null and b/images/icono_admin.jpg differ diff --git a/images/icono_alta.gif b/images/icono_alta.gif new file mode 100755 index 0000000..92526a5 Binary files /dev/null and b/images/icono_alta.gif differ diff --git a/images/icono_documentos.gif b/images/icono_documentos.gif new file mode 100755 index 0000000..eb4e735 Binary files /dev/null and b/images/icono_documentos.gif differ diff --git a/images/icono_grafico.gif b/images/icono_grafico.gif new file mode 100755 index 0000000..deb5141 Binary files /dev/null and b/images/icono_grafico.gif differ diff --git a/images/icono_modificar.gif b/images/icono_modificar.gif new file mode 100755 index 0000000..1099c97 Binary files /dev/null and b/images/icono_modificar.gif differ diff --git a/images/icono_usuarios.gif b/images/icono_usuarios.gif new file mode 100755 index 0000000..22bc16c Binary files /dev/null and b/images/icono_usuarios.gif differ diff --git a/images/icono_ver.gif b/images/icono_ver.gif new file mode 100755 index 0000000..2449fb8 Binary files /dev/null and b/images/icono_ver.gif differ diff --git a/images/linea_azul.jpg b/images/linea_azul.jpg new file mode 100755 index 0000000..0716f33 Binary files /dev/null and b/images/linea_azul.jpg differ diff --git a/images/list.jpg b/images/list.jpg new file mode 100755 index 0000000..4e7009d Binary files /dev/null and b/images/list.jpg differ diff --git a/images/list_on.jpg b/images/list_on.jpg new file mode 100755 index 0000000..c8f1ce9 Binary files /dev/null and b/images/list_on.jpg differ diff --git a/images/mas.png b/images/mas.png new file mode 100755 index 0000000..f95f1cd Binary files /dev/null and b/images/mas.png differ diff --git a/images/money.png b/images/money.png new file mode 100755 index 0000000..42c52d0 Binary files /dev/null and b/images/money.png differ diff --git a/images/money_add.gif b/images/money_add.gif new file mode 100755 index 0000000..b8c789f Binary files /dev/null and b/images/money_add.gif differ diff --git a/images/money_add.png b/images/money_add.png new file mode 100755 index 0000000..588fa9d Binary files /dev/null and b/images/money_add.png differ diff --git a/images/money_dollar.png b/images/money_dollar.png new file mode 100755 index 0000000..59af163 Binary files /dev/null and b/images/money_dollar.png differ diff --git a/images/oper.jpg b/images/oper.jpg new file mode 100755 index 0000000..01812f1 Binary files /dev/null and b/images/oper.jpg differ diff --git a/images/oper_on.jpg b/images/oper_on.jpg new file mode 100755 index 0000000..b1b51e5 Binary files /dev/null and b/images/oper_on.jpg differ diff --git a/images/outerContainer.gif b/images/outerContainer.gif new file mode 100755 index 0000000..fac97b1 Binary files /dev/null and b/images/outerContainer.gif differ diff --git a/images/proc.jpg b/images/proc.jpg new file mode 100755 index 0000000..d0e4724 Binary files /dev/null and b/images/proc.jpg differ diff --git a/images/proc_on.jpg b/images/proc_on.jpg new file mode 100755 index 0000000..5fa01ef Binary files /dev/null and b/images/proc_on.jpg differ diff --git a/images/search.jpg b/images/search.jpg new file mode 100755 index 0000000..8847424 Binary files /dev/null and b/images/search.jpg differ diff --git a/images/text_AltadeEmp.jpg b/images/text_AltadeEmp.jpg new file mode 100755 index 0000000..aae46f1 Binary files /dev/null and b/images/text_AltadeEmp.jpg differ diff --git a/images/text_AltaoModdeEmp.jpg b/images/text_AltaoModdeEmp.jpg new file mode 100755 index 0000000..28a103e Binary files /dev/null and b/images/text_AltaoModdeEmp.jpg differ diff --git a/images/text_AltaoModdeVeh.jpg b/images/text_AltaoModdeVeh.jpg new file mode 100755 index 0000000..9e1b723 Binary files /dev/null and b/images/text_AltaoModdeVeh.jpg differ diff --git a/images/text_ModdeEmp.jpg b/images/text_ModdeEmp.jpg new file mode 100755 index 0000000..4e2ad35 Binary files /dev/null and b/images/text_ModdeEmp.jpg differ diff --git a/images/user.jpg b/images/user.jpg new file mode 100755 index 0000000..d0c7e62 Binary files /dev/null and b/images/user.jpg differ diff --git a/images/vehic.jpg b/images/vehic.jpg new file mode 100755 index 0000000..4c223a5 Binary files /dev/null and b/images/vehic.jpg differ diff --git a/images/vehic/11.jpg b/images/vehic/11.jpg new file mode 100755 index 0000000..b9c8ebb Binary files /dev/null and b/images/vehic/11.jpg differ diff --git a/images/vehic/A4_L_10465.jpg b/images/vehic/A4_L_10465.jpg new file mode 100755 index 0000000..e505cc9 Binary files /dev/null and b/images/vehic/A4_L_10465.jpg differ diff --git a/images/vehic/DG.jpg b/images/vehic/DG.jpg new file mode 100755 index 0000000..16e9def Binary files /dev/null and b/images/vehic/DG.jpg differ diff --git a/images/vehic/Ferrari_430_Scuderia_1440_x_900_widescreen.jpg b/images/vehic/Ferrari_430_Scuderia_1440_x_900_widescreen.jpg new file mode 100755 index 0000000..3c97363 Binary files /dev/null and b/images/vehic/Ferrari_430_Scuderia_1440_x_900_widescreen.jpg differ diff --git a/images/vehic/Rancho_Chevy_2.jpg b/images/vehic/Rancho_Chevy_2.jpg new file mode 100755 index 0000000..d93d196 Binary files /dev/null and b/images/vehic/Rancho_Chevy_2.jpg differ diff --git a/images/vehic/Thumbs.db b/images/vehic/Thumbs.db new file mode 100755 index 0000000..93d0c22 Binary files /dev/null and b/images/vehic/Thumbs.db differ diff --git a/images/vehic/ferrari.jpg b/images/vehic/ferrari.jpg new file mode 100755 index 0000000..3c97363 Binary files /dev/null and b/images/vehic/ferrari.jpg differ diff --git a/images/vehic/peugeot.jpg b/images/vehic/peugeot.jpg new file mode 100755 index 0000000..c2ddc21 Binary files /dev/null and b/images/vehic/peugeot.jpg differ diff --git a/images/vehic/peugeot607.jpg b/images/vehic/peugeot607.jpg new file mode 100755 index 0000000..56ca321 Binary files /dev/null and b/images/vehic/peugeot607.jpg differ diff --git a/images/vehic/r8.Par.0075.Image.jpg b/images/vehic/r8.Par.0075.Image.jpg new file mode 100755 index 0000000..432f15f Binary files /dev/null and b/images/vehic/r8.Par.0075.Image.jpg differ diff --git a/images/vehic/ttr_2006.Par.0022.Image.jpg b/images/vehic/ttr_2006.Par.0022.Image.jpg new file mode 100755 index 0000000..8a99b92 Binary files /dev/null and b/images/vehic/ttr_2006.Par.0022.Image.jpg differ diff --git a/images/vehic/vwgolf.jpg b/images/vehic/vwgolf.jpg new file mode 100755 index 0000000..de219bf Binary files /dev/null and b/images/vehic/vwgolf.jpg differ diff --git a/images/vehic/wrc_03.jpg b/images/vehic/wrc_03.jpg new file mode 100755 index 0000000..41d4491 Binary files /dev/null and b/images/vehic/wrc_03.jpg differ diff --git a/images/vehic_alta.jpg b/images/vehic_alta.jpg new file mode 100755 index 0000000..a39155e Binary files /dev/null and b/images/vehic_alta.jpg differ diff --git a/images/vehic_alta_on.jpg b/images/vehic_alta_on.jpg new file mode 100755 index 0000000..9b2a571 Binary files /dev/null and b/images/vehic_alta_on.jpg differ diff --git a/images/vehic_entaller.jpg b/images/vehic_entaller.jpg new file mode 100755 index 0000000..c71e6e5 Binary files /dev/null and b/images/vehic_entaller.jpg differ diff --git a/images/vehic_entaller_on.jpg b/images/vehic_entaller_on.jpg new file mode 100755 index 0000000..df5d715 Binary files /dev/null and b/images/vehic_entaller_on.jpg differ diff --git a/images/vehic_fuera.jpg b/images/vehic_fuera.jpg new file mode 100755 index 0000000..2b6c7a6 Binary files /dev/null and b/images/vehic_fuera.jpg differ diff --git a/images/vehic_fuera_on.jpg b/images/vehic_fuera_on.jpg new file mode 100755 index 0000000..b8cb49b Binary files /dev/null and b/images/vehic_fuera_on.jpg differ diff --git a/images/vehic_todos.jpg b/images/vehic_todos.jpg new file mode 100755 index 0000000..fca7ef0 Binary files /dev/null and b/images/vehic_todos.jpg differ diff --git a/images/vehic_todos_on.jpg b/images/vehic_todos_on.jpg new file mode 100755 index 0000000..548f458 Binary files /dev/null and b/images/vehic_todos_on.jpg differ diff --git a/inc_fechas.php b/inc_fechas.php new file mode 100755 index 0000000..c04d3d5 --- /dev/null +++ b/inc_fechas.php @@ -0,0 +1,155 @@ +" . $day . "-" . $month . "-" . $year; + + return ($date); +} + +function mysql_date($date) +{ // by Mich. + # ========================================================== + # ==== Recibe una fecha con formato dd-mm-aaaa ==== + # ==== Devuelve una fecha con formato aaaa-mm-dd ==== + # ========================================================== + + $year = substr($date, 6, 4); // 01-12-2007 + $month = substr($date, 3, 2); // 0123456789 + $day = substr($date, 0, 2); + $date = $year . "-" . $month . "-" . $day; + + return ($date); +} diff --git a/index.php b/index.php new file mode 100755 index 0000000..cb94865 --- /dev/null +++ b/index.php @@ -0,0 +1,17 @@ + + + + + + CAPTACION DE PROCESOS + + + + +   + + + \ No newline at end of file diff --git a/listado.php b/listado.php new file mode 100755 index 0000000..fa4cbda --- /dev/null +++ b/listado.php @@ -0,0 +1,145 @@ + + + + + + + + + +Listados + + + + + + + + query($sql); + ?> + + + + + + + + + +
  Operación
+ .&style=196&type=C128B&width=200&height=100&xres=2&font=5'> +  
query($sql); + //$i = 1; ?> + + + + + + + + + + + + + + + + + +
 Empleados
  Apellido NombreDNI
+ +    
query($sql); + //debug echo $sql; + ?> + + + + + + + + + + + + + + + + +
Vehículos
 MarcaModeloDominio
+ + + +
+ + + + + + + + + + + + + + +
  Acción
+ GUARDAR
+ BORRAR
'; +} ?> + + diff --git a/listado_procesos.php b/listado_procesos.php new file mode 100755 index 0000000..9dec6eb --- /dev/null +++ b/listado_procesos.php @@ -0,0 +1,108 @@ + + + + + + + + +Listados + + + + + + += '".$_POST['desde']."' AND "; + if( $_POST['hasta']!='' ) // hasta + $sql .= " procesos.dia <= '".$_POST['hasta']."' AND "; + + $sql .= " procesos.auto = altas.alta_id AND procesos.operacion = operaciones.operaciones_id "; + $sql .= " AND procesos.empleado = empleados.empleado_id "; + + if( $_POST['ordenar_por']=='ob' ) // ORDER BY ob + $sql .= " ORDER BY altas.orden ASC, altas.asistencia_t ASC "; + + if( $_POST['ordenar_por']=='empleado' ) // ORDER BY empleado + $sql .= " ORDER BY empleados.apellido_e ASC, empleados.nombre_e ASC "; + + $res = $conn->query($sql); + // debug echo $sql; ?> + + + + + + + + + + + + + + + + + fetch_assoc() ) { ?> + + + + + + + + + + +
Procesos
OB - ATOMarca y ModeloDominioEmpleadoOperaciónIngresoEgresoTotal Hr:Min:Seg
+
+ '; +} ?> + + + diff --git a/logout.php b/logout.php new file mode 100755 index 0000000..4482b7c --- /dev/null +++ b/logout.php @@ -0,0 +1,16 @@ +Saliendo del sistema
Saliendo del Sistema...
'; +echo ''; + +exit; +?> \ No newline at end of file diff --git a/menu.php b/menu.php new file mode 100755 index 0000000..5891c61 --- /dev/null +++ b/menu.php @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + +
  Usuario: + + + | Salir +
+ Vehículos src="images/vehic_alta_on.jpg" src="images/vehic_alta.jpg" + alt="Alta" name="vehic_alta" width="66" height="27" border="0" id="vehic_alta" /> src="images/vehic_entaller_on.jpg" src="images/vehic_entaller.jpg" + alt="Dentro del Taller" name="vehic_entaller" width="74" height="27" border="0" id="vehic_entaller" /> src="images/vehic_fuera_on.jpg" src="images/vehic_fuera.jpg" + alt="Fuera de Taller" name="vehic_fuera" width="101" height="27" border="0" id="vehic_fuera" />Empleados src="images/emp_alta_on.jpg" src="images/emp_alta.jpg" + alt="Alta" name="emp_alta" width="66" height="27" border="0" id="emp_alta" /> src="images/emp_mod_on.jpg" src="images/emp_mod.jpg" + alt="Modificar" name="emp_mod" width="74" height="27" border="0" id="emp_mod" /> src="images/oper_on.jpg" src="images/oper.jpg" + alt="Operaciones" name="oper" width="84" height="27" border="0" id="oper" /> src="images/proc_on.jpg" src="images/proc.jpg" + alt="Procesos" name="proc" width="64" height="27" border="0" id="proc" /> src="images/list_on.jpg" src="images/list.jpg" + alt="Listados" name="list" width="64" height="27" border="0" id="list" /> +
+ '; +} ?> \ No newline at end of file diff --git a/nextglass_2008-11-13.sql b/nextglass_2008-11-13.sql new file mode 100755 index 0000000..51a4210 --- /dev/null +++ b/nextglass_2008-11-13.sql @@ -0,0 +1,227 @@ +-- phpMyAdmin SQL Dump +-- version 2.10.2 +-- http://www.phpmyadmin.net +-- +-- Servidor: localhost +-- Tiempo de generación: 13-11-2008 a las 16:17:27 +-- Versión del servidor: 5.0.45 +-- Versión de PHP: 5.2.3 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + +-- +-- Base de datos: `nextglass` +-- + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `altas` +-- + +CREATE TABLE `altas` ( + `alta_id` int(10) unsigned NOT NULL auto_increment, + `orden` varchar(100) default NULL, + `asistencia_t` varchar(100) default NULL, + `marca` varchar(100) default NULL, + `modelo` varchar(100) default NULL, + `anio` varchar(4) default NULL, + `chasis` varchar(100) default NULL, + `motor` varchar(100) default NULL, + `matricula` varchar(100) default NULL, + `combustible` varchar(100) default NULL, + `color` varchar(100) default NULL, + `nivel_brindaje` varchar(100) default NULL, + `multa` varchar(100) default NULL, + `renar` varchar(100) default NULL, + `f_ingreso` date default NULL, + `f_entrega` date default NULL, + `cinta` int(1) default NULL, + `techo` int(1) unsigned default '1', + `sirena_s` int(1) unsigned default '0', + `sirena_c` int(1) default NULL, + `tanque_blindado` int(1) unsigned default '1', + `run_flat` int(1) unsigned default '2', + `piso_b` int(1) unsigned default '1', + `com_motor` int(1) default NULL, + `cob_bateria` int(1) default NULL, + `filtro_aire` int(1) unsigned default '1', + `techo_trans` varchar(100) NOT NULL default '', + `color_vidrios` varchar(100) NOT NULL default '', + `num_llanta` varchar(100) NOT NULL default '', + `vendedor` varchar(100) NOT NULL default '', + `vehi_taller` int(1) default NULL, + `code_a` varchar(100) NOT NULL default '', + `imagen_a` varchar(100) NOT NULL default '', + `publico_a` int(1) NOT NULL default '0', + PRIMARY KEY (`alta_id`), + KEY `cliente` (`orden`), + KEY `vendedor_id` (`run_flat`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Volcar la base de datos para la tabla `altas` +-- + +INSERT INTO `altas` VALUES (1, '25', '', 'TOYOTA', 'HYLUX', '2007', '265655446464', 'SDS545646464', 'BFG578', 'NAFTA', 'ROJO', 'RB3', '1006', '', '2007-11-11', '2007-12-11', 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'OSCUROS', '656565', 'JUAN', 0, 'OB 25', 'DG.jpg', 1); +INSERT INTO `altas` VALUES (2, '', '50', 'PEUGEOT', '307', '2006', 'D5665656565', 'S546565656565', 'GHD158', 'NAFTA', 'VERDE', 'RB3', '', '123', '2007-09-11', '0000-00-00', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 'CLAROS', '1546876', 'JOSE', 1, 'ATO 50', 'peugeot.jpg', 1); +INSERT INTO `altas` VALUES (3, '25', '', 'AUDI', 'A4', '2008', '', '', '', 'NAFTA', '', '', '', '', '0000-00-00', '0000-00-00', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', '', '', 0, 'OB 25 AUDI', '', 0); +INSERT INTO `altas` VALUES (4, '69', '', 'FIAT', '600', '2004', '4654564', 'DSA', 'FASF', 'NAFTA', 'FDSF', 'FDS', 'FDSF', '', '0000-00-00', '0000-00-00', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '1', 'FD', 'df', 'FD', 1, 'OB 69', '11.jpg', 1); +INSERT INTO `altas` VALUES (5, '589', '', 'FERRARI', '360', '2007', 'SP*XX*PINIFARINA', 'FE265*655X645000', 'AXO900', 'NAFTA', 'ROJO', 'RB3', '1006', '', '0000-00-00', '0000-00-00', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '1', 'OSCUROS', '656565', 'JUAN', 0, 'OB 589', 'Ferrari_430_Scuderia_1440_x_900_widescreen.jpg', 1); +INSERT INTO `altas` VALUES (6, '555', '', 'DODGE', 'TRAX', '1999', '123456', 'ASDZXC', 'ASD123', 'NAFTA', 'ANARANJADO', 'ALERGICO A LAS BALAS', 'UN MONTON', '', '0000-00-00', '0000-00-00', 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, '1', 'POLARIZADOS CON AEROSOL', '19', 'MICH', 1, 'OB 555', 'Rancho_Chevy_2.jpg', 1); +INSERT INTO `altas` VALUES (7, '', '100', 'VW', 'GOL 1.0 MI', '2000', '123456ABCDEF', 'ABCDEF123456', 'ABC123', 'NAFTA', 'NEGRO', 'NIVEL1', 'NINGUNA', '', '0000-00-00', '0000-00-00', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 'POLARIZADOS', '13', '', 0, 'ATO 100', 'wrc_03.jpg', 1); +INSERT INTO `altas` VALUES (8, '1050', '2050', 'AUDI', 'A4', '2008', 'ABC123', 'MTR456', 'CZE631', 'NAFTA', 'NEGRO', 'MAXIMO', 'NO', '', '0000-00-00', '0000-00-00', 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, '', 'POLARIZADOS', '19', 'PAULITA', 1, 'OB 1050 ATO 2050', 'A4_L_10465.jpg', 1); +INSERT INTO `altas` VALUES (9, '3050', '4050', 'AUDI', 'R8', '2008', 'FGH654FGH64', '34564534564', 'AZT123', 'NAFTA', 'GRIS', 'MINIMO', 'NO', '', '0000-00-00', '0000-00-00', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', '', '', 1, 'OB 3050 ATO 4050', 'r8.Par.0075.Image.jpg', 1); +INSERT INTO `altas` VALUES (10, '5060', '7080', 'AUDI', 'TT', '2005', 'ASAA', 'ASD', 'XEN000', 'NAFTA', 'GRIS', 'MAXIMO', 'SI $ 1500.-', '', '0000-00-00', '0000-00-00', 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, '', '', '', '', 1, 'OB 5060 ATO 7080', 'ttr_2006.Par.0022.Image.jpg', 1); +INSERT INTO `altas` VALUES (11, '456', '987', 'PEUGEOT', '607', '2007', '123456AASD', 'QWQR', 'FASF', 'NAFTA', 'GRIS', 'ANTI MONIO', '$ 1500', '750', '0000-00-00', '0000-00-00', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 'POLARIZADOS CON AEROSOL', '19', 'JUAN', 1, 'OB 456 ATO 987', 'peugeot607.jpg', 1); +INSERT INTO `altas` VALUES (12, '1', '2', 'VW', 'AOLF', '2008', 'ASDAD', 'ASAFDF', 'DFS856', 'NAFTA', 'BERMELLON', 'SDF', 'DFDF', '123456790000', '0000-00-00', '0000-00-00', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', '', '', '', 0, 'OB 1 ATO 2', 'vwgolf.jpg', 1); +INSERT INTO `altas` VALUES (13, '1744', '5', 'VW', 'BORA', '2008', 'ABC123', 'XYZ890', 'ASD123', 'DIESEL', 'NEGRO', '5', 'NO', 'NO', '0000-00-00', '0000-00-00', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, '1', 'NEGRO', '17', 'MICH', 1, 'OB 1744 ATO 5', '', 1); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `empleados` +-- + +CREATE TABLE `empleados` ( + `empleado_id` int(10) unsigned NOT NULL default '0', + `nombre_e` char(100) default NULL, + `apellido_e` char(100) default NULL, + `dni_e` char(100) default NULL, + `grupo_e` char(100) default NULL, + `code_e` char(100) NOT NULL default '', + `imagen_e` char(100) NOT NULL default '', + `publico_e` char(50) default '1', + PRIMARY KEY (`empleado_id`), + KEY `cliente` (`nombre_e`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Volcar la base de datos para la tabla `empleados` +-- + +INSERT INTO `empleados` VALUES (1, 'RODOLFO', 'FERNANDEZ', '10711981', 'Produccion', '*E00001*', 'img-higherEducation-thumb.jpg', '1'); +INSERT INTO `empleados` VALUES (2, 'NESTOR', 'FOSTER', '18600315', 'Produccion', '*E00002*', 'img-financeAndInsurance-thumb.jpg', '1'); +INSERT INTO `empleados` VALUES (3, 'JOSE', 'GIL DOMINGUEZ', '16101494', 'Produccion', '*E00003*', 'img-internetAndIp-thumb.jpg', '1'); +INSERT INTO `empleados` VALUES (4, 'LUCIO', 'GONZALEZ', '28255339', 'Produccion', '*E00004*', 'img-networking-thumb.jpg', '1'); +INSERT INTO `empleados` VALUES (5, 'JAVIER', 'GRAMATICO', '29698018', 'Produccion', '*E00005*', '', '1'); +INSERT INTO `empleados` VALUES (6, 'JOSE', 'LOPEZ', '25584566', 'Produccion', '*E00006*', '', '1'); +INSERT INTO `empleados` VALUES (7, 'JULIAN', 'PEREIRA', '24228905', 'Produccion', '*E00007*', '', '1'); +INSERT INTO `empleados` VALUES (9, 'NESTOR', 'SOSA', '92248787', 'Produccion', '*E00009*', '', '1'); +INSERT INTO `empleados` VALUES (10, 'SERGIO', 'URIARTE', '30413181', 'Produccion', '*E00010*', '', '1'); +INSERT INTO `empleados` VALUES (15, 'MARTIN DANIEL', 'MANSILLA', '28776790', 'Produccion', '15', '', '1'); +INSERT INTO `empleados` VALUES (16, 'DAVID ALBERTO', 'RABINOWICZ', '31606648', 'Produccion', '*E00016*', '', '1'); +INSERT INTO `empleados` VALUES (17, 'MAURICIO', 'MICH', '30000000', 'Administrador', '*E00017*', '', '1'); +INSERT INTO `empleados` VALUES (18, 'JOSE LUIS', 'PEREZ', '5670983', 'Administrador', '*E00018*', '', '1'); +INSERT INTO `empleados` VALUES (19, 'MARTIN', 'GARCIA', '30400500', 'Produccion', '*E00019*', '', '1'); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `login` +-- + +CREATE TABLE `login` ( + `userid` int(6) NOT NULL auto_increment, + `username` char(50) default NULL, + `nombrereal` char(100) NOT NULL default '', + `password` char(100) default NULL, + PRIMARY KEY (`userid`), + KEY `username` (`username`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Volcar la base de datos para la tabla `login` +-- + +INSERT INTO `login` VALUES (1, 'admin', 'Administrador', 'mmKgxBJO0xJ2U'); +INSERT INTO `login` VALUES (2, 'mauricio', 'Mauricio', 'mmKgxBJO0xJ2U'); +INSERT INTO `login` VALUES (3, 'juampy', 'Juan Pablo', 'mm4Bk2Ze5n8Eg'); +INSERT INTO `login` VALUES (4, 'paula', 'Paula Sayago', 'mmYnPHkgeSFA6'); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `operaciones` +-- + +CREATE TABLE `operaciones` ( + `operaciones_id` int(10) unsigned NOT NULL auto_increment, + `nombre_o` char(100) default NULL, + `code_o` char(100) default NULL, + `publico_o` int(1) default NULL, + PRIMARY KEY (`operaciones_id`), + KEY `cliente` (`nombre_o`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Volcar la base de datos para la tabla `operaciones` +-- + +INSERT INTO `operaciones` VALUES (1, 'LAVADO', '1', 1); +INSERT INTO `operaciones` VALUES (2, 'DENTRO DE TALLER', '2', 1); +INSERT INTO `operaciones` VALUES (3, 'DESMONTAJE', '3', 1); +INSERT INTO `operaciones` VALUES (4, 'MOLDES', '4', 1); +INSERT INTO `operaciones` VALUES (5, 'OPACO', '5', 1); +INSERT INTO `operaciones` VALUES (6, 'VIDRIOS', '6', 1); +INSERT INTO `operaciones` VALUES (7, 'MONTAJE', '7', 1); +INSERT INTO `operaciones` VALUES (8, 'PINTURA', '8', 1); +INSERT INTO `operaciones` VALUES (9, 'CONTROL DE CALIDAD', '9', 1); +INSERT INTO `operaciones` VALUES (10, 'ASISTENCIA TECNICA', '10', 1); +INSERT INTO `operaciones` VALUES (11, 'OTROS', '11', 1); +INSERT INTO `operaciones` VALUES (12, 'MANTENIMIENTO PLANTA', '12', 1); +INSERT INTO `operaciones` VALUES (13, 'MANT. HERRERIA', '13', 1); +INSERT INTO `operaciones` VALUES (14, 'GRABAR DATOS', '14', 1); +INSERT INTO `operaciones` VALUES (15, 'BORRAR PANTALLA', '15', 1); +INSERT INTO `operaciones` VALUES (16, 'ADMINISTRAR', '16', 1); +INSERT INTO `operaciones` VALUES (17, 'MICH', '17', 0); +INSERT INTO `operaciones` VALUES (18, 'OPERACION DE PRUEBA', '18', 1); +INSERT INTO `operaciones` VALUES (19, 'VIDRIOS', '', 0); +INSERT INTO `operaciones` VALUES (20, 'VIDRIOS', '', 0); +INSERT INTO `operaciones` VALUES (21, 'XX', '', 0); +INSERT INTO `operaciones` VALUES (22, 'Z', '', 0); +INSERT INTO `operaciones` VALUES (23, 'B', '', 0); +INSERT INTO `operaciones` VALUES (24, 'AA', '', 0); +INSERT INTO `operaciones` VALUES (25, 'A', '', 0); + +-- -------------------------------------------------------- + +-- +-- Estructura de tabla para la tabla `procesos` +-- + +CREATE TABLE `procesos` ( + `procesos_id` int(10) unsigned NOT NULL auto_increment, + `empleado` char(100) default NULL, + `auto` char(100) default NULL, + `operacion` char(100) NOT NULL default '', + `dia` date NOT NULL default '0000-00-00', + `inicio` datetime default NULL, + `fin` datetime NOT NULL default '0000-00-00 00:00:00', + `code_p` char(100) NOT NULL default '', + `publico_p` int(1) default NULL, + PRIMARY KEY (`procesos_id`), + KEY `cliente` (`empleado`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Volcar la base de datos para la tabla `procesos` +-- + +INSERT INTO `procesos` VALUES (1, '1', '6', '16', '2008-04-28', '2008-04-28 19:21:54', '2008-04-28 19:50:04', '', 1); +INSERT INTO `procesos` VALUES (2, '2', '6', '16', '2008-04-28', '2008-04-28 19:25:07', '2008-04-28 20:00:55', '', 1); +INSERT INTO `procesos` VALUES (3, '19', '8', '10', '2008-04-28', '2008-04-28 19:58:02', '2008-04-28 20:01:33', '', 1); +INSERT INTO `procesos` VALUES (4, '19', '8', '16', '2008-04-28', '2008-04-28 19:59:33', '2008-04-28 20:01:58', '', 1); +INSERT INTO `procesos` VALUES (5, '2', '8', '16', '2008-04-28', '2008-04-28 20:00:21', '2008-04-28 20:02:20', '', 1); +INSERT INTO `procesos` VALUES (6, '2', '8', '16', '0000-00-00', '2008-09-23 08:06:00', '2008-09-24 10:15:00', '', 1); +INSERT INTO `procesos` VALUES (7, '2', '10', '3', '0000-00-00', '2008-09-22 17:30:54', '2008-09-24 10:15:50', '', 1); +INSERT INTO `procesos` VALUES (8, '2', '8', '3', '0000-00-00', '2008-09-22 17:32:23', '2008-09-24 10:16:14', '', 1); +INSERT INTO `procesos` VALUES (9, '2', '9', '3', '2008-09-22', '2008-09-22 17:32:49', '2008-09-24 10:17:40', '', 1); +INSERT INTO `procesos` VALUES (10, '1', '8', '16', '2008-09-22', '2008-09-22 17:34:39', '2008-09-22 17:35:03', '', 1); +INSERT INTO `procesos` VALUES (11, '1', '8', '3', '0000-00-00', '2008-09-23 10:19:28', '2008-09-24 08:44:00', '', 1); +INSERT INTO `procesos` VALUES (12, '1', '8', '16', '2008-09-22', '2008-09-22 17:35:51', '2008-09-22 17:41:30', '', 1); +INSERT INTO `procesos` VALUES (13, '1', '1', '3', '2008-09-22', '2008-09-22 20:44:48', '2008-09-22 20:45:41', '', 1); +INSERT INTO `procesos` VALUES (14, '1', '1', '14', '2008-09-22', '2008-09-22 20:45:24', '0000-00-00 00:00:00', '', 1); +INSERT INTO `procesos` VALUES (15, '16', '13', '9', '2008-09-24', '2008-09-24 10:34:43', '2008-09-24 10:34:45', '*P00020*', 1); +INSERT INTO `procesos` VALUES (16, '16', '1', '16', '2008-09-24', '2008-09-24 10:32:48', '2008-09-24 10:30:37', '*P00020*', 1); +INSERT INTO `procesos` VALUES (17, '16', '8', '16', '2008-09-24', '2008-09-24 10:32:36', '2008-09-24 10:33:09', '*P00020*', 1); diff --git a/operaciones.php b/operaciones.php new file mode 100755 index 0000000..f0f4c7a --- /dev/null +++ b/operaciones.php @@ -0,0 +1,142 @@ + + + + + + + + +Operaciones + + + + + + + + + + +query($sql); + // Debug echo $sql; +} + +// Debug echo $sql_m.'
POST id:'.$_POST['name']; + +// MODIFICAR ////////////////////////////////////////////////////////////////////////////////////////////////////////////// +if($_POST['nombre']!='' && $_POST['modificar']=='Modificar' ){ + $sql_m = " UPDATE operaciones SET nombre_o = '".strtoupper($_POST['nombre'])."' WHERE operaciones_id = ".$_POST['id']; + $res_m = $conn->query($sql_m); + // Debug echo $sql_m.'
POST id:'.$_POST['id']; +} + +// BAJA /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +if($_POST['borrarop'] =='Si' ){ + $sql_p = "UPDATE operaciones SET publico_o = '0' WHERE operaciones_id = ".$_POST['id_baja']; + $res_p = $conn->query($sql_p); + // Debug echo $sql_p; +} ?> + +

+
+ + + + + + + +
  Operaciones
+ + + + +

+ +

+
+ + + + + + + + + + +
+

 

+
+ +
+ query($sql); + $row = $result->fetch_assoc(); ?> + + + + +

+
+   Confirma la BAJA de la operación:

+    +
+ +

+ + + + + +
+
+
+'; +} ?> + + + \ No newline at end of file diff --git a/procesos.php b/procesos.php new file mode 100755 index 0000000..194fdce --- /dev/null +++ b/procesos.php @@ -0,0 +1,554 @@ + + + + + + + + +Procesos + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +query($sql_m); + // echo $sql_m; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// BAJA /////////////////////////////////////////////////////////////////////////////////////////////////////////// +if($_POST['si'] =='Si' ){ + $sql_p = " UPDATE procesos SET publico_p= '0' where procesos_id = ".$_POST['id_baja']; + $res_p = $conn->query($sql_p); + //echo $sql_p; +} ?> + + query($sql_max); + $row_max = $res_max->fetch_assoc(); + $id_code = $row_max['m'] +1; + $s = $id_code; + + $code= sprintf("*P%05s*", $s); // el relleno con ceros funciona con cadenas tambien + + $sql = " INSERT INTO procesos VALUES (NULL,'".$_POST['empleado']."' "; + $sql .= ", '".$_POST['auto']."' "; + $sql .= ", '".$_POST['operacion']."' "; + $sql .= ", '".$_POST['dia']."' "; + $sql .= ", '".$_POST['inicio']."' "; + $sql .= ", '".$_POST['fin']."' "; + $sql .= ", '".$code."' "; + $sql .= ", '1' "; + $sql .= " ) "; + $res = $conn->query($sql); + // echo $sql; + + } ?> +

+
+ + + + + + + + + + + +
Filtro:
+ + + + + + + + +
checked>Hoychecked>Ultimo Mes checked>Todo
+   + Alta
+
+
+ +
+ + + + + + + +
Confirma la Baja del Vehículo: + + +
+ + + + +
+
+

+ +

+ +
+ + + + +
+ + + + + + + + + + + + + + + + +
EmpleadoAutoOperaciónDiaInicioFin
+ + + + + + + + + + + +
+
+ +
+
+query($sql_proceso); + $row_proceso = $res_proceso->fetch_assoc(); + ?> +
+ + + + + +
+ + + + + + + + + + + + + + + + +
 Empleado Auto Operación Dia Inicio Fin
+ + + +
+
+

+ +     + +
+
+0) { + $style = BCS_ALIGN_CENTER; + $style |= ($output == "png" ) ? BCS_IMAGE_PNG : 0; + $style |= ($output == "jpeg") ? BCS_IMAGE_JPEG : 0; + $style |= ($border == "on" ) ? BCS_BORDER : 0; + $style |= ($drawtext== "on" ) ? BCS_DRAW_TEXT : 0; + $style |= ($stretchtext== "on" ) ? BCS_STRETCH_TEXT : 0; + $style |= ($negative== "on" ) ? BCS_REVERSE_COLOR : 0; + + switch ($type) + { + case "I25": + $obj = new I25Object(250, 120, $style, $barcode2); + break; + case "C39": + $obj = new C39Object(50, 120, $style, $barcode2); + break; + case "C128A": + $obj = new C128AObject(250, 120, $style, $barcode2); + break; + case "C128B": + $obj = new C128BObject(250, 120, $style, $barcode2); + break; + case "C128C": + $obj = new C128CObject(250, 120, $style, $barcode2); + break; + default: + $obj = false; + } + if ($obj) { + if ($obj->DrawObject($xres)) { + echo "
"; + } else echo "
".($obj->GetError())."
"; + } +} ?> +

+
+= '0000-00-00' "; // + + if( $_GET['filtro']=="hoy" ) // BUSCA BUSCA REGISTROS DEL DIA + $sql .= " WHERE procesos.dia = ".date("'Y-m-d'"); + + if( $_GET['filtro']=="mes" ) { + $sql .= " WHERE procesos.dia > '".date('Y-m')."-01' "; // BUSCA BUSCA REGISTROS DEL MES + $sql .= " AND procesos.dia < '".date('Y-m')."-32' "; + } + $sql .= " AND procesos.operacion = operaciones.operaciones_id AND procesos.auto = altas.alta_id + AND procesos.empleado = empleados.empleado_id AND procesos.publico_p = '1' "; + + $res = $conn->query($sql); + // echo $sql; + ?> +

+ + + + +
+ + + + + + + + + num_rows; $i++ ) { + + $row = $res->fetch_assoc(); + + if ( ($i%2)==0 ) { $fondo="#FFFFFF"; } else { $fondo="#E6E6E6"; } + + ?> + + + + + + + + + + + + + +
EmpleadoAutoOperaciónDiaInicioFin
+ + '.strtoupper($row['nombre_e']); ?> + + + + + + + + + + +
+
'.$res->num_rows.' Resultados
'; +} +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +} else { // fin valid_admin + echo ''; +} ?> + + + diff --git a/resultado_financiero.php b/resultado_financiero.php new file mode 100755 index 0000000..98ebf68 --- /dev/null +++ b/resultado_financiero.php @@ -0,0 +1,396 @@ + + + + +Resultado Financiero + + + + + + + + + + + + + +
Por Fecha: + +
+ + + +
+ + + + + + + + + + + + + query($sql_concepto); + //debug echo '

'.mysql_num_rows($res_concepto).' - '.$sql_concepto; + + for ( $i=1; $i <= mysql_num_rows($res_concepto); $i++ ) { + $row_concepto = mysql_fetch_array($res_concepto); + + if ( ($i%2)==0 ) { $fondo="#FFFFFF"; } else { $fondo="#F5F5F5"; } + ?> + '); bgcolor=""> + + + + + + + + + + + + + + + + + + + + +
Id Conceptos Ingresos Egresos Neto 
  + '".date('Y')."-01-00'"; + $sql_ing .= " AND fecha_pago < '".date('Y')."-12-32'"; + + } elseif ( $_GET['anual']!="todo" ) { // GET ANUAL DIFERENTE DE 'todo' FILTRA POR A�O SELECCIONADO + $sql_ing .= " AND fecha_pago > '".$_GET[anual]."-01-00'"; + $sql_ing .= " AND fecha_pago < '".$_GET[anual]."-12-32'"; + } + + $res_ing = $conn->query($sql_ing); + $row_ing = mysql_fetch_array($res_ing); + + // ACUMULA VARIABLE PARA QUE NO CONSULTE NUEVAMENTE A LA BASE + $conid = $row_concepto['concepto_id']; + $concepto_ing[$conid] = $row_ing['importe']; // ACUMULA POR CONCEPTO. ASIGNA ID A LA MATRIZ. + $concepto_nombre[$conid] = $row_concepto['concepto']; // ASIGNA A LA VARIABLE EL NOMBRE DEL CONCEPTO + $concepto_tipo_ing[$conid] = $row_concepto['tipo_ingreso']; // ASIGNA TIPO + $concepto_tipo_egr[$conid] = $row_concepto['tipo_ingreso']; // ASIGNA TIPO + + $suma_ing = $suma_ing + $row_ing['importe']; // ACUMULA TOTAL + ?> +    + + + + + + + + + + + + +
  
 Total:   egrneto
+ + + + + + + + + + + + + + + + + query($sql_forma_pago); + //debug echo '

'.mysql_num_rows($res_forma_pago).' - '.$sql_forma_pago; + + for ( $j=1; $j <= mysql_num_rows($res_forma_pago); $j++ ) { + $row_forma_pago = mysql_fetch_array($res_forma_pago); + + if ( ($j%2)==0 ) { $fondo="#FFFFFF"; } else { $fondo="#F5F5F5"; } + ?> + '); bgcolor=""> + + + + + + + + + + + + + + + for ( $k=1; $k <= ( mysql_num_rows($res_concepto)-mysql_num_rows($res_forma_pago) ); $k++ ) { + ?> + + + + + + + + + + + + + + + +
Id Forma de Pago Ingresos Egresos Neto 
  + '".date('Y')."-01-00'"; + $sql_ing_fp .= " AND fecha_pago < '".date('Y')."-12-32'"; + + } elseif ( $_GET['anual']!="todo" ) { // GET ANUAL DIFERENTE DE 'todo' FILTRA POR A�O SELECCIONADO + $sql_ing_fp .= " AND fecha_pago > '".$_GET[anual]."-01-00'"; + $sql_ing_fp .= " AND fecha_pago < '".$_GET[anual]."-12-32'"; + } + + $res_ing_fp = $conn->query($sql_ing_fp); + $row_ing_fp = mysql_fetch_array($res_ing_fp); + + $suma_ing_fp = $suma_ing_fp + $row_ing_fp['importe']; // ACUMULA INGRESO TOTAL + ?> +     
 
Total:   egrneto
  
+ + + + + + + + + + '); bgcolor=""> + + + + + + + + + +
Id INGRESOS TOTALES Importe  
  
Total:   
+ +

 

+
Neto
+ +
Egresos
+
Fondo Gris
+

+

 

+ + +

 

+ + + + + + + + + + + + + query($sql_vendprg); + //debug echo '

'.mysql_num_rows($res_vendprg).' - '.$sql_vendprg; + + // LISTA VENDEDORES + for ( $i=1; $i <= mysql_num_rows($res_vendprg); $i++ ) { + $row_vendprg = mysql_fetch_array($res_vendprg); + + if ( ($i%2)==0 ) { $fondo="#FFFFFF"; } else { $fondo="#F5F5F5"; } + ?> + '); bgcolor=""> + + + + + + + + + + + + + + + + + + + +
Id VENTAS: DISEÑOVendido Programado Cobrado 
  + '".date('Y')."-01-00'"; + $sql_ing_vend .= " AND planpago_vto < '".date('Y')."-12-32'"; + + } elseif ( $_GET['anual']!="todo" ) { // GET ANUAL DIFERENTE DE 'todo' FILTRA POR A�O SELECCIONADO + $sql_ing_vend .= " AND planpago_vto > '".$_GET[anual]."-01-00'"; + $sql_ing_vend .= " AND planpago_vto < '".$_GET[anual]."-12-32'"; + } + + $res_ing_vend = $conn->query($sql_ing_vend); + $row_ing_vend = mysql_fetch_array($res_ing_vend); + + $suma_ing_vend = $suma_ing_vend + $row_ing_vend['importe']; // ACUMULA TOTAL + ?> +    + + + '".date('Y')."-01-00'"; + $sql_ing_prg .= " AND planpago_vto < '".date('Y')."-12-32'"; + + } elseif ( $_GET['anual']!="todo" ) { // GET ANUAL DIFERENTE DE 'todo' FILTRA POR A�O SELECCIONADO + $sql_ing_prg .= " AND planpago_vto > '".$_GET[anual]."-01-00'"; + $sql_ing_prg .= " AND planpago_vto < '".$_GET[anual]."-12-32'"; + } + + $res_ing_prg = $conn->query($sql_ing_prg); + $row_ing_prg = mysql_fetch_array($res_ing_prg); + + $suma_ing_prg = $suma_ing_prg + $row_ing_prg['importe']; // ACUMULA TOTAL + ?> +    + + + '".date('Y')."-01-00'"; + $sql_ing_cob .= " AND planpago_vto < '".date('Y')."-12-32'"; + + } elseif ( $_GET['anual']!="todo" ) { // GET ANUAL DIFERENTE DE 'todo' FILTRA POR A�O SELECCIONADO + $sql_ing_cob .= " AND planpago_vto > '".$_GET[anual]."-01-00'"; + $sql_ing_cob .= " AND planpago_vto < '".$_GET[anual]."-12-32'"; + } + + $res_ing_cob = $conn->query($sql_ing_cob); + $row_ing_cob = mysql_fetch_array($res_ing_cob); + + $suma_ing_cob = $suma_ing_cob + $row_ing_cob['importe']; // ACUMULA TOTAL + ?> +    + +
  (No son ingresos)    Total Vendido:      
+ + + +
 
+ + '; +}?> + + diff --git a/script_alta_ingresos.php b/script_alta_ingresos.php new file mode 100755 index 0000000..c9096ec --- /dev/null +++ b/script_alta_ingresos.php @@ -0,0 +1,63 @@ + + + + +Ingresando Pago + + + +'.$_POST[guardar].'
'; + + for ( $i=1 ; $i<=100 ; $i++ ) { + //debug echo '
Cta '.$i.')
'; + + if ( $_POST['cuota_'.$i]>0 ) { + $sql = " INSERT INTO ingresos VALUES (NULL, '".$_POST['plan_pago_'.$i]."'"; + $sql .= ", '".$_POST['cuenta']."'"; + $sql .= ", '".$_POST['cuota_'.$i]."'"; + + // Recibe una fecha con formato dd-mm-aaaa y devuelve aaaa-mm-dd. + $sql .= ", '".mysql_date($_POST['fecha_pago'])."'"; // function mysql_date() by Mich. + + $sql .= ", '".$_POST['forma_pago']."'"; + $sql .= ", '".$_POST['concepto']."'"; + $sql .= ", '".$_POST['factura']."'"; + $sql .= ") "; + $res = $conn->query($sql); + //debug echo $sql.'
'; + } + /*//debug echo 'Saldo '.$i.': '.$_POST['saldo_'.$i].' + - Pago Cta: '.$_POST['cuota_'.$i].' = Neto: '.($_POST['saldo_'.$i]-$_POST['cuota_'.$i]).'
';*/ + + // SI saldo>0 (es para evitar update a ya cancelados) Y saldo - cuota = 0 (pone estado de tabla 'ingresos' cancelado) + if ( $_POST['saldo_'.$i]>0 && ($_POST['saldo_'.$i]-$_POST['cuota_'.$i])==0 ) { + + $update_ppago = " UPDATE plan_pago SET estado = 1 WHERE planpago_id = ".$_POST['plan_pago_'.$i]; + $res_ppago = $conn->query($update_ppago); + //echo 'Estado: Cancelado
UPDATE tabla plan_pago
'; + //debug echo $update_ppago.'

'; + } + + } + + $mensaje = "Pago ingresado correctamente."; + } else { + $mensaje = "ERROR: el pago NO fue ingresado."; // dejar la palabra ERROR en mayusculas dado que depende de cuentas.php + } ?> + + + '; +}?> + + \ No newline at end of file diff --git a/script_reclamo_pago.php b/script_reclamo_pago.php new file mode 100755 index 0000000..39e00eb --- /dev/null +++ b/script_reclamo_pago.php @@ -0,0 +1,97 @@ + + + + +Ingresando Reclamo de Pago + + + + + + + + + + + + + + + +

 

+'.$_POST[guardar].'
'; + $sql = " SELECT * FROM plan_pago WHERE planpago_id = $_GET[planpago]"; + $res = $conn->query($sql); + $row = $res->fetch_assoc(); + ?> +
+ + + + +
+ + + + + + + + + + + + +
Fecha: + + + + +
Detalle: +
 
+
+ + query($update_ppago); + //debug echo $update_ppago; + + $mensaje = "Reclamo de pago ingresado correctamente."; + ?> + + + '; +}?> + + \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100755 index 0000000..968daec --- /dev/null +++ b/styles.css @@ -0,0 +1,190 @@ +/* CSS Document */ +body { + font-size: 11px; + font-family: Verdana, Arial, Helvetica, sans-serif; + margin-top: 0px; +} +.hand { cursor: hand; } +.inputBold { text-align: right; padding-right: 6px; font-weight: bold; } + +.buscarLegend{ + color: #999999; +} +.CuotasImpagasOn { + color: #000000; + border: 2px solid #99CCFF; + background-color: #99CCFF; + font-weight: bold; +} +.inputBuscar{ + font-size: 11px; + height: 19px; + margin: 0px; + padding-top: 0px; + padding-bottom: 0px; + padding-left: 0px; + border: 1px solid #CCCCCC; +} +.inputBuscarID{ + font-size: 11px; + height: 19px; + margin: 0px; + padding-top: 0px; + padding-bottom: 0px; + padding-left: 0px; + width: 35px; + border: 1px solid #CCCCCC; +} + +.inputIngresoCuota { + text-align: right; + padding-right: 6px; + height: 19px; + margin: 0px; + padding-top: 0px; + padding-bottom: 0px; + padding-left: 0px; +} +.inputTextoBold { + font-weight: bold; + padding-left: 10px; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width: 0px; +} +.inputTextoSinBorde { + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width: 0px; +} +.inputTextoSinBordeBold { + font-weight: bold; + padding-left: 10px; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width: 0px; +} +.negrita { + font-weight: bold; +} +.norepeat { + background-repeat: repeat-x; +} +td { + font-size: 11px; + font-family: Verdana, Arial, Helvetica, sans-serif; +} +.tdBordeGrisInf { + border-left-width: 1px; + border-left-style: solid; + border-left-color: #CCCCCC; +} +.tdBordeGrisClaroInf { + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: #CCCCCC; + background-color: #F5F5F5; +} +.tdBordeCelesteInf { + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: #53A9FF; + background-color: #99CCFF; +} +.tdBordeCelesteInfBG { + background-image: url(images/bg_tbar.jpg); + background-repeat: repeat-x; + color:#FFFFFF; + font-weight:bold; +} + +.tdBordeGrisIzq { + border-left-width: 1px; + border-left-style: solid; + border-left-color: #CCCCCC; +} + +.textazul { + color: #195089; + font-weight:bold; +} + +.MenuCuentaTdInf { + border-left-width: 1; + border-left-style: solid; + border-left-color: #CCCCCC; + border-right-width: 1; + border-right-style: solid; + border-right-color: #CCCCCC; + height: 30px; + +} +.MenuCuentaOn { + border:1px; + border-style:solid; + border-color:#CCCCCC; + border-bottom:0px; + font-weight: bold; + text-align: center; +} +.MenuCuentaOff{ + border:1px; + border-style:solid; + border-color:#CCCCCC; + background-color:#F5F5F5; + font-weight: bold; + text-align: center; +} +.MenuCuentaSpacer{ + border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #CCCCCC; +} +#modificar, #save, #Submit, #si, #btnAlta, #modificar { + font-weight: bold; + color: #FFFFFF; + background-color: #3D72A4; + border-color: #195089; + border-style:solid; + border-width:1px; +} +#borraremp, #borrarop, #Baja, #btnBajaSi, #btnBaja { + font-weight: bold; + color: #FFFFFF; + background-color: #FF0000; + border-color: #990000; + border-style:solid; + border-width:1px; +} +.buttonReset { + CLEAR: both; + BORDER: #f06161 1px solid; + PADDING-RIGHT: 5px; + PADDING-LEFT: 5px; + FONT-WEIGHT: bold; + FONT-SIZE: 12pt; + BACKGROUND: #B60505 url(images/fnd_button_rojo.jpg) repeat-x 50% top; + PADDING-BOTTOM: 2px; + PADDING-TOP: 2px; + TEXT-DECORATION: none; + font-family: Arial, Helvetica, sans-serif; + color: #FFFFFF; + cursor: hand; +} +.buttonGrabar { + CLEAR: both; + BORDER: #0C406F 1px solid; + PADDING-RIGHT: 5px; + PADDING-LEFT: 5px; + FONT-WEIGHT: bold; + FONT-SIZE: 12pt; + PADDING-BOTTOM: 2px; + PADDING-TOP: 2px; + TEXT-DECORATION: none; + font-family: Arial, Helvetica, sans-serif; + color: #FFFFFF; + cursor: hand; + background: #0C406F url(images/fnd_button_azul.jpg) repeat-x 50% top; +} + diff --git a/sumatoria.php b/sumatoria.php new file mode 100755 index 0000000..7639636 --- /dev/null +++ b/sumatoria.php @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/validateform.php b/validateform.php new file mode 100755 index 0000000..b41712e --- /dev/null +++ b/validateform.php @@ -0,0 +1,27 @@ + \ No newline at end of file