freeipa/ipa-server/ipa-gui/ipagui/templates/groupeditform.kid

246 lines
7.4 KiB
Genshi

<div xmlns:py="http://purl.org/kid/ns#"
class="simpleroster">
<form action="${action}" name="${name}" method="${method}" class="tableform"
onsubmit="preSubmit()" >
<table class="formtable" cellpadding="2" cellspacing="0" border="0">
<tr>
<th>
<input type="submit" class="submitbutton" name="submit"
value="Update Group"/>
</th>
<td>
<input type="submit" class="submitbutton" name="submit"
value="Cancel Edit" />
</td>
</tr>
</table>
<?python
from ipagui.helpers import ipahelper
?>
<script type="text/javascript" charset="utf-8"
src="${tg.url('/static/javascript/dynamicedit.js')}"></script>
<?python searchurl = tg.url('/group/edit_search') ?>
<script type="text/javascript">
function toggleProtectedFields(checkbox) {
var gidnumberField = $('form_gidnumber');
if (checkbox.checked) {
gidnumberField.disabled = false;
$('form_editprotected').value = 'true';
} else {
gidnumberField.disabled = true;
$('form_editprotected').value = '';
}
}
function doSearch() {
$('searchresults').update("Searching...");
new Ajax.Updater('searchresults',
'${searchurl}',
{ asynchronous:true,
parameters: { criteria: $('criteria').value },
evalScripts: true });
return false;
}
</script>
<div py:for="field in hidden_fields"
py:replace="field.display(value_for(field), **params_for(field))"
/>
<div class="formsection">Group Details</div>
<table class="formtable" cellpadding="2" cellspacing="0" border="0">
<tr>
<th>
<label class="fieldlabel" for="${group.cn.field_id}"
py:content="group.cn.label" />:
</th>
<td>
<!-- <span py:replace="group.cn.display(value_for(group.cn))" />
<span py:if="tg.errors.get('cn')" class="fielderror"
py:content="tg.errors.get('cn')" /> -->
${value_for(group.cn)}
</td>
</tr>
<tr>
<th>
<label class="fieldlabel" for="${group.description.field_id}"
py:content="group.description.label" />:
</th>
<td>
<span py:replace="group.description.display(value_for(group.description))" />
<span py:if="tg.errors.get('description')" class="fielderror"
py:content="tg.errors.get('description')" />
</td>
</tr>
<tr>
<th>
<label class="fieldlabel" for="${group.gidnumber.field_id}"
py:content="group.gidnumber.label" />:
</th>
<td>
<span py:replace="group.gidnumber.display(value_for(group.gidnumber))" />
<span py:if="tg.errors.get('gidnumber')" class="fielderror"
py:content="tg.errors.get('gidnumber')" />
<script type="text/javascript">
document.getElementById('form_gidnumber').disabled = true;
</script>
</td>
</tr>
</table>
<div>
<div class="formsection">Group Members</div>
<div class="floatlist">
<div class="floatheader">To Remove:</div>
<div id="delmembers">
</div>
</div>
<div>
<?python div_counter = 1 ?>
<div py:for="member in members" id="member-${div_counter}">
<?python
member_dn = member.get('dn')
member_dn_esc = ipahelper.javascript_string_escape(member_dn)
member_uid = member.get('uid')
if member_uid:
member_name = "%s %s" % (member.get('givenName', ''),
member.get('sn', ''))
member_descr = "(%s)" % member.get('uid')
member_type = "user"
else:
member_name = member.get('cn')
member_descr = "[group]"
member_type = "group"
member_name_esc = ipahelper.javascript_string_escape(member_name)
member_descr_esc = ipahelper.javascript_string_escape(member_descr)
member_type_esc = ipahelper.javascript_string_escape(member_type)
?>
<span id="member-info-${div_counter}"></span>
<script type="text/javascript">
renderMemberInfo($('member-info-${div_counter}'),
new MemberDisplayInfo('${member_name_esc}',
'${member_descr_esc}',
'${member_type_esc}'));
</script>
<a href="#"
onclick="removememberHandler(this, '${member_dn_esc}',
new MemberDisplayInfo('${member_name_esc}',
'${member_descr_esc}',
'${member_type_esc}'));
return false;"
>remove</a>
<script type="text/javascript">
dn_to_member_div_id['${member_dn_esc}'] = "member-${div_counter}";
member_hash["${member_dn_esc}"] = 1;
</script>
<?python
div_counter = div_counter + 1
?>
</div>
</div>
</div>
<div style="clear:both">
<div class="formsection">Add Members</div>
<div class="floatlist">
<div class="floatheader">To Add:</div>
<div id="newmembers">
</div>
</div>
<div>
<div id="search">
<input id="criteria" type="text" name="criteria"
onkeypress="return enterDoSearch(event);" />
<input type="button" value="Find"
onclick="return doSearch();"
/>
</div>
<div id="searchresults">
</div>
</div>
</div>
<table class="formtable" cellpadding="2" cellspacing="0" border="0">
<tr>
<th>
<br />
<input type="submit" class="submitbutton" name="submit"
value="Update Group"/>
</th>
<td>
<br />
<input type="submit" class="submitbutton" name="submit"
value="Cancel Edit" />
</td>
</tr>
</table>
</form>
<script type="text/javascript">
/*
* This section restores the contents of the add and remove lists
* dynamically if we have to refresh the page
*/
if ($('form_dn_to_info_json').value != "") {
dn_to_info_hash = new Hash($('form_dn_to_info_json').value.evalJSON());
}
if ($('form_editprotected').value != "") {
$('toggleprotected_checkbox').checked = true;
toggleProtectedFields($('toggleprotected_checkbox'));
}
</script>
<?python
dnadds = value.get('dnadd', [])
if not(isinstance(dnadds,list) or isinstance(dnadds,tuple)):
dnadds = [dnadds]
dndels = value.get('dndel', [])
if not(isinstance(dndels,list) or isinstance(dndels,tuple)):
dndels = [dndels]
?>
<script py:for="dnadd in dnadds">
<?python
dnadd_esc = ipahelper.javascript_string_escape(dnadd)
?>
var dn = "${dnadd_esc}";
var info = dn_to_info_hash[dn];
var newdiv = addmember(dn, info);
if (newdiv != null) {
newdiv.style.display = 'block';
}
</script>
<script py:for="dndel in dndels">
<?python
dndel_esc = ipahelper.javascript_string_escape(dndel)
?>
var dn = "${dndel_esc}";
var info = dn_to_info_hash[dn];
var newdiv = removemember(dn, info);
newdiv.style.display = 'block';
orig_div_id = dn_to_member_div_id[dn]
$(orig_div_id).style.display = 'none';
</script>
</div>