Skip to content

Commit

Permalink
Merge 453da1f into bddeb35
Browse files Browse the repository at this point in the history
  • Loading branch information
shaheemazmalmmd committed Jun 12, 2019
2 parents bddeb35 + 453da1f commit 2871bd0
Show file tree
Hide file tree
Showing 9 changed files with 423 additions and 287 deletions.
2 changes: 1 addition & 1 deletion src/lib/php/Dao/UploadDao.php
Expand Up @@ -632,7 +632,7 @@ public function getPFilesDataPerHashAlgo(ItemTreeBounds $itemTreeBounds, $hashAl
public function getReportInfo($uploadId)
{
$stmt = __METHOD__;
$sql = "SELECT * FROM report_info where upload_fk=$1";
$sql = "SELECT * FROM report_info WHERE upload_fk = $1";
$row = $this->dbManager->getSingleRow($sql, array($uploadId), $stmt);

if (empty($row)) {
Expand Down
30 changes: 16 additions & 14 deletions src/spdx2/agent/spdx2.php
Expand Up @@ -670,15 +670,18 @@ protected function generateFileNodesByFiles($filesWithLicenses, $treeTableName,
$lastValue = $filesProceeded;
}
$hashes = $treeDao->getItemHashes($fileId);
$fileName = $treeDao->getFullPath($fileId,$treeTableName,0,true);
$fileName = $treeDao->getFullPath($fileId, $treeTableName, 0, true);
if (!is_array($licenses['concluded'])) {
$licenses['concluded'] = array();
}
if (!is_array($licenses['scanner'])) {
$licenses['scanner'] = array();
}
$stateComment = $this->getSPDXLicenseCommentState($uploadId);
$dataTemplate = array(
$stateComment = $this->getSPDXReportConf($uploadId, 0);
$stateWoInfos = $this->getSPDXReportConf($uploadId, 1);
if (!$stateWoInfos ||
($stateWoInfos && (!empty($licenses['concluded']) || (!empty($licenses['scanner']) && !empty($licenses['scanner'][0])) || !empty($licenses['copyrights'])))) {
$dataTemplate = array(
'fileId' => $fileId,
'sha1' => $hashes['sha1'],
'md5' => $hashes['md5'],
Expand All @@ -692,12 +695,12 @@ protected function generateFileNodesByFiles($filesWithLicenses, $treeTableName,
'scannerLicenses' => SpdxTwoUtils::addPrefixOnDemandList($licenses['scanner'], $this->spdxValidityChecker),
'copyrights' => $licenses['copyrights'],
'licenseCommentState' => $stateComment
);
if ($stateComment) {
$dataTemplate['licenseComment'] = SpdxTwoUtils::implodeLicenses($licenses['comment']);
);
if ($stateComment) {
$dataTemplate['licenseComment'] = SpdxTwoUtils::implodeLicenses($licenses['comment']);
}
$content .= $this->renderString($this->getTemplateFile('file'),$dataTemplate);
}

$content .= $this->renderString($this->getTemplateFile('file'),$dataTemplate);
}
$this->heartbeat($filesProceeded - $lastValue);
return $content;
Expand Down Expand Up @@ -806,20 +809,19 @@ protected function getVerificationCode(Upload $upload)
* @param int $uploadId
* @return boolval License comment state (TRUE : show license comment, FALSE : don't show it)
*/
protected function getSPDXLicenseCommentState($uploadId)
protected function getSPDXReportConf($uploadId, $key)
{
$sql = "SELECT ri_ga_checkbox_selection FROM report_info WHERE upload_fk=$1";
$sql = "SELECT ri_spdx_selection FROM report_info WHERE upload_fk = $1";
$getCommentState = $this->dbManager->getSingleRow($sql, array($uploadId), __METHOD__.'.SPDX_license_comment');
if (!empty($getCommentState['ri_ga_checkbox_selection'])) {
$getCommentStateSingle = explode(',', $getCommentState['ri_ga_checkbox_selection']);
if ($getCommentStateSingle[9] === "checked") {
if (!empty($getCommentState['ri_spdx_selection'])) {
$getCommentStateSingle = explode(',', $getCommentState['ri_spdx_selection']);
if ($getCommentStateSingle[$key] === "checked") {
return true;
}
}
return false;
}
}

$agent = new SpdxTwoAgent();
$agent->scheduler_connect();
$agent->run_scheduler_event_loop();
Expand Down
2 changes: 0 additions & 2 deletions src/www/ui/admin-upload-edit.php
Expand Up @@ -90,7 +90,6 @@ function UpdateUploadProperties($uploadId, $newName, $newDesc)
$this->dbManager->getSingleRow("UPDATE upload SET upload_desc=$2 WHERE upload_pk=$1",
array($uploadId, $trimNewDesc), __METHOD__ . '.updateUpload.desc');
}

return 1;
}

Expand All @@ -117,7 +116,6 @@ public function Output()
$text = _("Permission Denied");
return "<h2>$text</h2>";
}

$rc = $this->UpdateUploadProperties($upload_pk, $NewName, $NewDesc);
if ($rc == 0) {
$text = _("Nothing to Change");
Expand Down
4 changes: 4 additions & 0 deletions src/www/ui/core-schema.dat
Expand Up @@ -1754,6 +1754,10 @@
$Schema["TABLE"]["report_info"]["ri_ga_checkbox_selection"]["ADD"] = "ALTER TABLE \"report_info\" ADD COLUMN \"ri_ga_checkbox_selection\" text";
$Schema["TABLE"]["report_info"]["ri_ga_checkbox_selection"]["ALTER"] = "ALTER TABLE \"report_info\" ALTER COLUMN \"ri_ga_checkbox_selection\" DROP NOT NULL";

$Schema["TABLE"]["report_info"]["ri_spdx_selection"]["DESC"] = "";
$Schema["TABLE"]["report_info"]["ri_spdx_selection"]["ADD"] = "ALTER TABLE \"report_info\" ADD COLUMN \"ri_spdx_selection\" text";
$Schema["TABLE"]["report_info"]["ri_spdx_selection"]["ALTER"] = "ALTER TABLE \"report_info\" ALTER COLUMN \"ri_spdx_selection\" DROP NOT NULL";


$Schema["VIEW"]["license_file_ref"] = "CREATE VIEW \"license_file_ref\" AS SELECT license_ref.rf_fullname, license_ref.rf_shortname, license_ref.rf_pk, license_file.fl_end_byte, license_file.rf_match_pct, license_file.rf_timestamp, license_file.fl_start_byte, license_file.fl_ref_end_byte, license_file.fl_ref_start_byte, license_file.fl_pk, license_file.agent_fk, license_file.pfile_fk FROM (license_file JOIN license_ref ON ((license_file.rf_fk = license_ref.rf_pk)));";

Expand Down
1 change: 1 addition & 0 deletions src/www/ui/template/admin_upload_edit.html.twig
Expand Up @@ -28,6 +28,7 @@
<li>{{ 'Upload description'|trans }}:
<input type="text" name="newdesc" size="60" value="{{ uploadDesc|e }}" />
</li>

</ol>
<input type="submit" value="{{ 'Edit'|trans }}" />
</form>
Expand Down
190 changes: 190 additions & 0 deletions src/www/ui/template/ui-report-conf.html.twig
@@ -0,0 +1,190 @@
{# Copyright 2019 Siemens AG
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
This file is offered as-is, without any warranty.
#}
{% extends "include/base.html.twig" %}

{% block content %}

<h2>{{ "Report Configuration"|trans }}</h2>
<form action="" name="formReportInfo" method="post">
<table border="1">
<tr>
<td align="center" colspan="2">
<h2>{{ "Unified Report"|trans }}</h2>
</td>
</tr>
<tr>
<th>
{{ "Attribute"|trans }}
</th>
<th>
{{ "Information"|trans }}
</th>
</tr>
<tr>
<td align="left">
{{ "Copyright Text(report Footer)"|trans }}
</td>
<td align="left">
<input type="text" name="footerNote" style="width:98%" value="{{ footerNote|e }}" />
</td>
</tr>
<tr>
<td align="left">
{{ "Reviewed by (opt.)"|trans }}
</td>
<td align="left">
<input type="text" name="reviewedBy" style="width:98%" value="{{ reviewedBy|e }}" />
</td>
</tr>
<tr>
<td align="left">
{{ "Report release date"|trans }}
</td>
<td align="left">
<input type="text" name="reportRel" style="width:98%" value="{{ reportRel|e }}" />
</td>
</tr>
<tr>
<td align="left">
{{ "Community"|trans }}
</td>
<td align="left">
<input type="text" name="community" style="width:98%" value="{{ community|e }}" />
</td>
</tr>
<tr>
<td align="left">
{{ "Component"|trans }}
</td>
<td align="left">
<input type="text" name="component" style="width:98%" value="{{ component|e }}" />
</td>
</tr>
<tr>
<td align="left">
{{ "Version"|trans }}
</td>
<td align="left">
<input type="text" name="version" style="width:98%" value="{{ version|e }}" />
</td>
</tr>
<tr>
<td align="left">
{{ "Release date"|trans }}
</td>
<td align="left">
<input type="text" name="relDate" style="width:98%" value="{{ relDate|e }}" />
</td>
</tr>
<tr>
<td align="left">
{{ "Mainline /SW360 Portal Link"|trans }}
</td>
<td align="left">
<input type="text" name="sw360Link" style="width:98%" value="{{ sw360Link|e }}" />
</td>
</tr>
<tr>
<td align="left">
{{ "General assessment"|trans }}
</td>
<td align="left">
<textarea style="overflow:auto;width:98%;height:80px;" name="generalAssesment">{{ generalAssesment|e }}</textarea>
</td>
</tr>
<tr>
<td align="left">
{{ "Source / binary integration notes"|trans }}
</td>
<td align="left">
<input type="checkbox" name="nonCritical" {{ nonCritical }} />{{ "no critical files found, source code and binaries can be used as is"|trans }}<br />
<input type="checkbox" name="critical" {{ critical }} />{{ "critical files found, source code needs to be adapted and binaries possibly re-built"|trans }}
</td>
</tr>
<tr>
<td align="left">
{{ "Dependency notes"|trans }}
</td>
<td align="left">
<input type="checkbox" name="noDependency" {{ noDependency }} />{{ "no dependencies found, neither in source code nor in binaries"|trans }}<br />
<input type="checkbox" name="dependencySource" {{ dependencySource }} />{{ "dependencies found in source code (see obligations)"|trans }}<br />
<input type="checkbox" name="dependencyBinary" {{ dependencyBinary }} />{{ "dependencies found in binaries (see obligations)"|trans }}
</td>
</tr>
<tr>
<td align="left">
{{ "Export restrictions by copyright owner"|trans }}
</td>
<td align="left">
<input type="checkbox" name="noExportRestriction" {{ noExportRestriction }} />{{ "no export restrictions found"|trans }}<br />
<input type="checkbox" name="exportRestriction" {{ exportRestriction }} />{{ "export restrictions found (see obligations)"|trans }}
</td>
</tr>
<tr>
<td align="left">
{{ "Restrictions for use by copyright owner \n<br/> (e.g. not for Nuclear Power)"|trans }}
</td>
<td align="left">
<input type="checkbox" name="noRestriction" {{ noRestriction }} />{{ "no restrictions for use found"|trans }}<br />
<input type="checkbox" name="restrictionForUse" {{ restrictionForUse }} />{{ "restrictions for use found (see obligations)"|trans }}
</td>
</tr>
<tr>
<td align="left">
{{ "Additional notes"|trans }}
</td>
<td align="left">
<textarea style="overflow:auto;width:98%;height:80px;" name="gaAdditional">{{ gaAdditional|e }}</textarea>
</td>
</tr>
<tr>
<td align="left">
{{ "General Risks (optional)"|trans }}
</td>
<td align="left">
<textarea style="overflow:auto;width:98%;height:80px;" name="gaRisk">{{ gaRisk|e }}</textarea>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<h2>{{ "SPDX Report"|trans }}</h2>
</td>
</tr>
<tr>
<th>
{{ "Attribute"|trans }}
</th>
<th>
{{ "Information"|trans }}
</th>
</tr>
<tr>
<td align="left">
{{ "Show SPDX license comments"|trans }}
</td>
<td align="left">
<input type="checkbox" name="spdxLicenseComment" {{ spdxLicenseComment }} />
</td>
</tr>
<tr>
<td align="left">
{{ "Ignore files with no info in SPDX"|trans }}
</td>
<td align="left">
<input type="checkbox" name="ignoreFilesWOInfo" {{ ignoreFilesWOInfo }} />
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" name="submitReportConf" value="Submit" />
</td>
</tr>
</table>
</form>


{% endblock %}

0 comments on commit 2871bd0

Please sign in to comment.