[4329e85] | 1 | <?php |
---|
| 2 | // ******************************************************************************************************** |
---|
[3ec149c] | 3 | // Aplicación WEB: ogAdmWebCon |
---|
| 4 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla |
---|
| 5 | // Fecha Creación: Año 2009-2010 |
---|
| 6 | // Fecha Última modificación: Agosto-2010 |
---|
| 7 | // Nombre del fichero: propiedades_imagenes.php |
---|
| 8 | // Descripción : |
---|
| 9 | // Presenta el formulario de captura de datos de una imagen para insertar,modificar y eliminar |
---|
[4329e85] | 10 | // ******************************************************************************************************* |
---|
[3ec149c] | 11 | include_once("../includes/ctrlacc.php"); |
---|
| 12 | include_once("../clases/AdoPhp.php"); |
---|
[5105e58] | 13 | include_once("../includes/constantes.php"); |
---|
| 14 | include_once("../includes/opciones.php"); |
---|
| 15 | include_once("../includes/CreaComando.php");include_once("../includes/HTMLSELECT.php"); |
---|
[4329e85] | 16 | include_once("../includes/TomaDato.php"); |
---|
[3ec149c] | 17 | include_once("../idiomas/php/".$idioma."/propiedades_imagenes_".$idioma.".php"); |
---|
| 18 | //________________________________________________________________________________________________________ |
---|
[4329e85] | 19 | |
---|
[5105e58] | 20 | if (isset($_POST["opcion"])) {$opcion=$_POST["opcion"];}else{$opcion=0;} // Recoge parametros |
---|
[3ec149c] | 21 | $opciones=array($TbMsg[0],$TbMsg[1],$TbMsg[2],$TbMsg[3]); |
---|
| 22 | //________________________________________________________________________________________________________ |
---|
[4329e85] | 23 | |
---|
[fff35b2] | 24 | // Valores iniciales para variables. |
---|
| 25 | $idimagen=0; |
---|
[3ec149c] | 26 | $nombreca=""; |
---|
[4329e85] | 27 | $ruta=""; |
---|
[3ec149c] | 28 | $descripcion=""; |
---|
[fff35b2] | 29 | $codpar=0; |
---|
| 30 | $numpar=0; |
---|
[3ec149c] | 31 | $idperfilsoft=0; |
---|
[fff35b2] | 32 | $perfilsoft=""; |
---|
[3ec149c] | 33 | $comentarios=""; |
---|
| 34 | $grupoid=0; |
---|
[4329e85] | 35 | $litamb=""; |
---|
| 36 | $tipoimg=0; |
---|
[fff35b2] | 37 | $idrepositorio=0; |
---|
| 38 | $imagenid=0; |
---|
[5105e58] | 39 | if (isset($_POST["validnombreca"])) {$opcion=$_POST["validnombreca"];}else{$validnombreca="";} // Recoge parametros |
---|
[f65c8b8] | 40 | if (isset($_POST["datospost"])) {$datospost=$_POST["datospost"];}else{$datospost=0;} // Recoge parametros |
---|
[3ec149c] | 41 | if (isset($_GET["opcion"])) $opcion=$_GET["opcion"]; // Recoge parametros |
---|
| 42 | if (isset($_GET["idimagen"])) $idimagen=$_GET["idimagen"]; |
---|
| 43 | if (isset($_GET["grupoid"])) $grupoid=$_GET["grupoid"]; |
---|
| 44 | if (isset($_GET["identificador"])) $idimagen=$_GET["identificador"]; |
---|
[4329e85] | 45 | if (isset($_GET["litamb"])) $litamb=$_GET["litamb"]; |
---|
| 46 | if (isset($_GET["tipoimg"])) $tipoimg=$_GET["tipoimg"]; |
---|
[3ec149c] | 47 | //________________________________________________________________________________________________________ |
---|
[5105e58] | 48 | //________________________________________________________________________________________________________ |
---|
[3ec149c] | 49 | $cmd=CreaComando($cadenaconexion); // Crea objeto comando |
---|
| 50 | if (!$cmd) |
---|
| 51 | Header('Location: '.$pagerror.'?herror=2'); // Error de conexión con servidor B.D. |
---|
| 52 | if ($opcion!=$op_alta){ |
---|
| 53 | $resul=TomaPropiedades($cmd,$idimagen); |
---|
| 54 | if (!$resul) |
---|
| 55 | Header('Location: '.$pagerror.'?herror=3'); // Error de recuperación de datos. |
---|
| 56 | } |
---|
[5105e58] | 57 | |
---|
[f65c8b8] | 58 | if ( $opcion == 1 && $datospost == 1) |
---|
[5105e58] | 59 | { |
---|
[f65c8b8] | 60 | if (isset($_POST["opcion"])) $opcion=$_POST["opcion"];// Recoge parametros |
---|
[5105e58] | 61 | if (isset($_POST["idimagen"])) $idimagen=$_POST["idimagen"]; |
---|
| 62 | if (isset($_POST["nombreca"])) |
---|
| 63 | {$nombreca=$_POST["nombreca"];ValidaNombre($cmd,$nombreca);}if ($validnombreca != 1 ) {$validnombreca=0;} |
---|
| 64 | if (isset($_POST["ruta"])) $ruta=$_POST["ruta"]; |
---|
| 65 | if (isset($_POST["descripcion"])) $descripcion=$_POST["descripcion"]; |
---|
| 66 | if (isset($_POST["grupoid"])) $grupoid=$_POST["grupoid"]; |
---|
| 67 | if (isset($_POST["idperfilsoft"])) $idperfilsoft=$_POST["idperfilsoft"]; |
---|
| 68 | if (isset($_POST["comentarios"])) $comentarios=$_POST["comentarios"]; |
---|
| 69 | if (isset($_POST["identificador"])) $idimagen=$_POST["identificador"]; |
---|
| 70 | if (isset($_POST["numpar"])) $numpar=$_POST["numpar"]; |
---|
| 71 | if (isset($_POST["codpar"])) $codpar=$_POST["codpar"]; |
---|
| 72 | if (isset($_POST["idrepositorio"])) $idrepositorio=$_POST["idrepositorio"]; |
---|
| 73 | if (isset($_POST["imagenid"])) $imagenid=$_POST["imagenid"]; |
---|
| 74 | if (isset($_POST["tipoimg"])) $tipoimg=$_POST["tipoimg"]; |
---|
| 75 | if (isset($_POST["litamb"])) $litamb=$_POST["litamb"]; |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | } |
---|
[3ec149c] | 79 | //________________________________________________________________________________________________________ |
---|
| 80 | ?> |
---|
| 81 | <HTML> |
---|
| 82 | <TITLE>Administración web de aulas</TITLE> |
---|
| 83 | <HEAD> |
---|
| 84 | <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
---|
| 85 | <LINK rel="stylesheet" type="text/css" href="../estilos.css"> |
---|
[3b3043b] | 86 | <SCRIPT language="javascript" src="../jscripts/validators.js"></SCRIPT> |
---|
[4329e85] | 87 | <SCRIPT language="javascript" src="../jscripts/constantes.js"></SCRIPT> |
---|
[3ec149c] | 88 | <SCRIPT language="javascript" src="../jscripts/propiedades_imagenes.js"></SCRIPT> |
---|
| 89 | <SCRIPT language="javascript" src="../jscripts/opciones.js"></SCRIPT> |
---|
| 90 | <? echo '<SCRIPT language="javascript" src="../idiomas/javascripts/'.$idioma.'/propiedades_imagenes_'.$idioma.'.js"></SCRIPT>'?> |
---|
| 91 | </HEAD> |
---|
| 92 | <BODY> |
---|
[4329e85] | 93 | <DIV align=center> |
---|
[5105e58] | 94 | <?php if ( $opcion == 1 && $datospost == 1 && $validnombreca == 0 || $opcion != 1) { ?> |
---|
| 95 | <FORM name="fdatos" action="../gestores/gestor_imagenes.php" method="post"> |
---|
| 96 | <?php }else{ ?> |
---|
| 97 | <FORM name="fdatos" action="./propiedades_imagenes.php" method="post"> |
---|
| 98 | <?php } ?> |
---|
| 99 | |
---|
[4329e85] | 100 | <INPUT type="hidden" name="opcion" value="<?=$opcion?>"> |
---|
| 101 | <INPUT type="hidden" name="idimagen" value="<?=$idimagen?>"> |
---|
| 102 | <INPUT type="hidden" name="grupoid" value="<?=$grupoid?>"> |
---|
| 103 | <INPUT type="hidden" name="tipoimg" value="<?=$tipoimg?>"> |
---|
| 104 | <INPUT type="hidden" name="litamb" value="<?=$litamb?>"> |
---|
[5105e58] | 105 | <INPUT type="hidden" name="datospost" value="1"> |
---|
[4329e85] | 106 | <? |
---|
| 107 | switch($tipoimg){ |
---|
| 108 | case $IMAGENES_MONOLITICAS: |
---|
| 109 | $lit=$TbMsg[4]; |
---|
| 110 | break; |
---|
| 111 | case |
---|
| 112 | $IMAGENES_BASICAS: |
---|
| 113 | $lit=$TbMsg[12]; |
---|
| 114 | break; |
---|
| 115 | case $IMAGENES_INCREMENTALES: |
---|
| 116 | $lit=$TbMsg[13]; |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | ?> |
---|
| 120 | <P align=center class=cabeceras><?echo $lit?><BR> |
---|
| 121 | <SPAN align=center class=subcabeceras><? echo $opciones[$opcion]?></SPAN> |
---|
| 122 | </P> |
---|
| 123 | |
---|
[3ec149c] | 124 | <TABLE align=center border=0 cellPadding=1 cellSpacing=1 class=tabla_datos> |
---|
[4329e85] | 125 | <!--------------------------------------------------------------------------------------> |
---|
| 126 | <TR> |
---|
[3ec149c] | 127 | <TH align=center> <?echo $TbMsg[11]?> </TD> |
---|
[5105e58] | 128 | <?if ($opcion==$op_eliminacion || !empty($idperfilsoft) || $opcion == 2) |
---|
| 129 | echo '<TD style="width:150">'.$nombreca.' |
---|
[4329e85] | 130 | <INPUT type="hidden" name="nombreca" value="'.$nombreca.'"></TD>'; |
---|
[3ec149c] | 131 | else |
---|
[5105e58] | 132 | echo '<TD><INPUT class="formulariodatos" name=nombreca style="width:150" type=text value="'.$nombreca.'"></TH>';if ($validnombreca == 1){echo '<font color=red><strong> '.$TbMsg[18].'</strong>';}?> |
---|
[3ec149c] | 133 | </TR> |
---|
[4329e85] | 134 | <!--------------------------------------------------------------------------------------> |
---|
| 135 | <TR> |
---|
[3ec149c] | 136 | <TH align=center> <?echo $TbMsg[5]?> </TD> |
---|
| 137 | <?if ($opcion==$op_eliminacion) |
---|
| 138 | echo '<TD style="width:300">'.$descripcion.'</TD>'; |
---|
| 139 | else |
---|
[4329e85] | 140 | echo '<TD><INPUT class="formulariodatos" name=descripcion style="width:350" type=text value="'.$descripcion.'"></TH>';?> |
---|
[3ec149c] | 141 | </TR> |
---|
[4329e85] | 142 | <!--------------------------------------------------------------------------------------> |
---|
| 143 | <?if($tipoimg==$IMAGENES_INCREMENTALES){?> |
---|
[3ec149c] | 144 | <TR> |
---|
[4329e85] | 145 | <TH align=center> <?echo $TbMsg[14]?> </TD> |
---|
[3ec149c] | 146 | <? |
---|
[4329e85] | 147 | if ($opcion==$op_eliminacion || !empty($idperfilsoft)) |
---|
| 148 | echo '<TD>'.TomaDato($cmd,$idcentro,'imagenes',$imagenid,'imagenid','descripcion').' |
---|
| 149 | <INPUT type="hidden" name="imagenid" value="'.$imagenid.'"></TD>'; |
---|
[3ec149c] | 150 | else |
---|
[4329e85] | 151 | echo '<TD>'.HTMLSELECT($cmd,$idcentro,'imagenes',$imagenid,'idimagen','descripcion',300,"",""," |
---|
| 152 | tipo=".$IMAGENES_BASICAS,"imagenid").'</TD>'; |
---|
[3ec149c] | 153 | ?> |
---|
| 154 | </TR> |
---|
[4329e85] | 155 | <?}?> |
---|
| 156 | <!--------------------------------------------------------------------------------------> |
---|
| 157 | <?if($tipoimg!=$IMAGENES_INCREMENTALES){?> |
---|
[3ec149c] | 158 | <TR> |
---|
| 159 | <TH align=center> <?echo $TbMsg[8]?> </TD> |
---|
| 160 | <? |
---|
[4329e85] | 161 | if ($opcion==$op_eliminacion || !empty($idperfilsoft)) |
---|
| 162 | echo '<TD>'.$numpar.' |
---|
| 163 | <INPUT type="hidden" name="numpar" value="'.$numpar.'"></TD>'; |
---|
[3ec149c] | 164 | else |
---|
[4329e85] | 165 | echo '<TD><INPUT class="formulariodatos" name=numpar style="width:30" type=text value="'.$numpar.'"></TH>'; |
---|
[3ec149c] | 166 | ?> |
---|
| 167 | </TR> |
---|
[4329e85] | 168 | <!--------------------------------------------------------------------------------------> |
---|
[735fec4] | 169 | <tr> |
---|
| 170 | <th align="center"> <?php echo $TbMsg[9]?> </th> |
---|
| 171 | <?php |
---|
[4329e85] | 172 | if ($opcion==$op_eliminacion || !empty($idperfilsoft)) |
---|
| 173 | echo '<td>'.$tipopar.' |
---|
| 174 | <INPUT type="hidden" name="codpar" value="'.$codpar.'"></TD>'; |
---|
[3ec149c] | 175 | else |
---|
[60d0761] | 176 | echo '<td>'.HTMLSELECT($cmd,0,'tipospar',$codpar,'codpar',"CONCAT(tipopar,' (',HEX(codpar),')')",170,"","","clonable=1").'</td>'; |
---|
[3ec149c] | 177 | ?> |
---|
[735fec4] | 178 | </tr> |
---|
[4329e85] | 179 | <!--------------------------------------------------------------------------------------> |
---|
[3ec149c] | 180 | <TR> |
---|
| 181 | <TH align=center> <?echo $TbMsg[10]?> </TD> |
---|
| 182 | <? |
---|
[4329e85] | 183 | if ($opcion==$op_eliminacion || !empty($idperfilsoft)) |
---|
| 184 | echo '<TD>'.$nombrerepositorio.' |
---|
| 185 | <INPUT type="hidden" name="idrepositorio" value="'.$idrepositorio.'"></TD>'; |
---|
[3ec149c] | 186 | else |
---|
| 187 | echo '<TD>'.HTMLSELECT($cmd,$idcentro,'repositorios',$idrepositorio,'idrepositorio','nombrerepositorio',300).'</TD>'; |
---|
| 188 | ?> |
---|
[4329e85] | 189 | </TR> |
---|
| 190 | <!--------------------------------------------------------------------------------------> |
---|
| 191 | <?if($tipoimg==$IMAGENES_BASICAS){?> |
---|
| 192 | <TR> |
---|
| 193 | <TH align=center> <?echo $TbMsg[16]?> </TD> |
---|
| 194 | <?if ($opcion==$op_eliminacion || !empty($idperfilsoft)) |
---|
| 195 | echo '<TD>'.$ruta.' |
---|
| 196 | <INPUT type="hidden" name="ruta" value="'.$ruta.'"></TD>'; |
---|
| 197 | else |
---|
| 198 | echo '<TD><INPUT class="formulariodatos" name=ruta style="width:350" type=text value="'.$ruta.'"></TH>';?> |
---|
| 199 | </TR> |
---|
| 200 | <?}?> |
---|
| 201 | <!--------------------------------------------------------------------------------------> |
---|
| 202 | <TR> |
---|
[3ec149c] | 203 | <TH align=center> <?echo $TbMsg[7]?> </TD> |
---|
| 204 | <?if ($opcion==$op_eliminacion) |
---|
| 205 | echo '<TD>'.$comentarios.'</TD>'; |
---|
| 206 | else |
---|
[4329e85] | 207 | echo '<TD><TEXTAREA class="formulariodatos" name=comentarios rows=3 cols=55>'.$comentarios.'</TEXTAREA></TH>'; |
---|
[3ec149c] | 208 | ?> |
---|
[4329e85] | 209 | </TR> |
---|
| 210 | <!--------------------------------------------------------------------------------------> |
---|
| 211 | |
---|
| 212 | <TR> |
---|
| 213 | <TH align=center> <?echo $TbMsg[6]?> </TD> |
---|
| 214 | <? |
---|
| 215 | echo '<TD>'.$perfilsoft.' |
---|
| 216 | <INPUT type="hidden" name="idperfilsoft" value="'.$idperfilsoft.'"></TH>'; |
---|
| 217 | |
---|
| 218 | ?> |
---|
| 219 | </TR> |
---|
| 220 | <?}?> |
---|
| 221 | <!--------------------------------------------------------------------------------------> |
---|
[3ec149c] | 222 | </TABLE> |
---|
| 223 | </FORM> |
---|
[4329e85] | 224 | |
---|
[3ec149c] | 225 | <? |
---|
[4329e85] | 226 | if (!empty($idperfilsoft)){ // Nota a pie de página indicando que cuando la imagen tiene perfilsoft no pueden modificarse ciertos campos |
---|
| 227 | echo ' |
---|
| 228 | <DIV id="Layer_nota" align=center > |
---|
| 229 | <SPAN align=center class=notas><I>'.$TbMsg[15].'</I></SPAN> |
---|
| 230 | </DIV><br>'; |
---|
| 231 | } |
---|
[3ec149c] | 232 | //________________________________________________________________________________________________________ |
---|
[4329e85] | 233 | |
---|
[5105e58] | 234 | |
---|
| 235 | if ($validnombreca=="0"){ |
---|
| 236 | echo '<script type="text/javascript">'; |
---|
| 237 | echo 'confirmar('.$opcion.')'; |
---|
| 238 | echo '</script>'; |
---|
| 239 | } |
---|
| 240 | if ($validnombreca=="1"){ |
---|
| 241 | echo '<script type="text/javascript">'; |
---|
| 242 | echo 'alert('.$TbMsg[17].')'; |
---|
| 243 | echo '</script>'; |
---|
| 244 | |
---|
| 245 | } |
---|
[3ec149c] | 246 | include_once("../includes/opcionesbotonesop.php"); |
---|
| 247 | //________________________________________________________________________________________________________ |
---|
[4329e85] | 248 | |
---|
[3ec149c] | 249 | ?> |
---|
| 250 | </BODY> |
---|
| 251 | </HTML> |
---|
| 252 | <? |
---|
| 253 | //________________________________________________________________________________________________________ |
---|
[4329e85] | 254 | |
---|
[3ec149c] | 255 | // Recupera los datos de una imagen |
---|
| 256 | // Parametros: |
---|
| 257 | // - cmd: Una comando ya operativo (con conexión abierta) |
---|
| 258 | // - id: El identificador de la imagen |
---|
| 259 | //________________________________________________________________________________________________________ |
---|
[4329e85] | 260 | |
---|
[3ec149c] | 261 | function TomaPropiedades($cmd,$idmagen){ |
---|
| 262 | global $nombreca; |
---|
[4329e85] | 263 | global $ruta; |
---|
[3ec149c] | 264 | global $descripcion; |
---|
| 265 | global $comentarios; |
---|
| 266 | global $idperfilsoft; |
---|
| 267 | global $numpar; |
---|
| 268 | global $codpar; |
---|
| 269 | global $tipopar; |
---|
| 270 | global $nombrerepositorio; |
---|
| 271 | global $idrepositorio; |
---|
| 272 | global $perfilsoft; |
---|
[4329e85] | 273 | global $imagenid; |
---|
[3ec149c] | 274 | |
---|
| 275 | $rs=new Recordset; |
---|
[4329e85] | 276 | $cmd->texto="SELECT imagenes.*,tipospar.tipopar,repositorios.nombrerepositorio,perfilessoft.descripcion as perfilsoft |
---|
| 277 | FROM imagenes |
---|
| 278 | LEFT OUTER JOIN tipospar ON tipospar.codpar=imagenes.codpar |
---|
| 279 | LEFT OUTER JOIN repositorios ON repositorios.idrepositorio=imagenes.idrepositorio |
---|
| 280 | LEFT OUTER JOIN perfilessoft ON perfilessoft.idperfilsoft=imagenes.idperfilsoft |
---|
| 281 | WHERE imagenes.idimagen=".$idmagen; |
---|
[3ec149c] | 282 | $rs->Comando=&$cmd; |
---|
| 283 | if (!$rs->Abrir()) return(0); // Error al abrir recordset |
---|
| 284 | $rs->Primero(); |
---|
| 285 | if (!$rs->EOF){ |
---|
| 286 | $nombreca=$rs->campos["nombreca"]; |
---|
[4329e85] | 287 | $ruta=$rs->campos["ruta"]; |
---|
[3ec149c] | 288 | $descripcion=$rs->campos["descripcion"]; |
---|
| 289 | $idperfilsoft=$rs->campos["idperfilsoft"]; |
---|
| 290 | $comentarios=$rs->campos["comentarios"]; |
---|
| 291 | $numpar=$rs->campos["numpar"]; |
---|
| 292 | $tipopar=$rs->campos["tipopar"]; |
---|
| 293 | $codpar=$rs->campos["codpar"]; |
---|
| 294 | $idrepositorio=$rs->campos["idrepositorio"]; |
---|
| 295 | $nombrerepositorio=$rs->campos["nombrerepositorio"]; |
---|
| 296 | $perfilsoft=$rs->campos["perfilsoft"]; |
---|
[4329e85] | 297 | $imagenid=$rs->campos["imagenid"]; |
---|
[3ec149c] | 298 | $rs->Cerrar(); |
---|
| 299 | return(true); |
---|
| 300 | } |
---|
| 301 | else |
---|
| 302 | return(true); |
---|
| 303 | } |
---|
[5105e58] | 304 | |
---|
| 305 | //________________________________________________________________________________________________________ |
---|
| 306 | |
---|
| 307 | // Comprueba Nombre de la imagen |
---|
| 308 | // Parametros: |
---|
| 309 | // - cmd: Una comando ya operativo (con conexión abierta) |
---|
| 310 | // - id: El identificador de la imagen |
---|
| 311 | //________________________________________________________________________________________________________ |
---|
| 312 | |
---|
| 313 | function ValidaNombre($cmd,$nombreca){ |
---|
| 314 | global $nombreca; |
---|
| 315 | global $validnombreca; |
---|
| 316 | |
---|
| 317 | $rs=new Recordset; |
---|
| 318 | $cmd->texto="SELECT * from imagenes WHERE nombreca='$nombreca'"; |
---|
| 319 | $rs->Comando=&$cmd; |
---|
| 320 | if (!$rs->Abrir()) return(0); // Error al abrir recordset |
---|
| 321 | $rs->Primero(); |
---|
| 322 | if (!$rs->EOF){ |
---|
| 323 | $nombrecabase=$rs->campos["nombreca"]; |
---|
| 324 | if ( $nombrecabase == $nombreca ) |
---|
| 325 | {$validnombreca="1";}else{$validnombreca="0";} |
---|
| 326 | } |
---|
| 327 | $rs->Cerrar(); |
---|
| 328 | |
---|
| 329 | |
---|
| 330 | } |
---|
[3ec149c] | 331 | ?> |
---|