Index: doc/customizing.txt
===================================================================
RCS file: /var/lib/cvs/roundup/doc/customizing.txt,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -B -c -I$Id: -I$Revision: -r1.1.1.1 -r1.2
*** doc/customizing.txt	1 Jul 2003 05:30:11 -0000	1.1.1.1
--- doc/customizing.txt	1 Jul 2003 05:42:41 -0000	1.2
***************
*** 2127,2165 ****
  be looking for a ``issue.search`` file to display. So that is indeed the file
  that we are going to change.
  
! If you look at this file it should be starting to seem familiar. It is a
! simple HTML form using a table to define structure. You can add the new
! category search code anywhere you like within that form::
  
!     <tr>
!      <th>Category:</th>
!      <td>
        <select name="category">
!        <option value="">don't care</option>
!        <option value="">------------</option>
!        <option tal:repeat="s db/category/list" tal:attributes="value s/name"
!                tal:content="s/name">category to filter on</option>
        </select>
!      </td>
!      <td><input type="checkbox" name=":columns" value="category" checked></td>
!      <td><input type="radio" name=":sort" value="category"></td>
!      <td><input type="radio" name=":group" value="category"></td>
!     </tr>
  
- Most of this is straightforward to anyone who knows HTML. It is just
- setting up a select list followed by a checkbox and a couple of radio
- buttons. 
- 
- The ``tal:repeat`` part repeats the tag for every item in the "category"
- table and setting "s" to be each category in turn.
- 
- The ``tal:attributes`` part is setting up the ``value=`` part of the option tag
- to be the name part of "s" which is the current category in the loop.
- 
- The ``tal:content`` part is setting the contents of the option tag to be the
- name part of "s" again. For objects more complex than category, obviously
- you would put an id in the value, and the descriptive part in the content;
- but for category they are the same.
  
  Adding category to the default view
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- 2127,2175 ----
  be looking for a ``issue.search`` file to display. So that is indeed the file
  that we are going to change.
  
! If you look at this file it should be starting to seem familiar, although it
! does use some new macros. You can add the new category search code anywhere you
! like within that form::
! 
!   <tr tal:define="name string:category;
!                   db_klass string:category;
!                   db_content string:name;">
!     <th>Priority:</th>
!     <td metal:use-macro="search_select"></td>
!     <td metal:use-macro="column_input"></td>
!     <td metal:use-macro="sort_input"></td>
!     <td metal:use-macro="group_input"></td>
!   </tr>
  
! The definitions in the <tr> opening tag are used by the macros:
! 
! - search_select expands to a drop-down box with all categories using db_klass
!   and db_content.
! - column_input expands to a checkbox for selecting what columns should be
!   displayed.
! - sort_input expands to a radio button for selecting what property should be
!   sorted on.
! - group_input expands to a radio button for selecting what property should be
!   group on.
! 
! The category search code above would expand to the following::
! 
!   <tr>
!     <th>Category:</th>
!     <td>
        <select name="category">
!         <option value="">don't care</option>
!         <option value="">------------</option>      
!         <option value="1">scipy</option>
!         <option value="2">chaco</option>
!         <option value="3">weave</option>
        </select>
!     </td>
!     <td><input type="checkbox" name=":columns" value="category"></td>
!     <td><input type="radio" name=":sort" value="category"></td>
!     <td><input type="radio" name=":group" value="category"></td>
!   </tr>
  
  
  Adding category to the default view
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: roundup/cgi/client.py
===================================================================
RCS file: /var/lib/cvs/roundup/roundup/cgi/client.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -B -c -I$Id: -I$Revision: -r1.1.1.1 -r1.2
*** roundup/cgi/client.py	1 Jul 2003 05:30:12 -0000	1.1.1.1
--- roundup/cgi/client.py	1 Jul 2003 05:42:41 -0000	1.2
***************
*** 1325,1331 ****
          if queryname:
              # parse the environment and figure what the query _is_
              req = HTMLRequest(self)
!             url = req.indexargs_href('', {})
  
              # handle editing an existing query
              try:
--- 1325,1334 ----
          if queryname:
              # parse the environment and figure what the query _is_
              req = HTMLRequest(self)
! 
!             # The [1:] strips off the '?' character, it isn't part of the
!             # query string.
!             url = req.indexargs_href('', {})[1:]
  
              # handle editing an existing query
              try:
Index: roundup/cgi/templating.py
===================================================================
RCS file: /var/lib/cvs/roundup/roundup/cgi/templating.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -B -c -I$Id: -I$Revision: -r1.1.1.1 -r1.2
*** roundup/cgi/templating.py	1 Jul 2003 05:30:12 -0000	1.1.1.1
--- roundup/cgi/templating.py	1 Jul 2003 05:42:41 -0000	1.2
***************
*** 1492,1507 ****
          ''' Parse the URL for query args, and update my attributes using the
              values.
          ''' 
!         self.form = {}
!         for name, value in cgi.parse_qsl(url):
!             if self.form.has_key(name):
!                 if isinstance(self.form[name], type([])):
!                     self.form[name].append(cgi.MiniFieldStorage(name, value))
!                 else:
!                     self.form[name] = [self.form[name],
!                         cgi.MiniFieldStorage(name, value)]
!             else:
!                 self.form[name] = cgi.MiniFieldStorage(name, value)
          self._post_init()
  
      def update(self, kwargs):
--- 1492,1500 ----
          ''' Parse the URL for query args, and update my attributes using the
              values.
          ''' 
!         env = {'QUERY_STRING': url}
!         self.form = cgi.FieldStorage(environ=env)
! 
          self._post_init()
  
      def update(self, kwargs):
Index: templates/classic/html/issue.search.html
===================================================================
RCS file: /var/lib/cvs/roundup/templates/classic/html/issue.search.html,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -B -c -I$Id: -I$Revision: -r1.1.1.1 -r1.2
*** templates/classic/html/issue.search.html	1 Jul 2003 05:30:14 -0000	1.1.1.1
--- templates/classic/html/issue.search.html	1 Jul 2003 05:42:41 -0000	1.2
***************
*** 9,18 ****
  <input type="hidden" name=":action" value="search">
  
  <table class="form" tal:define="
!    cols python:'id activity priority title status assignedto'.split();
!    defsort python:['activity'];
!    defgroup python:['priority'];
!    defdisp python:'id activity title status assignedto'.split()">
  
  <tr>
   <th class="header">&nbsp;</th>
--- 9,23 ----
  <input type="hidden" name=":action" value="search">
  
  <table class="form" tal:define="
!    cols python:request.columns or 'id activity title status assignedto'.split();
!    sort_on python:request.sort[1] or 'activity';
!    group_on python:request.group[1] or 'priority';
! 
!    search_input templates/page/macros/search_input;
!    column_input templates/page/macros/column_input;
!    sort_input templates/page/macros/sort_input;
!    group_input templates/page/macros/group_input;
!    search_select templates/page/macros/search_select;">
  
  <tr>
   <th class="header">&nbsp;</th>
***************
*** 22,176 ****
   <th class="header">Group on</th>
  </tr>
  
! <tr>
!  <th>All text*:</th>
!  <td><input name=":search_text"
!             tal:attributes="value request/form/:search_text/value | nothing">
!  </td>
!  <td>&nbsp;</td>
!  <td>&nbsp;</td>
!  <td>&nbsp;</td>
! </tr>
! 
! <tr>
!  <th>Title:</th>
!  <td><input name="title"></td>
!  <td><input type="checkbox" name=":columns" value="title" checked></td>
!  <td><input type="radio" name=":sort" value="title"></td>
!  <td>&nbsp;</td>
! </tr>
! 
! <tr>
!  <th>Topic:</th>
!  <td>
!   <select name="topic">
!    <option value="">don't care</option>
!    <option value="">------------</option>
!    <option tal:repeat="s db/keyword/list" tal:attributes="value s/name"
!            tal:content="s/name">topic to filter on</option>
!   </select>
!  </td>
!  <td><input type="checkbox" name=":columns" value="topic" checked></td>
!  <td><input type="radio" name=":sort" value="topic"></td>
!  <td><input type="radio" name=":group" value="topic"></td>
! </tr>
! 
! <tr>
!  <th>ID:</th>
!  <td><input name="id"></td>
!  <td><input type="checkbox" name=":columns" value="id" checked></td>
!  <td><input type="radio" name=":sort" value="id"></td>
!  <td>&nbsp;</td>
! </tr>
! 
! <tr>
!  <th>Creation date:</th>
!  <td><input name="creation"></td>
!  <td><input type="checkbox" name=":columns" value="creation"></td>
!  <td><input type="radio" name=":sort" value="creation"></td>
!  <td><input type="radio" name=":group" value="creation"></td>
! </tr>
! 
! <tr>
!  <th>Creator:</th>
!  <td>
!   <select name="creator">
!    <option value="">don't care</option>
!    <option tal:attributes="value request/user/id">created by me</option>
!    <option value="-1">------------</option>
!    <option tal:repeat="s db/user/list" tal:attributes="value s/id"
!      tal:content="s/username">user to filter on</option>
!   </select>
!  </td>
!  <td><input type="checkbox" name=":columns" value="creator" checked></td>
!  <td><input type="radio" name=":sort" value="creator"></td>
!  <td><input type="radio" name=":group" value="creator"></td>
! </tr>
! 
! <tr>
!  <th>Activity:</th>
!  <td><input name="activity"></td>
!  <td><input type="checkbox" name=":columns" value="activity" checked></td>
!  <td><input type="radio" name=":sort" value="activity"></td>
!  <td>&nbsp;</td>
! </tr>
! 
! <tr>
!  <th>Priority:</th>
!  <td>
!   <select name="priority">
!    <option value="">don't care</option>
!    <option value="-1">not selected</option>
!    <option value="">------------</option>
!    <option tal:repeat="s db/priority/list" tal:attributes="value s/id"
!      tal:content="s/name">priority to filter on</option>
!   </select>
!  </td>
!  <td><input type="checkbox" name=":columns" value="priority"></td>
!  <td><input type="radio" name=":sort" value="priority"></td>
!  <td><input type="radio" name=":group" value="priority"></td>
! </tr>
! 
! <tr>
!  <th>Status:</th>
!  <td>
!   <select name="status">
!    <option value="">don't care</option>
!    <option value="-1,1,2,3,4,5,6,7">not resolved</option>
!    <option value="-1">not selected</option>
!    <option value="">------------</option>
!    <option tal:repeat="s db/status/list" tal:attributes="value s/id"
!            tal:content="s/name">status to filter on</option>
!   </select>
!  </td>
!  <td><input type="checkbox" name=":columns" value="status" checked></td>
!  <td><input type="radio" name=":sort" value="status"></td>
!  <td><input type="radio" name=":group" value="status"></td>
! </tr>
! 
! <tr>
!  <th>Assigned To:</th>
!  <td>
!   <select name="assignedto">
!    <option value="">don't care</option>
!    <option tal:attributes="value request/user/id">assigned to me</option>
!    <option value="-1">unassigned</option>
!    <option value="">------------</option>
!    <option tal:repeat="s db/user/list" tal:attributes="value s/id"
!      tal:content="s/username">user to filter on</option>
!   </select>
!  </td>
!  <td><input type="checkbox" name=":columns" value="assignedto" checked></td>
!  <td><input type="radio" name=":sort" value="assignedto"></td>
!  <td><input type="radio" name=":group" value="assignedto"></td>
  </tr>
  
  <tr>
  <th>Pagesize:</th>
! <td><input type="text" name=":pagesize" size="3" value="50"></td>
  </tr>
  
  <tr>
  <th>Start With:</th>
! <td><input type="text" name=":startwith" size="3" value="0"></td>
  </tr>
  
  <tr>
  <th>Sort Descending:</th>
! <td><input type="checkbox" name=":sortdir" checked>
  </td>
  
  <tr>
  <th>Group Descending:</th>
! <td><input type="checkbox" name=":groupdir">
  </td>
  </tr>
  
  <tr>
  <th>Query name**:</th>
  <td><input name=":queryname"
!             tal:attributes="value request/form/:queryname/value | nothing">
! </td>
  </tr>
  
  <tr><td>&nbsp;</td>
--- 27,170 ----
   <th class="header">Group on</th>
  </tr>
  
! <tr tal:define="name string::search_text">
!   <th>All text*:</th>
!   <td metal:use-macro="search_input"></td>
!   <td>&nbsp;</td>
!   <td>&nbsp;</td>
!   <td>&nbsp;</td>
! </tr>
! 
! <tr tal:define="name string:title">
!   <th>Title:</th>
!   <td metal:use-macro="search_input"></td>
!   <td metal:use-macro="column_input"></td>
!   <td metal:use-macro="sort_input"></td>
!   <td>&nbsp;</td>
! </tr>
! 
! <tr tal:define="name string:topic;
!                 db_klass string:keyword;
!                 db_content string:name;">
!   <th>Topic:</th>
!   <td metal:use-macro="search_select"></td>
!   <td metal:use-macro="column_input"></td>
!   <td metal:use-macro="sort_input"></td>
!   <td metal:use-macro="group_input"></td>
! </tr>
! 
! <tr tal:define="name string:id">
!   <th>ID:</th>
!   <td metal:use-macro="search_input"></td>
!   <td metal:use-macro="column_input"></td>
!   <td metal:use-macro="sort_input"></td>
!   <td>&nbsp;</td>
! </tr>
! 
! <tr tal:define="name string:creation">
!   <th>Creation Date:</th>
!   <td metal:use-macro="search_input"></td>
!   <td metal:use-macro="column_input"></td>
!   <td metal:use-macro="sort_input"></td>
!   <td metal:use-macro="group_input"></td>
! </tr>
! 
! <tr tal:define="name string:creator;
!                 db_klass string:user;
!                 db_content string:username;">
!   <th>Creator:</th>
!   <td metal:use-macro="search_select">
!     <option metal:fill-slot="extra_options"
!             tal:attributes="value request/user/id">created by me</option>
!   </td>
!   <td metal:use-macro="column_input"></td>
!   <td metal:use-macro="sort_input"></td>
!   <td metal:use-macro="group_input"></td>
! </tr>
! 
! <tr tal:define="name string:activity">
!   <th>Activity:</th>
!   <td metal:use-macro="search_input"></td>
!   <td metal:use-macro="column_input"></td>
!   <td metal:use-macro="sort_input"></td>
!   <td>&nbsp;</td>
! </tr>
! 
! <tr tal:define="name string:priority;
!                 db_klass string:priority;
!                 db_content string:name;">
!   <th>Priority:</th>
!   <td metal:use-macro="search_select">
!     <option metal:fill-slot="extra_options" value="-1"
!             tal:attributes="selected python:value == '-1'">not selected</option>
!   </td>
!   <td metal:use-macro="column_input"></td>
!   <td metal:use-macro="sort_input"></td>
!   <td metal:use-macro="group_input"></td>
! </tr>
! 
! <tr tal:define="name string:status;
!                 db_klass string:status;
!                 db_content string:name;">
!   <th>Status:</th>
!   <td metal:use-macro="search_select">
!     <tal:block metal:fill-slot="extra_options">
!       <option value="-1,1,2,3,4,5,6,7"
!               tal:attributes="selected python:value == '-1,1,2,3,4,5,6,7'">not resolved</option>
!       <option value="-1"
!               tal:attributes="selected python:value == '-1'">not selected</option>
!     </tal:block>    
!   </td>
!   <td metal:use-macro="column_input"></td>
!   <td metal:use-macro="sort_input"></td>
!   <td metal:use-macro="group_input"></td>
! </tr>
! 
! <tr tal:define="name string:assignedto;
!                 db_klass string:user;
!                 db_content string:username;">
!   <th>Assigned to:</th>
!   <td metal:use-macro="search_select">
!     <tal:block metal:fill-slot="extra_options">
!       <option tal:attributes="value request/user/id">assigned to me</option>
!       <option value="-1" tal:attributes="selected python:value == '-1'">unassigned</option>
!     </tal:block>
!   </td>
!   <td metal:use-macro="column_input"></td>
!   <td metal:use-macro="sort_input"></td>
!   <td metal:use-macro="group_input"></td>
  </tr>
  
  <tr>
  <th>Pagesize:</th>
! <td><input name=":pagesize" size="3" value="50"
!            tal:attributes="value request/form/:pagesize/value | default"></td>
  </tr>
  
  <tr>
  <th>Start With:</th>
! <td><input name=":startwith" size="3" value="0"
!            tal:attributes="value request/form/:startwith/value | default"></td>
  </tr>
  
  <tr>
  <th>Sort Descending:</th>
! <td><input type="checkbox" name=":sortdir"
!            tal:attributes="checked python:request.sort[0] == '-' or request.sort[0] is None">
  </td>
+ </tr>
  
  <tr>
  <th>Group Descending:</th>
! <td><input type="checkbox" name=":groupdir"
!            tal:attributes="checked python:request.group[0] == '-'">
  </td>
  </tr>
  
  <tr>
  <th>Query name**:</th>
  <td><input name=":queryname"
!            tal:attributes="value request/form/:queryname/value | default"></td>
  </tr>
  
  <tr><td>&nbsp;</td>
Index: templates/classic/html/page.html
===================================================================
RCS file: /var/lib/cvs/roundup/templates/classic/html/page.html,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -B -c -I$Id: -I$Revision: -r1.1.1.1 -r1.3
*** templates/classic/html/page.html	1 Jul 2003 05:30:14 -0000	1.1.1.1
--- templates/classic/html/page.html	1 Jul 2003 06:00:01 -0000	1.3
***************
*** 23,29 ****
    <p class="classblock" tal:condition="request/user/queries">
     <b>Your Queries</b><br>
     <tal:block tal:repeat="qs request/user/queries">
!     <a tal:attributes="href string:${qs/klass}${qs/url}"
         tal:content="qs/name">link</a><br>
     </tal:block>
    </p>
--- 23,29 ----
    <p class="classblock" tal:condition="request/user/queries">
     <b>Your Queries</b><br>
     <tal:block tal:repeat="qs request/user/queries">
!     <a tal:attributes="href string:${qs/klass}?${qs/url}"
         tal:content="qs/name">link</a><br>
     </tal:block>
    </p>
***************
*** 102,104 ****
--- 102,139 ----
  
  </body>
  </html>
+ 
+ <td metal:define-macro="search_input">
+   <input tal:attributes="value python:request.form.getvalue(name) or nothing;
+                          name name">
+ </td>
+ 
+ <td metal:define-macro="search_select">
+   <select tal:attributes="name name"
+           tal:define="value python:request.form.getvalue(name)">
+     <option value="">don't care</option>
+     <tal:block metal:define-slot="extra_options"></tal:block>
+     <option value="">------------</option>      
+     <option tal:repeat="s python:db[db_klass].list()"
+             tal:attributes="value s/id; selected python:value == s.id"
+             tal:content="python:s[db_content]"></option>
+   </select>
+ </td>
+ 
+ <td metal:define-macro="column_input">
+   <input type="checkbox" name=":columns"
+          tal:attributes="value name;
+                          checked python:name in cols">
+ </td>
+ 
+ <td metal:define-macro="sort_input">
+   <input type="radio" name=":sort"
+          tal:attributes="value name;
+                          checked python:name == sort_on">
+ </td>
+ 
+ <td metal:define-macro="group_input">
+   <input type="radio" name=":group"
+          tal:attributes="value name;
+                          checked python:name == group_on">
+ </td>
\ No newline at end of file
Index: templates/classic/html/user.item.html
===================================================================
RCS file: /var/lib/cvs/roundup/templates/classic/html/user.item.html,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -B -c -I$Id: -I$Revision: -r1.1.1.1 -r1.2
*** templates/classic/html/user.item.html	1 Jul 2003 05:30:14 -0000	1.1.1.1
--- templates/classic/html/user.item.html	1 Jul 2003 06:00:01 -0000	1.2
***************
*** 84,90 ****
    <td><a tal:attributes="href string:query${query/id}"
           tal:content="query/name"></a></td>
    <td>
!    <a tal:attributes="href python:'%s%s'%(query['klass'], query['url'])">display</a>
    </td>
    <td>
     <a tal:attributes="href string:?:remove:queries=${query/id}&:action=edit">remove</a>
--- 84,90 ----
    <td><a tal:attributes="href string:query${query/id}"
           tal:content="query/name"></a></td>
    <td>
!    <a tal:attributes="href string:${query/klass}?${query/url}">display</a>
    </td>
    <td>
     <a tal:attributes="href string:?:remove:queries=${query/id}&:action=edit">remove</a>

 	  	 
