From: ber Date: Tue, 9 Nov 2010 15:06:14 +0000 (+0000) Subject: Adding missing files from last commit (r4575) for fixing expressing filters X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=37cf23bbe648377e094a3888f20fa192fa006745;p=roundup.git Adding missing files from last commit (r4575) for fixing expressing filters for multilinkgs, see issue2550648. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4576 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/cgi/KeywordsExpr.py b/roundup/cgi/KeywordsExpr.py new file mode 100644 index 0000000..a94bf7c --- /dev/null +++ b/roundup/cgi/KeywordsExpr.py @@ -0,0 +1,273 @@ +# This module is free software, you may redistribute it +# and/or modify under the same terms as Python. + +WINDOW_CONTENT = '''\ +

Keyword Expression Editor:

+
+
+ +''' + +def list_nodes(request): + prop = request.form.getfirst("property") + cls = request.client.db.getclass(prop) + items = [] + for nodeid in cls.getnodeids(): + l = cls.getnode(nodeid).items() + l = dict([x for x in l if len(x) == 2]) + try: + items.append((l['id'], l['name'])) + except KeyError: + pass + items.sort(key=lambda x: int(x[0])) + return items + +def items_to_keywords(items): + return ',\n '.join(['["%s", "%s"]' % x for x in items]) + + +def render_keywords_expression_editor(request): + prop = request.form.getfirst("property") + + window_content = WINDOW_CONTENT % { + 'prop' : prop, + 'keywords': items_to_keywords(list_nodes(request)), + 'original': '' + } + + return window_content + +# vim: set et sts=4 sw=4 : diff --git a/share/roundup/templates/classic/html/_generic.keywords_expr.html b/share/roundup/templates/classic/html/_generic.keywords_expr.html new file mode 100644 index 0000000..4ff1dc2 --- /dev/null +++ b/share/roundup/templates/classic/html/_generic.keywords_expr.html @@ -0,0 +1,11 @@ + + + + + + + + + +