For the sorting, I added this to the comments tpl after uploading the arrows.png image that comes with the jQuery sortable script (I preferred the name "move.png" as it made it clearer what it was supposed to do)
[+jot.moderation.enabled:is=`1`:then=`
<img class="handle" src="[(base_url)]assets/snippets/jot/templates/move.png" width="16" height="16" alt="Move item" title="Move Item" border="0" />
`:strip+]
then before my Jot call I added the javascript code
<script type="text/javascript" src="assets/js/jquery-ui-1.7.1.custom.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#commentsAnchor").sortable({
handle : '.handle',
update : function () {
var order = $('#commentsAnchor').sortable('serialize');
$("#info").load("[~211~]?"+order);
}
});
});
</script>
<span id="info"></span>
The backend code, (in a snippet called on document #211 which is very plain, blank template, nothing but published, an alias and the snippet tags in the content)
<?php
$table = $modx->getFullTableName('jot_fields');
foreach ($_GET['listItem'] as $position => $item) {
$sql = "UPDATE $table SET `content` = '" . chr($position + 65) . "' WHERE `id` = $item AND `label` = 'position'";
$modx->db->query($sql);
}
?>