diff --git a/src/delagent/ui/admin-folder-delete.php b/src/delagent/ui/admin-folder-delete.php index 943def8f..f4b0fc56 100644 --- a/src/delagent/ui/admin-folder-delete.php +++ b/src/delagent/ui/admin-folder-delete.php @@ -1,136 +1,136 @@ Name = "admin_folder_delete"; $this->Title = TITLE_admin_folder_delete; $this->MenuList = "Organize::Folders::Delete Folder"; $this->Dependency = array(); $this->DBaccess = PLUGIN_DB_WRITE; parent::__construct(); $this->dbManager = $GLOBALS['container']->get('db.manager'); } /** * \brief Delete * Creates a job to detele the folder * * \param $folderpk - the folder_pk to remove * \return NULL on success, string on failure. */ function Delete($folderpk, $userId) { /* Can't remove top folder */ if ($folderpk == FolderGetTop()) { $text = _("Can Not Delete Root Folder"); return ($text); } /* Get the folder's name */ $FolderName = FolderGetName($folderpk); /* Prepare the job: job "Delete" */ $groupId = Auth::getGroupId(); $jobpk = JobAddJob($userId, $groupId, "Delete Folder: $FolderName"); if (empty($jobpk) || ($jobpk < 0)) { $text = _("Failed to create job record"); return ($text); } /* Add job: job "Delete" has jobqueue item "delagent" */ $jqargs = "DELETE FOLDER $folderpk"; $jobqueuepk = JobQueueAdd($jobpk, "delagent", $jqargs, NULL, NULL); if (empty($jobqueuepk)) { $text = _("Failed to place delete in job queue"); return ($text); } /* Tell the scheduler to check the queue. */ $success = fo_communicate_with_scheduler("database", $output, $error_msg); if (!$success) return $error_msg . "\n" . $output; return (NULL); } // Delete() /** * \brief Generate the text for this plugin. */ public function Output() { /* If this is a POST, then process the request. */ $folder = GetParm('folder', PARM_INTEGER); if (!empty($folder)) { $userId = Auth::getUserId(); $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;"; $Folder = $this->dbManager->getSingleRow($sql,array($folder,$userId),__METHOD__."GetRowWithFolderName"); if(!empty($Folder['folder_name'])){ $rc = $this->Delete($folder, $userId); if (empty($rc)) { /* Need to refresh the screen */ $text = _("Deletion of folder "); $text1 = _(" added to job queue"); $this->vars['message'] = $text . $Folder['folder_name'] . $text1; }else{ $text = _("Deletion of "); $text1 = _(" failed: "); $this->vars['message'] = $text . $Folder['folder_name'] . $text1 . $rc; } }else{ $text = _("Cannot delete this folder :: Permission denied"); $this->vars['message'] = $text; } } $V= "
\n"; return $V; } } $NewPlugin = new admin_folder_delete; diff --git a/src/delagent/ui/admin-upload-delete.php b/src/delagent/ui/admin-upload-delete.php index a4fdcd5c..806df573 100644 --- a/src/delagent/ui/admin-upload-delete.php +++ b/src/delagent/ui/admin-upload-delete.php @@ -1,187 +1,187 @@ Name = "admin_upload_delete"; $this->Title = TITLE_admin_upload_delete; $this->MenuList = "Organize::Uploads::Delete Uploaded File"; $this->DBaccess = PLUGIN_DB_WRITE; parent::__construct(); } /** * \brief Given a folder_pk, try to add a job after checking permissions. * \param $uploadpk - the upload(upload_id) you want to delete * * \return string with the message. */ function TryToDelete($uploadpk) { if (! GetUploadPerm($uploadpk) >= Auth::PERM_WRITE) { $text=_("You dont have permissions to delete the upload"); return DisplayMessage($text); } $rc = $this->Delete($uploadpk); if (! empty($rc)) { $text=_("Deletion Scheduling failed: "); return DisplayMessage($text.$rc); } /* Need to refresh the screen */ $URL = Traceback_uri() . "?mod=showjobs&upload=$uploadpk "; $LinkText = _("View Jobs"); $text=_("Deletion added to job queue."); $msg = "$text $LinkText"; return displayMessage($msg); } /** * \brief Given a folder_pk, add a job. * \param $uploadpk - the upload(upload_id) you want to delete * \param $Depends - Depends is not used for now * * \return NULL on success, string on failure. */ function Delete($uploadpk, $Depends = NULL) { /* Prepare the job: job "Delete" */ $user_pk = Auth::getUserId(); $group_pk = Auth::getGroupId(); $jobpk = JobAddJob($user_pk, $group_pk, "Delete", $uploadpk); if (empty($jobpk) || ($jobpk < 0)) { $text = _("Failed to create job record"); return ($text); } /* Add job: job "Delete" has jobqueue item "delagent" */ $jqargs = "DELETE UPLOAD $uploadpk"; $jobqueuepk = JobQueueAdd($jobpk, "delagent", $jqargs, NULL, NULL); if (empty($jobqueuepk)) { $text = _("Failed to place delete in job queue"); return ($text); } /* Tell the scheduler to check the queue. */ $success = fo_communicate_with_scheduler("database", $output, $error_msg); if (!$success) { $error_msg = _("Is the scheduler running? Your jobs have been added to job queue."); $URL = Traceback_uri() . "?mod=showjobs&upload=$uploadpk "; $LinkText = _("View Jobs"); $msg = "$error_msg $LinkText"; return $msg; } return (NULL); } // Delete() /** * \brief Generate the text for this plugin. */ public function Output() { $V = ""; /* If this is a POST, then process the request. */ $uploadpk = GetParm('upload', PARM_INTEGER); if (!empty($uploadpk)) { $V.= $this->TryToDelete($uploadpk); } /* Create the AJAX (Active HTTP) javascript for doing the reply and showing the response. */ $V.= ActiveHTTPscript("Uploads"); $V.= "\n"; /* Build HTML form */ $V.= "\n"; return $V; } } $NewPlugin = new admin_upload_delete; diff --git a/src/www/ui/template/admin-folder-create-form.html.twig b/src/www/ui/template/admin-folder-create-form.html.twig index 57b88ce5..f584f288 100644 --- a/src/www/ui/template/admin-folder-create-form.html.twig +++ b/src/www/ui/template/admin-folder-create-form.html.twig @@ -1,29 +1,29 @@ {# Copyright 2016 Siemens AG Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty. #} diff --git a/src/www/ui/template/admin-folder-edit-form.html.twig b/src/www/ui/template/admin-folder-edit-form.html.twig index c59970c7..4984c780 100644 --- a/src/www/ui/template/admin-folder-edit-form.html.twig +++ b/src/www/ui/template/admin-folder-edit-form.html.twig @@ -1,27 +1,27 @@{{ "The folder properties that can be changed are the folder name and description."|trans }} {{ "First select the folder to edit. Then enter the new values."|trans }} {{ "If no value is entered, then the corresponding field will not be changed."|trans }}
diff --git a/src/www/ui/template/admin_upload_edit.html.twig b/src/www/ui/template/admin_upload_edit.html.twig index fe4470f5..74f0fdd3 100644 --- a/src/www/ui/template/admin_upload_edit.html.twig +++ b/src/www/ui/template/admin_upload_edit.html.twig @@ -1,51 +1,51 @@ {# Copyright 2015 Siemens AG Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty. #} {% extends "include/base.html.twig" %} {% block content %} {% endblock %} {% block foot %} {{ parent() }} {% endblock %} diff --git a/src/www/ui/template/agent_adder.html.twig b/src/www/ui/template/agent_adder.html.twig index adbd93cf..072f3c12 100644 --- a/src/www/ui/template/agent_adder.html.twig +++ b/src/www/ui/template/agent_adder.html.twig @@ -1,77 +1,77 @@ {# Copyright 2014-2015 Siemens AG Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty. #} {% extends "include/base.html.twig" %} {% block content %} {% endblock %} {% block foot %} {{ parent() }} {% if uploadId %} {% endif %} {{ uploadScript }} {{ agentScript }} {{ outFoot }} {% endblock %} diff --git a/src/www/ui/template/oneshot-upload.html.twig b/src/www/ui/template/oneshot-upload.html.twig index 3f672b0c..65040397 100644 --- a/src/www/ui/template/oneshot-upload.html.twig +++ b/src/www/ui/template/oneshot-upload.html.twig @@ -1,24 +1,24 @@ {# Copyright 2014-2015 Siemens AG Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty. #} {% extends "include/base.html.twig" %} {% block content %} {{ 'This analyzer allows you to upload a single file for license analysis.'|trans }} {{ 'The limitations'|trans }}: