1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Use offset for sorting

This commit is contained in:
Tim Düsterhus 2012-03-16 17:09:12 +01:00
parent 03a84cdc4f
commit 907a348674
2 changed files with 5 additions and 3 deletions

View File

@ -4,7 +4,7 @@
//<![CDATA[
$(function() {
new WCF.Action.Delete('\\wcf\\data\\chat\\room\\ChatRoomAction', $('.chatRoomRow'));
new WCF.Sortable.List('chatRoomList', '\\wcf\\data\\chat\\room\\ChatRoomAction');
new WCF.Sortable.List('chatRoomList', '\\wcf\\data\\chat\\room\\ChatRoomAction', {@$startIndex-1});
});
//]]>
</script>
@ -30,7 +30,7 @@
<section id="chatRoomList" class="wcf-box wcf-marginTop wcf-boxPadding wcf-shadow1 wcf-sortableListContainer">
{hascontent}
<ol class="wcf-sortableList" data-object-id="0">
<ol class="wcf-sortableList" data-object-id="0" start="{$startIndex}">
{content}
{foreach from=$objects item=chatRoom}
<li class="wcf-sortableNode wcf-sortableNoNesting chatRoomRow" data-object-id="{@$chatRoom->roomID}">

View File

@ -71,6 +71,8 @@ public function validateUpdatePosition() {
if (!isset($this->parameters['data']['structure'])) {
throw new ValidateActionException('Missing parameter structure');
}
if (!isset($this->parameters['data']['offset'])) $this->parameters['data']['offset'] = 0;
}
/**
@ -82,7 +84,7 @@ public function updatePosition() {
$roomList->sqlLimit = 0;
$roomList->readObjects();
$i = 0;
$i = $this->parameters['data']['offset'];
WCF::getDB()->beginTransaction();
foreach ($this->parameters['data']['structure'][0] as $roomID) {
$room = $roomList->search($roomID);