The following changes to roundup have been tested with version 0.7.11
They allow each user to customise their "default page", i.e. the first page they see when logged in. A user customises their default page by creating any search they want and naming it "start page". This is then the first page shown on login.
If a user logs out then their default page just shows "No issues available".
Two files need to be updated in the tracker to get this to work: $TRACKER/html/home.html and $TRACKER/interfaces.py
Firstly in home.html, line 4, replace the lengthy spec of a list of issues, and instead get the html from interfaces.py:
<span tal:replace="structure python:utils.startPage(request.user.queries,request.user.id,request.base)"/>;
Next, in interfaces.py add a method called startPage to the class TemplatingUtils. Obviously the TemplatingUtils.startPage() method can then return any html you like.
The following version of the method looks through the user's queries looking for one called "start page".
If it is found then
- that query's url is used as the redirect URL.
If such a query is not found then
- for anonymous users the redirect URL shows all issues assigned to
them (i.e. None at our site, YMMV)
- normal users see the usual list of all open issues (status 1-7 are
open at our site, YMMV)
Once the URL is decided it is possible to go there with "raise Redirect, URL", but I have found that returning the redirect as part of the HTML is a gentler way of doing it, especially with browsers such as lynx and w3m
def startPage(self,userQueries,userId,base): users = issuesDb.users() username = users.getLoginName(userId) result = '<html><head><meta http-equiv="refresh" content=<0;"%s' % base started = False for query in userQueries: if query.name.plain().lower() == 'start page': restOfUrl = '%s?%s' % (query.klass, query.url) started = True if not started: if username == 'anonymous': toPage = 'a blank list' restOfUrl = 'issue?@filter=id&@columns=item&assignedto=2' else: toPage = 'the list of issues' restOfUrl = 'issue?@sort=-activity&@group=priority&@filter=status&@columns=id,activity,title,creator,assignedto,status&status=-1,1,2,3,4,5,6,7' else: toPage = 'the start page for %s' % username result += '''%s"></head><body>Redirecting you to %s <br>Or you may click <a href="%s">here</a> to continue <script language="JavaScript"><!-- setTimeout('Redirect()',0); function Redirect() { location.href = '%s%s' } // --></script>; </body> </html>''' % (restOfUrl,toPage,restOfUrl,base,restOfUrl) return result
As an "optional extra" you may wish to add the following line at the end of the method LogoutAction.handle() (in $PYTHON-SITE/roundup/cgi/actions.py), so that a user is forced through the above as soon as they logout.
raise Redirect, self.base
Note I had to edit the code above to replace html entities by < and > signs. I think I got it right, but YMMV. Also the http meta refresh looks wrong, but it looked wacky on the original page formatting too. JohnRouillard.