Commits

Guido Draheim  committed 5fc8f6d

search works

  • Participants
  • Parent commits fa762b8
  • Branches trunk

Comments (0)

Files changed (2)

File src/usernotes/notes_info.py

     def home_url(self, req, domain): 
         return Markup(u'<div><a href="%s">[welcome]</a></div>' % self.base_url(req, domain))
     def base_url(self, req, domain):
-        return req.href(web_nav.URL + "/" + web_nav.MAIL + "/" + domain)
+        return req.href(web_nav.URL + "/" + web_nav.INFO + "/" + domain)
     def do_info(self, req, path):
         username = req.authname
         m = re.match("^/([^/]+)(/.*)?", path)
         for item in q.all():
             datalist.append(Item(*item))
         message = "found %s entries for %s" % (len(datalist), domain)
-        base_url = req.href(web_nav.URL + "/" + web_nav.MAIL + "/" + domain)
+        base_url = req.href(web_nav.URL + "/" + web_nav.INFO + "/" + domain)
         data = {}
         data["base_url"] = base_url
         data["color_mail_user"] = self.color_mail_user
         if not message:
             message = ""
         message += "found %s fields for %s" % (len(datalist), domain)
-        base_url = req.href(web_nav.URL + "/" + web_nav.MAIL + "/" + domain)
+        base_url = req.href(web_nav.URL + "/" + web_nav.INFO + "/" + domain)
         data = {}
         data["base_url"] = base_url
         data["color_mail_user"] = self.color_mail_user
         data["home_url"] = self.home_url(req, domain)
         data["note_user"] = note_user
         session = context(self.env)
-        q = session.query(NotesInfo.note_user, NotesInfo.note_field,
-                          NotesInfo.note_number, NotesInfo.note_date,
-                          NotesInfo.note_string)
+        q = session.query(NotesInfo)
         q = q.filter_by(note_user=note_user, note_domain=domain)
         q = q.order_by(desc(NotesInfo.modified_on))
         datalist = []
         for item in q.all():
             datalist.append(item)
         message = len(datalist)
-        q = session.query(NotesFields.note_user, NotesInfo.note_field,
-                          NotesInfo.note_number, NotesInfo.note_date,
-                          NotesInfo.note_string)
-        q = q.filter_by(note_user=note_user)
-        q = q.order_by(desc(NotesInfo.modified_on))
-        datalist = []
-        for item in q.all():
-            datalist.append(item)
         data["datalist"] = datalist
+        data["fields"] = self.fields(domain)
         data["domains"] = self._domains(req)
         data["title"] = TITLE
         data["domains"] = self._domains(req)

File src/usernotes/templates/notes_info_textlist.html

+<!DOCTYPE html
+    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:py="http://genshi.edgewall.org/"
+	xmlns:xi="http://www.w3.org/2001/XInclude">
+<xi:include href="layout.html" />
+<xi:include href="macros.html" />
+<head>
+<title>${title}</title>
+</head>
+<body>
+	<div id="ctxtnav" class="nav"></div>
+	<xi:include href="usernotes_domains_nav.html" />
+
+	<div id="content">
+		<h2>${title}</h2>
+
+		<py:if test="message">
+			<div class="error">${message}</div>
+		</py:if>
+
+		<py:if test="content">
+			<div class="content">${content}</div>
+		</py:if>
+	</div>
+
+
+	<div class="body">
+		${home_url}
+		<h3>SEARCH ${note_user}</h3>
+		<table class="resulttable">
+			<py:for each="item in datalist">
+				<tr valign="top">
+					<td><a
+						href="${base_url}?op=search&amp;user=${item.note_user}">${item.note_user}</a>
+					</td>
+					<td>
+					   ${item.note_field}
+					</td>
+					<td>
+                                           ${item.note_string}					
+					</td>
+				</tr>
+			</py:for>
+		</table>
+	</div>
+	<div class="summary">
+	   <span class="count">${len(datalist)}</span> entries
+	</div>
+</body>
+</html>