-
Notifications
You must be signed in to change notification settings - Fork 9
/
omero_UI.php
234 lines (183 loc) · 8.13 KB
/
omero_UI.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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?php
// This file is part of the Huygens Remote Manager
// Copyright and license notice: see license.txt
// clear OMERO connection related variables if "disconnectOmero" was requested:
if (isset($_POST['disconnectOmero']) && isset($omeroConnection)) {
unset($omeroConnection);
unset($_SESSION['omeroConnection']);
}
// Dialog to ask for the OMERO credentials.
if (isset($_POST['getOmeroData']) && !isset($omeroConnection)) {
?>
<div id="floatingCredentialsDialog" title="OMERO login credentials">
<p>Your OMERO username and password are needed for
retrieving data. </p>
<p>Your login credentials will not be stored.</p>
<form name="omeroCheckCredentials" method="post">
<label for="omeroUser">Username:</label>
<input name="omeroUser" title="OMERO user name" type="text" size="8"
value="">
<br/>
<label for="omeroPass">Password:</label>
<input name="omeroPass" title="OMERO user password" type="password"
size="8" value="">
<input name="omeroCheckCredentials" type="hidden" value="true">
<input name="getOmeroData" type="hidden" value="true">
<br/>
<script>
$(function () {
var floatingCredentialsDialog = $("#floatingCredentialsDialog");
// Workaround to bind the 'Enter' button to the 'Submit' action.
floatingCredentialsDialog.keypress(function (e) {
if (e.keyCode == $.ui.keyCode.ENTER) {
$(':button:contains("Submit")').click();
}
});
floatingCredentialsDialog.dialog({
show: {
effect: "slide",
duration: 300
},
hide: {
effect: "fade",
duration: 300
},
modal: true,
buttons: {
"Submit": function () {
omeroLogin();
$(this).dialog("close");
}
}
})
});
</script>
</form> <!-- omeroCheckCredentials !-->
</div> <!-- floatingCredentialsDialog !-->
<?php
} // endif (isset($_POST['getOmeroData']) && !isset($omeroConnection))
// if we are connected to an OMERO server, always show the tree by default:
if (isset($omeroConnection) && !isset($_POST['disconnectOmero'])) {
?>
<script>
// hide the web up-/download button to prevent confusion with the
// OMERO transfer buttons as long as we're having an OMERO connection
hide("webTransferButton");
</script>
<div id="activeTransfer" title="OMERO transfer in progress">
<p>An OMERO transfer is currently running, please wait
until it has finished.</p>
<p>This message will automatically close upon completion.</p>
</div>
<script>
// Hide the "activeTransfer" div in the beginning
$(document).ready(function () {
$("#activeTransfer").hide();
});
function activeTransferDialog() {
$("#activeTransfer").dialog({
modal: true
})
}
</script>
<fieldset id="OmeroData">
<legend id="legendOmeroData">Your OMERO data</legend>
<div id="omeroSelection">
<form name="omeroForm"
onsubmit="return omeroTransfer(this, fileSelection,
'<?php echo $browse_folder; ?>')"
action="?folder=<?php echo $browse_folder; ?>"
method="post">
<div id="omeroActions">
<?php
if ($browse_folder == "src") {
?>
<input name="importFromOmero" type="submit"
onclick="activeTransferDialog();"
value="" class="icon remove"
onmouseover="Tip('Transfer selected files from OMERO')"
onmouseout="UnTip()"/>
<?php
} else {
?>
<input name="exportToOmero" type="submit"
onclick="activeTransferDialog();"
value="" class="icon down"
onmouseover="Tip('Transfer selected files to OMERO')"
onmouseout="UnTip()"/>
<?php
}
?>
<input type="button" class="icon clearlist"
onclick="UnTip(); cancelOmeroSelection()"
onmouseover="Tip('Reset OMERO selection')"
onmouseout="UnTip()"/>
<input name="refreshOmero" type="submit"
value="" class="icon update"
onclick="UnTip(); setActionToUpdate()"
onmouseover="Tip('Reload Omero tree view')"
onmouseout="UnTip()"/>
<input type="submit" class="icon abort" id="disconnectOmero"
name="disconnectOmero"
onclick="UnTip();"
onmouseover="Tip('Disconnect from OMERO')"
onmouseout="UnTip()"/>
<input name="OmeImages" type="hidden">
<input name="OmeDatasetId" type="hidden">
<input name="selectedFiles" type="hidden">
</div> <!-- omeroActions !-->
</form> <!-- omeroForm !-->
<fieldset>
<div id="omeroTree" data-url="omero_treeloader.php">
<br/> <br/>
<script>
// the global variable _GET is a (JSON) representation of the
// browser _GET variable that tells us which folder we are showing
// and we use to derive which nodes of the tree will be selectable:
var _GET = <?php echo json_encode($_GET); ?>;
</script>
<?php
if ($omeroConnection->loggedIn) {
?>
<script>
$(function () {
var oTree = $('#omeroTree');
if (_GET['folder'] == "src") {
// for downloading from OMERO we allow multi-selection:
oTree.bind('tree.click', handleMultiSelectClick);
oTree.tree({
saveState: true,
selectable: true,
onCreateLi: processNodeHTML
});
} else {
// we are in the "dest" folder (upload to OMERO), so we
// only allow *single* selection of an image or dataset:
oTree.tree({
saveState: true,
selectable: true,
onCreateLi: processNodeHTML,
onCanSelectNode: allowNodeSelect
});
}
});
</script>
<?php
} else echo " <option> </option>\n";
?>
</div> <!-- omeroTree !-->
</fieldset>
<?php
if ($browse_folder == "src") {
?>
<p><img alt="Disclaimer: " src="./images/note.png"/>
<b>OME-TIFFs</b> provided by OMERO might be missing the
original metadata.</p>
<?php
}
?>
</div> <!-- omeroSelection -->
</fieldset> <!-- fsOmeroData -->
<?php
} // endif (isset($omeroConnection))
?>