Browse Source

Start fixing the requests feature

pjc 5 years ago
parent
commit
91fda3abc2
2 changed files with 123 additions and 76 deletions
  1. 119
    73
      sections/requests/new_edit.php
  2. 4
    3
      sections/requests/take_new_edit.php

+ 119
- 73
sections/requests/new_edit.php View File

97
 ?>
97
 ?>
98
 <div class="thin">
98
 <div class="thin">
99
   <div class="header">
99
   <div class="header">
100
-    <h2><?=($NewRequest ? 'Create a request' : 'Edit a request')?></h2>
100
+    <h2><?=($NewRequest ? 'Create a request' : 'Edit a request')?>
101
+    </h2>
101
   </div>
102
   </div>
102
 
103
 
103
   <div class="box pad">
104
   <div class="box pad">
104
     <form action="" method="post" id="request_form" onsubmit="Calculate();">
105
     <form action="" method="post" id="request_form" onsubmit="Calculate();">
105
       <div>
106
       <div>
106
-<?php  if (!$NewRequest) { ?>
107
-        <input type="hidden" name="requestid" value="<?=$RequestID?>" />
108
-<?php  } ?>
109
-        <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
110
-        <input type="hidden" name="action" value="<?=($NewRequest ? 'takenew' : 'takeedit')?>" />
107
+        <?php  if (!$NewRequest) { ?>
108
+        <input type="hidden" name="requestid"
109
+          value="<?=$RequestID?>" />
110
+        <?php  } ?>
111
+        <input type="hidden" name="auth"
112
+          value="<?=$LoggedUser['AuthKey']?>" />
113
+        <input type="hidden" name="action"
114
+          value="<?=($NewRequest ? 'takenew' : 'takeedit')?>" />
111
       </div>
115
       </div>
112
 
116
 
113
       <table class="layout">
117
       <table class="layout">
114
         <tr>
118
         <tr>
115
-          <td colspan="2" class="center">Please make sure your request follows <a href="rules.php?p=requests">the request rules</a>!</td>
119
+          <td colspan="2" class="center">Please make sure your request follows <a href="rules.php?p=requests">the
120
+              request rules</a>!</td>
116
         </tr>
121
         </tr>
117
-<?php  if ($NewRequest || $CanEdit) { ?>
122
+        <?php  if ($NewRequest || $CanEdit) { ?>
118
         <tr>
123
         <tr>
119
-          <td class="label tooltip" title="What alphabet the sequence uses, n.b., plasmids fit in the Other category">Type</td>
124
+          <td class="label tooltip" title="What alphabet the sequence uses, n.b., plasmids fit in the Other category">
125
+            Type</td>
120
           <td>
126
           <td>
121
-<?php if (!empty($Disabled)) { ?>
122
-            <input type="hidden" name="type" value="<?=$CategoryName?>" />
127
+            <?php if (!empty($Disabled)) { ?>
128
+            <input type="hidden" name="type"
129
+              value="<?=$CategoryName?>" />
123
             <select id="categories" name="type" onchange="Categories();" disabled="disabled">
130
             <select id="categories" name="type" onchange="Categories();" disabled="disabled">
124
-<?php } else { ?>
125
-            <select id="categories" name="type" onchange="Categories();">
126
-<?php } ?>
127
-<?php    foreach (Misc::display_array($Categories) as $Cat) { ?>
128
-              <option value="<?=$Cat?>"<?=(!empty($CategoryName) && ($CategoryName === $Cat) ? ' selected="selected"' : '')?>><?=$Cat?></option>
129
-<?php    } ?>
130
-            </select>
131
+              <?php } else { ?>
132
+              <select id="categories" name="type" onchange="Categories();">
133
+                <?php } ?>
134
+                <?php    foreach (Misc::display_array($Categories) as $Cat) { ?>
135
+                <option value="<?=$Cat?>" <?=(!empty($CategoryName) && ($CategoryName === $Cat) ? ' selected="selected"' : '')?>><?=$Cat?>
136
+                </option>
137
+                <?php    } ?>
138
+              </select>
131
           </td>
139
           </td>
132
         </tr>
140
         </tr>
133
         <tr id="cataloguenumber_tr">
141
         <tr id="cataloguenumber_tr">
134
           <td class="label">Accession Number</td>
142
           <td class="label">Accession Number</td>
135
           <td>
143
           <td>
136
-            <input type="text" id="catalogue" name="cataloguenumber" size="15" value="<?=(isset($CatalogueNumber)?$CatalogueNumber:'') ?>" <?=$Disabled?>/>
137
-<?php if (empty($Disabled)) { ?>
138
-          <input type="button" autofill="jav" value="Autofill"></input>
139
-<?php } ?>
144
+            <input type="text" id="catalogue" name="cataloguenumber" size="15"
145
+              value="<?=(isset($CatalogueNumber)?$CatalogueNumber:'') ?>"
146
+              <?=$Disabled?>/>
147
+            <?php if (empty($Disabled)) { ?>
148
+            <input type="button" autofill="jav" value="Autofill"></input>
149
+            <?php } ?>
140
           </td>
150
           </td>
141
         </tr>
151
         </tr>
142
         <tr id="artist_tr">
152
         <tr id="artist_tr">
143
           <td class="label">Collaborator(s)</td>
153
           <td class="label">Collaborator(s)</td>
144
           <td id="artistfields">
154
           <td id="artistfields">
145
-            <p id="vawarning" class="hidden">Please use the multiple artists feature rather than adding "Various Artists" as an artist; read <a href="wiki.php?action=article&amp;id=369">this</a> for more information.</p>
146
-<?php
155
+            <p id="vawarning" class="hidden">Please use the multiple artists feature rather than adding "Various
156
+              Artists" as an artist; read <a href="wiki.php?action=article&amp;id=369">this</a> for more information.
157
+            </p>
158
+            <?php
147
     if (!empty($ArtistForm)) {
159
     if (!empty($ArtistForm)) {
148
         $First = true;
160
         $First = true;
149
         foreach ($ArtistForm as $Artist) {
161
         foreach ($ArtistForm as $Artist) {
150
             ?>
162
             ?>
151
-            <input type="text" id="artist_0" name="artists[]"<?php Users::has_autocomplete_enabled('other'); ?> size="45" value="<?=display_str($Artist['name']) ?>" <?=$Disabled?>/>
163
+            <input type="text" id="artist_0" name="artists[]" <?php Users::has_autocomplete_enabled('other'); ?>
164
+            size="45" value="<?=display_str($Artist['name']) ?>" <?=$Disabled?>/>
152
             <?php if (empty($Disabled)) {
165
             <?php if (empty($Disabled)) {
153
-                if ($First) { ?><a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a><?php }
166
+                if ($First) { ?><a class="add_artist_button brackets">+</a> <a
167
+              class="remove_artist_button brackets">&minus;</a><?php }
154
                 $First = false;
168
                 $First = false;
155
             } ?>
169
             } ?>
156
             <br />
170
             <br />
157
-<?php
171
+            <?php
158
         }
172
         }
159
     } else {
173
     } else {
160
-        ?>            <input type="text" id="artist_0" name="artists[]"<?php Users::has_autocomplete_enabled('other'); ?> size="45" <?=$Disabled?>/>
161
-<?php if (empty($Disabled)) { ?>
174
+        ?> <input type="text" id="artist_0" name="artists[]" <?php Users::has_autocomplete_enabled('other'); ?>
175
+            size="45" <?=$Disabled?>/>
176
+            <?php if (empty($Disabled)) { ?>
162
             <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
177
             <a class="add_artist_button brackets">+</a> <a class="remove_artist_button brackets">&minus;</a>
163
-<?php } ?>
164
-<?php
178
+            <?php } ?>
179
+            <?php
165
     }
180
     }
166
 ?>
181
 ?>
167
           </td>
182
           </td>
169
         <tr>
184
         <tr>
170
           <td class="label tooltip" title="FASTA definition line, e.g., Alcohol dehydrogenase ADH1">Sequence Name</td>
185
           <td class="label tooltip" title="FASTA definition line, e.g., Alcohol dehydrogenase ADH1">Sequence Name</td>
171
           <td>
186
           <td>
172
-            <input type="text" id="title" name="title" size="45" value="<?=(!empty($Title) ? $Title : '')?>" <?=$Disabled?>/>
187
+            <input type="text" id="title" name="title" size="45"
188
+              value="<?=(!empty($Title) ? $Title : '')?>"
189
+              <?=$Disabled?>/>
173
           </td>
190
           </td>
174
         </tr>
191
         </tr>
175
         <tr>
192
         <tr>
176
-          <td class="label tooltip" title="FASTA organism line binomial nomenclature, e.g., Saccharomyces cerevisiae">Organism</td>
193
+          <td class="label tooltip" title="FASTA organism line binomial nomenclature, e.g., Saccharomyces cerevisiae">
194
+            Organism</td>
177
           <td>
195
           <td>
178
-            <input type="text" id="title_rj" name="title_rj" size="45" value="<?=(!empty($TitleRJ) ? $TitleRJ : '')?>" <?=$Disabled?>/>
196
+            <input type="text" id="title_rj" name="title_rj" size="45"
197
+              value="<?=(!empty($TitleRJ) ? $TitleRJ : '')?>"
198
+              <?=$Disabled?>/>
179
           </td>
199
           </td>
180
         </tr>
200
         </tr>
181
         <tr>
201
         <tr>
182
           <td class="label tooltip" title="FASTA organism line if applicable, e.g., S288C">Strain/Variety</td>
202
           <td class="label tooltip" title="FASTA organism line if applicable, e.g., S288C">Strain/Variety</td>
183
           <td>
203
           <td>
184
-            <input type="text" id="title_jp" name="title_jp" size="45" value="<?=!empty($TitleJP)?$TitleJP:''?>" <?=$Disabled?>/>
204
+            <input type="text" id="title_jp" name="title_jp" size="45"
205
+              value="<?=!empty($TitleJP)?$TitleJP:''?>"
206
+              <?=$Disabled?>/>
185
           </td>
207
           </td>
186
         </tr>
208
         </tr>
187
-<?php  } ?>
188
-<?php  if ($NewRequest || $CanEdit) { ?>
209
+        <?php  } ?>
210
+        <?php  if ($NewRequest || $CanEdit) { ?>
189
         <tr id="image_tr">
211
         <tr id="image_tr">
190
           <td class="label tooltip" title="A meaningful picture, e.g., of the specimen">Picture</td>
212
           <td class="label tooltip" title="A meaningful picture, e.g., of the specimen">Picture</td>
191
           <td>
213
           <td>
192
-            <input type="text" id="image" name="image" size="45" value="<?=(!empty($Image) ? $Image : '')?>" <?=$Disabled?>/>
214
+            <input type="text" id="image" name="image" size="45"
215
+              value="<?=(!empty($Image) ? $Image : '')?>"
216
+              <?=$Disabled?>/>
193
           </td>
217
           </td>
194
         </tr>
218
         </tr>
195
-<?php  } ?>
219
+        <?php  } ?>
196
         <tr>
220
         <tr>
197
-          <td class="label tooltip" title="Comma-seperated list of tags, n.b., use vanity.house for data you produced">Tags</td>
221
+          <td class="label tooltip" title="Comma-seperated list of tags, n.b., use vanity.house for data you produced">
222
+            Tags</td>
198
           <td>
223
           <td>
199
-<?php
224
+            <?php
200
   $GenreTags = $Cache->get_value('genre_tags');
225
   $GenreTags = $Cache->get_value('genre_tags');
201
   if (!$GenreTags) {
226
   if (!$GenreTags) {
202
       $DB->query('
227
       $DB->query('
211
   if (!empty($Disabled)) {
236
   if (!empty($Disabled)) {
212
       ?>
237
       ?>
213
             <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;" disabled="disabled">
238
             <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;" disabled="disabled">
214
-<?php
239
+              <?php
215
   } else { ?>
240
   } else { ?>
216
-            <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;" >
217
-<?php } ?>
218
-              <option>---</option>
219
-<?php  foreach (Misc::display_array($GenreTags) as $Genre) { ?>
220
-              <option value="<?=$Genre?>"><?=$Genre?></option>
221
-<?php  } ?>
222
-            </select>
223
-            <input type="text" id="tags" name="tags" size="45" value="<?=(!empty($Tags) ? display_str($Tags) : '')?>"<?php Users::has_autocomplete_enabled('other'); ?> <?=$Disabled?>/>
241
+              <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;">
242
+                <?php } ?>
243
+                <option>---</option>
244
+                <?php  foreach (Misc::display_array($GenreTags) as $Genre) { ?>
245
+                <option value="<?=$Genre?>"><?=$Genre?>
246
+                </option>
247
+                <?php  } ?>
248
+              </select>
249
+              <input type="text" id="tags" name="tags" size="45"
250
+                value="<?=(!empty($Tags) ? display_str($Tags) : '')?>"
251
+                <?php Users::has_autocomplete_enabled('other'); ?>
252
+              <?=$Disabled?>/>
224
           </td>
253
           </td>
225
         </tr>
254
         </tr>
226
-<?php  if ($NewRequest || $CanEdit) { ?>
227
-<?php  } ?>
255
+        <?php  if ($NewRequest || $CanEdit) { ?>
256
+        <?php  } ?>
228
         <tr>
257
         <tr>
229
           <td class="label">Description</td>
258
           <td class="label">Description</td>
230
           <td>
259
           <td>
231
-<?php          new TEXTAREA_PREVIEW('description', 'req_desc', $Request['Description']??''); ?>
260
+            <?php          new TEXTAREA_PREVIEW('description', 'req_desc', $Request['Description']??''); ?>
232
           </td>
261
           </td>
233
         </tr>
262
         </tr>
234
-<?php  if (check_perms('site_moderate_requests')) { ?>
263
+        <?php  if (check_perms('site_moderate_requests')) { ?>
235
         <tr>
264
         <tr>
236
           <td class="label">Torrent Group</td>
265
           <td class="label">Torrent Group</td>
237
           <td>
266
           <td>
238
-            <?=site_url()?>torrents.php?id=<input type="text" name="groupid" value="<?=isset($GroupID)?$GroupID:''?>" size="15"/><br />
239
-            If this request matches a torrent group <strong>already existing</strong> on the site, please indicate that here.
267
+            <?=site_url()?>torrents.php?id=<input type="text"
268
+              name="groupid"
269
+              value="<?=isset($GroupID)?$GroupID:''?>"
270
+              size="15" /><br />
271
+            If this request matches a torrent group <strong>already existing</strong> on the site, please indicate that
272
+            here.
240
           </td>
273
           </td>
241
         </tr>
274
         </tr>
242
-<?php  } elseif (!empty($GroupID) && ($CategoryID !== 5) && ($CategoryID !== 0)) { ?>
275
+        <?php  } elseif (!empty($GroupID) && ($CategoryID !== 5) && ($CategoryID !== 0)) { ?>
243
         <tr>
276
         <tr>
244
           <td class="label">Torrent Group</td>
277
           <td class="label">Torrent Group</td>
245
           <td>
278
           <td>
246
             <a href="torrents.php?id=<?=$GroupID?>"><?=site_url()?>torrents.php?id=<?=$GroupID?></a><br />
279
             <a href="torrents.php?id=<?=$GroupID?>"><?=site_url()?>torrents.php?id=<?=$GroupID?></a><br />
247
-            This request <?=($NewRequest ? 'will be' : 'is')?> associated with the above torrent group.
248
-<?php    if (!$NewRequest) { ?>
249
-            If this is incorrect, please <a href="reports.php?action=report&amp;type=request&amp;id=<?=$RequestID?>">report this request</a> so that staff can fix it.
250
-<?php    } ?>
251
-            <input type="hidden" name="groupid" value="<?=$GroupID?>" />
280
+            This request <?=($NewRequest ? 'will be' : 'is')?>
281
+            associated with the above torrent group.
282
+            <?php    if (!$NewRequest) { ?>
283
+            If this is incorrect, please <a
284
+              href="reports.php?action=report&amp;type=request&amp;id=<?=$RequestID?>">report
285
+              this request</a> so that staff can fix it.
286
+            <?php    } ?>
287
+            <input type="hidden" name="groupid"
288
+              value="<?=$GroupID?>" />
252
           </td>
289
           </td>
253
         </tr>
290
         </tr>
254
-<?php  }
291
+        <?php  }
255
   if ($NewRequest) { ?>
292
   if ($NewRequest) { ?>
256
         <tr id="voting">
293
         <tr id="voting">
257
           <td class="label tooltip" title="How much upload credit the fulfiller wins">Bounty</td>
294
           <td class="label tooltip" title="How much upload credit the fulfiller wins">Bounty</td>
258
           <td>
295
           <td>
259
-            <input type="text" id="amount_box" size="8" value="<?=(!empty($Bounty) ? $Bounty : '100')?>" onchange="Calculate();" />
296
+            <input type="text" id="amount_box" size="8"
297
+              value="<?=(!empty($Bounty) ? $Bounty : '100')?>"
298
+              onchange="Calculate();" />
260
             <select id="unit" name="unit" onchange="Calculate();">
299
             <select id="unit" name="unit" onchange="Calculate();">
261
-              <option value="mb"<?=(!empty($_POST['unit']) && $_POST['unit'] === 'mb' ? ' selected="selected"' : '') ?>>MB</option>
262
-              <option value="gb"<?=(!empty($_POST['unit']) && $_POST['unit'] === 'gb' ? ' selected="selected"' : '') ?>>GB</option>
300
+              <option value="mb" <?=(!empty($_POST['unit']) && $_POST['unit'] === 'mb' ? ' selected="selected"' : '') ?>>MB
301
+              </option>
302
+              <option value="gb" <?=(!empty($_POST['unit']) && $_POST['unit'] === 'gb' ? ' selected="selected"' : '') ?>>GB
303
+              </option>
263
             </select>
304
             </select>
264
             <input type="button" value="Preview" onclick="Calculate();" />
305
             <input type="button" value="Preview" onclick="Calculate();" />
265
-            <strong><?=($RequestTax * 100)?>% of this is deducted as tax by the system.</strong>
306
+            <strong><?=($RequestTax * 100)?>% of this is deducted as
307
+              tax by the system.</strong>
266
           </td>
308
           </td>
267
         </tr>
309
         </tr>
268
         <tr>
310
         <tr>
269
           <td class="label">Post-Request Information</td>
311
           <td class="label">Post-Request Information</td>
270
           <td>
312
           <td>
271
-            <input type="hidden" id="amount" name="amount" value="<?=(!empty($Bounty) ? $Bounty : '100')?>" />
272
-            <input type="hidden" id="current_uploaded" value="<?=$LoggedUser['BytesUploaded']?>" />
273
-            <input type="hidden" id="current_downloaded" value="<?=$LoggedUser['BytesDownloaded']?>" />
313
+            <input type="hidden" id="amount" name="amount"
314
+              value="<?=(!empty($Bounty) ? $Bounty : '100')?>" />
315
+            <input type="hidden" id="current_uploaded"
316
+              value="<?=$LoggedUser['BytesUploaded']?>" />
317
+            <input type="hidden" id="current_downloaded"
318
+              value="<?=$LoggedUser['BytesDownloaded']?>" />
274
             Bounty after tax: <strong><span id="bounty_after_tax">90.00 MB</span></strong><br />
319
             Bounty after tax: <strong><span id="bounty_after_tax">90.00 MB</span></strong><br />
275
-            If you add the entered <strong><span id="new_bounty">100.00 MB</span></strong> of bounty, your new stats will be: <br />
320
+            If you add the entered <strong><span id="new_bounty">100.00 MB</span></strong> of bounty, your new stats
321
+            will be: <br />
276
             Uploaded: <span id="new_uploaded"><?=Format::get_size($LoggedUser['BytesUploaded'])?></span><br />
322
             Uploaded: <span id="new_uploaded"><?=Format::get_size($LoggedUser['BytesUploaded'])?></span><br />
277
             Ratio: <span id="new_ratio"><?=Format::get_ratio_html($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded'])?></span>
323
             Ratio: <span id="new_ratio"><?=Format::get_ratio_html($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded'])?></span>
278
           </td>
324
           </td>
282
             <input type="submit" id="button" value="Create request" disabled="disabled" />
328
             <input type="submit" id="button" value="Create request" disabled="disabled" />
283
           </td>
329
           </td>
284
         </tr>
330
         </tr>
285
-<?php  } else { ?>
331
+        <?php  } else { ?>
286
         <tr>
332
         <tr>
287
           <td colspan="2" class="center">
333
           <td colspan="2" class="center">
288
             <input type="submit" id="button" value="Edit request" />
334
             <input type="submit" id="button" value="Edit request" />
289
           </td>
335
           </td>
290
         </tr>
336
         </tr>
291
-<?php  } ?>
337
+        <?php  } ?>
292
       </table>
338
       </table>
293
     </form>
339
     </form>
294
   </div>
340
   </div>

+ 4
- 3
sections/requests/take_new_edit.php View File

4
 //----------------- Take request -----------------------------------------------//
4
 //----------------- Take request -----------------------------------------------//
5
 authorize();
5
 authorize();
6
 
6
 
7
-
8
 if ($_POST['action'] !== 'takenew' && $_POST['action'] !== 'takeedit') {
7
 if ($_POST['action'] !== 'takenew' && $_POST['action'] !== 'takeedit') {
9
     error(0);
8
     error(0);
10
 }
9
 }
113
 }
112
 }
114
 
113
 
115
 // Not required
114
 // Not required
115
+/*
116
 if (!empty($_POST['cataloguenumber']) && $CategoryName === 'Movies') {
116
 if (!empty($_POST['cataloguenumber']) && $CategoryName === 'Movies') {
117
     $CatalogueNumber = trim($_POST['cataloguenumber']);
117
     $CatalogueNumber = trim($_POST['cataloguenumber']);
118
 } else {
118
 } else {
123
 } else {
123
 } else {
124
     $DLSiteID = '';
124
     $DLSiteID = '';
125
 }
125
 }
126
+*/
126
 
127
 
127
 // GroupID
128
 // GroupID
128
 if (!empty($_POST['groupid'])) {
129
 if (!empty($_POST['groupid'])) {
324
         ($RequestID, ".$Artist['id'].")");
325
         ($RequestID, ".$Artist['id'].")");
325
         $Cache->delete_value('artists_requests_'.$Artist['id']);
326
         $Cache->delete_value('artists_requests_'.$Artist['id']);
326
     }
327
     }
327
-    // End Music only
328
+    // End music only
328
 } else {
329
 } else {
329
     // Not a music request anymore, delete music only fields.
330
     // Not a music request anymore, delete music only fields.
330
     if (!$NewRequest) {
331
     if (!$NewRequest) {
367
     }
368
     }
368
 }
369
 }
369
 
370
 
370
-//Tags
371
+// Tags
371
 if (!$NewRequest) {
372
 if (!$NewRequest) {
372
     $DB->query("
373
     $DB->query("
373
     DELETE FROM requests_tags
374
     DELETE FROM requests_tags

Loading…
Cancel
Save