23 define(
"TITLE_ADMIN_FOLDER_DELETE", _(
"Delete Folder"));
35 function __construct()
37 $this->Name =
"admin_folder_delete";
38 $this->Title = TITLE_ADMIN_FOLDER_DELETE;
39 $this->MenuList =
"Organize::Folders::Delete Folder";
40 $this->Dependency = array();
42 parent::__construct();
43 $this->
dbManager = $GLOBALS[
'container']->get(
'db.manager');
44 $this->folderDao = $GLOBALS[
'container']->get(
'dao.folder');
55 $splitFolder = explode(
" ",$folderpk);
56 if (! $this->folderDao->isFolderAccessible($splitFolder[1], $userId)) {
57 $text = _(
"No access to delete this folder");
62 $text = _(
"Can Not Delete Root Folder");
68 $groupId = Auth::getGroupId();
69 $jobpk = JobAddJob($userId, $groupId,
"Delete Folder: $FolderName");
70 if (empty($jobpk) || ($jobpk < 0)) {
71 $text = _(
"Failed to create job record");
75 $jqargs =
"DELETE FOLDER $folderpk";
76 $jobqueuepk =
JobQueueAdd($jobpk,
"delagent", $jqargs, NULL, NULL);
77 if (empty($jobqueuepk)) {
78 $text = _(
"Failed to place delete in job queue");
85 return $error_msg .
"\n" . $output;
99 $splitFolder = explode(
" ",$folder);
100 if (!empty($folder)) {
101 $userId = Auth::getUserId();
102 $sql =
"SELECT folder_name FROM folder join users on (users.user_pk = folder.user_fk or users.user_perm = 10) where folder_pk = $1 and users.user_pk = $2;";
103 $Folder = $this->
dbManager->getSingleRow($sql,array($splitFolder[1],$userId),__METHOD__.
"GetRowWithFolderName");
104 if (!empty($Folder[
'folder_name'])) {
105 $rc = $this->
Delete($folder, $userId);
108 $text = _(
"Deletion of folder ");
109 $text1 = _(
" added to job queue");
110 $this->vars[
'message'] = $text . $Folder[
'folder_name'] . $text1;
112 $text = _(
"Deletion of ");
113 $text1 = _(
" failed: ");
114 $this->vars[
'message'] = $text . $Folder[
'folder_name'] . $text1 . $rc;
117 $text = _(
"Cannot delete this folder :: Permission denied");
118 $this->vars[
'message'] = $text;
122 $V=
"<form method='post'>\n";
123 $text = _(
"Select the folder to");
124 $text1 = _(
"delete");
125 $V.=
"$text <em>$text1</em>.\n";
127 $text = _(
"This will");
128 $text1 = _(
"delete");
129 $text2 = _(
"the folder, all subfolders, and all uploaded files stored within the folder!");
130 $V.=
"<li>$text <em>$text1</em> $text2\n";
131 $text = _(
"Be very careful with your selection since you can delete a lot of work!");
133 $text = _(
"All analysis only associated with the deleted uploads will also be deleted.");
135 $text = _(
"THERE IS NO UNDELETE. When you select something to delete, it will be removed from the database and file repository.");
138 $text = _(
"Select the folder to delete: ");
140 $V.=
"<select name='folder' class='ui-render-select2'>\n";
141 $text = _(
"select folder");
142 $V.=
"<option value='' disabled selected>[$text]</option>\n";
144 $V.=
"</select><P />\n";
146 $V.=
"<input type='submit' value='$text'>\n";
FolderListOption($ParentFolder, $Depth, $IncludeTop=1, $SelectId=-1, $linkParent=false, $OldParent=0)
Create the folder tree, using OPTION tags.
JobQueueAdd($job_pk, $jq_type, $jq_args, $jq_runonpfile, $Depends, $host=NULL, $jq_cmd_args=NULL)
Insert a jobqueue + jobdepends records.
FolderGetName($FolderPk, $Top=-1)
Given a folder_pk, return the full path to this folder.
FolderGetTop()
DEPRECATED! Find the top-of-tree folder_pk for the current user.
UI plugin to delete folders.
Delete($folderpk, $userId)
Creates a job to detele the folder.
Output()
This function is called when user output is requested. This function is responsible for content...
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
fo_communicate_with_scheduler($input, &$output, &$error_msg)
Communicate with scheduler, send commands to the scheduler, then get the output.
#define PLUGIN_DB_WRITE
Plugin requires write permission on DB.
fo_dbManager * dbManager
fo_dbManager object
This is the Plugin class. All plugins should: