summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipa-gui/ipagui/templates/delegateform.kid
blob: e414e4443318fb2b228802818d0ad76ad2521f8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<div xmlns:py="http://purl.org/kid/ns#"
  class="simpleroster">

  <?python searchurl = tg.url('/delegate/group_search') ?>

  <script type="text/javascript">

    function enterDoSearch(e, which_group) {
      var keyPressed;
      if (window.event) {
        keyPressed = window.event.keyCode;
      } else {
        keyPressed = e.which; 
      }

      if (keyPressed == 13) {
        return doSearch(which_group);
      } else {
        return true;
      }
    }

    function doSearch(which_group) {
      $(which_group + '_searchresults').update("Searching...");
      new Ajax.Updater(which_group + '_searchresults',
          '${searchurl}',
          {  asynchronous:true,
             parameters: { criteria: $(which_group + '_criteria').value,
                           which_group: which_group},
             evalScripts: true });
      return false;
    }

    function selectGroup(which_group, group_dn, group_cn) {
      group_dn_field = $('form_' + which_group + '_group_dn');
      group_cn_field = $('form_' + which_group + '_group_cn');
      group_cn_span = $(which_group + '_group_cn');

      group_dn_field.value = group_dn;
      group_cn_field.value = group_cn;
      group_cn_span.update(group_cn);

      new Effect.Fade($(which_group + '_searcharea'), {duration: 0.25});
      new Effect.Appear($(which_group + '_change_link'), {duration: 0.25});
    }
  </script>

  <form action="${action}" name="${name}" method="${method}" class="tableform">

    <table class="formtable" cellpadding="2" cellspacing="0" border="0">
      <tr>
        <th>
          <input type="submit" class="submitbutton" name="submit"
                 value="${actionname} Delegation"/>
          <br/><br/>
        </th>
        <td>
          <input type="submit" class="submitbutton" name="submit"
                 value="Cancel ${actionname}"/>
          <br/><br/>
        </td>
      </tr>
    </table>

    <div py:for="field in hidden_fields"
      py:replace="field.display(value_for(field), **params_for(field))" 
      />

    <table class="formtable" cellpadding="2" cellspacing="0" border="0">
      <tr>
        <th valign="top">
          <label class="fieldlabel" for="${delegate.name.field_id}"
            py:content="delegate.name.label" />:
        </th>
        <td>
          <span py:replace="delegate.name.display(value_for(delegate.name))" />
          <span py:if="tg.errors.get('name')" class="fielderror"
              py:content="tg.errors.get('name')" />
        </td>
      </tr>
      <tr>
        <th valign="top">
          <label class="fieldlabel" for="${delegate.source_group_cn.field_id}"
            py:content="delegate.source_group_cn.label" />:
        </th>
        <td>
          <div>
            <span id='source_group_cn'>${value_for(delegate.source_group_cn)}</span>
            <a href="#" id='source_change_link'
              onclick="new Effect.Appear($('source_searcharea'), {duration: 0.25});
                       new Effect.Fade(this, {duration: 0.25});
                       return false;">change</a>
            <span py:if="tg.errors.get('source_group_dn')" class="fielderror"
                py:content="tg.errors.get('source_group_dn')" />
          </div>
          <div id="source_searcharea" style="display:none">
            <div>
              <input id="source_criteria" type="text"
                onkeypress="return enterDoSearch(event, 'source');" />
              <input type="button" value="Find"
                onclick="return doSearch('source');"
              />
            </div>
            <div id="source_searchresults">
            </div>
          </div>
        </td>
      </tr>
      <tr>
        <th valign="top">
          <label class="fieldlabel" for="${delegate.attrs.field_id}"
            py:content="delegate.attrs.label" />:
        </th>
        <td valign="top">
          <span py:if="tg.errors.get('attrs')" class="fielderror"
              py:content="tg.errors.get('attrs')" />
          <span py:replace="delegate.attrs.display(value_for(delegate.attrs))" />
        </td>
      </tr>
      <tr>
        <th valign="top">
          <label class="fieldlabel" for="${delegate.dest_group_cn.field_id}"
            py:content="delegate.dest_group_cn.label" />:
        </th>
        <td>
          <div>
            <span id='dest_group_cn'>${value_for(delegate.dest_group_cn)}</span>
            <a href="#" id='dest_change_link'
              onclick="new Effect.Appear($('dest_searcharea'), {duration: 0.25});
                       new Effect.Fade(this, {duration: 0.25});
                       return false;">change</a>
            <span py:if="tg.errors.get('dest_group_dn')" class="fielderror"
                py:content="tg.errors.get('dest_group_dn')" />
          </div>
          <div id="dest_searcharea" style="display:none">
            <div>
              <input id="dest_criteria" type="text"
                onkeypress="return enterDoSearch(event, 'dest');" />
              <input type="button" value="Find"
                onclick="return doSearch('dest');"
              />
            </div>
            <div id="dest_searchresults">
            </div>
          </div>
        </td>
      </tr>
    </table>

    <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>
      </tr>
    </table>

  <script py:if="not value.get('source_group_dn')"
    type="text/javascript">
      new Effect.Appear($('source_searcharea'), {duration: 0.25});
      new Effect.Fade($('source_change_link'), {duration: 0.25});
  </script>
  <script py:if="not value.get('dest_group_dn')"
    type="text/javascript">
      new Effect.Appear($('dest_searcharea'), {duration: 0.25});
      new Effect.Fade($('dest_change_link'), {duration: 0.25});
  </script>

  </form>
</div>