/** 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 **/