[cpif] r237 - trunk/frontend-web

svn at argo.es svn at argo.es
Tue Jul 3 22:59:40 CEST 2007


Author: jcea
Date: Tue Jul  3 22:59:39 2007
New Revision: 237

Log:


Added:
   trunk/frontend-web/url_edit_metatags.py
      - copied, changed from r236, /trunk/frontend-web/url_edit_metatags
Removed:
   trunk/frontend-web/url_edit_metatags
Modified:
   trunk/frontend-web/url_edit_metatags_POST.py

Copied: trunk/frontend-web/url_edit_metatags.py (from r236, /trunk/frontend-web/url_edit_metatags)
==============================================================================
--- /trunk/frontend-web/url_edit_metatags	(original)
+++ trunk/frontend-web/url_edit_metatags.py	Tue Jul  3 22:59:39 2007
@@ -6,18 +6,35 @@
 def gestiona_url(conn,handler,path,usuario) :
   if len(path)!=1 : return None
 
-  import database
-  database.actualiza_no_leidos(conn,usuario)
-  
-  import skins
-  pagina = skins.Skin(path,usuario,handler.headers)
+  if usuario!="master" :
+    import skins
+    pagina = skins.Skin(path,usuario)
+    pagina.load_dict({"page_title": "cpif - metatags editados con exito"})
+    pagina.load_url(["error"])
+    pagina.load_dict({"generic_message": "<h1>Solo el usuario master puede editar metatags</h1>"})
+    return (pagina.web())
 
-  d = {
-      "page_title": "cpif - listado de subforos",
-      "metatags":database.get_metatags(conn,usuario)
-      }
+  root=conn.get_root()
 
-  pagina.load_dict(d)
+  texto=['<tr><th colspan="2">Cambiar los nombres de los metatags</th></tr>']
+  for i in root["metatags"]["metatags"].items() :
+    texto.append('<tr><td>%s</td><td><input type="text" name="metatag%d" size="60" value="" /></td></tr>' % (i[1]["nombre"],i[0]))
 
-  return(pagina.web())
+  texto.append('<tr><td>&nbsp;</td><td>&nbsp;</td></tr>')
+
+  texto.append('<tr><td>Crear metatag nuevo</td><td><input type="text" name="metatag_new" size="60" value="" /></td></tr>')
+
+  return (200, {"Content-Type":"text/html; charset=utf-8"}, 
+"""
+<html>
+<title>Editar Metatags</title>
+<body>
+<form action="/edit_metatags_POST" method="post" enctype="multipart/form-data">
+<table>
+%s
+<tr><td colspan="2" align="right"><input type="submit" name="submit" value="actualizar metatags"/></td></tr>
+</table>
+</body>
+</html>
+""" % ("\r\n".join(texto)))
 

Modified: trunk/frontend-web/url_edit_metatags_POST.py
==============================================================================
--- trunk/frontend-web/url_edit_metatags_POST.py	(original)
+++ trunk/frontend-web/url_edit_metatags_POST.py	Tue Jul  3 22:59:39 2007
@@ -26,7 +26,8 @@
   metatag_nuevo=cuerpo.getfirst("metatag_new")
   if metatag_nuevo== None : return None
   metatag_nuevo=metatag_nuevo.strip()
-  if metatag_nuevo : database.metatag_add(conn,metatag_nuevo)
+  if metatag_nuevo :
+    database.metatag_add(conn,metatag_nuevo)
 
   return (302,{"Location":"/"},"")
 



More information about the cpif mailing list