Fixes to acilist: make use POST, use field labels.

This commit is contained in:
Kevin McCarthy 2007-10-15 16:21:10 -07:00
parent 60e78feeba
commit 1592229c3c
4 changed files with 33 additions and 19 deletions

View File

@ -44,7 +44,7 @@ aci_checkbox_attrs = [(field.name, field.label) for field in aci_attrs]
aci_name_to_label = dict(aci_checkbox_attrs)
class DelegateFields():
name = widgets.TextField(name="name", label="ACI Name")
name = widgets.TextField(name="name", label="Name")
source_group_dn = widgets.HiddenField(name="source_group_dn")
dest_group_dn = widgets.HiddenField(name="dest_group_dn")

View File

@ -193,7 +193,8 @@ class DelegationController(IPAController):
ipagui.forms.delegate.aci_name_to_label.get(name, name),
aci.attrs)
return dict(aci_list=aci_list, group_dn_to_cn=group_dn_to_cn)
return dict(aci_list=aci_list, group_dn_to_cn=group_dn_to_cn,
fields=ipagui.forms.delegate.DelegateFields())
@expose("ipagui.templates.delegategroupsearch")
@identity.require(identity.not_anonymous())

View File

@ -52,12 +52,12 @@
<th>
<input type="submit" class="submitbutton" name="submit"
value="${actionname} Delegation"/>
<br />
<br/><br/>
</th>
<td>
<input type="submit" class="submitbutton" name="submit"
value="Cancel ${actionname}"/>
<br />
<br/><br/>
</td>
</tr>
</table>
@ -150,10 +150,12 @@
<table class="formtable" cellpadding="2" cellspacing="0" border="0">
<tr>
<th>
<br/>
<input type="submit" class="submitbutton" name="submit"
value="${actionname} Delegation"/>
</th>
<td>
<br/>
<input type="submit" class="submitbutton" name="submit"
value="Cancel ${actionname}"/>
</td>

View File

@ -6,18 +6,35 @@
<title>Delegations</title>
</head>
<body>
<?python
from ipagui.helpers import ipahelper
?>
<script type="text/javascript" charset="utf-8" src="${tg.url('/static/javascript/tablekit.js')}"></script>
<script type="text/javascript">
function editDelegation(acistr) {
$('edit_acistr').value = acistr;
$('editform').submit();
return false;
}
</script>
<form style="display:none" id='editform'
method="post" action="${tg.url('/delegate/edit')}">
<input type="hidden" id="edit_acistr" name="acistr" value="" />
</form>
<h2>Delegations</h2>
<table id="resultstable" class="sortable resizable">
<thead>
<tr>
<th>Name</th>
<th>People in Group</th>
<th>Can Modify</th>
<th>For People in Group</th>
<th>Action</th>
<th>${fields.name.label}</th>
<th>${fields.source_group_cn.label}</th>
<th>${fields.attrs.label}</th>
<th>${fields.dest_group_cn.label}</th>
</tr>
</thead>
<tbody>
@ -25,9 +42,12 @@
<?python
source_cn = group_dn_to_cn.get(aci.source_group)
dest_cn = group_dn_to_cn.get(aci.dest_group)
acistr = aci.orig_acistr
acistr_esc = ipahelper.javascript_string_escape(acistr)
?>
<td>
${aci.name}
<a href="#" onclick="return editDelegation('${acistr_esc}');"
>${aci.name}</a>
</td>
<td>
<a href="${tg.url('/group/show', cn=source_cn)}"
@ -40,15 +60,6 @@
<a href="${tg.url('/group/show', cn=dest_cn)}"
>${dest_cn}</a>
</td>
<td>
<?python
# it's probably a bad idea to use a GET string here.
# orig_acistr may be quite long
# TODO - change to use a form/POST
#
?>
<a href="${tg.url('/delegate/edit', acistr=aci.orig_acistr)}">edit</a><br />
</td>
</tr>
</tbody>
</table>