forked from NYCPlanning/edm-metadata-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_dataset_manage.php
More file actions
116 lines (96 loc) · 3.07 KB
/
Copy pathview_dataset_manage.php
File metadata and controls
116 lines (96 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
include ('navbar.php');
$email = $_SESSION['user'];
$u_type = $_SESSION['type'];
$sde = $_GET['sde'];
$common = $_GET['common'];
$delete_email = $_GET['delete_email'];
if(isset($_GET['add_email'])) {
$email = $_GET['add_email'];
$a_query ="INSERT INTO collaboration(sdename, email) VALUES ($1,$2)";
pg_query_params($db, $a_query, array($sde, $email));
}
if(isset($_GET['delete'])) {
if($email == $delete_email){
$d_query = "DELETE FROM collaboration WHERE sdename = $1 AND email = $2";
pg_query_params($db, $d_query, array($sde, $delete_email));
echo '<script>';
echo 'window.location.href="view_dataset.php"'; //not showing an alert box.
echo '</script>';
} else {
$d_query = "DELETE FROM collaboration WHERE sdename = $1 AND email = $2";
pg_query_params($db, $d_query, array($sde, $delete_email));
}
}
$query = "SELECT email FROM collaboration WHERE sdename = $1 ORDER BY email";
$result = pg_query_params($db, $query, array($sde));
$row =pg_fetch_all($result);
?>
<style>
.collab_header {
display:inline-block;
}
.collab-add-button {
border:none;
}
.collab-add-button i {
color: black;
font-size: 20px;
}
.collab-add-button i:hover, .fa-trash-alt:hover {
color: #D96B27;
}
.fa-trash-alt {
color: black;
}
#email {
width: 70%;
}
</style>
<!-- Modal -->
<div id="addCollab" class="modal fade " role="dialog" style="margin-top: 200px;">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content ">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3 class="modal-title text-left" style="">Add Collaborators</h3>
</div>
<div class="modal-body">
<div class="">
<div class="text-center">
<form method="get" action="view_dataset_manage.php">
<label for="email">Email:</label>
<input type="text" name="add_email" id="email">
<input type="hidden" name="sde" value="<?php echo $sde?>">
<input type="hidden" name="common" value="<?php echo $common?>">
<input type="submit" name="submit" value="Add">
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<h3><?php echo $common; ?></h3>
<hr>
<h3 class="collab_header">Collaborators</h3>
<button type="button" data-toggle="modal" data-target="#addCollab" class="collab-add-button">
<i class="fas fa-plus-circle"></i>
</button>
<br>
<?php
// Displays all the retrieved data from the database
foreach($row as $r) {
echo "<p><a id=".$r["email"]."> <i id=".$r["email"]." class='far fa-trash-alt' onClick='deleteUser(this.id)' style='margin-right:5px;'></i></a>".$r["email"]." </p>";
}
?>
</div>
<script>
function deleteUser(id) {
if (confirm("Are you sure you want to delete this user?")) {
window.location.href= "view_dataset_manage.php?delete=True&sde=<?php echo $sde.'&common='.$common.'&delete_email=';?>"+id;
}
}
</script>