FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
ajax-tags.php
1 <?php
2 /***********************************************************
3  Copyright (C) 2010-2012 Hewlett-Packard Development Company, L.P.
4  Copyright (C) 2015 Siemens AG
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 
22 define("TITLE_AJAX_TAGS", _("List Tags"));
23 
24 class ajax_tags extends FO_Plugin
25 {
26  function __construct()
27  {
28  $this->Name = "tag_get";
29  $this->Title = TITLE_AJAX_TAGS;
30  $this->DBaccess = PLUGIN_DB_READ;
31  $this->OutputType = 'Text'; /* This plugin needs no HTML content help */
32 
33  parent::__construct();
34  }
35 
39  function Output()
40  {
41  $V="";
42 
43  $item = GetParm("uploadtree_pk",PARM_INTEGER);
44  /* get uploadtree_tablename from $Item */
45  $uploadtreeRec = GetSingleRec("uploadtree", "where uploadtree_pk='$item'");
46  $uploadRec = GetSingleRec("upload", "where upload_pk='$uploadtreeRec[upload_fk]'");
47  if (empty($uploadRec['uploadtree_tablename'])) {
48  $uploadtree_tablename = "uploadtree";
49  } else {
50  $uploadtree_tablename = $uploadRec['uploadtree_tablename'];
51  }
52 
53  $List = GetAllTags($item, true, $uploadtree_tablename);
54  foreach ($List as $L) {
55  $V .= $L['tag_name'] . ",";
56  }
57 
58  return new Response($V, Response::HTTP_OK,array('content-type'=>'text/plain'));
59  }
60 }
61 
62 $NewPlugin = new ajax_tags();
63 $NewPlugin->Initialize();
GetSingleRec($Table, $Where="")
Retrieve a single database record.
Definition: common-db.php:102
GetAllTags($Item, $Recurse=true, $uploadtree_tablename="uploadtree")
Get all Tags of this uploadtree_pk.
Definition: common-tags.php:37
#define PLUGIN_DB_READ
Plugin requires read permission on DB.
Definition: libfossology.h:49
Output()
Display the loaded menu and plugins.
Definition: ajax-tags.php:39
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
Definition: common-parm.php:57
const PARM_INTEGER
Definition: common-parm.php:25
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:67