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

svn at argo.es svn at argo.es
Mon Jul 30 19:55:11 CEST 2007


Author: alvaro
Date: Mon Jul 30 19:55:11 2007
New Revision: 314

Log:
Soporte para monitorizar metatags


Added:
   trunk/frontend-web/skins/default/body_metatags_metatag_anonymous.html
      - copied unchanged from r309, /trunk/frontend-web/skins/default/body_metatags_metatag.html
   trunk/frontend-web/skins/default/body_metatags_metatag_mon.html
      - copied, changed from r309, /trunk/frontend-web/skins/default/body_show_thread_mon.html
   trunk/frontend-web/skins/default/body_metatags_metatag_unmon.html
      - copied, changed from r309, /trunk/frontend-web/skins/default/body_show_thread_unmon.html
Modified:
   trunk/frontend-web/skins.py
   trunk/frontend-web/skins/default/body_metatags_metatag.html
   trunk/frontend-web/skins/default/body_metatags_metatag_unread.html
   trunk/frontend-web/skins/default/js.js
   trunk/frontend-web/url_.py

Modified: trunk/frontend-web/skins.py
==============================================================================
--- trunk/frontend-web/skins.py	(original)
+++ trunk/frontend-web/skins.py	Mon Jul 30 19:55:11 2007
@@ -27,7 +27,10 @@
     'body_anonymous': 'body_threadlist_anonymous.html',
     'body_metatags':  'body_metatags.html',
     'metatag':        'body_metatags_metatag.html',
+    'metatag_anonymous':      'body_metatags_metatag_anonymous.html',
     'metatag_unread': 'body_metatags_metatag_unread.html',
+    'metatag_mon':    'body_metatags_metatag_mon.html',
+    'metatag_unmon':  'body_metatags_metatag_unmon.html',
     'thread_unread':  'body_threadlist_thread_unread.html',
     'thread_anonymous':       'body_threadlist_thread_anonymous.html',
     'thread':         'body_threadlist_thread.html',
@@ -190,10 +193,14 @@
     for id, title, nr, mon in m_list:
       format = self._style.pop(0)
       self._style.append(format)
-      if nr:
-        aux = available_skins[self._skin]['metatag_unread'] % {"title":title, "format": format, "link": "/indice/%d" % id}
+      if self._dict["user"]:
+        mon = available_skins[self._skin]['metatag_unmon'] % { "metatag_num": id } if mon else available_skins[self._skin]['metatag_mon'] % { "metatag_num": id }
+        if nr:
+          aux = available_skins[self._skin]['metatag_unread'] % {"title":title, "format": format, "link": "/indice/%d" % id, "mon": mon}
+        else:
+          aux = available_skins[self._skin]['metatag'] % {"title":title, "format": format, "link": "/indice/%d" % id, "mon": mon}
       else:
-        aux = available_skins[self._skin]['metatag'] % {"title":title, "format": format, "link": "/indice/%d" % id}
+        aux = available_skins[self._skin]['metatag_anonymous'] % {"title":title, "format": format, "link": "/indice/%d" % id}
       self.set_text(aux)
 
   def list_threads(self):

Modified: trunk/frontend-web/skins/default/body_metatags_metatag.html
==============================================================================
--- trunk/frontend-web/skins/default/body_metatags_metatag.html	(original)
+++ trunk/frontend-web/skins/default/body_metatags_metatag.html	Mon Jul 30 19:55:11 2007
@@ -1,3 +1,3 @@
 <div class="alt %(format)s">
-  <a href="%(link)s">%(title)s</a>
+  <a href="%(link)s">%(title)s</a> - %(mon)s
 </div>

Copied: trunk/frontend-web/skins/default/body_metatags_metatag_mon.html (from r309, /trunk/frontend-web/skins/default/body_show_thread_mon.html)
==============================================================================
--- /trunk/frontend-web/skins/default/body_show_thread_mon.html	(original)
+++ trunk/frontend-web/skins/default/body_metatags_metatag_mon.html	Mon Jul 30 19:55:11 2007
@@ -1 +1 @@
-<a href="javascript:toggle_thread_mon(%(thread_num)s);" id="linkmon">Monitorizar</a>
+<a href="javascript:toggle_metatag_mon(%(metatag_num)s);" id="linkmon%(metatag_num)s">Monitorizar</a>

Copied: trunk/frontend-web/skins/default/body_metatags_metatag_unmon.html (from r309, /trunk/frontend-web/skins/default/body_show_thread_unmon.html)
==============================================================================
--- /trunk/frontend-web/skins/default/body_show_thread_unmon.html	(original)
+++ trunk/frontend-web/skins/default/body_metatags_metatag_unmon.html	Mon Jul 30 19:55:11 2007
@@ -1 +1 @@
-<a href="javascript:toggle_thread_mon(%(thread_num)s);" id="linkmon">Dejar de monitorizar</a>
+<a href="javascript:toggle_metatag_mon(%(metatag_num)s);" id="linkmon%(metatag_num)s">Dejar de monitorizar</a>

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	Mon Jul 30 19:55:11 2007
@@ -1,3 +1,3 @@
 <div class="alt %(format)s">
-  <a href="%(link)s">%(title)s</a> - NO LE&Iacute;DO
+  <a href="%(link)s">%(title)s</a> - NO LE&Iacute;DO - %(mon)s
 </div>

Modified: trunk/frontend-web/skins/default/js.js
==============================================================================
--- trunk/frontend-web/skins/default/js.js	(original)
+++ trunk/frontend-web/skins/default/js.js	Mon Jul 30 19:55:11 2007
@@ -24,6 +24,25 @@
   }
 }
 
+function toggle_metatag_mon(id) {
+  var req = false;
+  try {
+    req = new XMLHttpRequest();
+  }
+  catch(e) {
+    req = false;
+  }
+  if(req) {
+    req.open("GET","/toggle_monitor_AJAX/metatag/"+id,false);
+    req.send("");
+    var xml = req.responseXML;
+    var txt = xml.getElementsByTagName("msg")[0].textContent;
+    var link = document.getElementById("linkmon"+id);
+    link.innerHTML = txt;
+  }
+
+}
+
 function toggle_thread_mon(id) {
   var req = false;
   try {

Modified: trunk/frontend-web/url_.py
==============================================================================
--- trunk/frontend-web/url_.py	(original)
+++ trunk/frontend-web/url_.py	Mon Jul 30 19:55:11 2007
@@ -20,6 +20,7 @@
   d = {
       "page_title": "cpif - listado de subforos",
       "metatags":database.get_metatags(conn,usuario),
+      "user": usuario
       }
 
   pagina.load_dict(d)



More information about the cpif mailing list