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,71 +97,86 @@ View::show_header(($NewRequest ? 'Create a request' : 'Edit a request'), 'bbcode
97 97
 ?>
98 98
 <div class="thin">
99 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 102
   </div>
102 103
 
103 104
   <div class="box pad">
104 105
     <form action="" method="post" id="request_form" onsubmit="Calculate();">
105 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 115
       </div>
112 116
 
113 117
       <table class="layout">
114 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 121
         </tr>
117
-<?php  if ($NewRequest || $CanEdit) { ?>
122
+        <?php  if ($NewRequest || $CanEdit) { ?>
118 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 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 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 139
           </td>
132 140
         </tr>
133 141
         <tr id="cataloguenumber_tr">
134 142
           <td class="label">Accession Number</td>
135 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 150
           </td>
141 151
         </tr>
142 152
         <tr id="artist_tr">
143 153
           <td class="label">Collaborator(s)</td>
144 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 159
     if (!empty($ArtistForm)) {
148 160
         $First = true;
149 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 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 168
                 $First = false;
155 169
             } ?>
156 170
             <br />
157
-<?php
171
+            <?php
158 172
         }
159 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 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 182
           </td>
@@ -169,34 +184,44 @@ View::show_header(($NewRequest ? 'Create a request' : 'Edit a request'), 'bbcode
169 184
         <tr>
170 185
           <td class="label tooltip" title="FASTA definition line, e.g., Alcohol dehydrogenase ADH1">Sequence Name</td>
171 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 190
           </td>
174 191
         </tr>
175 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 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 199
           </td>
180 200
         </tr>
181 201
         <tr>
182 202
           <td class="label tooltip" title="FASTA organism line if applicable, e.g., S288C">Strain/Variety</td>
183 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 207
           </td>
186 208
         </tr>
187
-<?php  } ?>
188
-<?php  if ($NewRequest || $CanEdit) { ?>
209
+        <?php  } ?>
210
+        <?php  if ($NewRequest || $CanEdit) { ?>
189 211
         <tr id="image_tr">
190 212
           <td class="label tooltip" title="A meaningful picture, e.g., of the specimen">Picture</td>
191 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 217
           </td>
194 218
         </tr>
195
-<?php  } ?>
219
+        <?php  } ?>
196 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 223
           <td>
199
-<?php
224
+            <?php
200 225
   $GenreTags = $Cache->get_value('genre_tags');
201 226
   if (!$GenreTags) {
202 227
       $DB->query('
@@ -211,68 +236,89 @@ View::show_header(($NewRequest ? 'Create a request' : 'Edit a request'), 'bbcode
211 236
   if (!empty($Disabled)) {
212 237
       ?>
213 238
             <select id="genre_tags" name="genre_tags" onchange="add_tag(); return false;" disabled="disabled">
214
-<?php
239
+              <?php
215 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 253
           </td>
225 254
         </tr>
226
-<?php  if ($NewRequest || $CanEdit) { ?>
227
-<?php  } ?>
255
+        <?php  if ($NewRequest || $CanEdit) { ?>
256
+        <?php  } ?>
228 257
         <tr>
229 258
           <td class="label">Description</td>
230 259
           <td>
231
-<?php          new TEXTAREA_PREVIEW('description', 'req_desc', $Request['Description']??''); ?>
260
+            <?php          new TEXTAREA_PREVIEW('description', 'req_desc', $Request['Description']??''); ?>
232 261
           </td>
233 262
         </tr>
234
-<?php  if (check_perms('site_moderate_requests')) { ?>
263
+        <?php  if (check_perms('site_moderate_requests')) { ?>
235 264
         <tr>
236 265
           <td class="label">Torrent Group</td>
237 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 273
           </td>
241 274
         </tr>
242
-<?php  } elseif (!empty($GroupID) && ($CategoryID !== 5) && ($CategoryID !== 0)) { ?>
275
+        <?php  } elseif (!empty($GroupID) && ($CategoryID !== 5) && ($CategoryID !== 0)) { ?>
243 276
         <tr>
244 277
           <td class="label">Torrent Group</td>
245 278
           <td>
246 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 289
           </td>
253 290
         </tr>
254
-<?php  }
291
+        <?php  }
255 292
   if ($NewRequest) { ?>
256 293
         <tr id="voting">
257 294
           <td class="label tooltip" title="How much upload credit the fulfiller wins">Bounty</td>
258 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 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 304
             </select>
264 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 308
           </td>
267 309
         </tr>
268 310
         <tr>
269 311
           <td class="label">Post-Request Information</td>
270 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 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 322
             Uploaded: <span id="new_uploaded"><?=Format::get_size($LoggedUser['BytesUploaded'])?></span><br />
277 323
             Ratio: <span id="new_ratio"><?=Format::get_ratio_html($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded'])?></span>
278 324
           </td>
@@ -282,13 +328,13 @@ View::show_header(($NewRequest ? 'Create a request' : 'Edit a request'), 'bbcode
282 328
             <input type="submit" id="button" value="Create request" disabled="disabled" />
283 329
           </td>
284 330
         </tr>
285
-<?php  } else { ?>
331
+        <?php  } else { ?>
286 332
         <tr>
287 333
           <td colspan="2" class="center">
288 334
             <input type="submit" id="button" value="Edit request" />
289 335
           </td>
290 336
         </tr>
291
-<?php  } ?>
337
+        <?php  } ?>
292 338
       </table>
293 339
     </form>
294 340
   </div>

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

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

Loading…
Cancel
Save