Browse Source

Line-by-line torrent form overhaul

pjc 5 years ago
parent
commit
28e47c23f1

+ 355
- 232
classes/torrent_form.class.php View File

@@ -62,95 +62,112 @@ class TorrentForm
62 62
     public function head()
63 63
     {
64 64
         G::$DB->query("
65
-      SELECT COUNT(ID)
66
-      FROM torrents
67
-      WHERE UserID = ?", G::$LoggedUser['ID']);
65
+          SELECT COUNT(ID)
66
+          FROM torrents
67
+          WHERE UserID = ?", G::$LoggedUser['ID']);
68 68
         list($Uploads) = G::$DB->next_record(); ?>
69 69
 
70
+<!-- Everything until the catalogue number field-->
70 71
 <div class="thin">
71
-  <?php    if ($this->NewTorrent) { ?>
72
+  <?php if ($this->NewTorrent) { ?>
72 73
   <p style="text-align: center;">
73
-    If you would like to use your own torrent file, add the following to it:<br />
74
-    <?php      $Announces = call_user_func_array('array_merge', ANNOUNCE_URLS);
74
+    If you would like to use your own torrent file, add the following to it.
75
+    Otherwise, add none of it and redownload the torrent file after uploading it.
76
+    All of the above data will be added to it by the site.
77
+    <strong>If you never have before, be sure to read this list of <a href="wiki.php?action=article&name=uploadingpitfalls">uploading pitfalls</a></strong>.
78
+  </p>
79
+
80
+  <p style="text-align: center;">
81
+    <?php
82
+      $Announces = call_user_func_array('array_merge', ANNOUNCE_URLS);
75 83
         foreach ($Announces as $Announce) {
76
-            ?>
77
-    Announce: <input type="text"
78
-      value="<?=$Announce . '/' . G::$LoggedUser['torrent_pass'] . '/announce'?>"
84
+            # Loop through tracker URLs
85
+    ?>
86
+    <strong>Announce</strong>
87
+    <input type="text" value="<?= $Announce . '/' . G::$LoggedUser['torrent_pass'] . '/announce' ?>"
79 88
       size="74" onclick="this.select();" readonly="readonly" /> <br />
80 89
     <?php
81 90
         } ?>
82
-    Source: <input type="text"
83
-      value="<?=Users::get_upload_sources()[0]?>" size="20"
91
+
92
+    <strong>Source</strong>
93
+    <input type="text" value="<?= Users::get_upload_sources()[0] ?>" size="20"
84 94
       onclick="this.select();" readonly="readonly" />
85
-    <p style="text-align: center;">
86
-      Otherwise, add none of it and simply redownload the torrent file after uploading it. All of the above data will be
87
-      added to it by the site.<br /><br />
88
-      <strong<?=((!$Uploads)?' class="important_text"':'')?>>
89
-        If you never have before, be sure to read this list of <a
90
-          href="wiki.php?action=article&name=uploadingpitfalls">uploading pitfalls</a>
91
-        </strong>
92
-    </p>
93 95
   </p>
94
-  <?php    }
96
+
97
+  <!-- Error display -->
98
+  <p style="text-align: center;">
99
+    <?php
100
+      }
95 101
         if ($this->Error) {
96
-            echo "\t".'<p style="color: red; text-align: center;">'.$this->Error."</p>\n";
102
+            echo "\t".'<p style="color: red; text-align: center;">' . $this->Error . "</p>\n";
97 103
         } ?>
104
+  </p>
105
+  
106
+  <!-- Torrent form hidden values -->
98 107
   <form class="create_form box pad" name="torrent" action="" enctype="multipart/form-data" method="post"
99 108
     onsubmit="$('#post').raw().disabled = 'disabled';">
100 109
     <div>
101 110
       <input type="hidden" name="submit" value="true" />
102 111
       <input type="hidden" name="auth"
103 112
         value="<?=G::$LoggedUser['AuthKey']?>" />
104
-      <?php    if (!$this->NewTorrent) { ?>
113
+      <?php if (!$this->NewTorrent) { ?>
105 114
       <input type="hidden" name="action" value="takeedit" />
106 115
       <input type="hidden" name="torrentid"
107 116
         value="<?=display_str($this->TorrentID)?>" />
108 117
       <input type="hidden" name="type"
109 118
         value="<?=display_str($this->Torrent['CategoryID']-1)?>" />
110 119
       <?php
111
-    } else {
112
-        if ($this->Torrent && $this->Torrent['GroupID']) {
113
-            ?>
120
+        } else {
121
+            if ($this->Torrent && $this->Torrent['GroupID']) {
122
+                # Find groups and requests
123
+      ?>
114 124
       <input type="hidden" name="groupid"
115
-        value="<?=display_str($this->Torrent['GroupID'])?>" />
125
+        value="<?= display_str($this->Torrent['GroupID']) ?>" />
116 126
       <input type="hidden" name="type"
117
-        value="<?=display_str($this->Torrent['CategoryID']-1)?>" />
127
+        value="<?= display_str($this->Torrent['CategoryID']-1) ?>" />
118 128
       <?php
119
-        }
120
-        if ($this->Torrent && ($this->Torrent['RequestID'] ?? false)) {
121
-            ?>
129
+            }
130
+            if ($this->Torrent && ($this->Torrent['RequestID'] ?? false)) {
131
+                ?>
122 132
       <input type="hidden" name="requestid"
123 133
         value="<?=display_str($this->Torrent['RequestID'])?>" />
124 134
       <?php
125
-        }
126
-    } ?>
135
+            }
136
+        } ?>
127 137
     </div>
128
-    <?php    if ($this->NewTorrent) { ?>
138
+
139
+    <!-- New torrent options: file and category -->
140
+    <?php if ($this->NewTorrent) { ?>
129 141
     <table cellpadding="3" cellspacing="1" border="0" class="layout" width="100%">
130 142
       <tr>
131
-        <td class="label tooltip" title="Use the above announce URL and set the private flag in your BitTorrent client">
132
-          Torrent File</td>
133
-        <td><input id="file" type="file" name="file_input" size="50" /></td>
143
+        <td class="label">Torrent File</td>
144
+        <td><input id="file" type="file" name="file_input" size="50" /><br />
145
+          Use the above announce URL and set the private flag in your BitTorrent client, e.g.,
146
+          <pre>mktorrent -p -a &lt;announce&gt; &lt;target folder&gt;</pre>
147
+        </td>
134 148
       </tr>
135 149
       <tr>
136
-        <td class="label tooltip" title="What alphabet the sequence uses, n.b., plasmids fit in the Other category">Type
137
-        </td>
150
+        <td class="label">Type</td>
138 151
         <td>
139
-          <select id="categories" name="type" onchange="Categories()" <?=($this->DisabledFlag) ? ' disabled="disabled"' : ''?>>
140
-            <?php
141
-      foreach (Misc::display_array($this->Categories) as $Index => $Cat) {
142
-          echo "\t\t\t\t\t\t<option value=\"$Index\"";
143
-          if ($Cat == $this->Torrent['CategoryName']) {
144
-              echo ' selected="selected"';
145
-          }
146
-          echo ">$Cat</option>\n";
147
-      }
148
-?>
149
-          </select>
152
+          <select id="categories" name="type" onchange="Categories()"
153
+            <?= ($this->DisabledFlag) ? ' disabled="disabled"' : '' ?>>
154
+          <?php
155
+            foreach (Misc::display_array($this->Categories) as $Index => $Cat) {
156
+                echo "\t\t\t\t\t\t<option value=\"$Index\"";
157
+                if ($Cat == $this->Torrent['CategoryName']) {
158
+                    echo ' selected="selected"';
159
+                }
160
+                echo ">$Cat</option>\n";
161
+            }
162
+          ?>
163
+          </select><br />
164
+          What alphabet the sequence uses, n.b., plasmids fit in the Other category
150 165
         </td>
151 166
       </tr>
152 167
     </table>
153
-    <?php    }//if?>
168
+
169
+    <!-- Start the dynamic form -->
170
+    <?php } # if?>
154 171
     <div id="dynamic_form">
155 172
       <?php
156 173
     }
@@ -159,86 +176,104 @@ class TorrentForm
159 176
     {
160 177
         $Torrent = $this->Torrent; ?>
161 178
     </div>
179
+
180
+    <!-- Freeleech type -->
162 181
     <table cellpadding="3" cellspacing="1" border="0" class="layout slice" width="100%">
163 182
       <?php
164
-    if (!$this->NewTorrent) {
165
-        if (check_perms('torrents_freeleech')) {
166
-            ?>
183
+        if (!$this->NewTorrent) {
184
+            if (check_perms('torrents_freeleech')) {
185
+                ?>
167 186
       <tr id="freetorrent">
168 187
         <td class="label">Freeleech</td>
169 188
         <td>
170 189
           <select name="freeleech">
171 190
             <?php
172
-        $FL = array("Normal", "Free", "Neutral");
173
-            foreach ($FL as $Key => $Name) {
174
-                ?>
175
-            <option value="<?=$Key?>" <?=($Key == $Torrent['FreeTorrent'] ? ' selected="selected"' : '')?>><?=$Name?>
191
+              $FL = array("Normal", "Free", "Neutral");
192
+                foreach ($FL as $Key => $Name) {
193
+                    # Cycle types
194
+            ?>
195
+            <option value="<?= $Key ?>" <?= ($Key === $Torrent['FreeTorrent'] ? ' selected="selected"' : '') ?>><?= $Name ?>
176 196
             </option>
177 197
             <?php
178
-            } ?>
198
+                } ?>
179 199
           </select>
180 200
           because
181 201
           <select name="freeleechtype">
182 202
             <?php
183
-        $FL = array("N/A", "Staff Pick", "Perma-FL", "Freeleechizer", "Site-Wide FL");
184
-            foreach ($FL as $Key => $Name) {
185
-                ?>
186
-            <option value="<?=$Key?>" <?=($Key == $Torrent['FreeLeechType'] ? ' selected="selected"' : '')?>><?=$Name?>
203
+              $FL = array("N/A", "Staff Pick", "Perma-FL", "Freeleechizer", "Site-Wide FL");
204
+                foreach ($FL as $Key => $Name) {
205
+                    # Cycle reasons
206
+            ?>
207
+            <option value="<?=$Key?>" <?= ($Key === $Torrent['FreeLeechType'] ? ' selected="selected"' : '') ?>><?= $Name ?>
187 208
             </option>
188 209
             <?php
189
-            } ?>
210
+                } ?>
190 211
           </select>
191 212
         </td>
192 213
       </tr>
193 214
       <?php
194
-        }
195
-    } ?>
215
+            }
216
+        } ?>
217
+
218
+      <!-- Rules notice (displays just before submit) -->
196 219
       <tr>
197 220
         <td colspan="2" style="text-align: center;">
198
-          <p>Be sure that your torrent is approved by the <a href="rules.php?p=upload" target="_blank">rules</a>. Not
199
-            doing this will result in a <strong class="important_text">warning</strong> or <strong
200
-              class="important_text">worse</strong>.</p>
201
-          <?php    if ($this->NewTorrent) { ?>
202
-          <p>After uploading the torrent, you will have a one hour grace period during which no one other than you can
203
-            fill requests with this torrent. Make use of this time wisely, and <a href="requests.php">search the list of
204
-              requests</a>.</p>
205
-          <?php    } ?>
206
-          <input id="post" type="submit" <?php if ($this->NewTorrent) {
207
-        echo ' value="Upload torrent"';
208
-    } else {
209
-        echo ' value="Edit torrent"';
210
-    } ?>
221
+          <p>Be sure that your torrent is approved by the <a href="rules.php?p=upload" target="_blank">rules</a>.
222
+          Not doing this will result in a <strong class="important_text">warning</strong> or <strong class="important_text">worse</strong>.</p>
223
+          <?php if ($this->NewTorrent) { ?>
224
+          <p>
225
+            After uploading the torrent, you will have a one hour grace period during which no one other than you can fill requests with this torrent.
226
+            Make use of this time wisely, and <a href="requests.php">search the list of requests</a>.
227
+          </p>
228
+          <?php } ?>
229
+          <input id="post" type="submit"
230
+          <?php
231
+            if ($this->NewTorrent) {
232
+                echo ' value="Upload torrent"';
233
+            } else {
234
+                echo ' value="Edit torrent"';
235
+            } ?>
211 236
           />
212 237
         </td>
213 238
       </tr>
214 239
     </table>
215 240
   </form>
216 241
 </div>
242
+
243
+<!-- Okay, finally the real form -->
217 244
 <?php
218
-    }
245
+    } # End
219 246
 
220 247
     public function upload_form()
221 248
     {
222 249
         $QueryID = G::$DB->get_query_id();
223 250
         $this->head();
224 251
         $Torrent = $this->Torrent; ?>
252
+
253
+<!-- Catalogue number field -->
225 254
 <table cellpadding="3" cellspacing="1" border="0" class="layout slice" width="100%">
226 255
   <?php if ($this->NewTorrent) { ?>
227 256
   <tr id="javdb_tr">
228
-    <td class="label tooltip" title="RefSeq accession number, e.g., NM_001183340.1">Accession Number</td>
257
+    <td class="label tooltip" title="">Accession Number</td>
229 258
     <td>
230 259
       <input type="text" id="catalogue" name="catalogue" size="10"
231
-        value="<?=display_str($Torrent['CatalogueNumber']) ?>"
232
-        <?=$this->Disabled?>/>
260
+        value="<?= display_str($Torrent['CatalogueNumber']) ?>"
261
+        <?= $this->Disabled ?>/>
233 262
       <?php if (!$this->DisabledFlag) { ?>
234
-      <input type="button" autofill="jav" value="Autofill" style="background: lightgrey; pointer-events: none;"></input>
263
+        <input type="button" autofill="jav" value="Autofill"
264
+          style="background: lightgrey; pointer-events: none;">
265
+        </input>
266
+        Coming Soon!<br />
267
+        RefSeq accession number, e.g., NM_001183340.1
235 268
       <?php } ?>
236 269
     </td>
237 270
   </tr>
271
+
272
+  <!-- Other autofill options -->
238 273
   <tr id="anidb_tr" class="hidden">
239 274
     <td class="label">AniDB Autofill (optional)</td>
240 275
     <td>
241
-      <input type="text" id="anidb" size="10" <?=$this->Disabled?>/>
276
+      <input type="text" id="anidb" size="10" <?= $this->Disabled ?>/>
242 277
       <?php if (!$this->DisabledFlag) { ?>
243 278
       <input type="button" autofill="anime" value="Autofill" />
244 279
       <?php } ?>
@@ -247,241 +282,329 @@ class TorrentForm
247 282
   <tr id="ehentai_tr" class="hidden">
248 283
     <td class="label">e-hentai URL (optional)</td>
249 284
     <td>
250
-      <input type="text" id="catalogue" size="50" <?=$this->Disabled?> />
285
+      <input type="text" id="catalogue" size="50" <?= $this->Disabled ?> />
251 286
       <?php if (!$this->DisabledFlag) { ?>
252 287
       <input type="button" autofill="douj" value="Autofill" />
253 288
       <?php } ?>
254 289
     </td>
255 290
   </tr>
291
+
292
+  <!-- Three title fields -->
256 293
   <tr id="title_tr">
257
-    <td class="label tooltip" title="FASTA definition line, e.g., Alcohol dehydrogenase ADH1">Sequence Name</td>
258
-    <td><input type="text" id="title" name="title" size="60"
259
-        value="<?=display_str($Torrent['Title']) ?>"
260
-        <?=$this->Disabled?>/></td>
294
+    <td class="label">Sequence Name</td>
295
+    <td>
296
+      <input type="text" id="title" name="title" size="60"
297
+        value="<?= display_str($Torrent['Title']) ?>"
298
+        <?= $this->Disabled ?>/><br />
299
+      Definition line, e.g., Alcohol dehydrogenase ADH1
300
+    </td>
261 301
   </tr>
302
+
262 303
   <tr id="title_rj_tr">
263
-    <td class="label tooltip" title="FASTA organism line binomial nomenclature, e.g., Saccharomyces cerevisiae">Organism
304
+    <td class="label tooltip" title="">Organism
305
+    </td>
306
+    <td>
307
+      <input type="text" id="title_rj" name="title_rj" size="60"
308
+        value="<?= display_str($Torrent['TitleRJ']) ?>"
309
+        <?= $this->Disabled ?>/><br />
310
+      Organism line binomial nomenclature, e.g., <em>Saccharomyces cerevisiae</em>
264 311
     </td>
265
-    <td><input type="text" id="title_rj" name="title_rj" size="60"
266
-        value="<?=display_str($Torrent['TitleRJ']) ?>"
267
-        <?=$this->Disabled?>/></td>
268 312
   </tr>
313
+
269 314
   <tr id="title_jp_tr">
270
-    <td class="label tooltip" title="FASTA organism line if applicable, e.g., S288C">Strain/Variety</td>
271
-    <td><input type="text" id="title_jp" name="title_jp" size="60"
272
-        value="<?=display_str($Torrent['TitleJP']) ?>"
273
-        <?=$this->Disabled?>/></td>
315
+    <td class="label">Strain/Variety</td>
316
+    <td>
317
+      <input type="text" id="title_jp" name="title_jp" size="60"
318
+        value="<?= display_str($Torrent['TitleJP']) ?>"
319
+        <?= $this->Disabled ?>/><br />
320
+      Organism line if applicable, e.g., S288C
321
+    </td>
274 322
   </tr>
323
+
324
+  <!-- Multiple artists -->
275 325
   <tr id="idols_tr">
276
-    <td class="label tooltip" title="FASTA authors line, e.g., Robert K. Mortimer and David Schild">Collaborator(s)</td>
326
+    <td class="label tooltip" title="">Authors(s)</td>
277 327
     <td id="idolfields">
278
-      <?php      if (!empty($Torrent['Artists'])) {
279
-            foreach ($Torrent['Artists'] as $Num => $Artist) { ?>
280
-      <input type="text" id="idols_<?=$Num?>" name="idols[]"
281
-        size="45"
282
-        value="<?=display_str($Artist['name'])?>"
283
-        <?=$this->Disabled?>/>
328
+      One author per field, e.g., Robert K. Mortimer [+] David Schild<br />
329
+      <?php
330
+        if (!empty($Torrent['Artists'])) {
331
+          foreach ($Torrent['Artists'] as $Num => $Artist) {
332
+      ?>
333
+      <input type="text" id="idols_<?= $Num ?>" name="idols[]"
334
+        size="45" value="<?= display_str($Artist['name']) ?>"
335
+        <?= $this->Disabled ?>/>
284 336
       <?php if ($Num == 0) { ?>
285
-      <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
286
-      <?php }
337
+      <a class="add_artist_button brackets">+</a>
338
+      <a class="remove_artist_button brackets">&minus;</a>
339
+      <?php
287 340
             }
288
-        } else { ?>
289
-      <input type="text" id="idols_0" name="idols[]" size="45" value="" <?=$this->Disabled?> />
290
-      <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
291
-      <?php        } ?>
341
+          }
342
+        } else {
343
+      ?>
344
+      <input type="text" id="idols_0" name="idols[]" size="45" value="" <?= $this->Disabled ?> />
345
+      <a class="add_artist_button brackets">+</a>
346
+      <a class="remove_artist_button brackets">&minus;</a>
347
+      <?php
348
+        } ?>
292 349
     </td>
293 350
   </tr>
351
+
352
+  <!-- Production studio -->
294 353
   <tr id="studio_tr">
295
-    <td class="label tooltip" title="Who produced the sequence, e.g., Lawrence Berkeley Laboratory">Department/Lab</td>
296
-    <td><input type="text" id="studio" name="studio" size="60"
297
-        value="<?=display_str($Torrent['Studio']) ?>"
298
-        <?=$this->Disabled?>/></td>
354
+    <td class="label">Department/Lab</td>
355
+    <td>
356
+      <input type="text" id="studio" name="studio" size="60"
357
+        value="<?= display_str($Torrent['Studio']) ?>"
358
+        <?= $this->Disabled ?>/><br />
359
+      First author's institution, e.g., Lawrence Berkeley Laboratory
360
+    </td>
299 361
   </tr>
362
+
363
+  <!-- Location -->
300 364
   <tr id="series_tr">
301
-    <td class="label tooltip" title="Their physical location, e.g., Berkeley, CA">Location</td>
302
-    <td><input type="text" id="series" name="series" size="60"
303
-        value="<?=display_str($Torrent['Series']) ?>"
304
-        <?=$this->Disabled?>/></td>
365
+    <td class="label">Location</td>
366
+    <td>
367
+      <input type="text" id="series" name="series" size="60"
368
+        value="<?= display_str($Torrent['Series']) ?>"
369
+        <?= $this->Disabled ?>/><br />
370
+      Its physical location, e.g., Berkeley, CA
371
+    </td>
305 372
   </tr>
373
+
374
+  <!-- Year -->
306 375
   <tr id="year_tr">
307
-    <td class="label tooltip" title="What year they published the sequence in">Year</td>
308
-    <td><input type="text" id="year" name="year" maxlength="4" size="5"
309
-        value="<?=display_str($Torrent['Year']) ?>"
310
-        <?=$this->Disabled?>/></td>
376
+    <td class="label">Year</td>
377
+    <td>
378
+      <input type="text" id="year" name="year" maxlength="4" size="5"
379
+        value="<?= display_str($Torrent['Year']) ?>"
380
+        <?= $this->Disabled ?>/><br />
381
+      Original publication year
382
+    </td>
311 383
   </tr>
312
-  <?php } ?>
384
+
385
+  <!-- Media type -->
386
+  <?php } # Ends if NewTorrent line 256?>
313 387
   <tr id="media_tr">
314
-    <td class="label tooltip" title="What class of sequencing technology they used">Platform</td>
388
+    <td class="label">Platform</td>
315 389
     <td>
316 390
       <select name="media">
317 391
         <option>---</option>
318 392
         <?php
319
-    foreach ($this->Media as $Media) {
320
-        echo "\t\t\t\t\t\t<option value=\"$Media\"";
321
-        if ($Media == ($Torrent['Media'] ?? false)) {
322
-            echo " selected";
323
-        }
324
-        echo ">$Media</option>\n";
325
-    } ?>
326
-      </select>
327
-    </td>
328
-  </tr>
329
-  <tr id="archive_tr">
330
-    <td class="label tooltip" title="How the data is archived and compressed">Archive</td>
331
-    <td>
332
-      <select name='archive'>
333
-        <option>---</option>
334
-        <?php
335
-    foreach ($this->Archives as $Archive) {
336
-        echo "\t\t\t\t\t\t<option value=\"$Archive\"";
337
-        if ($Archive == ($Torrent['Archive'] ?? false)) {
338
-            echo ' selected';
339
-        }
340
-        echo ">$Archive</option>\n";
341
-    } ?>
342
-      </select>
393
+          foreach ($this->Media as $Media) {
394
+              echo "\t\t\t\t\t\t<option value=\"$Media\"";
395
+              if ($Media == ($Torrent['Media'] ?? false)) {
396
+                  echo " selected";
397
+              }
398
+              echo ">$Media</option>\n";
399
+          } ?>
400
+      </select><br />
401
+      Class of sequencing technology used
343 402
     </td>
344 403
   </tr>
404
+
405
+  <!-- Container -->
345 406
   <tr id="container_tr">
346
-    <td class="label tooltip" title="What file format the sequence is in">Format</td>
407
+    <td class="label">Format</td>
347 408
     <td>
348 409
       <select name="container">
349 410
         <option>---</option>
350 411
         <?php
351
-    foreach ($this->Containers as $Cont) {
352
-        echo "\t\t\t\t\t\t<option value=\"$Cont\"";
353
-        if ($Cont == ($Torrent['Container'] ?? false)) {
354
-            echo " selected";
355
-        }
356
-        echo ">$Cont</option>\n";
357
-    } ?>
358
-      </select>
359
-    </td>
360
-  </tr>
361
-  <tr id="codec_tr">
362
-    <td class="label tooltip" title="What license the collaborators released the data under">License</td>
363
-    <td>
364
-      <select name="codec">
365
-        <option>---</option>
366
-        <?php
367
-    foreach ($this->Codecs as $Codec) {
368
-        echo "\t\t\t\t\t\t<option value=\"$Codec\"";
369
-        if ($Codec == ($Torrent['Codec'] ?? false)) {
370
-            echo " selected";
371
-        }
372
-        echo ">$Codec</option>\n";
373
-    } ?>
374
-      </select>
412
+          foreach ($this->Containers as $Cont) {
413
+              echo "\t\t\t\t\t\t<option value=\"$Cont\"";
414
+              if ($Cont === ($Torrent['Container'] ?? false)) {
415
+                  echo " selected";
416
+              }
417
+              echo ">$Cont</option>\n";
418
+          } ?>
419
+      </select><br />
420
+      The data's file format
375 421
     </td>
376 422
   </tr>
423
+
424
+  <!-- Resolution -->
377 425
   <tr id="resolution_tr">
378
-    <td class="label tooltip" title="How complete the sequence data is">Assembly Level</td>
426
+    <td class="label">Assembly Level</td>
379 427
     <td>
380 428
       <select id="ressel" name="ressel" onchange="SetResolution()">
381 429
         <option value="">---</option>
382 430
         <?php
383
-    foreach ($this->Resolutions as $Res) {
384
-        echo "\t\t\t\t\t\t<option value=\"$Res\"";
385
-        if ($Res == ($Torrent['Resolution'] ?? false) || (!isset($FoundRes) && ($Torrent['Resolution'] ?? false) && $Res == "Other")) {
386
-            echo " selected";
387
-            $FoundRes = true;
388
-        }
389
-        echo ">$Res</option>\n";
390
-    } ?>
431
+          foreach ($this->Resolutions as $Res) {
432
+              echo "\t\t\t\t\t\t<option value=\"$Res\"";
433
+              if ($Res === ($Torrent['Resolution'] ?? false)
434
+              || (!isset($FoundRes) && ($Torrent['Resolution'] ?? false)
435
+              && $Res === 'Other')) {
436
+                  echo " selected";
437
+                  $FoundRes = true;
438
+              }
439
+              echo ">$Res</option>\n";
440
+          } ?>
391 441
       </select>
392
-      <input type="text" id="resolution" name="resolution" size="10" class="hidden tooltip" pattern="[0-9]+x[0-9]+"
393
-        title='Enter "Other" resolutions in the form ###x###'
394
-        value="<?=($Torrent['Resolution']??'')?>"
395
-        readonly></input>
442
+
443
+      <input type="text" id="resolution" name="resolution" size="10" class="hidden"
444
+        value="<?= ($Torrent['Resolution']??'') ?>"
445
+        readonly>
446
+      </input>
396 447
       <script>
397 448
         if ($('#ressel').raw().value == "Other") {
398 449
           $('#resolution').raw().readOnly = false
399 450
           $('#resolution').gshow()
400 451
         }
401
-      </script>
452
+      </script><br />
453
+      How complete the sequence is
402 454
     </td>
403 455
   </tr>
404
-  <?php    if ($this->NewTorrent) { ?>
405
-  <tr id="tags_tr">
406
-    <td class="label tooltip" title="Comma-seperated list of tags, n.b., use vanity.house for data you produced">Tags
456
+
457
+  <!-- Compression -->
458
+  <tr id="archive_tr">
459
+    <td class="label">Archive</td>
460
+    <td>
461
+      <select name='archive'>
462
+        <option>---</option>
463
+        <?php
464
+          foreach ($this->Archives as $Archive) {
465
+              echo "\t\t\t\t\t\t<option value=\"$Archive\"";
466
+              if ($Archive === ($Torrent['Archive'] ?? false)) {
467
+                  echo ' selected';
468
+              }
469
+              echo ">$Archive</option>\n";
470
+          } ?>
471
+      </select><br />
472
+      Its compression algorithm
407 473
     </td>
474
+  </tr>
475
+
476
+  <!-- Encoding -->
477
+  <tr id="codec_tr">
478
+    <td class="label">License</td>
479
+    <td>
480
+      <select name="codec">
481
+        <option>---</option>
482
+        <?php
483
+          foreach ($this->Codecs as $Codec) {
484
+              echo "\t\t\t\t\t\t<option value=\"$Codec\"";
485
+              if ($Codec === ($Torrent['Codec'] ?? false)) {
486
+                  echo " selected";
487
+              }
488
+              echo ">$Codec</option>\n";
489
+          } ?>
490
+      </select><br />
491
+      Please see <a href="http://www.dcc.ac.uk/resources/how-guides/license-research-data" target="_blank">How to License Research Data</a>
492
+    </td>
493
+  </tr>
494
+
495
+  <!-- Tags -->
496
+  <?php if ($this->NewTorrent) { ?>
497
+  <tr id="tags_tr">
498
+    <td class="label">Tags</td>
408 499
     <td>
409 500
       <?php
410
-  $GenreTags = G::$Cache->get_value('genre_tags');
411
-  if (!$GenreTags) {
412
-      $DB->query("
413
-      SELECT Name
414
-      FROM tags
415
-      WHERE TagType = 'genre'
416
-      ORDER BY Name");
417
-      $GenreTags = $DB->collect('Name');
418
-      G::$Cache->cache_value('genre_tags', $GenreTags, 3600*6);
419
-  }
420
-?>
421
-      <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;" <?=($this->DisabledFlag) ? ' disabled="disabled"' : ''?>>
501
+        $GenreTags = G::$Cache->get_value('genre_tags');
502
+        if (!$GenreTags) {
503
+            $DB->query("
504
+            SELECT Name
505
+            FROM tags
506
+            WHERE TagType = 'genre'
507
+            ORDER BY Name");
508
+            $GenreTags = $DB->collect('Name');
509
+            G::$Cache->cache_value('genre_tags', $GenreTags, 3600*6);
510
+        }
511
+      ?>
512
+      <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;" <?= ($this->DisabledFlag) ? ' disabled="disabled"' : '' ?>>
422 513
         <option>---</option>
423 514
         <?php foreach (Misc::display_array($GenreTags) as $Genre) { ?>
424
-        <option value="<?=$Genre?>"><?=$Genre?>
515
+        <option value="<?= $Genre ?>"><?= $Genre ?>
425 516
         </option>
426 517
         <?php } ?>
427 518
       </select>
428 519
       <input type="text" id="tags" name="tags" size="60"
429
-        value="<?=display_str(implode(', ', explode(',', $Torrent['TagList']))) ?>"
430
-        <?php Users::has_autocomplete_enabled('other'); ?> />
431
-      <p class="min_padding notes"></p>
520
+        value="<?= display_str(implode(', ', explode(',', $Torrent['TagList']))) ?>"
521
+        <?php Users::has_autocomplete_enabled('other'); ?> /><br />
522
+      Comma-seperated list of tags, n.b., use <strong class="important_text_alt">vanity.house</strong> for data you produced
432 523
     </td>
433 524
   </tr>
525
+
526
+  <!-- Picture -->
434 527
   <tr id="cover_tr">
435
-    <td class="label tooltip" title="A meaningful picture, e.g., of the specimen">Picture</td>
436
-    <td><input type="text" id="image" name="image" size="60"
437
-        value="<?=display_str($Torrent['Image']) ?>"
438
-        <?=$this->Disabled?> /></td>
528
+    <td class="label">Picture</td>
529
+    <td>
530
+      <input type="text" id="image" name="image" size="60"
531
+        value="<?= display_str($Torrent['Image']) ?>"
532
+        <?= $this->Disabled ?> /><br />
533
+      A meaningful picture, e.g., of the specimen
534
+    </td>
439 535
   </tr>
536
+
537
+  <!-- Sample pictures/links -->
440 538
   <?php if (!$this->DisabledFlag && $this->NewTorrent) { ?>
441 539
   <tr id="screenshots_tr">
442
-    <td class="label tooltip" title="Relevant publications that use the data">Publications</td>
540
+    <td class="label">Publications</td>
443 541
     <td>
444 542
       <textarea rows="8" cols="60" name="screenshots"
445
-        id="screenshots"><?=display_str($Torrent['Screenshots'])?></textarea>
446
-      <p>Enter up to 10 links to studies for the torrent, one per line. The system will automatically remove malformed
447
-        or invalid links, as well as any links after the 10th. Remember to consult the <a
448
-          href="/rules.php?p=upload#h1.4">rules for adding publications</a>.</p>
449
-      <p class="min_padding notes"></p>
450
-  </tr>
543
+        id="screenshots"><?= display_str($Torrent['Screenshots'])?></textarea>
544
+      Up to ten DOI numbers relevant to the torrent, one per line
545
+    </tr>
451 546
   <?php } ?>
547
+
548
+  <!-- Artist description -->
452 549
   <tr id="group_desc_tr">
453
-    <td class="label tooltip" title="General info about the gene or protein's function or significance">Torrent Group
454
-      Description</td>
550
+    <td class="label">Torrent Group Description</td>
455 551
     <td>
456
-      <p class="min_padding notes"></p>
457
-      <?php new TEXTAREA_PREVIEW('album_desc', 'album_desc', display_str($Torrent['GroupDescription']), 60, 8, !$this->DisabledFlag, !$this->DisabledFlag, false, array($this->Disabled)); ?>
552
+      <?php
553
+        new TEXTAREA_PREVIEW(
554
+          'album_desc',
555
+          'album_desc',
556
+          display_str($Torrent['GroupDescription']),
557
+          60,
558
+          8,
559
+          !$this->DisabledFlag,
560
+          !$this->DisabledFlag,
561
+          false,
562
+          array($this->Disabled)
563
+      );
564
+      ?><br />
565
+      General info about the gene or protein's function or significance
458 566
     </td>
459 567
   </tr>
460
-  <?php    } ?>
568
+  <?php } # Ends if NewTorrent line 499?>
569
+
570
+  <!-- Torrent description -->
461 571
   <tr id="release_desc_tr">
462
-    <td class="label tooltip" title="Specific info about what protocols and equipment helped generate the data">Torrent
463
-      Description (optional)</td>
572
+    <td class="label">Torrent Description</td>
464 573
     <td>
465
-      <p class="min_padding notes"></p>
466
-      <?php new TEXTAREA_PREVIEW('release_desc', 'release_desc', display_str($Torrent['TorrentDescription']??''), 60, 8); ?>
574
+      <?php
575
+        new TEXTAREA_PREVIEW(
576
+          'release_desc',
577
+          'release_desc',
578
+          display_str($Torrent['TorrentDescription'] ?? ''),
579
+          60,
580
+      ); ?><br />
581
+      Specific info about the protocols and equipment relevant to this data
467 582
     </td>
468 583
   </tr>
584
+
585
+  <!-- Boolean options -->
469 586
   <tr id="censored_tr">
470
-    <td class="label tooltip" title="Whether the torrent contains raw reads or alignment data">Aligned Sequence?</td>
587
+    <td class="label">Aligned Sequence?</td>
471 588
     <td>
472
-      <input type="checkbox" name="censored" value="1" <?=(($Torrent['Censored'] ?? 0) ? 'checked ' : '')?>/>
589
+      <input type="checkbox" name="censored" value="1"
590
+        <?= (($Torrent['Censored'] ?? 0) ? 'checked ' : '') ?>/>
591
+      Whether the torrent contains raw reads or alignment data
473 592
     </td>
474 593
   </tr>
594
+
475 595
   <tr id="anon_tr">
476
-    <td class="label tooltip" title="Hide your username from other users on the torrent details page">Upload
477
-      Anonymously?</td>
478
-    <td><input type="checkbox" name="anonymous" value="1" <?=(($Torrent['Anonymous'] ?? false) ? 'checked ' : '')?>/>
596
+    <td class="label">Upload Anonymously?</td>
597
+    <td>
598
+      <input type="checkbox" name="anonymous" value="1"
599
+        <?= (($Torrent['Anonymous'] ?? false) ? 'checked ' : '') ?>/>
600
+      Hide your username from other users on the torrent details page
479 601
     </td>
480 602
   </tr>
481 603
 </table>
482 604
 
483 605
 <?php
484
-    $this->foot();
606
+  # Phew
607
+  $this->foot();
485 608
         G::$DB->set_query_id($QueryID);
486 609
     }
487 610
 }

+ 1
- 1
sections/torrents/details.php View File

@@ -34,7 +34,7 @@ if (!$GroupName) {
34 34
 
35 35
 $DisplayName = "<span dir=\"ltr\">$GroupName</span><br />";
36 36
 $AltName = $GroupName; // Goes in the alt text of the image
37
-$Title = $GroupName; // goes in <title>
37
+$Title = $GroupName; // Goes in <title>
38 38
 $WikiBody = Text::full_format($WikiBody);
39 39
 
40 40
 $Artists = Artists::get_artist($GroupID);

+ 6
- 6
sections/upload/upload_handle.php View File

@@ -1,4 +1,5 @@
1 1
 <?php
2
+
2 3
 //****************************************************************************//
3 4
 //--------------- Take upload ------------------------------------------------//
4 5
 // This pages handles the backend of the torrent upload function. It checks   //
@@ -6,12 +7,12 @@
6 7
 // the data to the database and the torrent to the disk.                      //
7 8
 //****************************************************************************//
8 9
 
9
-// Maximum allowed size for uploaded files.
10
-// http://php.net/upload-max-filesize
11
-ini_set('upload_max_filesize', 2097152); // 2 Mebibytes
12
-
10
+// Maximum allowed size for uploaded files
11
+// https://php.net/upload-max-filesize
12
+ini_set('upload_max_filesize', 2097152); // 2 MiB
13 13
 ini_set('max_file_uploads', 100);
14 14
 define('MAX_FILENAME_LENGTH', 180);
15
+
15 16
 include(SERVER_ROOT.'/classes/validate.class.php');
16 17
 include(SERVER_ROOT.'/classes/feed.class.php');
17 18
 include(SERVER_ROOT.'/sections/torrents/functions.php');
@@ -23,8 +24,6 @@ authorize();
23 24
 $Validate = new VALIDATE;
24 25
 $Feed = new FEED;
25 26
 
26
-define('QUERY_EXCEPTION', true); // Shut up debugging
27
-
28 27
 //*****************************************************************************//
29 28
 //--------------- Set $Properties array ---------------------------------------//
30 29
 // This is used if the form doesn't validate, and when the time comes to enter //
@@ -35,6 +34,7 @@ define('QUERY_EXCEPTION', true); // Shut up debugging
35 34
 $Properties = [];
36 35
 $Type = $Categories[(int)$_POST['type']];
37 36
 $TypeID = $_POST['type'] + 1;
37
+
38 38
 $Properties['CategoryID'] = $TypeID;
39 39
 $Properties['CategoryName'] = $Type;
40 40
 $Properties['Title'] = $_POST['title'];

BIN
static/common/bioicons/med_img.png View File


Loading…
Cancel
Save