summaryrefslogtreecommitdiff
blob: 0be17266623594e4f08c6099bb9a63e1423b4dfa (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
/** Latering **/
uki(
  { view: 'Popup', rect: '500 300', anchors: 'left top', id: 'later-popup', hideOnClick: false, relativeTo: uki('#popup'), childViews: [
      { view: 'Label', rect: '10 10 480 20', anchors: 'top', html: '<strong>The following CVEs will be marked as LATER:</strong>', id: 'cve-later-title'},
      { view: 'ScrollableList', rect: '10 35 480 190', anchors: 'top left right bottom', id: 'cve-later-list' },
      { view: 'TextField', rect: '10 235 480 22', anchors: 'left top right', placeholder: 'Add a (public) comment', id: 'later-comment' },
      { view: 'Button', rect: '345 265 70 24', anchors: 'bottom right', id: 'cve-later-cancel', text: 'Cancel' },
      { view: 'Button', rect: '420 265 70 24', anchors: 'bottom right', id: 'cve-later-go', text: 'Commit' }
    ]
  }
);

uki("#cve-mark-later").click(
  function() {
    var sel = uki('Table').selectedRows();

    if (sel.length < 1) {
      alert("Please select at least one CVE.");
      return false;
    }

    var data = new Array();
    cve_later_data = new Array();

    for (var i = 0; i < sel.length; i++) {
      data.push("(" + sel[i][1] + ") " + sel[i][2]);
      cve_later_data.push(sel[i][0]);
    }

    uki('#cve-later-list').data(data);

    uki('#later-comment').value('');
    uki('#later-popup').show();

    uki('#cve-later-go').focus();
  }
);

uki('#cve-later-go').click(
  function() {
    if (cve_later_data < 1) {
      alert("Error. Internal CVE list empty.");
      return;
      uki('#later-popup').hide();
    }
    
    new Ajax.Request('/cve/later', {
      parameters: { cves: cve_later_data.join(','), reason: uki('#later-comment').value() },
      onSuccess: function(response) {
        uki('#later-popup').hide();
        reloadTable();
      },
      onFailure: function(response) {
        alert("Could not process your request:\n\n" + response.responseText);
      }
    });
  }
);

uki('#cve-later-cancel').click(
  function() {
    uki('#later-popup').hide();
  }
);
/** Latering end **/