Fix Update function on details page.

The problem was that parameters with no values are automatically
set to None by the framework and it wasn't handled properly in
baseldap.py:get_attributes function. Also, there were two logical
bugs in details.js:
1) atttribute callback to update values were called for input elements
   instead of dt elements
2) it was always trying to update the primary key
This commit is contained in:
Pavel Zuna 2010-08-17 14:53:03 -04:00 committed by Adam Young
parent 19466d499b
commit 7a007d958b
2 changed files with 17 additions and 14 deletions

View File

@ -92,17 +92,9 @@ function ipa_details_update(pkey, on_win, on_fail)
return;
var attr = dt.attr('title');
if (!attr)
if (!attr || attr.indexOf('call_') == 0)
return;
if (attr.indexOf('call_') == 0) {
var func = window[attr.substr(5)];
if (!func)
return;
func(dt, modlist, IPA_DETAILS_UPDATE);
return;
}
var param_info = ipa_get_param_info(attr);
if (param_info) {
modlist[attr] = jobj.val();
@ -118,9 +110,20 @@ function ipa_details_update(pkey, on_win, on_fail)
var jobj = $(this);
var attr = jobj.attr('title');
if (!attr || attr.indexOf('call_') == 0)
if (!attr)
return;
if (attr.indexOf('call_') == 0) {
var func = window[attr.substr(5)];
if (func)
func(jobj, modlist, IPA_DETAILS_UPDATE);
return;
}
var param_info = ipa_get_param_info(attr);
if (param_info && param_info['primary_key'])
return;
var next = jobj.next('dd');
if ((!next.length) || (!next.children('input').length))
attrs_wo_option[attr] = [''];

View File

@ -49,10 +49,10 @@ def get_attributes(attrs):
Given a list of values in the form name=value, return a list of name.
"""
attrlist=[]
for attr in attrs:
m = re.match("\s*(.*?)\s*=\s*(.*?)\s*$", attr)
attrlist.append(str(m.group(1)).lower())
if attrs:
for attr in attrs:
m = re.match("\s*(.*?)\s*=\s*(.*?)\s*$", attr)
attrlist.append(str(m.group(1)).lower())
return attrlist