--- a/tool/run/plugins/spdx/show.java
+++ b/tool/run/plugins/spdx/show.java
@@ -21,7 +21,7 @@
import java.io.File;
import www.Table;
import java.util.ArrayList;
-import main.Graphs;
+import utils.Graphs;
import script.Plugin;
import spdxlib.tools;
import spdxlib.FileInfo;
@@ -280,6 +280,13 @@
}
// read the whole file
String result = utils.files.readAsString(file);
+
+ // we have to make it web-ready, replace break lines with BR tags
+ result =
+ "<p>"
+ + result.replace("\n", "<br>")
+ + "</p>";
+
// output the file
request.setAnswer(result);
}
@@ -313,11 +320,11 @@
int counterFiles = spdx.fileSection.files.size();
// calculate percentage of files with a license declared
- String percentage =
- " ("
- + (counterLicensesDeclared * 100)/counterFiles
- + "% in total)" + html.br;
-
+// String percentage =
+// " ("
+// + (counterLicensesDeclared * 100)/counterFiles
+// + "% in total)" + html.br;
+//
String searchEngines =
html.div(10)
+ html.linkToSearchGoogle(spdx.getId())
@@ -330,18 +337,41 @@
String evaluation = doEvaluation(spdx);
+
+
+
+ // the header when showing summary about a specific SPDX file
+ String summary =
+ html.h2(
+ // html.getIcon("wooden-box-label.png", request)
+ spdx.getId())
+ + counterFiles + " files inside the package"
+ + html.br
+ //+ html.getCommonFolderIcon("calculator.png")
+ + counterLicensesDeclared + " files with declared licenses"
+ //+ percentage
+ + evaluation
+ ;
+
+ // generate the nice graph
+ String[] titles = new String[]{"No license declared", "License declared"};
+ int noLicenses = counterFiles - counterLicensesDeclared;
+ int[] values = new int[]{noLicenses, counterLicensesDeclared};
+ // do the graph file
+ File graphFile = Graphs.generate(thisFolder, titles, values);
+
+ String[] header = new String[]{summary,
+ html.br
+ + html.getIcon("chart.png", request)};
+ values = new int[]{270, 180};
+
+ summary = Table.alignedTable(header, values);
+
// prepare the answer
String result = ""
//swingUtils.getBreadcrumb(node)
+ html.div(20)
- + html.h2(spdx.getId())
- //+ html.getCommonFolderIcon("documents-stack.png")
- + counterFiles + " files inside the package"
- + html.br
- //+ html.getCommonFolderIcon("calculator.png")
- + counterLicensesDeclared + " files with declared licenses"
- + percentage
- + evaluation
+ + summary
+ html._div