Skip to content

Commit

Permalink
Merge ef62413 into ce3d8bc
Browse files Browse the repository at this point in the history
  • Loading branch information
ag4ums committed Dec 12, 2017
2 parents ce3d8bc + ef62413 commit 822e1be
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 16 deletions.
11 changes: 9 additions & 2 deletions src/lib/php/common-sysconfig.php
Expand Up @@ -279,14 +279,21 @@ function Populate_sysconfig()
$Variable = "CommonObligation";
$contextNamePrompt = _("Common Obligation");
$contextValue = "";
$contextDesc = _("Common Obligation Text, add line break with \n at the end of the line");
$contextDesc = _("Common Obligation Text, add line break at the end of the line");
$ValueArray[$Variable] = "'$Variable', '$contextValue', '$contextNamePrompt', "
. CONFIG_TYPE_TEXTAREA .
",'ReportText', null, '$contextDesc', null";
$Variable = "AdditionalObligation";
$contextNamePrompt = _("Additional Obligation");
$contextValue = "";
$contextDesc = _("Additional Obligation Text, add line break with \n at the end of the line");
$contextDesc = _("Additional Obligation Text, add line break at the end of the line");
$ValueArray[$Variable] = "'$Variable', '$contextValue', '$contextNamePrompt', "
. CONFIG_TYPE_TEXTAREA .
",'ReportText', null, '$contextDesc', null";
$Variable = "ObligationAndRisk";
$contextNamePrompt = _("Obligation And Risk Assessment");
$contextValue = "";
$contextDesc = _("Obligations and risk assessment, add line break at the end of the line");
$ValueArray[$Variable] = "'$Variable', '$contextValue', '$contextNamePrompt', "
. CONFIG_TYPE_TEXTAREA .
",'ReportText', null, '$contextDesc', null";
Expand Down
56 changes: 42 additions & 14 deletions src/unifiedreport/agent/reportStatic.php
Expand Up @@ -224,14 +224,26 @@ function assessmentSummaryTable(Section $section, $otherStatement)
}


/**
* @param string $text
* @return array $texts
*/
protected function reArrangeObligationText($text)
{
$texts = explode(PHP_EOL, $text);
return $texts;
}


/**
* @param Section $section
*/
function todoTable(Section $section)
{
global $SysConf;
$text1 = $SysConf['SYSCONFIG']["CommonObligation"];
$text2 = $SysConf['SYSCONFIG']["AdditionalObligation"];
$textCommonObligation = $this->reArrangeObligationText($SysConf['SYSCONFIG']["CommonObligation"]);
$textAdditionalObligation = $this->reArrangeObligationText($SysConf['SYSCONFIG']["AdditionalObligation"]);
$textObligationAndRisk = $this->reArrangeObligationText($SysConf['SYSCONFIG']["ObligationAndRisk"]);

$rowStyle = array("bgColor" => "E0E0E0", "spaceBefore" => 0, "spaceAfter" => 0, "spacing" => 0);
$secondRowColorStyle = array("color" => "008000");
Expand All @@ -252,10 +264,12 @@ function todoTable(Section $section)

$r1c1 = "2.1.1";
$r2c1 = "2.1.2";
$r3c1 = "2.1.3";

$r1c2 = "Documentation of license conditions and copyright notices in product documentation (License Notice File / README_OSS) is provided by this component clearing report:";
$r2c2 = "Additional Common Obligations:";
$r2c3 = "Need to be ensured by the distributing party:";
$r2c21 = "Need to be ensured by the distributing party:";
$r3c2 = "Obligations and risk assessment regarding distribution";

$table = $section->addTable($this->tablestyle);

Expand All @@ -266,34 +280,48 @@ function todoTable(Section $section)
$table->addRow($rowWidth);
$cell = $table->addCell($firstColLen);
$cell = $table->addCell($secondColLen);
if (!empty($text1) && strpos($text1, '\n')!==FALSE){
$texts = explode('\n', $text1);
foreach($texts as $text){
$cell->addText(htmlspecialchars($text), $secondRowColorStyle, "pStyle");
}
if(empty($textCommonObligation)){
$cell->addText(htmlspecialchars($textCommonObligation), $secondRowColorStyle, "pStyle");
}
else{
$cell->addText(htmlspecialchars($text1),$secondRowColorStyle , "pStyle");
foreach($textCommonObligation as $text){
$cell->addText(htmlspecialchars($text), $secondRowColorStyle, "pStyle");
}
}

$table->addRow($rowWidth);
$cell = $table->addCell($firstColLen, $rowStyle)->addText(htmlspecialchars($r2c1), $rowTextStyleLeft, "pStyle");
$cell = $table->addCell($secondColLen, $rowStyle);
$cell->addText(htmlspecialchars($r2c2), $rowTextStyleRightBold, "pStyle");
$cell->addText(htmlspecialchars($r2c3), $rowTextStyleRightBold, "pStyle");
$cell->addText(htmlspecialchars($r2c21), $rowTextStyleRightBold, "pStyle");

$table->addRow($rowWidth);
$cell = $table->addCell($firstColLen);
$cell = $table->addCell($secondColLen);
if (!empty($text1) && strpos($text2, '\n')!==FALSE){
$texts = explode('\n', $text2);
foreach($texts as $text){
if (empty($textAdditionalObligation)){
$cell->addText(htmlspecialchars($textAdditionalObligation), null, "pStyle");
}
else{
foreach($textAdditionalObligation as $text){
$cell->addText(htmlspecialchars($text), null, "pStyle");
}
}
$table->addRow($rowWidth);
$cell = $table->addCell($firstColLen, $rowStyle)->addText(htmlspecialchars($r3c1), $rowTextStyleLeft, "pStyle");
$cell = $table->addCell($secondColLen, $rowStyle)->addText(htmlspecialchars($r3c2), $rowTextStyleRightBold, "pStyle");

$table->addRow($rowWidth);
$cell = $table->addCell($firstColLen);
$cell = $table->addCell($secondColLen);
if(empty($textObligationAndRisk)){
$cell->addText(htmlspecialchars($textObligationAndRisk), $secondRowColorStyle, "pStyle");
}
else{
$cell->addText(htmlspecialchars($text2), null, "pStyle");
foreach($textObligationAndRisk as $text){
$cell->addText(htmlspecialchars($text), $secondRowColorStyle, "pStyle");
}
}

$section->addTextBreak();
}

Expand Down

0 comments on commit 822e1be

Please sign in to comment.