[cpif] r156 - in trunk/frontend-web: . skins/default

svn at argo.es svn at argo.es
Fri Jun 15 22:50:53 CEST 2007


Author: alvaro
Date: Fri Jun 15 22:50:51 2007
New Revision: 156

Log:
Corregidos mas errores de validacion

Botones de navegacion mas chulos



Added:
   trunk/frontend-web/skins/default/body_show_thread_first.html
      - copied, changed from r155, /trunk/frontend-web/skins/default/body_show_thread_prev.html
   trunk/frontend-web/skins/default/body_show_thread_last.html
      - copied, changed from r155, /trunk/frontend-web/skins/default/body_show_thread_prev.html
   trunk/frontend-web/skins/default/body_show_thread_num_inactive.html
      - copied, changed from r155, /trunk/frontend-web/skins/default/body_show_thread_num.html
Modified:
   trunk/frontend-web/skins.py
   trunk/frontend-web/skins/default/body_generic.html
   trunk/frontend-web/skins/default/body_metatags_metatag_unread.html
   trunk/frontend-web/skins/default/body_show_thread.html
   trunk/frontend-web/skins/default/body_show_thread_anonymous.html
   trunk/frontend-web/skins/default/body_show_thread_next.html
   trunk/frontend-web/skins/default/body_show_thread_num.html
   trunk/frontend-web/skins/default/body_show_thread_prev.html
   trunk/frontend-web/skins/default/body_threadlist.html
   trunk/frontend-web/skins/default/body_threadlist_anonymous.html
   trunk/frontend-web/skins/default/body_threadlist_thread_unread.html
   trunk/frontend-web/skins/default/footer.html
   trunk/frontend-web/skins/default/header.html
   trunk/frontend-web/url_hilo.py

Modified: trunk/frontend-web/skins.py
==============================================================================
--- trunk/frontend-web/skins.py	(original)
+++ trunk/frontend-web/skins.py	Fri Jun 15 22:50:51 2007
@@ -12,9 +12,12 @@
     'body_thread_anonymous':    'body_show_thread_anonymous.html',
     'thread_entry':   'body_show_thread_entry.html',
     'thread_entry_anonymous':   'body_show_thread_entry_anonymous.html',
+    'thread_first':   'body_show_thread_first.html',
     'thread_prev':    'body_show_thread_prev.html',
     'thread_num':     'body_show_thread_num.html',
+    'thread_num_inactive':     'body_show_thread_num_inactive.html',
     'thread_next':    'body_show_thread_next.html',
+    'thread_last':    'body_show_thread_last.html',
     'new_user':       'body_new_user.html',
     'generic':        'body_generic.html',
     'body':           'body_threadlist.html',
@@ -104,7 +107,8 @@
 
   def show_thread(self):
     """Format some entries inside a thread"""
-    first_post, messages = self._dict.pop("messages")
+    first_post, num_msgs, messages = self._dict.pop("messages")
+    thread_num = self._dict.get("thread_num")
     metatag = self._dict.get("metatag",None)
     for msg_num,author,date,text in messages:
       format = self._style.pop(0)
@@ -117,13 +121,27 @@
           "date":hourdate(date,self._tz),
           "text":text,"format":format }
       self.set_text(aux)
+
+    from globales import thread_len
+
+    aux = []
+    if first_post!=1 :
+      if first_post > thread_len * 2 :
+        aux.append(available_skins[self._skin]['thread_first'] % {'link': '/hilo/%d' % thread_num})
+      aux.append(available_skins[self._skin]['thread_prev'] % {'link': '/hilo/%d/%d' % (thread_num,first_post-thread_len)})
     
-    tl = self._dict.get('thread_prev',None)
-    if tl:
-      self.set_text(available_skins[self._skin]['thread_prev'] % {'link': '/hilo/%s' %tl})
-    tl = self._dict.get('thread_next',None)
-    if tl:
-      self.set_text(available_skins[self._skin]['thread_next'] % {'link': '/hilo/%s' %tl})
+    curr = (first_post / thread_len) + 1
+    for i in range(curr-2,curr+3):
+      if i==curr:
+        aux.append(available_skins[self._skin]['thread_num_inactive'] % {'num': curr})
+      elif i>0 and i <= num_msgs/thread_len+1:
+        aux.append(available_skins[self._skin]['thread_num'] % {'link': '/hilo/%d/%d' % (thread_num,(i-1)*thread_len+1), 'num':i})
+
+    if first_post + thread_len <= num_msgs:
+      aux.append(available_skins[self._skin]['thread_next'] % {'link': '/hilo/%d/%d' % (thread_num,first_post+thread_len)})
+    if first_post + thread_len * 2 <= num_msgs:
+      aux.append(available_skins[self._skin]['thread_last'] % {'link': '/hilo/%d/%d' % (thread_num, 1 + (num_msgs/thread_len) * thread_len)})
+    self._dict["nav"]="".join(aux)
   
   def list_metatags(self):
     """Format the thread list"""
@@ -184,7 +202,7 @@
       self.show_thread()
       self._dict["link_metatag"] = "/indice/%d" % metatag
       if self._user:
-        self._dict["link_form_new_post"] = "/nuevo_post_POST/%d/%d" %(metatag,self._dict["msg_num"])
+        self._dict["link_form_new_post"] = "/nuevo_post_POST/%d/%d" %(metatag,self._dict["thread_num"])
         aux = available_skins[self._skin]['body_thread']
       else:
         aux = available_skins[self._skin]['body_thread_anonymous']

Modified: trunk/frontend-web/skins/default/body_generic.html
==============================================================================
--- trunk/frontend-web/skins/default/body_generic.html	(original)
+++ trunk/frontend-web/skins/default/body_generic.html	Fri Jun 15 22:50:51 2007
@@ -4,4 +4,4 @@
   <div id="menu">
     <h3>Men&uacute;</h3>
     <ul>
-      <li><a href="/">Pagina principal</a></li>
+      <li><a href="/">P&aacute;gina principal</a></li>

Modified: trunk/frontend-web/skins/default/body_metatags_metatag_unread.html
==============================================================================
--- trunk/frontend-web/skins/default/body_metatags_metatag_unread.html	(original)
+++ trunk/frontend-web/skins/default/body_metatags_metatag_unread.html	Fri Jun 15 22:50:51 2007
@@ -1,3 +1,3 @@
 <div class="alt %(format)s" onkeypress="window.location='%(link)s';" onclick="window.location='%(link)s';" >
-  <a href="%(link)s">%(title)s</a> - NO LEIDO
+  <a href="%(link)s">%(title)s</a> - NO LE&Iacute;DO
 </div>

Modified: trunk/frontend-web/skins/default/body_show_thread.html
==============================================================================
--- trunk/frontend-web/skins/default/body_show_thread.html	(original)
+++ trunk/frontend-web/skins/default/body_show_thread.html	Fri Jun 15 22:50:51 2007
@@ -1,8 +1,16 @@
   <div class="hilo" id="hilos">
     <h4>Subforo: %(metatag_title)s</h4>
-    <h2>Titulo: %(thread_title)s</h2>
+    <h2>T&iacute;tulo: %(thread_title)s</h2>
     <h3>Iniciado por %(thread_author)s</h3>
-    %(body)s
+    <ul class="nav">
+      %(nav)s
+    </ul>
+    <div class="hilos">
+      %(body)s
+    </div>
+    <ul class="nav">
+      %(nav)s
+    </ul>
     <div class="form" id="form">
       <form  action="%(link_form_new_post)s" method="post" enctype="multipart/form-data">
         Texto:<textarea name="texto" rows="10" cols="60"></textarea><br />
@@ -31,7 +39,7 @@
 </script>
 <div id="footer">
   <div id="menu">
-    <h3>Menu</h3>
+    <h3>Men&uacute;</h3>
     <ul>
       <li><a href="%(link_metatag)s">Volver al subforo '%(metatag_title)s'</a></li>
-      <li><a href="/">Pagina principal</a></li>
+      <li><a href="/">P&aacute;gina principal</a></li>

Modified: trunk/frontend-web/skins/default/body_show_thread_anonymous.html
==============================================================================
--- trunk/frontend-web/skins/default/body_show_thread_anonymous.html	(original)
+++ trunk/frontend-web/skins/default/body_show_thread_anonymous.html	Fri Jun 15 22:50:51 2007
@@ -1,13 +1,19 @@
   <div class="hilo">
     <h4>Subforo: %(metatag_title)s</h4>
-    <h2>Titulo: %(thread_title)s</h2>
+    <h2>T&iacute;tulo: %(thread_title)s</h2>
     <h3>Iniciado por %(thread_author)s</h3>
-    %(body)s
+    <ul class="nav">
+      %(nav)s
+    </ul>
+      %(body)s
+    <ul class="nav">
+      %(nav)s
+    </ul>
   </div>
 </div>
 <div id="footer">
     <div id="menu">
-      <h3>Menu</h3>
+      <h3>Men&uacute;</h3>
       <ul>
         <li><a href="%(link_metatag)s">Volver al subforo '%(metatag_title)s'</a></li>
-        <li><a href="/">Pagina principal</a></li>
+        <li><a href="/">P&aacute;gina principal</a></li>

Copied: trunk/frontend-web/skins/default/body_show_thread_first.html (from r155, /trunk/frontend-web/skins/default/body_show_thread_prev.html)
==============================================================================
--- /trunk/frontend-web/skins/default/body_show_thread_prev.html	(original)
+++ trunk/frontend-web/skins/default/body_show_thread_first.html	Fri Jun 15 22:50:51 2007
@@ -1 +1 @@
-<p class="linkidx"><a href='%(link)s'>Anterior</a></p>
+<li class="linkidx"><a href='%(link)s'>&#171;</a></li>

Copied: trunk/frontend-web/skins/default/body_show_thread_last.html (from r155, /trunk/frontend-web/skins/default/body_show_thread_prev.html)
==============================================================================
--- /trunk/frontend-web/skins/default/body_show_thread_prev.html	(original)
+++ trunk/frontend-web/skins/default/body_show_thread_last.html	Fri Jun 15 22:50:51 2007
@@ -1 +1 @@
-<p class="linkidx"><a href='%(link)s'>Anterior</a></p>
+<li class="linkidx"><a href='%(link)s'>&#187;</a></li>

Modified: trunk/frontend-web/skins/default/body_show_thread_next.html
==============================================================================
--- trunk/frontend-web/skins/default/body_show_thread_next.html	(original)
+++ trunk/frontend-web/skins/default/body_show_thread_next.html	Fri Jun 15 22:50:51 2007
@@ -1 +1 @@
-<p class="linkidx"><a href='%(link)s'>Siguiente</a></p>
+<li class="linkidx"><a href='%(link)s'>&rsaquo;</a></li>

Modified: trunk/frontend-web/skins/default/body_show_thread_num.html
==============================================================================
--- trunk/frontend-web/skins/default/body_show_thread_num.html	(original)
+++ trunk/frontend-web/skins/default/body_show_thread_num.html	Fri Jun 15 22:50:51 2007
@@ -1 +1 @@
-<p class="linkidx"><a href='/hilo/%(thread_num_link)s'>%(thread_num)s</a></p>
+<li class="linkidx"><a href="%(link)s">%(num)s</a></li>

Copied: trunk/frontend-web/skins/default/body_show_thread_num_inactive.html (from r155, /trunk/frontend-web/skins/default/body_show_thread_num.html)
==============================================================================
--- /trunk/frontend-web/skins/default/body_show_thread_num.html	(original)
+++ trunk/frontend-web/skins/default/body_show_thread_num_inactive.html	Fri Jun 15 22:50:51 2007
@@ -1 +1 @@
-<p class="linkidx"><a href='/hilo/%(thread_num_link)s'>%(thread_num)s</a></p>
+<li class="linkidx inactive">%(num)s</li>

Modified: trunk/frontend-web/skins/default/body_show_thread_prev.html
==============================================================================
--- trunk/frontend-web/skins/default/body_show_thread_prev.html	(original)
+++ trunk/frontend-web/skins/default/body_show_thread_prev.html	Fri Jun 15 22:50:51 2007
@@ -1 +1 @@
-<p class="linkidx"><a href='%(link)s'>Anterior</a></p>
+<li class="linkidx"><a href='%(link)s'>&lsaquo;</a></li>

Modified: trunk/frontend-web/skins/default/body_threadlist.html
==============================================================================
--- trunk/frontend-web/skins/default/body_threadlist.html	(original)
+++ trunk/frontend-web/skins/default/body_threadlist.html	Fri Jun 15 22:50:51 2007
@@ -33,4 +33,4 @@
     <div id="menu">
       <h3>Men&uacute;</h3>
       <ul>
-        <li><a href="/">Pagina principal</a></li>
+        <li><a href="/">P&aacute;gina principal</a></li>

Modified: trunk/frontend-web/skins/default/body_threadlist_anonymous.html
==============================================================================
--- trunk/frontend-web/skins/default/body_threadlist_anonymous.html	(original)
+++ trunk/frontend-web/skins/default/body_threadlist_anonymous.html	Fri Jun 15 22:50:51 2007
@@ -9,4 +9,4 @@
     <div id="menu">
       <h3>Men&uacute;</h3>
       <ul>
-        <li><a href="/">Pagina principal</a></li>
+        <li><a href="/">P&aacute;gina principal</a></li>

Modified: trunk/frontend-web/skins/default/body_threadlist_thread_unread.html
==============================================================================
--- trunk/frontend-web/skins/default/body_threadlist_thread_unread.html	(original)
+++ trunk/frontend-web/skins/default/body_threadlist_thread_unread.html	Fri Jun 15 22:50:51 2007
@@ -1,3 +1,3 @@
 <div class="alt %(format)s" onkeypress="window.location='%(link)s';" onclick="window.location='%(link)s';" >
-  <a href="%(link)s">%(title)s</a> (%(t_date)s) - <a href='%(link_notread)s'>No leido</a>
+  <a href="%(link)s">%(title)s</a> (%(t_date)s) - <a href='%(link_notread)s'>No le&iacute;do</a>
 </div>

Modified: trunk/frontend-web/skins/default/footer.html
==============================================================================
--- trunk/frontend-web/skins/default/footer.html	(original)
+++ trunk/frontend-web/skins/default/footer.html	Fri Jun 15 22:50:51 2007
@@ -3,7 +3,7 @@
   <li><a href="/stop">Parar la demo</a></li>
 </ul>
 </div>
-<p class="version">Version: %(version)d</p>
+<p class="version">Versi&oacute;n: %(version)d</p>
 </div> <!-- footer -->
 </body>
 </html>

Modified: trunk/frontend-web/skins/default/header.html
==============================================================================
--- trunk/frontend-web/skins/default/header.html	(original)
+++ trunk/frontend-web/skins/default/header.html	Fri Jun 15 22:50:51 2007
@@ -41,6 +41,9 @@
           #contenido .threadlist {
             margin-top:1em;
           }
+          #contenido .hilos {
+            background:#ff0000;
+          }
           #contenido .hilo h2 {
             margin-bottom:0.5em;
           }
@@ -72,7 +75,23 @@
             padding-top: 0.5em;
             margin-top:0.5em
           }
-
+          #contenido .nav {
+            margin-top:1em;
+            margin-bottom:1em;
+            list-style: none;
+          }
+          #contenido .nav li {
+            display:inline;
+            border:1px solid #ffa31a;
+            background:#f1f1f1;
+            padding: 1px 2px 1px 2px;
+          }
+          #contenido .inactive {
+            background: #919191 !important;
+          }
+          #contenido .linkidx:hover {
+            background: #d1d1d1;
+          }
       #form, #form-inline {
         background:#ffffff;
         margin:0 3px 0 3px;

Modified: trunk/frontend-web/url_hilo.py
==============================================================================
--- trunk/frontend-web/url_hilo.py	(original)
+++ trunk/frontend-web/url_hilo.py	Fri Jun 15 22:50:51 2007
@@ -21,8 +21,11 @@
     except :
       return None
 
-  meta,mensajes,num_mensajes,finished,metatags=database.listado_hilo(conn,usuario,hilo_num,first_post)
-  if not meta : return None
+  try: 
+    meta,mensajes,num_mensajes,finished,metatags=database.listado_hilo(conn,usuario,hilo_num,first_post)
+    if not meta : return None
+  except:
+    return None
 
   assert len(metatags)==1 # De momento no permitimos multiples metatags para un hilo
   metatag=iter(metatags).next()
@@ -33,21 +36,15 @@
       "page_title":"cpif - %s" % meta["titulo"],
       "thread_title": meta["titulo"],
       "thread_author": meta["creador"],
-      "msg_num": hilo_num,
-      "messages": (first_post,mensajes),
+      "thread_num": hilo_num,
+      "messages": (first_post,num_mensajes,mensajes),
       "metatag": metatag
+
       }
 
   root=conn.get_root()
   d["metatag_title"] = root["metatags"]["metatags"][metatag]["nombre"]
 
-  if first_post!=1 :
-    if first_post-1<=thread_len :
-      d["thread_prev"] =  "%d" % hilo_num # FIXME especificar aqui el enlace /hilo/42?
-    else :
-      d["thread_prev"] =  "%d/%d" % (hilo_num,first_post-thread_len)
-  if not finished :
-    d["thread_next"] = "%d/%d" % (hilo_num,first_post+thread_len)
 
   pagina.load_dict(d)
   return(pagina.web())



More information about the cpif mailing list