summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipa-gui/ipagui/static/javascript/dynamicselect.js
blob: 534646366f1bbc3f706e29800a42bf4a3c62c94f (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
/**
 * dynamicselect.js
 *
 * Shared code, data, and functions for the dynamic select lists on the
 * edit user pages.
 *
 */

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

  if (keyPressed == 13) {
    return doSelectSearch(which_select);
  } else {
    return true;
  }
}

function startSelect(which_select) {
  new Effect.Appear($(which_select + '_searcharea'), {duration: 0.25});
  new Effect.Fade($(which_select + '_links'), {duration: 0.25});
  return false;
}

function doSelect(which_select, select_dn, select_cn) {
  select_dn_field = $('form_' + which_select);
  select_cn_field = $('form_' + which_select + '_cn');
  select_cn_span = $(which_select + '_select_cn');

  select_dn_field.value = select_dn;
  select_cn_field.value = select_cn;
  select_cn_span.update(select_cn);

  new Effect.Fade($(which_select + '_searcharea'), {duration: 0.25});
  new Effect.Appear($(which_select + '_links'), {duration: 0.25});
}

function clearSelect(which_select) {
  select_dn_field = $('form_' + which_select);
  select_cn_field = $('form_' + which_select + '_cn');
  select_cn_span = $(which_select + '_select_cn');

  select_dn_field.value = '';
  select_cn_field.value = '';
  select_cn_span.update('');

  return false;
}