-
Notifications
You must be signed in to change notification settings - Fork 1
/
sharegroup.php
90 lines (81 loc) · 3.16 KB
/
sharegroup.php
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
<?php
require 'config.php';
include($config['root_dir'] . 'includes/bootstrap_curator.inc');
connect();
loginTest();
if (loginTest2()) {
$row = loadUser($_SESSION['username']);
$myname = $row['users_name'];
$myid = $row['users_uid'];
}
//ob_start();
//authenticate_redirect(array(USER_TYPE_ADMINISTRATOR, USER_TYPE_CURATOR, USER_TYPE_PARTICIPANT));
authenticate_redirect(array(USER_TYPE_ADMINISTRATOR, USER_TYPE_CURATOR));
//ob_end_flush();
include($config['root_dir'].'theme/admin_header.php');
?>
<div id="primaryContentContainer">
<div id="primaryContent">
<h1>Sharing private data</h1>
<div class="section">
<p>Phenotype and genotype datasets you add to T3 are stamped
<b>Public</b>, <b>CAP</b> or <b>Private</b>, as you choose.
CAP data will become Public after X months by Triticeae CAP project policy.
Private data will be visible only to the users you specify here.
It is your responsibility to notify these users that some of the
data they see is private and to discuss any restrictions on their
use of it.
<?php
// If we're re-entering the script with data, handle it.
//print "<pre>"; print_r($_POST); print "</pre>";
if ( isset($_POST['newshare']) && $_POST['newshare'] != "" ) {
$newshare = $_POST['newshare'];
$_POST['newshare'] = "";
$sql="select users_uid from users where users_name = '$newshare'";
$r = mysql_query($sql);
if (mysql_num_rows($r) == 0)
echo "<p><font color=red>\"$newshare\" not found.</font>";
else {
$row = mysql_fetch_row($r);
$shareuid = $row[0];
$sql = "insert into sharegroup (owner_users_uid, shareto_users_uid) values ($myid, $shareuid)";
$r = mysql_query($sql) or die(mysql_error());
}
}
if (isset($_POST['deselGroup'])) {
$remove = $_POST['deselGroup'];
for ($i=0; $i < count($remove); $i++) {
$sql = "delete from sharegroup
where owner_users_uid = $myid
and shareto_users_uid = $remove[$i]";
$r = mysql_query($sql) or die(mysql_error());
}
}
// End of handling user input.
echo "<h3><font color=blue>Current group members</font></h3>";
print "<form id=\"deselGroupForm\" action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";
print "<select name=\"deselGroup[]\" multiple=\"multiple\" style=\"height: 6em;width: 16em\">";
$sql = "select u2.users_uid, u2.name
from users u, users u2, sharegroup
where u.users_uid = $myid
and sharegroup.owner_users_uid = u.users_uid
and u2.users_uid = sharegroup.shareto_users_uid";
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_row($result)) {
print "<option value=\"$row[0]\">$row[1]</option>\n";
}
print "</select>";
print " <input type=\"submit\" value=\"Remove highlighted members\" /></p>";
print "</form>";
print "<p>";
print "<form action = \"".$_SERVER['PHP_SELF']."\" method=\"post\">";
print "Add a member<br>";
print "<input type=text name=newshare>";
print "<input type=submit value=\"Add\"><br>";
print "User's T3 email address";
print "</form>";
print "<p>";
print "</div></div></div>";
$footer_div=1;
include($config['root_dir'].'theme/footer.php');
?>