Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from batkinson/master
Fixes for reported issues #4 and #5 This allows anyone with TICKET_VIEW to view the backlog, but you need BACKLOG_ADMIN to modify the backlog (instead of TICKET_MODIFY). Also, allow configuration of the fields via a preference pane.
- Loading branch information
Showing
5 changed files
with
127 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright (C) 2011 Brent Atkinson | ||
# All rights reserved. | ||
# | ||
# This software is licensed as described in the file LICENSE.txt, which | ||
# you should have received as part of this distribution. | ||
|
||
from trac.core import * | ||
from trac.prefs import IPreferencePanelProvider | ||
from trac.util.translation import _ | ||
from trac.web.chrome import add_notice, ITemplateProvider | ||
|
||
class BacklogPluginPrefPanel(Component): | ||
implements(IPreferencePanelProvider, ITemplateProvider) | ||
|
||
_form_fields = [ | ||
'id', 'summary', 'component', 'version', 'type', 'owner', 'status', | ||
'time_created' | ||
] | ||
|
||
# IPreferencePanelProvider methods | ||
|
||
def get_preference_panels(self, req): | ||
yield ('backlog', _('Backlog')) | ||
|
||
|
||
def render_preference_panel(self, req, panel): | ||
|
||
if req.method == 'POST': | ||
fields = req.args.get('backlog_fields') | ||
req.session['backlog_fields'] = fields | ||
add_notice(req,_('Your backlog preferences have been saved.')) | ||
req.redirect(req.href.prefs(panel or None)) | ||
|
||
return 'prefs_backlog.html', { | ||
'shown_fields': req.session.get('backlog_fields') or self._form_fields | ||
} | ||
|
||
# ITemplateProvider methods | ||
|
||
def get_htdocs_dirs(self): | ||
from pkg_resources import resource_filename | ||
return [('backlog', resource_filename(__name__, 'htdocs'))] | ||
|
||
def get_templates_dirs(self): | ||
from pkg_resources import resource_filename | ||
return [resource_filename(__name__, 'templates')] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!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="prefs.html" /> | ||
<head> | ||
<title>Backlog</title> | ||
<style type="text/css"> | ||
label { | ||
padding-right: .5em; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="field"> | ||
<label>Shown Ticket Fields:</label> | ||
<label> | ||
<input type="checkbox" name="backlog_fields" value="id" checked="${'id' in shown_fields or None}" />Id | ||
</label> | ||
<label> | ||
<input type="checkbox" name="backlog_fields" value="summary" checked="${'summary' in shown_fields or None}" />Summary | ||
</label> | ||
<label> | ||
<input type="checkbox" name="backlog_fields" value="component" checked="${'component' in shown_fields or None}" />Component | ||
</label> | ||
<label> | ||
<input type="checkbox" name="backlog_fields" value="version" checked="${'version' in shown_fields or None}" />Version | ||
</label> | ||
<label> | ||
<input type="checkbox" name="backlog_fields" value="type" checked="${'type' in shown_fields or None}" />Type | ||
</label> | ||
<label> | ||
<input type="checkbox" name="backlog_fields" value="owner" checked="${'owner' in shown_fields or None}" />Owner | ||
</label> | ||
<label> | ||
<input type="checkbox" name="backlog_fields" value="status" checked="${'status' in shown_fields or None}" />Status | ||
</label> | ||
<label> | ||
<input type="checkbox" name="backlog_fields" value="time_created" checked="${'time_created' in shown_fields or None}" />Created | ||
</label> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters