]> git.llucax.com Git - z.facultad/75.43/tp1.git/blobdiff - src/lib/info.forms.php
Subo la version final de FAQ,. cambios en la paginacion, en la forma en la que se...
[z.facultad/75.43/tp1.git] / src / lib / info.forms.php
index 8af0c93e6fda0bf8629579bc01851bcf8c45c635..ba3d940e147e5def90c0c2e03c21175800afe624 100644 (file)
@@ -8,18 +8,25 @@
 require_once 'lib/info.functions.php';\r
 require_once 'Tema.php';\r
 \r
-function info_form_ingresar_tema( $nombre, $icono, $descripcion ) {\r
+function info_form_ingresar_tema( $__hidID, $nombre, $icono, $descripcion ) {\r
 ?>\r
        <form name="info_ingresar_tema" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" onSubmit="return info_validar_ingresar_tema(this);" enctype="multipart/form-data">\r
+                       <input type="hidden" name="__hidID" value="<? echo $__hidID; ?>">\r
             <script type="text/javascript" language="JavaScript">\r
                 <!--\r
                 function info_validar_ingresar_tema(f)\r
                 {\r
-                    if (!check_vacio(f.txtNombre, 'Nombre')) return false;\r
-                                       if (!check_vacio(f.txtIcono, 'Icono')) return false;\r
-                                       if (!check_vacio(f.txtDescripcion, 'Descripcion')) return false;\r
+                    if ( (!check_vacio(f.txtNombre, 'Nombre')) || (!check_min_max_cant(f.txtURL, 'URL', 5, 20)) ) return false;\r
+                                       if ( (!check_vacio(f.txtIcono, 'Icono')) ) return false;\r
+                                       if ( (!check_vacio(f.txtDescripcion, 'Descripcion')) || (!check_min_max_cant(f.txtURL, 'URL', 5, 200)) ) return false;\r
                     return true;\r
                 }\r
+\r
+                               function info_blankActual(f) {\r
+                                       if (confirm("Seguro desea perder la posibilidad de modificar?")) {\r
+                                               location.href = "<?php echo $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; ?>";\r
+                                       }\r
+                               }\r
                 -->\r
             </script>\r
                        <table>\r
@@ -36,43 +43,61 @@ function info_form_ingresar_tema( $nombre, $icono, $descripcion ) {
                                        <td><textarea name="txtDescripcion" rows="3" cols="50"><?php echo $descripcion ?></textarea></td>\r
                                </tr>\r
                                <tr>\r
-                    <td colspan="2"><input type="submit" name="btnSubmit" value="Guardar"/></td>\r
+                     <? if ( $__hidID == -1 ) { ?>\r
+                                               <td colspan="2"><input type="submit" name="btnSubmit" value="Guardar Tema"/></td>\r
+                                       <? } else { ?>\r
+                                               <td colspan="2">\r
+                                                       <input type="submit" name="btnSubmit" value="Modificar Tema"/>&nbsp;\r
+                                                       <input type="button" name="btnNew" value="Nuevo Tema" onclick="info_blankActual(this.form);"/>&nbsp;\r
+                                               </td>\r
+                                       <? } ?>\r
                                </tr>\r
                        </table>\r
        </form>\r
 <?php\r
 }\r
 \r
+function info_form_printTemaCombo( $tema , $onchangeTema) {\r
+\r
+       ?>\r
+       <select name="txtTema"<? if ($onchangeTema != '') { echo ' onchange="' . $onchangeTema . '"'; } ?>\r
+               <option value="">Seleccione un Tema...</option>\r
+       <?php\r
+               $arrTemas = info_obtener_temas();\r
+               foreach( $arrTemas as $objTema ) {\r
+               ?><option value="<?php echo $objTema->id; ?>"<?php if ($tema == $objTema->id) { echo " selected"; } ?>><? echo $objTema->nombre; ?></option><?php\r
+               }\r
+       ?>\r
+       </select>\r
+       <?php\r
+}\r
 \r
 \r
-function info_form_ingresar_info( $tema, $url, $comentario ) {\r
+function info_form_ingresar_info( $__hidID, $tema, $url, $comentario ) {\r
 ?>\r
        <form name="info_ingresar_info" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post" onSubmit="return info_validar_ingresar_info(this);">\r
+                       <input type="hidden" name="__hidID" value="<? echo $__hidID; ?>">\r
             <script type="text/javascript" language="JavaScript">\r
                 <!--\r
                 function info_validar_ingresar_info(f)\r
                 {\r
-                                       if (!check_vacio(f.txtTema, 'Tema')) return false;\r
-                    if (!check_vacio(f.txtURL, 'URL')) return false;\r
-                    if (!check_vacio(f.txtComentario, 'Comentario')) return false;\r
+                                       if ( (!check_vacio(f.txtTema, 'Tema')) ) return false;\r
+                    if ( (!check_vacio(f.txtURL, 'URL')) || (!check_min_max_cant(f.txtURL, 'URL', 5, 200)) ) return false;\r
+                    if ( (!check_vacio(f.txtComentario, 'Comentario')) || (!check_min_max_cant(f.txtComentario, 'Comentario', 10, 500)) ) return false;\r
                     return true;\r
                 }\r
+\r
+                               function info_blankActual(f) {\r
+                                       if (confirm("Seguro desea perder la posibilidad de modificar?")) {\r
+                                               location.href = "<?php echo $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; ?>";\r
+                                       }\r
+                               }\r
                 -->\r
             </script>\r
                        <table>\r
                                <tr>\r
                                        <td>Tema:</td>\r
-                                       <td>\r
-                                               <select name="txtTema">\r
-                                                       <option value="">Seleccione un Tema...</option>\r
-                                               <?php\r
-                                                       $arrTemas = info_obtener_temas();\r
-                                                       foreach( $arrTemas as $objTema ) {\r
-                                                       ?><option value="<?php echo $objTema->id; ?>"<?php if ($tema == $objTema->id) { echo " selected"; } ?>><? echo $objTema->nombre; ?></option><?php\r
-                                                       }\r
-                                               ?>\r
-                                               </select>\r
-                                       </td>\r
+                                       <td><?info_form_printTemaCombo($tema,'');?></td>\r
                                </tr>\r
                                <tr>\r
                                        <td>URL:</td>\r
@@ -83,7 +108,57 @@ function info_form_ingresar_info( $tema, $url, $comentario ) {
                                        <td><textarea name="txtComentario" rows="3" cols="50"><?php echo $comentario ?></textarea></td>\r
                                </tr>\r
                                <tr>\r
-                    <td colspan="2"><input type="submit" name="btnSubmit" value="Guardar"/></td>\r
+                    <? if ( $__hidID == -1 ) { ?>\r
+                                               <td colspan="2"><input type="submit" name="btnSubmit" value="Guardar Información"/></td>\r
+                                       <? } else { ?>\r
+                                               <td colspan="2">\r
+                                                       <input type="submit" name="btnSubmit" value="Modificar Información"/>&nbsp;\r
+                                                       <input type="button" name="btnNew" value="Nueva Información" onclick="info_blankActual(this.form);"/>&nbsp;\r
+                                               </td>\r
+                                       <? } ?>\r
+                               </tr>\r
+                       </table>\r
+       </form>\r
+<?php\r
+}\r
+\r
+\r
+\r
+\r
+function info_form_ingresar_comentario( $__hidID, $info_id, $comentario ) {\r
+?>\r
+       <form name="info_ingresar_comentario" action="<?php echo $_SERVER['PHP_SELF'] ?>?id=<?echo $info_id;?>" method="post" onSubmit="return info_validar_ingresar_comentario(this);">\r
+            <input type="hidden" name="hidSaving" value="1">\r
+                       <input type="hidden" name="__hidID" value="<? echo $__hidID; ?>">\r
+            <script type="text/javascript" language="JavaScript">\r
+                <!--\r
+                function info_validar_ingresar_comentario(f)\r
+                {\r
+                                       if ( (!check_vacio(f.txtComentario, 'Comentario') || (!check_min_max_cant(f.txtComentario, 'Comentario', 10, 500)) ) ) return false;\r
+                    return true;\r
+                }\r
+\r
+                               function info_blankActual(f) {\r
+                                       if (confirm("Seguro desea perder la posibilidad de modificar?")) {\r
+                                               location.href = "<?php echo $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']; ?>";\r
+                                       }\r
+                               }\r
+                -->\r
+            </script>\r
+                       <table>\r
+                               <tr>\r
+                                       <td>Comentario:</td>\r
+                                       <td><textarea name="txtComentario" rows="3" cols="50"><?php echo $comentario ?></textarea></td>\r
+                               </tr>\r
+                               <tr>\r
+                                       <? if ( $__hidID == -1 ) { ?>\r
+                                               <td colspan="2"><input type="submit" name="btnSubmit" value="Guardar Comentario"/></td>\r
+                                       <? } else { ?>\r
+                                               <td colspan="2">\r
+                                                       <input type="submit" name="btnSubmit" value="Modificar Comentario"/>&nbsp;\r
+                                                       <input type="button" name="btnNew" value="Nuevo Comentario" onclick="info_blankActual(this.form);"/>&nbsp;\r
+                                               </td>\r
+                                       <? } ?>\r
                                </tr>\r
                        </table>\r
        </form>\r