mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Rename position to showOrder
This commit is contained in:
parent
c001e1c728
commit
d64f11b315
@ -38,7 +38,7 @@ public function readData() {
|
||||
parent::readData();
|
||||
|
||||
$this->objects = new \chat\data\room\RoomList();
|
||||
$this->objects->sqlOrderBy = 'position ASC';
|
||||
$this->objects->sqlOrderBy = 'showOrder ASC';
|
||||
$this->objects->readObjects();
|
||||
}
|
||||
|
||||
|
@ -41,14 +41,14 @@ public function create() {
|
||||
$room = parent::create();
|
||||
|
||||
WCF::getDB()->beginTransaction();
|
||||
$sql = "SELECT MAX(position)
|
||||
$sql = "SELECT MAX(showOrder)
|
||||
FROM ".call_user_func(array($this->className, 'getDatabaseTableName'))."
|
||||
FOR UPDATE";
|
||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||
$stmt->execute();
|
||||
|
||||
$editor = new RoomEditor($room);
|
||||
$editor->update(array('position' => ($stmt->fetchColumn() + 1)));
|
||||
$editor->update(array('showOrder' => ($stmt->fetchColumn() + 1)));
|
||||
WCF::getDB()->commitTransaction();
|
||||
|
||||
return $room;
|
||||
@ -115,7 +115,7 @@ public function updatePosition() {
|
||||
if ($room === null) continue;
|
||||
|
||||
$editor = new RoomEditor($room);
|
||||
$editor->update(array('position' => $i++));
|
||||
$editor->update(array('showOrder' => $i++));
|
||||
}
|
||||
WCF::getDB()->commitTransaction();
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public static function deleteAll(array $objectIDs = array()) {
|
||||
}
|
||||
|
||||
$sql = "SELECT
|
||||
position
|
||||
showOrder
|
||||
FROM
|
||||
chat".WCF_N."_room
|
||||
WHERE
|
||||
@ -40,9 +40,9 @@ public static function deleteAll(array $objectIDs = array()) {
|
||||
$sql = "UPDATE
|
||||
chat".WCF_N."_room
|
||||
SET
|
||||
position = position - 1
|
||||
showOrder = showOrder - 1
|
||||
WHERE
|
||||
position > ?";
|
||||
showOrder > ?";
|
||||
$update = WCF::getDB()->prepareStatement($sql);
|
||||
|
||||
foreach ($objectIDs as $objectID) {
|
||||
|
@ -17,7 +17,7 @@ class RoomCacheBuilder extends \wcf\system\cache\builder\AbstractCacheBuilder {
|
||||
public function rebuild(array $parameters) {
|
||||
// get all chat rooms
|
||||
$roomList = new \chat\data\room\RoomList();
|
||||
$roomList->sqlOrderBy = "room.position";
|
||||
$roomList->sqlOrderBy = "room.showOrder";
|
||||
$roomList->readObjects();
|
||||
|
||||
return $roomList->getObjects();
|
||||
|
12
install.sql
12
install.sql
@ -32,11 +32,11 @@ CREATE TABLE chat1_room (
|
||||
roomID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
topic VARCHAR(255) NOT NULL,
|
||||
position INT(10) NOT NULL DEFAULT 0,
|
||||
showOrder INT(10) NOT NULL DEFAULT 0,
|
||||
permanent TINYINT(1) NOT NULL DEFAULT 1,
|
||||
owner INT(10) DEFAULT NULL,
|
||||
|
||||
KEY positionKey (position),
|
||||
KEY showOrder (showOrder),
|
||||
KEY owner (owner)
|
||||
);
|
||||
|
||||
@ -63,7 +63,7 @@ ALTER TABLE chat1_room ADD FOREIGN KEY (owner) REFERENCES wcf1_user (userID) ON
|
||||
ALTER TABLE chat1_suspension ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
|
||||
ALTER TABLE chat1_suspension ADD FOREIGN KEY (roomID) REFERENCES chat1_room (roomID) ON DELETE CASCADE;
|
||||
|
||||
INSERT INTO chat1_room (title, topic, position) VALUES ('chat.room.title1', 'chat.room.topic1', 1);
|
||||
INSERT INTO chat1_room (title, topic, position) VALUES ('Testroom 2', 'Topic of Testroom 2', 2);
|
||||
INSERT INTO chat1_room (title, topic, position) VALUES ('Testroom with a very long', 'The topic of this room is rather loing as well!', 3);
|
||||
INSERT INTO chat1_room (title, topic, position) VALUES ('Room w/o topic', '', 4);
|
||||
INSERT INTO chat1_room (title, topic, showOrder) VALUES ('chat.room.title1', 'chat.room.topic1', 1);
|
||||
INSERT INTO chat1_room (title, topic, showOrder) VALUES ('Testroom 2', 'Topic of Testroom 2', 2);
|
||||
INSERT INTO chat1_room (title, topic, showOrder) VALUES ('Testroom with a very long', 'The topic of this room is rather loing as well!', 3);
|
||||
INSERT INTO chat1_room (title, topic, showOrder) VALUES ('Room w/o topic', '', 4);
|
||||
|
Loading…
Reference in New Issue
Block a user