[cpif] r357 - trunk/frontend-web

svn at argo.es svn at argo.es
Mon Sep 10 22:54:09 CEST 2007


Author: alvaro
Date: Mon Sep 10 22:54:08 2007
New Revision: 357

Log:
Hilos sticky


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

Modified: trunk/frontend-web/skins.py
==============================================================================
--- trunk/frontend-web/skins.py	(original)
+++ trunk/frontend-web/skins.py	Mon Sep 10 22:54:08 2007
@@ -33,6 +33,7 @@
     'metatag_unread': 'body_metatags_metatag_unread.html',
     'metatag_mon':    'body_metatags_metatag_mon.html',
     'metatag_unmon':  'body_metatags_metatag_unmon.html',
+    'sticky':    'sticky.html',
     'read only':    'read_only.html',
     'thread_unread':  'body_threadlist_thread_unread.html',
     'thread_anonymous':       'body_threadlist_thread_anonymous.html',
@@ -84,6 +85,7 @@
                  "***JS***":"/static/js/%s" %js}
 
     icons = {
+        "icon sticky": os.path.join(sdir,dir,"icons/phpBB2/folder_announce.gif"),
         "icon ro": os.path.join(sdir,dir,"icons/phpBB2/topic_lock.gif"),
         "icon unread": os.path.join(sdir,dir,"icons/phpBB2/icon_newest_reply.gif"),
         }
@@ -229,54 +231,63 @@
 
   def list_threads(self):
     """Format the thread list"""
-    t_list = self._dict.pop("threads",None)
+    threads = ["stickies", "threads"]
     metatag = self._dict.get("metatag",None)
     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, ro in threads:
-        format = self._style.pop(0)
-        self._style.append(format)
-        read_only = available_skins[self._skin]['read only'] if ro else ""
-        read_only = read_only % icons
-        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 }
-          if nr:
-            page = ((nr[0] - 1) / thread_len)  * thread_len + 1
-            aux = available_skins[self._skin]['thread_unread'] % {"title":title,
-                "link": "/hilo/%d" %(thread),
-                "link_notread": "/hilo/%d/%d#m%d" %(thread,page,nr_point),
-                "t_date": hourdate(ts,self._tz),
-                "format": format,
-                "not_read": nr_point,
-                "t_replies": n_msgs,
-                "mon":mon,
-                "read only": read_only,
-                "icon unread": icons["icon unread"],
-                }
+    for list_type in threads:
+      t_list = self._dict.pop(list_type,None)
+      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, ro in threads:
+          format = self._style.pop(0)
+          self._style.append(format)
+          read_only = available_skins[self._skin]['read only'] if ro else ""
+          read_only = read_only % icons
+          sticky = available_skins[self._skin]['sticky'] if list_type == "stickies" else ""
+          sticky = sticky % icons
+          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 }
+            if nr:
+              page = ((nr[0] - 1) / thread_len)  * thread_len + 1
+              aux = available_skins[self._skin]['thread_unread'] % {"title":title,
+                  "link": "/hilo/%d" %(thread),
+                  "link_notread": "/hilo/%d/%d#m%d" %(thread,page,nr_point),
+                  "t_date": hourdate(ts,self._tz),
+                  "format": format,
+                  "not_read": nr_point,
+                  "t_replies": n_msgs,
+                  "mon":mon,
+                  "read only": read_only,
+                  "icon unread": icons["icon unread"],
+                  "sticky": sticky,
+                  }
+            else:
+              print read_only
+              print sticky
+              aux = available_skins[self._skin]['thread'] % {"title":title,
+                  "link": "/hilo/%d" %thread,
+                  "t_date":hourdate(ts,self._tz),
+                  "format": format,
+                  "t_replies": n_msgs,
+                  "mon":mon,
+                  "read only": read_only,
+                  "sticky": sticky,
+                  }
           else:
-            aux = available_skins[self._skin]['thread'] % {"title":title,
+            aux = available_skins[self._skin]['thread_anonymous'] % {"title":title,
                 "link": "/hilo/%d" %thread,
                 "t_date":hourdate(ts,self._tz),
                 "format": format,
                 "t_replies": n_msgs,
-                "mon":mon,
                 "read only": read_only,
+                "sticky": sticky,
                 }
-        else:
-          aux = available_skins[self._skin]['thread_anonymous'] % {"title":title,
-              "link": "/hilo/%d" %thread,
-              "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'] 
-        mon = mon % { "metatag_num": metatag }
-        self._dict["mon"] = mon
-        self.set_text(aux)
+          # The monitoring of the metatag:
+          mon = available_skins[self._skin]['metatag_unmon'] if self._dict["monitor"] else available_skins[self._skin]['metatag_mon'] 
+          mon = mon % { "metatag_num": metatag }
+          self._dict["mon"] = mon
+          self.set_text(aux)
 
   def _header(self):
     return available_skins[self._skin]['header'] % self._dict

Modified: trunk/frontend-web/url_indice.py
==============================================================================
--- trunk/frontend-web/url_indice.py	(original)
+++ trunk/frontend-web/url_indice.py	Mon Sep 10 22:54:08 2007
@@ -74,7 +74,7 @@
   if first_page:
     h=database.listado_stickies_personal(conn,usuario,metatag=metatag)
     if len(h) : # if we touch this data schema, we must update the "normal thread" one too.
-      d["stickies"].extend([(
+      d["stickies"].append((ts, [(
         id,
         title,
         hilos[id]["TS"],
@@ -82,7 +82,7 @@
         punto_no_leido.get(id,None), # El punto donde el usuario no ha leido
         hilos[id]["num_mensajes"],
         mon,
-        ro) for id,title,not_read,mon,ro in h])
+        ro) for id,title,not_read,mon,ro in h]))
   
   while (num_hilos<50) and (fecha>=fecha_min) :
     ts2=timegm(fecha)



More information about the cpif mailing list