[cpif] r336 - trunk/frontend-web

svn at argo.es svn at argo.es
Thu Sep 6 19:26:10 CEST 2007


Author: alvaro
Date: Thu Sep  6 19:26:09 2007
New Revision: 336

Log:
Aniadido soporte para iconos y pequenia prueba.


Modified:
   trunk/frontend-web/skins.py
   trunk/frontend-web/url_hilo.py
   trunk/frontend-web/url_indice.py

Modified: trunk/frontend-web/skins.py
==============================================================================
--- trunk/frontend-web/skins.py	(original)
+++ trunk/frontend-web/skins.py	Thu Sep  6 19:26:09 2007
@@ -31,6 +31,7 @@
     'metatag_unread': 'body_metatags_metatag_unread.html',
     'metatag_mon':    'body_metatags_metatag_mon.html',
     'metatag_unmon':  'body_metatags_metatag_unmon.html',
+    'thread_ro':    'body_threadlist_thread_ro.html',
     'thread_unread':  'body_threadlist_thread_unread.html',
     'thread_anonymous':       'body_threadlist_thread_anonymous.html',
     'thread':         'body_threadlist_thread.html',
@@ -80,6 +81,18 @@
     replacement={"***CSS***":"/static/css/%s" %css,
                  "***JS***":"/static/js/%s" %js}
 
+    icons = {"icon ro": os.path.join(sdir,dir,"icons/topic_lock.gif")}
+    @monitor
+    def save_icons(conn,icons):
+      from database import save_static,check_image
+      ret = {}
+      for icon_name,file in icons.iteritems():
+        icon = open(file).read()
+        result,metadata = check_image(icon)
+        ret[icon_name] = "/static/icons/%s" %save_static(conn,"icons",icon,metadata)
+      return ret
+    icons = save_icons(icons)
+
     for skin,file in skin_files.items():
       f=open(os.path.join(sdir,dir,file))
       data=f.read()
@@ -213,12 +226,14 @@
     thread_len=globales.thread_len
     for date,threads in t_list:
       self.set_text(available_skins[self._skin]['group_date'] % {'group_date':daydate(date,self._tz)})
-      for thread, title, ts, nr, nr_point, n_msgs, mon in threads:
+      for thread, title, ts, nr, nr_point, n_msgs, mon, ro in threads:
         format = self._style.pop(0)
         self._style.append(format)
         if self._dict["user"]:
           mon =  available_skins[self._skin]['thread_unmon'] if mon else available_skins[self._skin]['thread_mon']
           mon = mon % { "thread_num": thread }
+          read_only = available_skins[self._skin]['thread_ro'] if ro else ""
+          read_only = read_only % icons
           if nr:
             page = ((nr[0] - 1) / thread_len)  * thread_len + 1
             aux = available_skins[self._skin]['thread_unread'] % {"title":title,
@@ -228,7 +243,8 @@
                 "format": format,
                 "not_read": nr_point,
                 "t_replies": n_msgs,
-                "mon":mon
+                "mon":mon,
+                "read only": read_only,
                 }
           else:
             aux = available_skins[self._skin]['thread'] % {"title":title,
@@ -236,7 +252,8 @@
                 "t_date":hourdate(ts,self._tz),
                 "format": format,
                 "t_replies": n_msgs,
-                "mon":mon
+                "mon":mon,
+                "read only": read_only,
                 }
         else:
           aux = available_skins[self._skin]['thread_anonymous'] % {"title":title,
@@ -244,6 +261,7 @@
               "t_date":hourdate(ts,self._tz),
               "format": format,
               "t_replies": n_msgs,
+              "read only": read_only,
               }
         # The monitoring of the metatag:
         mon = available_skins[self._skin]['metatag_unmon'] if self._dict["monitor"] else available_skins[self._skin]['metatag_mon'] 

Modified: trunk/frontend-web/url_hilo.py
==============================================================================
--- trunk/frontend-web/url_hilo.py	(original)
+++ trunk/frontend-web/url_hilo.py	Thu Sep  6 19:26:09 2007
@@ -38,6 +38,7 @@
       "metatag": metatag[0],
       "metatag_title": metatag[1],
       "monitor": mon,
+      "read only": meta["read only"],
       }
 
   pagina.load_dict(d)

Modified: trunk/frontend-web/url_indice.py
==============================================================================
--- trunk/frontend-web/url_indice.py	(original)
+++ trunk/frontend-web/url_indice.py	Thu Sep  6 19:26:09 2007
@@ -77,9 +77,10 @@
         title,
         hilos[id]["TS"], 
         hilos[id]["mensajes"].get(punto_no_leido.get(id,None)), # El numero de mensajes hasta el no leido
-        punto_no_leido.get(id,None),
+        punto_no_leido.get(id,None), # El punto donde el usuario no ha leido
         hilos[id]["num_mensajes"],
-        mon) for id,title,not_read,mon in h])) # El punto donde el usuario no ha leido
+        mon,
+        ro) for id,title,not_read,mon,ro in h])) 
 
       num_hilos+=l
     ts=ts2



More information about the cpif mailing list