Empty commit

This commit is contained in:
Git 2013-08-09 08:00:53 +00:00
parent 51165f4c3d
commit 640e96bb46
6 changed files with 105 additions and 66 deletions

View File

@ -1,5 +1,8 @@
CHANGELOG
2013-08-08 by Squiffy
Drag and Drop ordering on the Do Not Upload page in toolbox
2013-08-05 by Ajax
Search email blacklist

View File

@ -252,6 +252,7 @@ CREATE TABLE `do_not_upload` (
`Comment` varchar(255) COLLATE utf8_bin NOT NULL,
`UserID` int(10) NOT NULL,
`Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Sequence` mediumint(8) NOT NULL,
PRIMARY KEY (`ID`),
KEY `Time` (`Time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

View File

@ -5,7 +5,14 @@
authorize();
if ($_POST['submit'] == 'Delete') { //Delete
if($_POST['submit'] == 'Reorder') { // Reorder
foreach ($_POST['item'] as $Position => $Item) {
$Position = db_string($Position);
$Item = db_string($Item);
$DB->query('UPDATE `do_not_upload` SET `Sequence` = ' . $Position . ' WHERE `id` = '. $Item);
}
} else if ($_POST['submit'] == 'Delete') { //Delete
if (!is_number($_POST['id']) || $_POST['id'] == '') {
error(0);
}
@ -38,9 +45,9 @@
} else { //Create
$DB->query("
INSERT INTO do_not_upload
(Name, Comment, UserID, Time)
(Name, Comment, UserID, Time, Sequence)
VALUES
('$P[name]','$P[comment]','$LoggedUser[ID]','".sqltime()."')");
('$P[name]','$P[comment]','$LoggedUser[ID]','".sqltime()."', 9999)");
}
}

View File

@ -4,7 +4,7 @@
}
$Title = 'Manage the "Do Not Upload" list';
View::show_header($Title);
View::show_header($Title, 'jquery-ui,dnu_list');
$DB->query("
SELECT
d.ID,
@ -14,12 +14,13 @@
d.Time
FROM do_not_upload as d
LEFT JOIN users_main AS um ON um.ID=d.UserID
ORDER BY d.Time DESC");
ORDER BY d.Sequence");
?>
<div class="header">
<h2><?=($Title)?></h2>
<center><p>Drag and drop table rows to reorder.</p></center>
</div>
<table>
<table id="dnu">
<tr class="colhead">
<td colspan="4">Add an entry to the "Do Not Upload" list</td>
</tr>
@ -44,8 +45,9 @@
<td>Added</td>
<td>Submit</td>
</tr>
<tbody>
<? while (list($ID, $Name, $Comment, $UserID, $DNUTime) = $DB->next_record()) { ?>
<tr>
<tr id="item_<?=$ID?>">
<form class="manage_form dnu" action="tools.php" method="post">
<td>
<input type="hidden" name="action" value="dnu_alter" />
@ -67,5 +69,6 @@
</form>
</tr>
<? } ?>
</tbody>
</table>
<? View::show_footer(); ?>

View File

@ -99,7 +99,7 @@
d.Comment,
d.Time
FROM do_not_upload as d
ORDER BY d.Time DESC');
ORDER BY d.Sequence');
$DNU = $DB->to_array();
list($Name, $Comment, $Updated) = reset($DNU);
reset($DNU);

View File

@ -0,0 +1,25 @@
jQuery(document).ready(function ($) {
// Helper function to preserve table cell dimentions
var fixDimentions = function (unused, elements) {
// Iterate through each table cell and correct width
elements.children().each(function () {
$(this).width($(this).width());
});
return elements;
};
// Make table sortable
$('#dnu tbody').sortable({
helper: fixDimentions,
cancel: 'input, .colhead, .rowa',
update: function (event, ui) {
var post = $(this).sortable('serialize');
request = $.ajax({
url: 'tools.php',
type: "post",
data: 'action=dnu_alter&auth=' + authkey + '&' + post + '&submit=Reorder'
});
request.done(function (response, textStatus, jqXHR) {
});
}
});
});