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
|
/** Filing **/
uki(
{ view: 'Popup', rect: '500 300', anchors: 'left top', id: 'file-1-popup', hideOnClick: false, relativeTo: uki('#popup'), childViews: [
{ view: 'Label', rect: '10 10 480 20', anchors: 'top', text: 'Select a package to file this bug against:', id: 'cve-file-1-title' },
{ view: 'ScrollableList', rect: '10 35 480 170', anchors: 'top left right bottom', id: 'cve-file-1-list' },
{ view: 'Label', rect: '10 210 480 20', anchors: 'top', text: 'Or manually enter a package atom:', id: 'cve-file-1-title2' },
{ view: 'TextField', rect: '10 235 480 22', anchors: 'left top right', placeholder: 'package atom', id: 'cve-file-1-atom' },
{ view: 'Button', rect: '345 265 70 24', anchors: 'bottom right', id: 'cve-file-1-cancel', text: 'Cancel' },
{ view: 'Button', rect: '420 265 70 24', anchors: 'bottom right', id: 'cve-file-1-go', text: 'Next' }
]
}
);
uki(
{ view: 'Popup', rect: '650 400', anchors: 'left top', id: 'file-2-popup', hideOnClick: false, relativeTo: uki('#popup'), childViews: [
{ view: 'Label', rect: '10 10 630 20', anchors: 'top', text: 'Enter the information for filing the bug:', id: 'cve-file-2-title' },
{ view: 'ScrollPane', rect: '10 30 635 320', anchors: 'top left right bottom', id: 'cve-file-2-scroll', scrollableV: true, scrollableH: false, childViews: [
{ view: 'Label', rect: '10 10 600 400', anchors: 'top', text: '', id: 'cve-file-2-text', textSelectable: true, multiline: true},
] },
{ view: 'Button', rect: '495 365 70 24', anchors: 'bottom right', id: 'cve-file-2-cancel', text: 'Cancel' },
{ view: 'Button', rect: '570 365 70 24', anchors: 'bottom right', id: 'cve-file-2-go', text: 'File bug' }
]
}
);
uki("#cve-file").click(
function() {
var sel = uki('Table').selectedRows();
if (sel.length < 1) {
alert("Please select at least one CVE.");
return false;
}
// TODO: Avoid DoS'ing the package search by limiting the # of package to search for
var popup = uki('#file-1-popup');
// yes, this wants to be a global var
cve_file_data = new Array();
for (var i = 0; i < sel.length; i++) {
cve_file_data.push(sel[i][0]);
}
new Ajax.Request('/cve/bug_package', {
parameters: { cves: cve_file_data.join(',')},
onSuccess: function(response) {
uki('#cve-file-1-list').data(response.responseJSON['package_hints']);
uki('#cve-file-1-atom').value('');
uki('#cve-file-1-atom').focus();
disableMainView();
popup.show();
},
onFailure: function(response) {
alert("Could not process your request:\n\n" + response.responseText);
return false;
}
});
}
);
uki('#cve-file-1-cancel').click(
function() {
uki('#file-1-popup').hide();
enableMainView();
}
);
uki('#cve-file-1-go').click(
function() {
var package_name = "";
if (uki('#cve-file-1-list').selectedIndex() > 0 && uki('#cve-file-1-atom').value() != '') {
alert('Either select a package or enter something');
return false;
}
if (uki('#cve-file-1-list').selectedIndex() < 0) {
package_name = uki('#cve-file-1-atom').value();
} else {
package_name = uki('#cve-file-1-list').selectedRow();
}
if (package_name == undefined || package_name == "") {
alert("Please select a package.");
return false;
}
if (cve_file_data < 1) {
alert("Error. Internal CVE list empty.");
uki('#file-1-popup').hide();
return;
}
new Ajax.Request('/cve/bug_preview', {
parameters: { package: package_name, cves: cve_file_data.join(',') },
onSuccess: function(response) {
uki('#cve-file-2-text').html(response.responseText);
uki('#cve-file-2-text').resizeToContents('height');
uki('#file-1-popup').hide();
uki('#file-2-popup').show();
$('bug_title').focus();
},
onFailure: function(response) {
alert("Could not process your request:\n\n" + response.responseText);
return false;
}
});
}
);
uki('#cve-file-2-cancel').click(
function() {
uki('#file-2-popup').hide();
}
);
uki('#cve-file-2-go').click(
function() {
if (cve_file_data < 1) {
alert("Error. Internal CVE list empty.");
uki('#file-2-popup').hide();
return;
}
if ($('wb_1').value == '--') {
alert('Please select a whiteboard setting. If unsure use "??" instead.');
$('wb_1').focus();
return;
}
if (!($('add_comment').checked || $('add_cves').checked)) {
alert("Adding the CVE description is strongly suggested!\n\nIf you do not want to add it, then you need at least to add a comment.");
$('comment').focus();
return;
}
uki('#cve-file-2-go').disabled(true);
var params = {
bug_title: $('bug_title').value,
bug_type: $('type_1').checked,
cc_maint: $('cc_maint').checked,
cc_custom: $('custom_cc').value,
wb_1: $('wb_1').value,
wb_2: $('wb_2').value,
wb_ext: $('wb_ext').value,
add_comment: $('add_comment').checked,
comment: $('comment').value,
add_cves: $('add_cves').checked,
package: $('package').value,
cves: cve_file_data.join(',')
};
new Ajax.Request('/cve/bug', {
parameters: params,
onSuccess: function(response) {
uki('#file-2-popup').hide();
uki('#cve-file-2-go').disabled(false);
reloadTable();
},
onFailure: function(response) {
alert("Could not process your request:\n\n" + response.responseText);
uki('#cve-file-2-go').disabled(false);
}
});
}
);
/** Filing end **/
|