moksha/api/widgets/selectable/templates/selectable.mak | 8 ++++---- moksha/connector/connector.py | 12 ++++++------ moksha/public/javascript/ui/moksha.ui.grid.js | 6 ++++-- 3 files changed, 14 insertions(+), 12 deletions(-)
New commits: commit bcf743d93c50c59adf7abf393d2e927d891d2c1e Merge: 9cb64ef... 5564f2d... Author: John (J5) Palmieri johnp@redhat.com Date: Tue Mar 17 16:14:05 2009 -0400
Merge branch 'master' of git+ssh://johnp@git.fedorahosted.org/git/moksha
commit 9cb64eff9e3f5f444809a3af44a4fd800c30d796 Author: John (J5) Palmieri johnp@redhat.com Date: Tue Mar 17 16:12:48 2009 -0400
fix filtering in the connectors, make grid csrf aware, fix selectable template
diff --git a/moksha/api/widgets/selectable/templates/selectable.mak b/moksha/api/widgets/selectable/templates/selectable.mak index ec87647..12d03c6 100644 --- a/moksha/api/widgets/selectable/templates/selectable.mak +++ b/moksha/api/widgets/selectable/templates/selectable.mak @@ -1,12 +1,12 @@ <div class="links" id="${content_id}"> - % for c in categories: + % for i, c in enumerate(categories): <h4> ${c['label']} </h4> <ul> - % for c, item in enumerate(c['items']): + % for j, item in enumerate(c['items']): <li> - <a id="${content_id}_${c}" href="${item['link']}" >${item['label']}</a> + <a id="${content_id}_${i}_${j}" href="${item['link']}" >${item['label']}</a> % if 'data' in item: <script type="text/javascript"> <% @@ -15,7 +15,7 @@ if 'label' not in data: data['label'] = label %> - $("#${content_id}_${c}").data('.moksha_selectable_data', ${item['data']}) + $("#${content_id}_${i}_${j}").data('.moksha_selectable_data', ${item['data']}) </script> % endif </li> diff --git a/moksha/connector/connector.py b/moksha/connector/connector.py index 11f2dff..41a1180 100644 --- a/moksha/connector/connector.py +++ b/moksha/connector/connector.py @@ -376,7 +376,7 @@ class ParamFilter(object):
self._translation_table[a] = param
- def filter(self, d): + def filter(self, d, conn=None): results = {} for k, v in d.iteritems(): if k in self._translation_table: @@ -398,14 +398,14 @@ class ParamFilter(object): elif cast: v = cast(v)
+ allow_none = pf['allow_none'] + ff = pf['filter_func'] if ff: - ff(results, k, v, allow_none) + ff(conn, results, k, v, allow_none) assign = False
- allow_none = pf['allow_none'] - - if (allow_none or (v != None)) and assign: - results[param] = v + if (allow_none or (v != None)) and assign: + results[param] = v
return results diff --git a/moksha/public/javascript/ui/moksha.ui.grid.js b/moksha/public/javascript/ui/moksha.ui.grid.js index cf88fc2..328820f 100644 --- a/moksha/public/javascript/ui/moksha.ui.grid.js +++ b/moksha/public/javascript/ui/moksha.ui.grid.js @@ -89,6 +89,8 @@ var self = this;
self.element.find('tbody').fadeOut('slow'); + if (moksha_csrf_token) + args['_csrf_token'] = moksha_csrf_token; var xmlrequest = jQuery.getJSON(path, args, function (json) { callback(json); self.element.find('tbody').fadeIn('slow'); @@ -138,7 +140,7 @@ var sc = search_criteria;
if (typeof(sc.rows_requested) != 'undefined') - self.options.rows_per_page =sc.rows_requested; + self.options.rows_per_page = sc.rows_requested;
if (typeof(sc.page_num) != 'undefined') self.options.page_num = sc.page_num; @@ -177,7 +179,7 @@
var numrows = search_criteria.numrows if (typeof(numrows) != 'undefined') - dispatch_data['filters'] = filters + dispatch_data['numrows'] = numrows
var offset = search_criteria.start_row if (typeof(offset) != 'undefined')