Submitted by : simon at: 2003-10-26T21:31:27+00:00 (14 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :


2001/11/27 18:32 US/Pacific (via web):
filtering: done

sorting: kind of but not complete. Issues include


comments:

Patch --EmmaLaurijssens, Thu, 06 Apr 2006 15:37:52 -0700 reply
I've sent a patch for the second bullet.

Patch --EmmaLaurijssens, Thu, 06 Apr 2006 15:42:18 -0700 reply
Basically, it's:

  hunk ./plugins/tracker/IssueTracker.dtml 173
  -  order="REQUEST.get('sort_order','') and '&sort_order=' or '&sort_order=reverse' #not used"
  +  order="(not (REQUEST.get('sort_order','') == 'ascending')) and '&sort_order=ascending' or '&sort_order=reverse' "

and replacing & dtml-query in the header with & dtml-order. This also fixes a bug where repeatedly clicking the "modified" column header adds &sort-order=reverse to the original url .

Patch --EmmaLaurijssens, Mon, 24 Apr 2006 12:58:38 -0700 reply
Not entirely true - & dtml-query needs to stay in place, and another filter needs to be added to remove sort_order from the query string.

Got back to this one --EmmaLaurijssens, Thu, 08 Mar 2007 10:24:54 +0000 reply
It's definitely something I need. I succeeded in making it work, but I'm not an experienced programmer so it's a bit messy. Perhaps someone can lend a hand cleaning it up.

For the issue name sort, I think it's not entirely doable without adding the issue title to the catalog, so I modified tracker.py to include this.

For the reverse sorting, the problem is we don't parse the query very well, hence my messy code.

I'll post the changes when I get back to my computer.

Got back to this one --Frank Laurijssens, Thu, 08 Mar 2007 13:14:27 +0000 reply
In tracker.py, add a propery issuename and catalog it.

In createIssue, create a property issuename as well:

  hunk ./plugins/tracker/tracker.py 256
  +            issue.manage_addProperty('issuename',self.issueNameFrom(pageid),'string')

It needs to work when you rename an issue in changeIssueProperties as well:

  hunk ./plugins/tracker/tracker.py 338
  +                self.manage_changeProperties(issuename=self.issueNameFrom(newpagename))

issuename needs to be in the catalog for sorting purposes:

  hunk ./plugins/tracker/tracker.py 530
  -            ]
  +         'issuename']

And we need a way to upgrade existing issuetrackers:

  hunk ./plugins/tracker/tracker.py 636
  +         if not 'issuename' in existingprops:
  +            self.manage_addProperty('issuename',self.issueNameFrom(self.title),'string')
  +            changed = 1

Got back to this one --Frank Laurijssens, Thu, 08 Mar 2007 14:04:10 +0000 reply
Now the messy part in IssueTracker.dtml.

We need a way to remove sort_order= from the query string. The way it is done for sort_on doesn't work well either so we might need to find a totally different approach here:

  hunk ./plugins/tracker/IssueTracker.dtml 192
  +  sortorderstart="_.string.find(query,'sort_order')"
  +  sortorderend="_.string.find(query,'&',sortorderstart)"
  +  sortorderend="(sortorderend != -1) and (sortorderend+1) or _.len(query)"
  +  amp="(sortorderstart == -1) and '*' or query[sortorderstart-1]"
  +  sortorderstart="(amp == '&') and sortorderstart-1 or sortorderstart"
  +  query="(sortorderstart == -1) and query or (query[:sortorderstart]+query[sortorderend:])"

This way we catch the first sort_order occurrence and the preceding ampersand, if any. This check is omitted from the code that strips sort_on from the query, assuming that sort_on always comes first in the query.

If there's no sort order in the query, or the order is ascending, then when you click on a header, the new order is reverse:

  hunk ./plugins/tracker/IssueTracker.dtml 199
  -  order="REQUEST.get('sort_order','') and '&sort_order=' or '&sort_order=reverse' #not used"
  +  order="(not (REQUEST.get('sort_order','') == 'reverse')) and '&sort_order=reverse' or '&sort_order=ascending' "

A new issue name column is added, and all columns set a sort_order:

  hunk ./plugins/tracker/IssueTracker.dtml 223
  -       <td align=left valign=top>
  +       <td align=left valign=top width="1%">
  hunk ./plugins/tracker/IssueTracker.dtml 226
  -         <a href="&dtml-URL;?sort_on=issueNumber&dtml-query;&dtml-scrollto;"><dtml-translate domain=zwiki>#</dtml-translate></a>
  +         <a href="&dtml-URL;?sort_on=issueNumber&dtml-query;&dtml-order;&dtml-scrollto;"><dtml-translate domain=zwiki>#</dtml-translate></a>
  +         <dtml-var "bold and '</b>' or ''">
  +         </dtml-let>
  +       </td>
  +       <td align=left valign=top>
  +         <dtml-let bold="sort_on=='issuename'">
  +         <dtml-var "bold and '<b>' or ''">
  +         <a href="&dtml-URL;?sort_on=issuename&dtml-query;&dtml-order;&dtml-scrollto;"><dtml-translate domain=zwiki>category</dtml-translate></a>
  hunk ./plugins/tracker/IssueTracker.dtml 240
  -         <a href="&dtml-URL;?sort_on=category_index&dtml-query;&dtml-scrollto;"><dtml-translate domain=zwiki>category</dtml-translate></a>
  +         <a href="&dtml-URL;?sort_on=category_index&dtml-query;&dtml-order;&dtml-scrollto;"><dtml-translate domain=zwiki>category</dtml-translate></a>
  hunk ./plugins/tracker/IssueTracker.dtml 247
  -         <a href="&dtml-URL;?sort_on=severity_index&dtml-query;&dtml-scrollto;"><dtml-translate domain=zwiki>severity</dtml-translate></a>
  +         <a href="&dtml-URL;?sort_on=severity_index&dtml-query;&dtml-order;&dtml-scrollto;"><dtml-translate domain=zwiki>severity</dtml-translate></a>
  hunk ./plugins/tracker/IssueTracker.dtml 254
  -         <a href="&dtml-URL;?sort_on=status_index&dtml-query;&dtml-scrollto;"><dtml-translate domain=zwiki>status</dtml-translate></a>
  +         <a href="&dtml-URL;?sort_on=status_index&dtml-query;&dtml-order;&dtml-scrollto;"><dtml-translate domain=zwiki>status</dtml-translate></a>
  hunk ./plugins/tracker/IssueTracker.dtml 261
  -         <a href="&dtml-URL;?sort_on=creation_time&dtml-query;&dtml-scrollto;"><dtml-translate domain=zwiki>age</dtml-translate></a>
  +         <a href="&dtml-URL;?sort_on=creation_time&dtml-query;&dtml-order;&dtml-scrollto;"><dtml-translate domain=zwiki>age</dtml-translate></a>
  hunk ./plugins/tracker/IssueTracker.dtml 268
  -         <a href="&dtml-URL;?sort_on=lastEditTime&dtml-query;&sort_order=reverse&dtml-scrollto;"><dtml-translate domain=zwiki>modified</dtml-translate></a>
  +         <a href="&dtml-URL;?sort_on=lastEditTime&dtml-query;&dtml-order;&dtml-scrollto;"><dtml-translate domain=zwiki>modified</dtml-translate></a>

Now a part I definitely don't like, and probably stems from my lack of Zope knowledge. I would expect to be able to get the issuename and issueNumber through some dtml statement, but & dtml-issueNumber yields None and & dtml-issuename yields an error. The following is a kludge to work around this:

  hunk ./plugins/tracker/IssueTracker.dtml 280
  +       titleseparator="_.string.find(Title,' ')"
  +       issuenmbr="titleseparator != -1 and Title[:titleseparator] or 'None'"
  +       issuenam="titleseparator != -1 and Title[titleseparator+1:] or 'None'"

And from there it's just a matter of adding the new columns:

  hunk ./plugins/tracker/IssueTracker.dtml 291  
  -                   title="<dtml-var "'' #page.linkTitle()">">&dtml-Title;</a>
  +                   title="<dtml-var "'' #page.linkTitle()">">&dtml-issuenmbr;</a>
  +               <dtml-var "bold and '</b>' or ''">
  +             </td>
  +             <td align=left valign=top>
  +               <dtml-var "bold and '<b>' or ''"
  +               ><a href="&dtml-wiki_url;/&dtml-id;" 
  +                   title="<dtml-var "'' #page.linkTitle()">">&dtml-issuenam;</a>

FilterIssues.dtml --Frank Laurijssens, Thu, 08 Mar 2007 14:13:16 +0000 reply
FilterIssues.dtml needs to be adapted in a similar way. I'll add all files to my repository so you can see how it works, though I'll have to do that when I get home later today.

See --EmmaLaurijssens, Mon, 12 Mar 2007 14:53:22 +0000 reply
See http://zwiki.ictio.nl/IssueTracker.

Got back to this one --simon, Wed, 14 Mar 2007 18:19:15 +0000 reply
Frank - I especially liked your literate-programming style writeup, explaining each change and making this very understandable; your live demo, making it easy to try this out; and your darcs repo, making it easy to preview the exact changes (v key) and pull them now or at any time in the future without fear of forgetting. Here are my two concerns about this patch: 1. IssueTracker.dtml is becoming even harder to comprehend 2. in particular, without more investigation I don't know that adding yet another catalog field won't hurt our scalability; it seems to mean more work and conflict opportunities for zope. But the goodness of your patch submission conquered these fears! In it goes, thanks!

For the release notes --EmmaLaurijssens, Thu, 15 Mar 2007 09:01:55 +0000 reply
We need to add to the release notes that:

Finally! --EmmaLaurijssens, Thu, 15 Mar 2007 09:09:54 +0000 reply
Status: open => closed