FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
CopyrightView.php
1 <?php
2 /*
3  Copyright (C) 2014-2015, Siemens AG
4  Author: Johannes Najjar
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  version 2 as published by the Free Software Foundation.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
21 
23 
24 class CopyrightView extends Xpview
25 {
26  const NAME = 'copyright-view';
27 
28  function __construct()
29  {
30  $this->decisionTableName = "copyright_decision";
31  $this->tableName = "copyright";
32  $this->modBack = 'copyright-hist';
33  $this->optionName = "skipFileCopyRight";
34  $this->ajaxAction = "setNextPrevCopyRight";
35  $this->skipOption = "noCopyright";
36  $this->highlightTypeToStringMap = array(Highlight::COPYRIGHT => 'copyright remark',
37  Highlight::URL => 'URL', Highlight::EMAIL => 'e-mail address',
38  Highlight::AUTHOR => 'author or maintainer');
39  $this->xptext = 'copyright/e-mail/URL';
40  $this->typeToHighlightTypeMap = array(
41  'statement' => Highlight::COPYRIGHT,
42  'email' => Highlight::EMAIL,
43  'url' => Highlight::URL,
44  'author' => Highlight::AUTHOR);
45  parent::__construct(self::NAME, array(
46  self::TITLE => _("View Copyright/Email/Url Analysis")
47  ));
48  }
49 
54  protected function additionalVars($uploadId, $uploadTreeId, $agentId)
55  {
56  if (empty($agentId))
57  {
58  $agentMap = $this->agentDao->getLatestAgentResultForUpload($uploadId,array('copyright'));
59  $agentId = array_key_exists('copyright',$agentMap) ? $agentMap['copyright'] : 0;
60  }
61 
62  $modCopyrightHist = plugin_find('copyright-hist');
63  $filter = '';
64  list($output, $tableVars) = $modCopyrightHist->getTableForSingleType('statement', _("Copyright"), $uploadId, $uploadTreeId, $filter, $agentId);
65 
66  $vars = array('statement'=>$tableVars,
67  'content' => "$output\n",
68  'script' => '<script>$(document).ready(function() { createTablestatement(); } );</script>');
69  return $vars;
70  }
71 
72 }
73 
74 register_plugin(new CopyrightView());
Namespace for Copyright agent&#39;s UI components.
plugin_find($pluginName)
Given the official name of a plugin, return the $Plugins object.
additionalVars($uploadId, $uploadTreeId, $agentId)
Get additional variables for a give item.