mirror of
https://github.com/kakwa/ldapcherry
synced 2024-12-01 21:45:51 +01:00
77 lines
2.9 KiB
Cheetah
77 lines
2.9 KiB
Cheetah
## -*- coding: utf-8 -*-
|
|
<%
|
|
len_attr = len(attributes)
|
|
switch = len_attr / 2
|
|
if not switch * 2 == len_attr:
|
|
switch = switch + 1
|
|
counter = 1
|
|
lc1 = []
|
|
lc2 = []
|
|
for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']):
|
|
if counter <= switch:
|
|
lc1.append(a)
|
|
else:
|
|
lc2.append(a)
|
|
counter = counter + 1
|
|
%>
|
|
<%def name="form_col(l)">
|
|
% for a in l:
|
|
<% attr = attributes[a] %>
|
|
<div class="form-group">
|
|
<div class="input-group">
|
|
<%
|
|
if modify:
|
|
required = ''
|
|
else:
|
|
required = ' required '
|
|
if not values is None and a in values:
|
|
if type(values[a]) is list:
|
|
tmp = values[a][0]
|
|
else:
|
|
tmp = values[a]
|
|
value = ' value="'+ tmp + '"'
|
|
value2 = '<option>'+ tmp +'</option>'
|
|
else:
|
|
value = ''
|
|
value2 = ''
|
|
%>
|
|
|
|
<span class="input-group-addon" id="basic-addon-${a}">${attr['display_name']}</span>
|
|
% if modify and a == keyattr:
|
|
<input type="hidden" name="attr.${a}" class="form-control" aria-describedby="basic-addon-${a}" ${required} ${value}>
|
|
<span class="form-control" aria-describedby="basic-addon-${a}">${tmp}</span>
|
|
% elif attr['type'] == 'string':
|
|
<input type="text" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon-${a}" ${required} ${value}>
|
|
% elif attr['type'] == 'email':
|
|
<input type="email" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon-${a}" ${required} ${value} data-error="email address is invalid">
|
|
% elif attr['type'] == 'int':
|
|
<input type="number" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon-${a}" ${required} ${value}>
|
|
% elif attr['type'] == 'fix':
|
|
<input type="hidden" name="attr.${a}" class="form-control" aria-describedby="basic-addon-${a}" ${required} value="${attr['value']}">
|
|
<span class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon-${a}">${attr['value']}</span>
|
|
% elif attr['type'] == 'stringlist':
|
|
<select class="form-control" name="attr.${a}">
|
|
${value2}
|
|
%for val in attr['values']:
|
|
<option>${val}</option>
|
|
%endfor
|
|
</select>
|
|
% elif attr['type'] == 'password':
|
|
<input type="password" class="form-control" data-error="Don't meet password policy" data-remote="/checkppolicy" name="attr.${a}1" id="${a}1" placeholder="${attr['description']}" ${required}>
|
|
<span class="input-group-addon" id="basic-addon-${a}2">Retype ${attr['display_name']}</span>
|
|
<input type="password" class="form-control" data-match="#${a}1" data-match-error="Passwords don't match" name="attr.${a}2" id="#${a}2" placeholder="Confirm" ${required}>
|
|
% endif
|
|
</div>
|
|
<div class="help-block with-errors"></div>
|
|
</div>
|
|
% endfor
|
|
</%def>
|
|
<div class="row">
|
|
<div class="col-md-6 column">
|
|
${form_col(lc1)}
|
|
</div>
|
|
<div class="col-md-6 column">
|
|
${form_col(lc2)}
|
|
</div>
|
|
</div>
|