|
a/tool/run/plugins/spdx/show.java |
|
b/tool/run/plugins/spdx/show.java |
|
... |
|
... |
28 |
import spdxlib.SPDXfile;
|
28 |
import spdxlib.SPDXfile;
|
29 |
import main.core;
|
29 |
import main.core;
|
30 |
import main.param;
|
30 |
import main.param;
|
31 |
import script.log;
|
31 |
import script.log;
|
32 |
import utils.html;
|
32 |
import utils.html;
|
|
|
33 |
import www.RequestOrigin;
|
33 |
import www.WebRequest;
|
34 |
import www.WebRequest;
|
34 |
|
35 |
|
35 |
|
36 |
|
36 |
/**
|
37 |
/**
|
37 |
*
|
38 |
*
|
|
... |
|
... |
90 |
counterFiles += spdx.fileSection.files.size();
|
91 |
counterFiles += spdx.fileSection.files.size();
|
91 |
counterCreators += spdx.creatorSection.people.size();
|
92 |
counterCreators += spdx.creatorSection.people.size();
|
92 |
counterLicensesDeclared += doStatistics(spdx);
|
93 |
counterLicensesDeclared += doStatistics(spdx);
|
93 |
}
|
94 |
}
|
94 |
|
95 |
|
|
|
96 |
String reviewerList = "";
|
|
|
97 |
// just one reviewer
|
|
|
98 |
if(counterCreators == 1){
|
|
|
99 |
reviewerList = counterCreators + " reviewer" + html.br;
|
|
|
100 |
}
|
|
|
101 |
if(counterCreators > 1){
|
|
|
102 |
reviewerList = counterCreators + " reviewers" + html.br;
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
|
95 |
// calculate percentage of files with a license declared
|
106 |
// calculate percentage of files with a license declared
|
96 |
// String percentage =
|
107 |
// String percentage =
|
97 |
// " ("
|
108 |
// " ("
|
98 |
// + (counterLicensesDeclared * 100)/counterFiles
|
109 |
// + (counterLicensesDeclared * 100)/counterFiles
|
99 |
// + "% in total)" + html.br;
|
110 |
// + "% in total)" + html.br;
|
|
... |
|
... |
124 |
+ html.br
|
135 |
+ html.br
|
125 |
+ counterFiles + " files in total"
|
136 |
+ counterFiles + " files in total"
|
126 |
+ html.br
|
137 |
+ html.br
|
127 |
//+ percentage
|
138 |
//+ percentage
|
128 |
//+ html.getCommonFolderIcon("stickman.png")
|
139 |
//+ html.getCommonFolderIcon("stickman.png")
|
129 |
+ counterCreators + " reviewers" + html.br
|
140 |
+ reviewerList
|
130 |
+ html.br
|
141 |
+ html.br
|
131 |
;
|
142 |
;
|
132 |
|
143 |
|
133 |
// generate the nice graph
|
144 |
// generate the nice graph
|
134 |
String[] titles = new String[]{"No license declared", "License declared"};
|
145 |
String[] titles = new String[]{"No license declared", "License declared"};
|
|
... |
|
... |
283 |
return;
|
294 |
return;
|
284 |
}
|
295 |
}
|
285 |
// read the whole file
|
296 |
// read the whole file
|
286 |
String result = utils.files.readAsString(file);
|
297 |
String result = utils.files.readAsString(file);
|
287 |
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
// what happens when we want to see this file from a browser?
|
|
|
302 |
if(request.requestOrigin == RequestOrigin.BROWSER){
|
288 |
// we have to make it web-ready, replace break lines with BR tags
|
303 |
// we have to make it web-ready, replace break lines with BR tags
|
289 |
result =
|
304 |
result =
|
290 |
"<p>"
|
305 |
"<p>"
|
291 |
+ result.replace("\n", "<br>")
|
306 |
+ result.replace("\n", "<br>")
|
292 |
+ "</p>";
|
307 |
+ "</p>";
|
293 |
|
|
|
294 |
// output the file
|
308 |
// output the file
|
295 |
request.setAnswer(result);
|
309 |
request.setAnswer(result);
|
|
|
310 |
return;
|
|
|
311 |
}
|
|
|
312 |
|
|
|
313 |
request.setAnswer("Loading text..");
|
|
|
314 |
// we just want to just this on the GUI
|
|
|
315 |
core.studio.editorPane(is.contentText, false, 0, result);
|
|
|
316 |
|
296 |
}
|
317 |
}
|
297 |
|
318 |
|
298 |
|
319 |
|
299 |
/**
|
320 |
/**
|
300 |
* Show the summary for a given SPDX document
|
321 |
* Show the summary for a given SPDX document
|