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"; // no url = this url $text = _("Select the folder to"); $text1 = _("delete"); $V.= "$text $text1.\n"; $V.= "\n"; $text = _("Select the folder to delete: "); $V.= "

$text\n"; $V.= "

\n"; $text = _("Delete"); - $V.= "\n"; + $V.= "\n"; $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"; // no url = this url $text = _("Select the uploaded file to"); $text1 = _("delete"); $V.= "$text $text1\n"; $V.= "\n"; $text = _("Select the uploaded file to delete:"); $V.= "

$text

\n"; $V.= "

    \n"; $text = _("Select the folder containing the file to delete: "); $V.= "
  1. $text"; $V.= "

    \n"; $text = _("Select the uploaded project to delete:"); $V.= "

  2. $text"; $V.= "
    \n"; $V.= "

    \n"; $V.= "

    \n"; $V.= "
\n"; $text = _("Delete"); - $V.= "\n"; + $V.= "\n"; $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. #}
  1. {{ "Select the parent folder:"|trans }}

  2. {{ "Enter the new folder name:"|trans }}

  3. {{ "Enter a meaningful description:"|trans }}
- +
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 }}

  1. {{ "Select the folder to edit:"|trans }}

  2. {{ "Change folder name:"|trans }}

  3. {{ "Change folder description:"|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 %}
  1. {{ 'Select the folder that contains the upload'|trans }}: {% include 'components/select-folder.html.twig' with {'name': 'oldfolderid', 'id': 'oldfolderid', 'selected': folderId} %}
  2. {{ "Select the upload you wish to edit"|trans }}: {% if uploadId is not empty %} {% import "include/macros.html.twig" as macro %} {{ macro.select('uploadselect',uploadList,'uploadselect',uploadId,uploadAction) }} {% else %} {{ 'No upload available in this folder'|trans }} {% endif %}
  3. {{ 'Upload name'|trans }}:
  4. {{ 'Upload description'|trans }}:
- +
{% 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 %}
{{ "Select an uploaded file for additional analysis."|trans }}
  1. {{"Select the folder containing the upload you wish to analyze"|trans}}:
  2. {{"Select the upload to analyze"|trans}}:
  3. {{ "Select additional analysis."|trans }}
    {{ out }}
- +
{% 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 }}:
{{ 'Select the file to upload'|trans }}:

- +
{% endblock %} diff --git a/src/www/ui/user-del.php b/src/www/ui/user-del.php index a884bd3b..73e83c47 100644 --- a/src/www/ui/user-del.php +++ b/src/www/ui/user-del.php @@ -1,163 +1,163 @@ Name = "user_del"; $this->Title = TITLE_user_del; $this->MenuList = "Admin::Users::Delete"; $this->DBaccess = PLUGIN_DB_ADMIN; parent::__construct(); } /** * \brief Delete a user. * * \return NULL on success, string on failure. */ function Delete($UserId) { global $PG_CONN; /* See if the user already exists */ $sql = "SELECT * FROM users WHERE user_pk = '$UserId' LIMIT 1;"; $result = pg_query($PG_CONN, $sql); DBCheckResult($result, $sql, __FILE__, __LINE__); $row = pg_fetch_assoc($result); pg_free_result($result); if (empty($row['user_name'])) { $text = _("User does not exist."); return($text); } /* Delete the users group * First look up the users group_pk */ $sql = "SELECT group_pk FROM groups WHERE group_name = '$row[user_name]' LIMIT 1;"; $result = pg_query($PG_CONN, $sql); DBCheckResult($result, $sql, __FILE__, __LINE__); $GroupRow = pg_fetch_assoc($result); pg_free_result($result); /* Delete all the group user members for this user_pk */ $sql = "DELETE FROM group_user_member WHERE user_fk = '$UserId'"; $result = pg_query($PG_CONN, $sql); DBCheckResult($result, $sql, __FILE__, __LINE__); pg_free_result($result); /* Delete the user */ $sql = "DELETE FROM users WHERE user_pk = '$UserId';"; $result = pg_query($PG_CONN, $sql); DBCheckResult($result, $sql, __FILE__, __LINE__); pg_free_result($result); /* Now delete their group */ DeleteGroup($GroupRow['group_pk']); /* Make sure it was deleted */ $sql = "SELECT * FROM users WHERE user_name = '$UserId' LIMIT 1;"; $result = pg_query($PG_CONN, $sql); DBCheckResult($result, $sql, __FILE__, __LINE__); $rowCount = pg_num_rows($result); pg_free_result($result); if ($rowCount != 0) { $text = _("Failed to delete user."); return($text); } return(NULL); } // Delete() /** * \brief Generate the text for this plugin. */ public function Output() { global $PG_CONN; $V=""; /* If this is a POST, then process the request. */ $User = GetParm('userid',PARM_TEXT); $Confirm = GetParm('confirm',PARM_INTEGER); if (!empty($User)) { if ($Confirm != 1) { $rc = "Deletion not confirmed. Not deleted."; } else { $rc = $this->Delete($User); } if (empty($rc)) { /* Need to refresh the screen */ $text = _("User deleted."); $this->vars['message'] = $text; } else { $this->vars['message'] = $rc; } } /* Get the user list */ $currentUserId = Auth::getUserId(); $sql = "SELECT user_pk,user_name,user_desc FROM users WHERE user_pk != '$currentUserId' AND user_pk != '1' ORDER BY user_name"; $result = pg_query($PG_CONN, $sql); DBCheckResult($result, $sql, __FILE__, __LINE__); if (pg_num_rows($result) == 0) { $V .= _("No users to delete."); } else { /* Build HTML form */ $V .= _("Deleting a user removes the user entry from the FOSSology system. The user's name, account information, and password will be permanently removed. (There is no 'undo' to this delete.)

\n"); $V .= "

\n"; // no url = this url $V .= _("To delete a user, enter the following information:

\n"); $V .= "

    \n"; $V .= _("
  1. Select the user to delete.
    "); $V .= "\n"; $text = _("Confirm user deletion"); $V .= "

  2. $text: "; $V .= "
\n"; $text = _("Delete"); - $V .= "\n"; + $V .= "\n"; $V .= "
\n"; } pg_free_result($result); return $V; } } $NewPlugin = new user_del;