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 CHANGELOG
2013-08-08 by Squiffy
Drag and Drop ordering on the Do Not Upload page in toolbox
2013-08-05 by Ajax 2013-08-05 by Ajax
Search email blacklist Search email blacklist

View File

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

View File

@ -5,7 +5,14 @@
authorize(); 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'] == '') { if (!is_number($_POST['id']) || $_POST['id'] == '') {
error(0); error(0);
} }
@ -38,9 +45,9 @@
} else { //Create } else { //Create
$DB->query(" $DB->query("
INSERT INTO do_not_upload INSERT INTO do_not_upload
(Name, Comment, UserID, Time) (Name, Comment, UserID, Time, Sequence)
VALUES VALUES
('$P[name]','$P[comment]','$LoggedUser[ID]','".sqltime()."')"); ('$P[name]','$P[comment]','$LoggedUser[ID]','".sqltime()."', 9999)");
} }
} }

View File

@ -4,68 +4,71 @@
} }
$Title = 'Manage the "Do Not Upload" list'; $Title = 'Manage the "Do Not Upload" list';
View::show_header($Title); View::show_header($Title, 'jquery-ui,dnu_list');
$DB->query(" $DB->query("
SELECT SELECT
d.ID, d.ID,
d.Name, d.Name,
d.Comment, d.Comment,
d.UserID, d.UserID,
d.Time d.Time
FROM do_not_upload as d FROM do_not_upload as d
LEFT JOIN users_main AS um ON um.ID=d.UserID LEFT JOIN users_main AS um ON um.ID=d.UserID
ORDER BY d.Time DESC"); ORDER BY d.Sequence");
?> ?>
<div class="header"> <div class="header">
<h2><?=($Title)?></h2> <h2><?=($Title)?></h2>
</div> <center><p>Drag and drop table rows to reorder.</p></center>
<table> </div>
<tr class="colhead"> <table id="dnu">
<td colspan="4">Add an entry to the "Do Not Upload" list</td> <tr class="colhead">
</tr> <td colspan="4">Add an entry to the "Do Not Upload" list</td>
<tr class="rowa"> </tr>
<form class="add_form" name="dnu" action="tools.php" method="post"> <tr class="rowa">
<input type="hidden" name="action" value="dnu_alter" /> <form class="add_form" name="dnu" action="tools.php" method="post">
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<td>
<input type="text" name="name" size="40" />
</td>
<td colspan="2">
<input type="text" name="comment" size="60" />
</td>
<td>
<input type="submit" value="Create" />
</td>
</form>
</tr>
<tr class="colhead">
<td>Name</td>
<td>Comment</td>
<td>Added</td>
<td>Submit</td>
</tr>
<? while (list($ID, $Name, $Comment, $UserID, $DNUTime) = $DB->next_record()) { ?>
<tr>
<form class="manage_form dnu" action="tools.php" method="post">
<td>
<input type="hidden" name="action" value="dnu_alter" /> <input type="hidden" name="action" value="dnu_alter" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="id" value="<?=$ID?>" /> <td>
<input type="text" name="name" value="<?=display_str($Name)?>" size="40" /> <input type="text" name="name" size="40" />
</td> </td>
<td> <td colspan="2">
<input type="text" name="comment" value="<?=display_str($Comment)?>" size="60" /> <input type="text" name="comment" size="60" />
</td> </td>
<td> <td>
<?=Users::format_username($UserID, false, false, false)?><br /> <input type="submit" value="Create" />
<? echo time_diff($DNUTime, 1) . "\n"; ?> </td>
</td> </form>
<td> </tr>
<input type="submit" name="submit" value="Edit" /> <tr class="colhead">
<input type="submit" name="submit" value="Delete" /> <td>Name</td>
</td> <td>Comment</td>
</form> <td>Added</td>
</tr> <td>Submit</td>
<? } ?> </tr>
</table> <tbody>
<? View::show_footer(); ?> <? while (list($ID, $Name, $Comment, $UserID, $DNUTime) = $DB->next_record()) { ?>
<tr id="item_<?=$ID?>">
<form class="manage_form dnu" action="tools.php" method="post">
<td>
<input type="hidden" name="action" value="dnu_alter" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="id" value="<?=$ID?>" />
<input type="text" name="name" value="<?=display_str($Name)?>" size="40" />
</td>
<td>
<input type="text" name="comment" value="<?=display_str($Comment)?>" size="60" />
</td>
<td>
<?=Users::format_username($UserID, false, false, false)?><br />
<? echo time_diff($DNUTime, 1) . "\n"; ?>
</td>
<td>
<input type="submit" name="submit" value="Edit" />
<input type="submit" name="submit" value="Delete" />
</td>
</form>
</tr>
<? } ?>
</tbody>
</table>
<? View::show_footer(); ?>

View File

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