FOSSology
4.4.0
Open Source License Compliance by Open Source Software
delete-file-browse.php
1
<?php
2
/*
3
/*
4
SPDX-FileCopyrightText: © 2023 Simran Nigam <nigamsimran14@gmail.com>
5
SPDX-FileContributor: Simran Nigam <nigamsimran14@gmail.com>
6
7
SPDX-License-Identifier: GPL-2.0-only
8
*/
9
14
namespace
Fossology\DelAgent\UI\Page
;
15
16
use
Fossology\Lib\Auth\Auth
;
17
use
Fossology\Lib\Dao\UploadDao
;
18
use
Fossology\Lib\Dao\FolderDao
;
19
use
Fossology\Lib\Plugin\DefaultPlugin
;
20
use Symfony\Component\HttpFoundation\Request;
21
use Symfony\Component\HttpFoundation\RedirectResponse;
22
27
class
BrowseUploadDelete
extends
DefaultPlugin
28
{
29
const
NAME =
"browse_upload_delete"
;
30
32
private
$uploadDao;
33
35
private
$folderDao;
36
37
function
__construct()
38
{
39
parent::__construct(self::NAME, array(
40
self::TITLE => _(
"Delete Uploaded File"
),
41
self::PERMISSION =>
Auth::PERM_ADMIN
,
42
self::REQUIRES_LOGIN =>
true
43
));
44
45
global $container;
46
$this->uploadDao = $container->get(
'dao.upload'
);
47
$this->folderDao = $container->get(
'dao.folder'
);
48
}
49
53
function
RegisterMenus
()
54
{
55
$text = _(
"Delete Browse File"
);
56
menu_insert
(
"Browse-Pfile::Delete"
,0,$this->Name,$text);
57
}
// RegisterMenus()
58
63
protected
function
handle
(Request $request)
64
{
65
$vars = array();
66
67
$uploadpk = $request->get(
'upload'
);
68
$folderId = $request->get(
'folder'
);
69
70
if
(!empty($uploadpk)) {
74
$adminUploadDelete =
plugin_find
(
"admin_upload_delete"
);
75
$adminUploadDelete->TryToDelete($uploadpk, $folderId);
76
}
77
return
new
RedirectResponse(
Traceback_uri
() .
'?mod='
.
'showjobs'
);
78
}
79
}
80
81
register_plugin(
new
BrowseUploadDelete());
Fossology\DelAgent\UI\Page\BrowseUploadDelete
UI plugin to delete uploaded files.
Definition:
delete-file-browse.php:28
Fossology\DelAgent\UI\Page\BrowseUploadDelete\RegisterMenus
RegisterMenus()
Customize submenus.
Definition:
delete-file-browse.php:53
Fossology\Lib\Auth\Auth
Contains the constants and helpers for authentication of user.
Definition:
Auth.php:24
Fossology\Lib\Auth\Auth\PERM_ADMIN
const PERM_ADMIN
Definition:
Auth.php:52
Fossology\Lib\Dao\FolderDao
Definition:
FolderDao.php:18
Fossology\Lib\Dao\UploadDao
Definition:
UploadDao.php:26
Fossology\Lib\Plugin\DefaultPlugin
Definition:
DefaultPlugin.php:22
Fossology\Lib\Plugin\DefaultPlugin\handle
handle(Request $request)
menu_insert
menu_insert($Path, $LastOrder=0, $URI=NULL, $Title=NULL, $Target=NULL, $HTML=NULL)
Given a Path, order level for the last item, and optional plugin name, insert the menu item.
Definition:
common-menu.php:269
Traceback_uri
Traceback_uri()
Get the URI without query to this location.
Definition:
common-parm.php:97
plugin_find
plugin_find($pluginName)
Given the official name of a plugin, return the $Plugins object.
Definition:
common-plugin.php:197
Fossology\DelAgent\UI\Page
UI namespace for DelAgent.
src
delagent
ui
delete-file-browse.php
Generated on Mon Nov 18 2024 07:37:12 for FOSSology by
1.9.1