15 const NAME =
'copyright-view';
17 function __construct()
19 $this->decisionTableName =
"copyright_decision";
20 $this->tableName =
"copyright";
21 $this->modBack =
'copyright-hist';
22 $this->optionName =
"skipFileCopyRight";
23 $this->ajaxAction =
"setNextPrevCopyRight";
24 $this->skipOption =
"noCopyright";
25 $this->highlightTypeToStringMap = array(Highlight::COPYRIGHT =>
'copyright remark',
26 Highlight::URL =>
'URL', Highlight::EMAIL =>
'e-mail address',
27 Highlight::AUTHOR =>
'author or maintainer');
28 $this->xptext =
'copyright/e-mail/URL';
29 $this->typeToHighlightTypeMap = array(
30 'statement' => Highlight::COPYRIGHT,
31 'email' => Highlight::EMAIL,
32 'url' => Highlight::URL,
33 'author' => Highlight::AUTHOR);
34 parent::__construct(self::NAME, array(
35 self::TITLE => _(
"View Copyright/Email/Url Analysis")
45 if (empty($agentId)) {
46 $agentMap = $this->agentDao->getLatestAgentResultForUpload($uploadId,array(
'copyright',
'reso'));
47 $agentId = array_key_exists(
'copyright',$agentMap) ? $agentMap[
'copyright'] : 0;
48 if (array_key_exists(
'reso',$agentMap)) {
49 $ResoagentId = $agentMap[
'reso'];
50 $agentId .=
"," . $ResoagentId;
53 $typeDescriptionPairs = array(
54 'statement' => _(
"FOSSology"),
55 'scancode_statement' => _(
"ScanCode")
61 foreach ($typeDescriptionPairs as $type=>$description) {
62 if ($type===
"scancode_statement") {
64 $this->agentName =
"scancode";
66 list($out, $vars) = $modCopyrightHist->getTableForSingleType($type, $description, $uploadId, $uploadTreeId, $filter, $agentId);
67 $tableVars[$type] = $vars;
71 list ($vCopyright, $vScancode)=$output;
72 $vars = array(
'tables'=>$tableVars,
73 'foss_content' =>
"$vCopyright\n",
74 'scan_content' =>
"$vScancode\n",
75 'script' => $this->createScriptBlock());
79 protected function createScriptBlock()
83 var copyrightTabViewCookie = 'stickyCopyrightViewTab';
85 $(document).ready(function() {
86 tableCopyright = createTablestatement();
87 tableScancode = createTablescancode_statement();
88 $('#CopyrightViewTabs').tabs({
89 active: ($.cookie(copyrightTabViewCookie) || 0),
90 activate: function(e, ui){
91 // Get active tab index and update cookie
92 var idString = $(e.currentTarget).attr('id');
93 idString = parseInt(idString.slice(-1)) - 1;
94 $.cookie(copyrightTabViewCookie, idString);
102 register_plugin(
new CopyrightView());
additionalVars($uploadId, $uploadTreeId, $agentId)
Get additional variables for a give item.
LatestAgentpk($upload_pk, $arsTableName, $arsSuccess=false)
Given an upload_pk, find the latest enabled agent_pk with results.
plugin_find($pluginName)
Given the official name of a plugin, return the $Plugins object.
Namespace for Copyright agent's UI components.