FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
ajax-uploads.php
Go to the documentation of this file.
1 <?php
2 /***********************************************************
3  Copyright (C) 2008-2013 Hewlett-Packard Development Company, L.P.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 ***********************************************************/
18 
21 
32 define("TITLE_CORE_UPLOADS", _("List Uploads as Options"));
33 
34 class core_uploads extends FO_Plugin
35 {
36  function __construct()
37  {
38  $this->Name = "upload_options";
39  $this->Title = TITLE_CORE_UPLOADS;
40  $this->DBaccess = PLUGIN_DB_READ;
41  $this->OutputType = 'Text'; /* This plugin needs no HTML content help */
42 
43  parent::__construct();
44  }
45 
49  function Output()
50  {
51  $FolderId = GetParm("folder",PARM_INTEGER);
52  if (empty($FolderId)) {
53  $FolderId = FolderGetTop();
54  }
55  $V = '';
56  $uploadList = FolderListUploads_perm($FolderId, Auth::PERM_WRITE);
57  foreach ($uploadList as $upload) {
58  $V .= "<option value='" . $upload['upload_pk'] . "'>";
59  $V .= htmlentities($upload['name']);
60  if (! empty($upload['upload_desc'])) {
61  $V .= " (" . htmlentities($upload['upload_desc']) . ")";
62  }
63  if (! empty($upload['upload_ts'])) {
64  $V .= " :: " . htmlentities($upload['upload_ts']);
65  }
66  $V .= "</option>\n";
67  }
68  return new Response($V, Response::HTTP_OK, array('Content-type'=>'text/plain'));
69  }
70 }
71 
72 $NewPlugin = new core_uploads();
73 $NewPlugin->Initialize();
FolderListUploads_perm($ParentFolder, $perm)
Returns an array of uploads in a folder.
FolderGetTop()
DEPRECATED! Find the top-of-tree folder_pk for the current user.
#define PLUGIN_DB_READ
Plugin requires read permission on DB.
Definition: libfossology.h:49
Output()
Display the loaded menu and plugins.
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
#define PERM_WRITE
Read-Write permission.
Definition: libfossology.h:45