From 67955ebc650887a6aeb893b295ded37f21d9294a Mon Sep 17 00:00:00 2001 From: Robert Goldmann <deadlocker@gmx.de> Date: Tue, 30 Jul 2019 19:31:50 +0200 Subject: [PATCH] Fixed #24 - cleanup --- client/static/js/main.js | 45 +----- php/admin/admin-edit-subtask.php | 154 -------------------- php/admin/admin-subtasks.php | 128 ---------------- php/admin/helper/checkLogin.php | 32 ---- php/admin/helper/delete-milestone.php | 30 ---- php/admin/helper/delete-roadmap.php | 30 ---- php/admin/helper/delete-subtask.php | 36 ----- php/admin/helper/delete-task.php | 30 ---- php/admin/helper/edit-milestone.php | 94 ------------ php/admin/helper/edit-roadmap.php | 67 --------- php/admin/helper/edit-subtask.php | 77 ---------- php/admin/helper/edit-task.php | 77 ---------- php/admin/helper/mark-all-tasks-as-done.php | 30 ---- php/admin/helper/settings-template.php | 9 -- 14 files changed, 2 insertions(+), 837 deletions(-) delete mode 100644 php/admin/admin-edit-subtask.php delete mode 100644 php/admin/admin-subtasks.php delete mode 100644 php/admin/helper/checkLogin.php delete mode 100644 php/admin/helper/delete-milestone.php delete mode 100644 php/admin/helper/delete-roadmap.php delete mode 100644 php/admin/helper/delete-subtask.php delete mode 100644 php/admin/helper/delete-task.php delete mode 100644 php/admin/helper/edit-milestone.php delete mode 100644 php/admin/helper/edit-roadmap.php delete mode 100644 php/admin/helper/edit-subtask.php delete mode 100644 php/admin/helper/edit-task.php delete mode 100644 php/admin/helper/mark-all-tasks-as-done.php delete mode 100644 php/admin/helper/settings-template.php diff --git a/client/static/js/main.js b/client/static/js/main.js index 539cc9b..513dfcc 100644 --- a/client/static/js/main.js +++ b/client/static/js/main.js @@ -11,7 +11,7 @@ $(document).ready(function() //getting the next element var $content = $header.next(); - //open up the content needed - toggle the slide- if visible, slide up, if not slidedown. + //open up the content needed - toggle the slide- if visible, slide up, if not slide down. $content.slideToggle(200); }); @@ -33,21 +33,6 @@ $(document).ready(function() }); } - $('.button-save-milestone').click(function() - { - editMilestone(this.dataset.id, this.dataset.roadmapid); - }); - - $('.button-save-task').click(function() - { - editTask(this.dataset.id, this.dataset.milestoneid); - }); - - $('.button-save-subtask').click(function() - { - editSubtask(this.dataset.id, this.dataset.taskid); - }); - $('.button-delete-roadmap').click(function() { var response = confirm("Do you really want to delete this roadmap?"); @@ -108,11 +93,6 @@ $(document).ready(function() formatSubmit: 'yyyy-mm-dd' }); - $('#button-mark-all-as-done').click(function() - { - markAllTasksAsDone(this.dataset.milestoneid); - }); - createTrainMap(); }); @@ -123,7 +103,7 @@ function isNull(object) function hideElement(element, value) { - if(value == true) + if(value === true) { element.classList.add("hide"); } @@ -236,24 +216,3 @@ function validateNewTaskForm() return true; } - -function markAllTasksAsDone(milestone_ID) -{ - $.post('../admin/helper/mark-all-tasks-as-done.php', - { - "milestoneID": milestone_ID - - }, function(data, error) - { - data = data.toString().trim(); - - if(data != "error" && data != "bad_login") - { - window.location.href = "../admin/admin-tasks.php?id=" + milestone_ID; - } - else - { - alert('An error occurred while marking all tasks as done'); - } - }); -} diff --git a/php/admin/admin-edit-subtask.php b/php/admin/admin-edit-subtask.php deleted file mode 100644 index 8edd018..0000000 --- a/php/admin/admin-edit-subtask.php +++ /dev/null @@ -1,154 +0,0 @@ -<!DOCTYPE html> - -<?php -if(!isset($_SESSION)) -{ - session_start(); -} -if(!isset($_SESSION['loggedIn'])) -{ - header('Location: login.php'); -} - -include_once('../getLanguageJSON.php'); -include_once('../database.php'); - -if(!isset($_GET['taskID'])) -{ - header('Location: ../error.php?message=error_param_missing'); - exit; -} - -$taskID = $_GET['taskID']; -if(!is_numeric($taskID) || $taskID < 1) -{ - header('Location: ../error.php?message=error_param_invalid'); - exit; -} - - -if(!isset($_GET['edit'])) -{ - $_GET['edit'] = "false"; - - $ID = 0; - - $db = new DB(); - $db->createTables(); -} -else -{ - if(!isset($_GET['id'])) - { - header('Location: ../error.php?message=error_param_missing'); - exit; - } - - $ID = $_GET['id']; - if(!is_numeric($ID) || $ID < 1) - { - header('Location: ../error.php?message=error_param_invalid'); - exit; - } - - $db = new DB(); - $db->createTables(); - - $subtask = $db->getSubtask($ID); - if($subtask == false) - { - header('Location: ../error.php?message=error_subtask_not_existing'); - exit; - } -} -?> -<html xmlns="http://www.w3.org/1999/html"> - <head> - <meta charset="UTF-8"/> - <?php - if($_GET['edit'] == "false") - { - echo '<title>New Subtask</title>'; - } - else - { - echo '<title>Edit Subtask</title>'; - } - ?> - <!--Import Google Icon Font--> - <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> - <!--Import materialize.css--> - <link type="text/css" rel="stylesheet" href="../../materialize/css/materialize.min.css" media="screen,projection"/> - <link type="text/css" rel="stylesheet" href="../../css/style.css"/> - - <!--Import jQuery before materialize.js--> - <script type="text/javascript" src="../../js/jquery-2.2.4.min.js"></script> - <script type="text/javascript" src="../../materialize/js/materialize.min.js"></script> - <script type="text/javascript" src="../../js/main.js"></script> - <script type="text/javascript" src="../../js/ResizeSensor.js"></script> - <script type="text/javascript" src="../../js/ElementQueries.js"></script> - - <!--Let browser know website is optimized for mobile--> - <meta name="viewport" content="width=device-width, initial-scale=1.0"/> - </head> - - <body class="grey lighten-3"> - <div class="hide" id="edit"><?php echo $_GET['edit'];?></div> - <div id="main"> - <div class="container"> - <?php - if($_GET['edit'] == "false") - { - echo '<h2 class="center-align" id="headline">New Subtask</h2>'; - } - else - { - echo '<h2 class="center-align" id="headline">Edit Subtask</h2>'; - } - ?> - - <div class="row center-align"> - <div class="col s12 m8 offset-m2 l6 offset-l3"> - <div class="input-field col s12"> - <input id="title" name="title" type="text" value="<?php if(isset($subtask)){echo $subtask['Title'];}?>"> - <label for="title">Title</label> - </div> - </div> - </div> - <div class="row center-align"> - <div class="col s12 m8 offset-m2 l6 offset-l3"> - <div class="input-field col s12"> - <input id="description" name="description" type="text" value="<?php if(isset($subtask)){echo $subtask['Description'];}?>"> - <label for="description">Description</label> - </div> - </div> - </div> - <div class="row center-align"> - <div class="col s12 m8 offset-m2 l6 offset-l3"> - <div class="col s12 left-align"> - <input type="checkbox" id="checkbox-done" - <?php - if(isset($subtask)) - { - if($subtask['Status'] == "1") - { - echo "checked"; - } - } - ?> - /> - <label for="checkbox-done">Done</label> - </div> - </div> - </div> - - <div class="row center-align margin-top"> - <div class="col s12 m8 offset-m2 l6 offset-l3"> - <a class="waves-effect waves-light btn blue darken-3" href="admin-subtasks.php?id=<?php echo $taskID;?>"><i class="material-icons left">arrow_back</i>Back</a> - <a class="waves-effect waves-light btn blue darken-3 margin-left button-save-subtask" data-id="<?php echo $ID;?>" data-taskid="<?php echo $taskID;?>"><i class="material-icons left">save</i>Save</a> - </div> - </div> - </div> - </div> - </body> -</html> \ No newline at end of file diff --git a/php/admin/admin-subtasks.php b/php/admin/admin-subtasks.php deleted file mode 100644 index 6a413f6..0000000 --- a/php/admin/admin-subtasks.php +++ /dev/null @@ -1,128 +0,0 @@ -<!DOCTYPE html> - -<?php -if(!isset($_SESSION)) -{ - session_start(); -} -if(!isset($_SESSION['loggedIn'])) -{ - header('Location: login.php'); -} - -include_once('../getLanguageJSON.php'); -include_once('../database.php'); - -if(!isset($_GET['id'])) -{ - header('Location: ../error.php?message=error_param_missing'); - exit; -} - -$ID = $_GET['id']; -if(!is_numeric($ID) || $ID < 1) -{ - header('Location: ../error.php?message=error_param_invalid'); - exit; -} - -$db = new DB(); -$db->createTables(); - -$task = $db->getTask($ID); -if($task == false) -{ - header('Location: ../error.php?message=error_subtask_not_existing'); - exit; -} - -?> -<html xmlns="http://www.w3.org/1999/html"> -<head> - <meta charset="UTF-8"/> - <title>Subtasks - Adminarea</title> - <!--Import Google Icon Font--> - <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> - <!--Import materialize.css--> - <link type="text/css" rel="stylesheet" href="../../materialize/css/materialize.min.css" media="screen,projection"/> - <link type="text/css" rel="stylesheet" href="../../css/style.css"/> - - <!--Import jQuery before materialize.js--> - <script type="text/javascript" src="../../js/jquery-2.2.4.min.js"></script> - <script type="text/javascript" src="../../materialize/js/materialize.min.js"></script> - <script type="text/javascript" src="../../js/main.js"></script> - <script type="text/javascript" src="../../js/ResizeSensor.js"></script> - <script type="text/javascript" src="../../js/ElementQueries.js"></script> - - <!--Let browser know website is optimized for mobile--> - <meta name="viewport" content="width=device-width, initial-scale=1.0"/> -</head> - -<body class="grey lighten-3"> -<a class="waves-effect waves-light btn blue darken-3" href="admin-tasks.php?id=<?php echo $task['MilestoneID'];?>"><i class="material-icons left">arrow_back</i>Back</a> -<a class="waves-effect waves-light btn blue darken-3 right" href="logout.php"><i class="material-icons left">lock</i>Logout</a> -<div id="main"> - <div class="container"> - <h2 class="center-align truncate" id="headline"><?php echo $task['Title'];?></h2> - <h4 class="center-align" id="headline">Subtasks</h4> - - <div class="row"> - <div class="col s12 m8 offset-m2 l6 offset-l3 center-align"> - <a class="waves-effect waves-light btn blue darken-3" href="admin-edit-subtask.php?taskID=<?php echo $ID;?>"><i - class="material-icons left">add</i>New</a> - </div> - </div> - <div class="row"> - <div class="col s12 m10 offset-m1 l8 offset-l2"> - <table class="bordered"> - <thead> - <tr> - <th data-field="id">ID</th> - <th data-field="project-name">Title</th> - <th data-field="project-name">Status</th> - </tr> - </thead> - - <tbody> - <?php - $tasks = $db->getSubtasks($ID); - - if($tasks == false) - { - echo '<td colspan="6" class="center-align">No Subtasks</td>'; - exit; - } - else - { - for($i = 0; $i < sizeof($tasks); $i++) - { - $status = $tasks[$i]['Status']; - echo '<tr>' . - '<td>' . $tasks[$i]['ID'] . '</td>' . - '<td>' . $tasks[$i]['Title'] . '</td>'; - - if($status == "0") - { - echo '<td><i class="material-icons red-text">build</i></td>'; - } - else - { - echo '<td><i class="material-icons green-text">check</i></td>'; - } - - echo '<td class="right-align">' . - '<a class="btn-flat no-padding tooltipped" href="admin-edit-subtask.php?id=' . $tasks[$i]['ID'] . '&taskID='. $ID .'&edit=true" data-position="bottom" data-delay="50" data-tooltip="Edit"><i class="material-icons left">edit</i></a>' . - '<a class="btn-flat button-delete-subtask no-padding tooltipped" data-id="' . $tasks[$i]['ID'] . '" data-taskid="' . $ID . '" data-position="bottom" data-delay="50" data-tooltip="Delete"><i class="material-icons left">delete</i></a>' . - '</td>' . - '</tr>'; - } - } - ?> - </tbody> - </table> - </div> - </div> - </div> -</div> -</body> -</html> \ No newline at end of file diff --git a/php/admin/helper/checkLogin.php b/php/admin/helper/checkLogin.php deleted file mode 100644 index 7282760..0000000 --- a/php/admin/helper/checkLogin.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -require_once('settings.php'); - -if(!isset($_SESSION)) -{ - session_start(); -} - -if($_SERVER['REQUEST_METHOD'] == 'POST') -{ - if(isset($_POST['password'])) - { - if($_POST['password'] == $admin_password) - { - $_SESSION['loggedIn'] = 'true'; - echo "success"; - } - else - { - echo "bad_login"; - } - } - else - { - echo "error"; - } -} -else -{ - echo "error"; -} \ No newline at end of file diff --git a/php/admin/helper/delete-milestone.php b/php/admin/helper/delete-milestone.php deleted file mode 100644 index 3f13922..0000000 --- a/php/admin/helper/delete-milestone.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -include_once('../../database.php'); - -if($_SERVER['REQUEST_METHOD'] == 'POST') -{ - if(!isset($_POST['milestone_ID'])) - { - echo "error"; - exit; - } - - $db = new DB(); - $db->createTables(); - - if($db->deleteMilestone($_POST['milestone_ID']) == false) - { - echo "error"; - exit; - } - else - { - echo "success"; - exit; - } -} -else -{ - echo "error"; - exit; -} \ No newline at end of file diff --git a/php/admin/helper/delete-roadmap.php b/php/admin/helper/delete-roadmap.php deleted file mode 100644 index 5458faa..0000000 --- a/php/admin/helper/delete-roadmap.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -include_once('../../database.php'); - -if($_SERVER['REQUEST_METHOD'] == 'POST') -{ - if(!isset($_POST['roadmap_ID'])) - { - echo "error"; - exit; - } - - $db = new DB(); - $db->createTables(); - - if($db->deleteRoadmap($_POST['roadmap_ID']) == false) - { - echo "error"; - exit; - } - else - { - echo "success"; - exit; - } -} -else -{ - echo "error"; - exit; -} \ No newline at end of file diff --git a/php/admin/helper/delete-subtask.php b/php/admin/helper/delete-subtask.php deleted file mode 100644 index 0e15489..0000000 --- a/php/admin/helper/delete-subtask.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -include_once('../../database.php'); - -if($_SERVER['REQUEST_METHOD'] == 'POST') -{ - if(!isset($_POST['subtask_ID'])) - { - echo "error"; - exit; - } - - if(!isset($_POST['task_ID'])) - { - echo "error"; - exit; - } - - $db = new DB(); - $db->createTables(); - - if($db->deleteSubtask($_POST['subtask_ID'], $_POST['task_ID']) == false) - { - echo "error"; - exit; - } - else - { - echo "success"; - exit; - } -} -else -{ - echo "error"; - exit; -} \ No newline at end of file diff --git a/php/admin/helper/delete-task.php b/php/admin/helper/delete-task.php deleted file mode 100644 index 181dbb9..0000000 --- a/php/admin/helper/delete-task.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -include_once('../../database.php'); - -if($_SERVER['REQUEST_METHOD'] == 'POST') -{ - if(!isset($_POST['task_ID'])) - { - echo "error"; - exit; - } - - $db = new DB(); - $db->createTables(); - - if($db->deleteTask($_POST['task_ID']) == false) - { - echo "error"; - exit; - } - else - { - echo "success"; - exit; - } -} -else -{ - echo "error"; - exit; -} \ No newline at end of file diff --git a/php/admin/helper/edit-milestone.php b/php/admin/helper/edit-milestone.php deleted file mode 100644 index 55eed60..0000000 --- a/php/admin/helper/edit-milestone.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -include_once('../../database.php'); - -if($_SERVER['REQUEST_METHOD'] == 'POST') -{ - if(!isset($_POST['edit'])) - { - echo "error"; - exit; - } - - if(!isset($_POST['ID'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['roadmap-ID'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['version-name'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['version-code'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['title'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['due-date'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['done-date'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['done'])) - { - echo "error-edit"; - exit; - } - - $db = new DB(); - $db->createTables(); - - if($_POST['edit'] == "true") - { - if($db->updateMilestone($_POST['ID'], $_POST['version-code'], $_POST['version-name'], $_POST['title'], $_POST['due-date'], $_POST['done-date'], $_POST['done']) == false) - { - echo "error-edit"; - exit; - } - else - { - echo "success"; - exit; - } - } - else - { - if($db->insertMilestone($_POST['roadmap-ID'], $_POST['version-code'], $_POST['version-name'], $_POST['title'], $_POST['due-date'], $_POST['done-date'], $_POST['done']) == false) - { - echo "error-insert"; - exit; - } - else - { - echo "success"; - exit; - } - } -} -else -{ - echo "error"; - exit; -} \ No newline at end of file diff --git a/php/admin/helper/edit-roadmap.php b/php/admin/helper/edit-roadmap.php deleted file mode 100644 index 3c74d7a..0000000 --- a/php/admin/helper/edit-roadmap.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -include_once('../../database.php'); - -if($_SERVER['REQUEST_METHOD'] == 'POST') -{ - if(!isset($_POST['edit'])) - { - echo "error"; - exit; - } - - if($_POST['edit'] == "true") - { - if(!isset($_POST['ID'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['project-name'])) - { - echo "error-edit"; - exit; - } - - $db = new DB(); - $db->createTables(); - - if($db->updateRoadmap($_POST['ID'], $_POST['project-name']) == false) - { - echo "error-edit"; - exit; - } - else - { - echo "success"; - exit; - } - } - else - { - if(!isset($_POST['project-name'])) - { - echo "error-insert"; - exit; - } - - $db = new DB(); - $db->createTables(); - - if($db->insertRoadmap($_POST['project-name']) == false) - { - echo "error-insert"; - exit; - } - else - { - echo "success"; - exit; - } - } -} -else -{ - echo "error"; - exit; -} \ No newline at end of file diff --git a/php/admin/helper/edit-subtask.php b/php/admin/helper/edit-subtask.php deleted file mode 100644 index 2be94bb..0000000 --- a/php/admin/helper/edit-subtask.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -include_once('../../database.php'); - -if($_SERVER['REQUEST_METHOD'] == 'POST') -{ - if(!isset($_POST['edit'])) - { - echo "error"; - exit; - } - - if(!isset($_POST['ID'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['task-ID'])) - { - echo "error-edit"; - exit; - } - - - if(!isset($_POST['title'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['description'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['done'])) - { - echo "error-edit"; - exit; - } - - $db = new DB(); - $db->createTables(); - - if($_POST['edit'] == "true") - { - if($db->updateSubtask($_POST['ID'], $_POST['task-ID'], $_POST['title'], $_POST['description'], $_POST['done']) == false) - { - echo "error-edit"; - exit; - } - else - { - echo "success"; - exit; - } - } - else - { - if($db->insertSubtask($_POST['task-ID'], $_POST['title'], $_POST['description'], $_POST['done']) == false) - { - echo "error-insert"; - exit; - } - else - { - echo "success"; - exit; - } - } -} -else -{ - echo "error"; - exit; -} \ No newline at end of file diff --git a/php/admin/helper/edit-task.php b/php/admin/helper/edit-task.php deleted file mode 100644 index 9e9922c..0000000 --- a/php/admin/helper/edit-task.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -include_once('../../database.php'); - -if($_SERVER['REQUEST_METHOD'] == 'POST') -{ - if(!isset($_POST['edit'])) - { - echo "error"; - exit; - } - - if(!isset($_POST['ID'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['milestone-ID'])) - { - echo "error-edit"; - exit; - } - - - if(!isset($_POST['title'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['description'])) - { - echo "error-edit"; - exit; - } - - if(!isset($_POST['done'])) - { - echo "error-edit"; - exit; - } - - $db = new DB(); - $db->createTables(); - - if($_POST['edit'] == "true") - { - if($db->updateTask($_POST['ID'], $_POST['milestone-ID'], $_POST['title'], $_POST['description'], $_POST['done']) == false) - { - echo "error-edit"; - exit; - } - else - { - echo "success"; - exit; - } - } - else - { - if($db->insertTask($_POST['milestone-ID'], $_POST['title'], $_POST['description'], $_POST['done']) == false) - { - echo "error-insert"; - exit; - } - else - { - echo "success"; - exit; - } - } -} -else -{ - echo "error"; - exit; -} \ No newline at end of file diff --git a/php/admin/helper/mark-all-tasks-as-done.php b/php/admin/helper/mark-all-tasks-as-done.php deleted file mode 100644 index 1a56e44..0000000 --- a/php/admin/helper/mark-all-tasks-as-done.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -include_once('../../database.php'); - -if($_SERVER['REQUEST_METHOD'] == 'POST') -{ - if(!isset($_POST['milestoneID'])) - { - echo "error"; - exit; - } - - $db = new DB(); - $db->createTables(); - - if($db->markAllTasksAsDone($_POST['milestoneID']) == false) - { - echo "error"; - exit; - } - else - { - echo "success"; - exit; - } -} -else -{ - echo "error"; - exit; -} \ No newline at end of file diff --git a/php/admin/helper/settings-template.php b/php/admin/helper/settings-template.php deleted file mode 100644 index 1e8bfe8..0000000 --- a/php/admin/helper/settings-template.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php -// mysql or pgsql -$database_type = "mysql"; -$database_name=""; -$database_user=""; -$database_password=""; - -$admin_password="123"; - -- GitLab