Log note :
changed:
-
<p>The following changes to roundup have been tested with version 0.7.11</p>

<p>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.</p>

<p>If a user logs out then their default page just shows "No issues available"</p>

<p>Two files need to be updated in the tracker to get this to work: <pre>$TRACKER/html/home.html</pre> and <pre>$TRACKER/interfaces.py</pre></p>

<p>Firstly in home.html, line 4, replace the lengthy spec of a list of issues, and instead get the html from interfaces.py:</p>
<pre>&lt;span tal:replace="structure python: utils.startPage(request.user.queries,request.user.id,request.base)"/&gt;</pre>

<p>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.</p>
<p>The following version of the method looks through the user's queries looking for one called "start page".</p><p>If it is found then</p><ul><li>that query's url is used as the redirect URL.</li></ul><p>If such a query is not found then</p><ul><li>for anonymous users the redirect URL shows all issues assigned to them (i.e. None at our site, <a href="http://www.google.com/search?&q=define%3A+YMMV">YMMV</a>)</li><li>normal users see the usual list of all open issues (status 1-7 are open at our site, <a href="http://www.google.com/search?&q=define%3A+YMMV">YMMV</a>)</li></ul>
<p>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<p>
<pre>
    def startPage(self,userQueries,userId,base):
        users = issuesDb.users()
        username = users.getLoginName(userId)
        result = '&lt;html&gt;&lt;head&gt;&lt;meta http-equiv="refresh" content=&lt;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"&gt;&lt;/head&gt;&lt;body&gt;Redirecting you to %s
&lt;br&gt;Or you may click &lt;a href="%s"&gt;here&lt;/a&gt; to continue       
&lt;script language="JavaScript"&gt;&lt;!--
setTimeout('Redirect()',0);
function Redirect()
{
  location.href = '%s%s'
}
// --&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;''' % (restOfUrl,toPage,restOfUrl,base,restOfUrl)
        return result

</pre>

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.
<pre>
    raise Redirect, self.base
</pre>