summaryrefslogtreecommitdiff
blob: 33a93833d6c6b5fa3ff0accd3f3e60744b1093cd (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
<% if @cve == nil %>

<h2 style="margin-top: 0;"><%= error_msg("Invalid CVE ID") %></h2>
<p>There is no such CVE.</p>

<% else %>
<script language="JavaScript" type="text/javascript">
cve_id = "<%= escape_javascript @cve.cve_id %>";

// page layout
uki({ view: 'VSplitPane', rect: '500 600', anchors: 'left top right bottom', topMin: 120, handlePosition: 120,
    topChildViews: [
        { view: 'Box', rect: '0 0 500 30', anchors: 'top right left', background: 'cssBox(background:#D3CFE5;border-bottom:1px solid #999)', childViews: [
          { view: 'Label', rect: '5 5 400 20', html: "<h2 style='margin: 0;'><%= @cve.colorize.html_safe %> <small>(<%= @cve.state %>)</small></h2>", anchors: 'top left'},
          { view: 'Button', rect: '440 4 50 20', text: 'Close', anchors: 'top right', id: 'close' }
        ] },
        { view: 'Label', rect: '5 35 490 50', anchors: 'left top right', html: '<%= escape_javascript(simple_format_without_paragraph(@cve.summary)).gsub(/\n/, '') %>', textSelectable: true, multiline: true}
    ],
    bottomPane: { background: '#FFF', childViews: [
        { view: 'ScrollPane', rect: '0 0 500 445', anchors: 'top left right bottom', id: 'info-scroll', scrollableV: true, scrollableH: false, childViews: [
          { view: 'Label', rect: '5 5 495 445', anchors: 'top left right bottom', html: '', id: 'content', textSelectable: true, multiline: true}, 
        ] },    
        
        { view: 'Box', rect: '0 445 500 28', anchors: 'left bottom right', background: 'cssBox(background:#CCC;border-top:1px solid #999;padding:1px;)', childViews: [
          { view: 'Button', rect: '5 4 40 20', text: 'Info', anchors: 'bottom left', id: 'info' },
          { view: 'Button', rect: '50 4 80 20', text: 'References', anchors: 'bottom left', id: 'references' },
          { view: 'Button', rect: '135 4 70 20', text: 'Packages', anchors: 'bottom left', id: 'packages' },
          { view: 'Button', rect: '210 4 80 20', text: 'Comments', anchors: 'bottom left', id: 'comments' },  
          { view: 'Button', rect: '295 4 60 20', text: 'Changes', anchors: 'bottom left', id: 'changes' },
          <% if current_user.access >= 2 %>{ view: 'Button', rect: '430 4 60 20', text: 'Actions', anchors: 'bottom right', id: 'actions' },<% end %>
        ] }
    ]}
}).attachTo(window, '500 600');

uki('#close').click(
  function() {
    window.close();
  }
);

uki('#info').click(
  function() {
    new Ajax.Request('/cve/general_info', {
      parameters: { cve_id: cve_id },
      onSuccess: function(response) {
        uki('#content').html(response.responseText);
        uki('#content').resizeToContents('height');
      },
      onFailure: function(response) {
        alert("Could not process your request:\n\n" + response.responseText);
        return false;
      }
    });
  }
);

uki('#info').click();

uki('#references').click(
  function() {
    new Ajax.Request('/cve/references', {
      parameters: { cve_id: cve_id },
      onSuccess: function(response) {
        uki('#content').html(response.responseText);
        uki('#content').resizeToContents('height');
      },
      onFailure: function(response) {
        alert("Could not process your request:\n\n" + response.responseText);
        return false;
      }
    });
  }
);

uki('#packages').click(
  function() {
    new Ajax.Request('/cve/packages', {
      parameters: { cve_id: cve_id },
      onSuccess: function(response) {
        uki('#content').html(response.responseText);
        uki('#content').resizeToContents('height');
      },
      onFailure: function(response) {
        alert("Could not process your request:\n\n" + response.responseText);
        return false;
      }
    });
  }
);

uki('#comments').click(
  function() {
    new Ajax.Request('/cve/comments', {
      parameters: { cve_id: cve_id },
      onSuccess: function(response) {
        uki('#content').html(response.responseText);
        uki('#content').resizeToContents('height');
      },
      onFailure: function(response) {
        alert("Could not process your request:\n\n" + response.responseText);
        return false;
      }
    });
  }
);

uki('#changes').click(
  function() {
    new Ajax.Request('/cve/changes', {
      parameters: { cve_id: cve_id },
      onSuccess: function(response) {
        uki('#content').html(response.responseText);
        uki('#content').resizeToContents('height');
      },
      onFailure: function(response) {
        alert("Could not process your request:\n\n" + response.responseText);
        return false;
      }
    });
  }
);

uki('#actions').click(
  function() {
    new Ajax.Request('/cve/actions', {
      parameters: { cve_id: cve_id },
      onSuccess: function(response) {
        uki('#content').html(response.responseText);
        uki('#content').resizeToContents('height');
      },
      onFailure: function(response) {
        alert("Could not process your request:\n\n" + response.responseText);
        return false;
      }
    });
  }
);
</script>

<% end %>