12 define(
"TITLE_ADMIN_FOLDER_DELETE", _(
"Delete Folder"));
26 $this->Name =
"admin_folder_delete";
27 $this->Title = TITLE_ADMIN_FOLDER_DELETE;
28 $this->MenuList =
"Organize::Folders::Delete Folder";
29 $this->Dependency = array();
31 parent::__construct();
32 $this->
dbManager = $GLOBALS[
'container']->get(
'db.manager');
33 $this->folderDao = $GLOBALS[
'container']->get(
'dao.folder');
44 $splitFolder = explode(
" ",$folderpk);
45 if (! $this->folderDao->isFolderAccessible($splitFolder[1], $userId)) {
46 $text = _(
"No access to delete this folder");
51 $text = _(
"Can Not Delete Root Folder");
57 $groupId = Auth::getGroupId();
58 $jobpk = JobAddJob($userId, $groupId,
"Delete Folder: $FolderName");
59 if (empty($jobpk) || ($jobpk < 0)) {
60 $text = _(
"Failed to create job record");
64 $jqargs =
"DELETE FOLDER $folderpk";
65 $jobqueuepk =
JobQueueAdd($jobpk,
"delagent", $jqargs, NULL, NULL);
66 if (empty($jobqueuepk)) {
67 $text = _(
"Failed to place delete in job queue");
74 return $error_msg .
"\n" . $output;
88 $splitFolder = explode(
" ",$folder);
89 if (!empty($folder)) {
90 $userId = Auth::getUserId();
91 $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;";
92 $Folder = $this->
dbManager->getSingleRow($sql,array($splitFolder[1],$userId),__METHOD__.
"GetRowWithFolderName");
93 if (!empty($Folder[
'folder_name'])) {
94 $rc = $this->
Delete($folder, $userId);
97 $text = _(
"Deletion of folder ");
98 $text1 = _(
" added to job queue");
99 $this->vars[
'message'] = $text . $Folder[
'folder_name'] . $text1;
101 $text = _(
"Deletion of ");
102 $text1 = _(
" failed: ");
103 $this->vars[
'message'] = $text . $Folder[
'folder_name'] . $text1 . $rc;
106 $text = _(
"Cannot delete this folder :: Permission denied");
107 $this->vars[
'message'] = $text;
111 $V=
"<form method='post'>\n";
112 $text = _(
"Select the folder to");
113 $text1 = _(
"delete");
114 $V.=
"$text <em>$text1</em>.\n";
116 $text = _(
"This will");
117 $text1 = _(
"delete");
118 $text2 = _(
"the folder, all subfolders, and all uploaded files stored within the folder!");
119 $V.=
"<li>$text <em>$text1</em> $text2\n";
120 $text = _(
"Be very careful with your selection since you can delete a lot of work!");
122 $text = _(
"All analysis only associated with the deleted uploads will also be deleted.");
124 $text = _(
"THERE IS NO UNDELETE. When you select something to delete, it will be removed from the database and file repository.");
127 $text = _(
"Select the folder to delete: ");
129 $V.=
"<select name='folder' class='ui-render-select2'>\n";
130 $text = _(
"select folder");
131 $V.=
"<option value='' disabled selected>[$text]</option>\n";
133 $V.=
"</select><P />\n";
135 $V.=
"<input type='submit' value='$text'>\n";
This is the Plugin class. All plugins should:
Contains the constants and helpers for authentication of user.
UI plugin to delete folders.
Delete($folderpk, $userId)
Creates a job to detele the folder.
__construct()
base constructor. Most plugins will just use this
Output()
This function is called when user output is requested. This function is responsible for content....
FolderGetName($FolderPk, $Top=-1)
Given a folder_pk, return the full path to this folder.
FolderListOption($ParentFolder, $Depth, $IncludeTop=1, $SelectId=-1, $linkParent=false, $OldParent=0)
Create the folder tree, using OPTION tags.
FolderGetTop()
DEPRECATED! Find the top-of-tree folder_pk for the current user.
JobQueueAdd($job_pk, $jq_type, $jq_args, $jq_runonpfile, $Depends, $host=NULL, $jq_cmd_args=NULL)
Insert a jobqueue + jobdepends records.
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