aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Heinlein <keytoaster@gentoo.org>2010-05-17 20:24:13 +0200
committerTobias Heinlein <keytoaster@gentoo.org>2010-05-17 20:24:13 +0200
commite7519dc1b2aad1ed0710f9b0bdfb9aed2cd455fb (patch)
treeac16d4dcee81d9e1db448047b15d83cd0710bffe
parentReferences and bug fixes. (diff)
downloadglsamaker-e7519dc1b2aad1ed0710f9b0bdfb9aed2cd455fb.tar.gz
glsamaker-e7519dc1b2aad1ed0710f9b0bdfb9aed2cd455fb.tar.bz2
glsamaker-e7519dc1b2aad1ed0710f9b0bdfb9aed2cd455fb.zip
Boilerplates.
- Fixed workaround poilerplate. - Implemented resolution poilerplate. - Implemented new mini description boilerplate.
-rw-r--r--app/controllers/glsa_controller.rb2
-rw-r--r--app/helpers/glsa_helper.rb4
-rw-r--r--app/views/glsa/edit.html.erb14
-rw-r--r--public/javascripts/glsamaker.js51
4 files changed, 64 insertions, 7 deletions
diff --git a/app/controllers/glsa_controller.rb b/app/controllers/glsa_controller.rb
index 8c1185a..30792c2 100644
--- a/app/controllers/glsa_controller.rb
+++ b/app/controllers/glsa_controller.rb
@@ -76,7 +76,7 @@ class GlsaController < ApplicationController
session[:delbugs][@glsa.id] = []
# Packages
- @rev.packages.build(:vulnerable_version_comp => "<") if @rev.packages.length == 0
+ @rev.packages.build(:vulnerable_version_comp => "<", :arch => "*") if @rev.packages.length == 0
# References
@rev.references.build if @rev.references.length == 0
diff --git a/app/helpers/glsa_helper.rb b/app/helpers/glsa_helper.rb
index 5a5faa3..5cd5745 100644
--- a/app/helpers/glsa_helper.rb
+++ b/app/helpers/glsa_helper.rb
@@ -60,7 +60,7 @@ module GlsaHelper
def add_package_link(name)
link_to_function name, :title => "Add package" do |page|
- page.insert_html :bottom, :packages_table, :partial => 'package', :object => Package.new(:vulnerable_version_comp => "<")
+ page.insert_html :bottom, :packages_table, :partial => 'package', :object => Package.new(:vulnerable_version_comp => "<", :arch => "*")
end
end
@@ -69,5 +69,5 @@ module GlsaHelper
page.insert_html :bottom, :references_table, :partial => 'reference', :object => Reference.new
end
end
-
+
end
diff --git a/app/views/glsa/edit.html.erb b/app/views/glsa/edit.html.erb
index c6b866e..f0c576b 100644
--- a/app/views/glsa/edit.html.erb
+++ b/app/views/glsa/edit.html.erb
@@ -129,6 +129,11 @@
<div class="box" id="desc-box">
<h2 style="position: relative;">
<span style="float: right; margin-right: 5px; margin-top: 5px;">
+ <%= link_to_function image_tag('icons/resolution-go.png',
+ :alt => 'Set default description'),
+ "generateDescription()",
+ :title => 'Set default description' %>
+ <img src="/images/separator.png" />
<a href="javascript:///" onclick="lines('description', -5);" title="Fewer lines">
<img src="/images/icons/zoom_out.png" alt="Fewer lines" />
</a>
@@ -172,7 +177,7 @@
<div class="box">
<h2 style="margin: 0;">
<span style="float: right; margin-right: 5px; margin-top: 5px;">
- <a href="javascript:///" onclick="$('workaround').value = 'There is no known workaround at the moment.'" title="No known workaround">
+ <a href="javascript:///" onclick="$('workaround').value = 'There is no known workaround at this time.'" title="No known workaround">
<img src="/images/icons/workaround-no.png" alt="No known workaround" />
</a>
</span>
@@ -185,9 +190,10 @@
<div class="box">
<h2 style="margin: 0;">
<span style="float: right; margin-right: 5px; margin-top: 5px;">
- <a href="javascript:///" onclick="$('resolution').value = 'There is no known workaround at the moment.'" title="Set default resolution">
- <img src="/images/icons/resolution-go.png" alt="Set default resolution" />
- </a>
+ <%= link_to_function( image_tag('icons/resolution-go.png',
+ :alt => 'Set default resolution'),
+ "generateResolution()",
+ :title => 'Set default resolution') %>
</span>
<img src="/images/icons/resolution.png" alt="Resolution" />
<label for="resolution">Resolution</label>
diff --git a/public/javascripts/glsamaker.js b/public/javascripts/glsamaker.js
index 1246936..aa025e4 100644
--- a/public/javascripts/glsamaker.js
+++ b/public/javascripts/glsamaker.js
@@ -62,6 +62,57 @@ function markEntryAsDeleted(elem, type) {
}
elem.up('.entry').toggleClassName("delbug");
}
+
+function generateResolution() {
+ $('resolution').value = "";
+ resolution = "";
+ for (i = 0; i < $('packages_table').select('.entry').length; i++) {
+ if ($('packages_table').down(".entry", i).select('input[type=hidden][value=ignore]').length > 0)
+ continue;
+
+ atom = $('packages_table').down(".entry", i).down("#glsa_package__atom").value;
+ name = atom.split("/")[1];
+ comp = $('packages_table').down(".entry", i).down("#glsa_package__unaffected_version_comp").value;
+ version = $('packages_table').down(".entry", i).down("#glsa_package__unaffected_version").value;
+
+ resolution += "All " + name + " users should upgrade to the latest version:\n\n\
+<code>\n\
+# emerge --sync\n\
+# emerge --ask --oneshot --verbose \"" + comp + atom + "-" + version + "\"</code>\n\n";
+ }
+
+
+ $('resolution').value = resolution;
+}
+
+function generateDescription() {
+ // This code is pretty ugly. You have been warned.
+ // cnt is the number of 'entry's
+ // act_cnt is cnt minus the number of to be ignored 'entry's
+ // i is used to walk down into the i'th entry element
+ // act_i is used to keep track of how many packages have been / will be added
+
+ name = "";
+ cnt = $('packages_table').select('.entry').length;
+ act_cnt = cnt - $('packages_table').select('.entry input[type=hidden][value=ignore]').length;
+
+ act_i = 0;
+ for (i = 0; i < cnt; i++) {
+ if ($('packages_table').down(".entry", i).select('input[type=hidden][value=ignore]').length > 0)
+ continue;
+
+ atom = $('packages_table').down(".entry", i).down("#glsa_package__atom").value;
+ if (act_cnt > 1 && act_i == act_cnt - 1) {
+ name += ", and ";
+ } else if (act_cnt > 1 && act_i != 0) {
+ name += ", ";
+ }
+ act_i++;
+ name += atom.split("/")[1];
+ }
+
+ $('description').value = "Multiple vulnerabilities have been discovered in " + name + ". Please view the CVE identifiers referenced below for details.";
+}
//document.observe('dom:loaded', function() {
//});