Gazelle/sections/collages/manage.php

147 lines
5.2 KiB
PHP
Raw Normal View History

2013-06-27 08:01:06 +00:00
<?
$CollageID = $_GET['collageid'];
if (!is_number($CollageID)) {
error(0);
}
2011-03-28 14:21:28 +00:00
2013-06-28 08:01:04 +00:00
$DB->query("
SELECT Name, UserID, CategoryID
FROM collages
WHERE ID = '$CollageID'");
2013-06-27 08:01:06 +00:00
list($Name, $UserID, $CategoryID) = $DB->next_record();
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
2013-07-30 08:00:51 +00:00
if ($CategoryID == array_search(ARTIST_COLLAGE, $CollageCats)) {
error(404);
}
2013-06-27 08:01:06 +00:00
$DB->query("
SELECT
ct.GroupID,
um.ID,
um.Username,
ct.Sort,
tg.CatalogueNumber
FROM collages_torrents AS ct
2013-06-28 08:01:04 +00:00
JOIN torrents_group AS tg ON tg.ID = ct.GroupID
LEFT JOIN users_main AS um ON um.ID = ct.UserID
WHERE ct.CollageID = '$CollageID'
2013-06-27 08:01:06 +00:00
ORDER BY ct.Sort");
2011-03-28 14:21:28 +00:00
2013-06-27 08:01:06 +00:00
$GroupIDs = $DB->collect('GroupID');
2011-03-28 14:21:28 +00:00
2013-06-27 08:01:06 +00:00
$CollageDataList = $DB->to_array('GroupID', MYSQLI_ASSOC);
if (count($GroupIDs) > 0) {
$TorrentList = Torrents::get_groups($GroupIDs);
} else {
$TorrentList = array();
}
2012-07-11 08:00:16 +00:00
2014-03-16 08:00:50 +00:00
View::show_header("Manage collage: $Name", 'jquery-ui,jquery.tablesorter,sort');
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>Manage collage <a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a></h2>
</div>
2012-09-01 08:00:24 +00:00
<table width="100%" class="layout">
2012-10-27 08:00:09 +00:00
<tr class="colhead"><td id="sorting_head">Sorting</td></tr>
2012-07-11 08:00:16 +00:00
<tr>
<td id="drag_drop_textnote">
<ul>
<li>Click on the headings to organize columns automatically.</li>
<li>Sort multiple columns simultaneously by holding down the shift key and clicking other column headers.</li>
<li>Click and drag any row to change its order.</li>
2013-03-09 08:00:18 +00:00
<li>Press "Save All Changes" when you are finished sorting.</li>
<li>Press "Edit" or "Remove" to simply modify one entry.</li>
2012-07-11 08:00:16 +00:00
</ul>
</td>
2011-03-28 14:21:28 +00:00
</tr>
2012-07-11 08:00:16 +00:00
</table>
2011-03-28 14:21:28 +00:00
2012-07-11 08:00:16 +00:00
<div class="drag_drop_save hidden">
2013-08-28 23:08:41 +00:00
<input type="button" name="submit" value="Save All Changes" class="save_sortable_collage" />
2012-07-11 08:00:16 +00:00
</div>
<table id="manage_collage_table">
<thead>
<tr class="colhead">
2014-03-16 08:00:50 +00:00
<th style="width: 7%;" data-sorter="false">Order</th>
2013-11-05 08:01:12 +00:00
<th style="width: 1%;"><span><abbr class="tooltip" title="Current rank">#</abbr></span></th>
2013-06-28 08:01:04 +00:00
<th style="width: 7%;"><span>Cat.&nbsp;#</span></th>
2013-05-25 08:01:03 +00:00
<th style="width: 1%;"><span>Year</span></th>
2014-03-16 08:00:50 +00:00
<th style="width: 15%;" data-sorter="ignoreArticles"><span>Artist</span></th>
<th data-sorter="ignoreArticles"><span>Torrent</span></th>
2013-05-25 08:01:03 +00:00
<th style="width: 1%;"><span>User</span></th>
2014-03-16 08:00:50 +00:00
<th style="width: 1%; text-align: right;" class="nobr" data-sorter="false"><span><abbr class="tooltip" title="Modify an individual row">Tweak</abbr></span></th>
2012-07-11 08:00:16 +00:00
</tr>
2012-10-27 08:00:09 +00:00
</thead>
2012-07-11 08:00:16 +00:00
<tbody>
2012-08-19 08:00:19 +00:00
<?
2011-03-28 14:21:28 +00:00
2012-07-11 08:00:16 +00:00
$Number = 0;
2014-05-07 08:00:45 +00:00
foreach ($GroupIDs as $GroupID) {
if (!isset($TorrentList[$GroupID])) {
continue;
}
$Group = $TorrentList[$GroupID];
2013-02-25 21:16:55 +00:00
extract(Torrents::array_group($Group));
list(, $UserID, $Username, $Sort, $CatNum) = array_values($CollageDataList[$GroupID]);
2011-03-28 14:21:28 +00:00
2012-07-11 08:00:16 +00:00
$Number++;
$DisplayName = '';
if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
2011-11-24 08:00:16 +00:00
unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
2012-10-11 08:00:15 +00:00
$DisplayName .= Artists::display_artists($ExtendedArtists, true, false);
2013-05-05 08:00:31 +00:00
} elseif (count($Artists) > 0) {
2013-06-28 08:01:04 +00:00
$DisplayName .= Artists::display_artists(array('1' => $Artists), true, false);
2012-07-11 08:00:16 +00:00
}
2013-10-26 08:00:58 +00:00
$TorrentLink = "<a href=\"torrents.php?id=$GroupID\" class=\"tooltip\" title=\"View torrent group\">$GroupName</a>";
2012-07-11 08:00:16 +00:00
$GroupYear = $GroupYear > 0 ? $GroupYear : '';
2013-05-05 08:00:31 +00:00
if ($GroupVanityHouse) {
2013-10-26 08:00:58 +00:00
$DisplayName .= ' [<abbr class="tooltip" title="This is a Vanity House release">VH</abbr>]';
2013-05-05 08:00:31 +00:00
}
2012-07-11 08:00:16 +00:00
2013-06-28 08:01:04 +00:00
$AltCSS = ($Number % 2 === 0) ? 'rowa' : 'rowb';
2011-03-28 14:21:28 +00:00
?>
2013-03-09 08:00:18 +00:00
<tr class="drag <?=$AltCSS?>" id="li_<?=$GroupID?>">
<form class="manage_form" name="collage" action="collages.php" method="post">
<td>
<input class="sort_numbers" type="text" name="sort" value="<?=$Sort?>" id="sort_<?=$GroupID?>" size="4" />
</td>
<td><?=$Number?></td>
<td><?=trim($CatNum) ?: '&nbsp;'?></td>
<td><?=trim($GroupYear) ?: '&nbsp;'?></td>
<td><?=trim($DisplayName) ?: '&nbsp;'?></td>
<td><?=trim($TorrentLink)?></td>
<td class="nobr"><?=Users::format_username($UserID, $Username, false, false, false)?></td>
<td class="nobr">
<input type="hidden" name="action" value="manage_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="hidden" name="groupid" value="<?=$GroupID?>" />
<input type="submit" name="submit" value="Edit" />
<input type="submit" name="submit" value="Remove" />
</td>
</form>
</tr>
2012-08-19 08:00:19 +00:00
<? } ?>
2012-07-11 08:00:16 +00:00
</tbody>
2011-03-28 14:21:28 +00:00
</table>
2012-07-11 08:00:16 +00:00
<div class="drag_drop_save hidden">
2013-08-28 23:08:41 +00:00
<input type="button" name="submit" value="Save All Changes" class="save_sortable_collage" />
2012-07-11 08:00:16 +00:00
</div>
2012-09-15 08:00:25 +00:00
<form class="dragdrop_form hidden" name="collage" action="collages.php" method="post" id="drag_drop_collage_form">
2012-07-11 08:00:16 +00:00
<div>
<input type="hidden" name="action" value="manage_handle" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="collageid" value="<?=$CollageID?>" />
<input type="hidden" name="groupid" value="1" />
<input type="hidden" name="drag_drop_collage_sort_order" id="drag_drop_collage_sort_order" readonly="readonly" value="" />
</div>
</form>
2011-03-28 14:21:28 +00:00
</div>
2012-12-05 08:00:19 +00:00
<? View::show_footer(); ?>