From a8e8aa218d63e4cf8b821ad00ece1d3065b521c0 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 19 Oct 2011 16:38:23 +0200 Subject: [PATCH] Moved collapsible handler into user namespace Renamed to reflect the user-related behavior --- .../ICollapsibleContentAction.class.php | 24 +++++++++++++++++++ .../UserCollapsibleContentHandler.class.php | 12 +++++----- wcfsetup/setup/db/install.sql | 22 ++++++++--------- 3 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 wcfsetup/install/files/lib/system/user/collapsible/content/ICollapsibleContentAction.class.php rename wcfsetup/install/files/lib/system/user/{ => collapsible/content}/UserCollapsibleContentHandler.class.php (93%) diff --git a/wcfsetup/install/files/lib/system/user/collapsible/content/ICollapsibleContentAction.class.php b/wcfsetup/install/files/lib/system/user/collapsible/content/ICollapsibleContentAction.class.php new file mode 100644 index 0000000000..6d80be29d6 --- /dev/null +++ b/wcfsetup/install/files/lib/system/user/collapsible/content/ICollapsibleContentAction.class.php @@ -0,0 +1,24 @@ + + * @package com.woltlab.wcf + * @subpackage system.user.collapsible.content + * @category Community Framework + */ +interface ICollapsibleContentAction { + /** + * Validates required parameters. + */ + public function validateToggleContainer(); + + /** + * Toggles the visibility of container content. + */ + public function toggleContainer(); +} diff --git a/wcfsetup/install/files/lib/system/user/UserCollapsibleContentHandler.class.php b/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php similarity index 93% rename from wcfsetup/install/files/lib/system/user/UserCollapsibleContentHandler.class.php rename to wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php index abc0a8fed3..6463bf8c16 100644 --- a/wcfsetup/install/files/lib/system/user/UserCollapsibleContentHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/collapsible/content/UserCollapsibleContentHandler.class.php @@ -1,5 +1,5 @@ * @package com.woltlab.wcf - * @subpackage system.user + * @subpackage system.user.collapsible.content * @category Community Framework */ class UserCollapsibleContentHandler extends SingletonFactory { @@ -70,7 +70,7 @@ class UserCollapsibleContentHandler extends SingletonFactory { if (WCF::getUser()->userID) { $sql = "SELECT objectID - FROM wcf".WCF_N."_collapsible_content + FROM wcf".WCF_N."_user_collapsible_content WHERE objectTypeID = ? AND userID = ?"; $statement = WCF::getDB()->prepareStatement($sql); @@ -104,7 +104,7 @@ class UserCollapsibleContentHandler extends SingletonFactory { public function markAsCollapsed($objectTypeID, $objectID) { if (WCF::getUser()->userID) { $sql = "SELECT * - FROM wcf".WCF_N."_collapsible_content + FROM wcf".WCF_N."_user_collapsible_content WHERE objectTypeID = ? AND objectID = ? AND userID = ?"; @@ -117,7 +117,7 @@ class UserCollapsibleContentHandler extends SingletonFactory { $row = $statement->fetchArray(); if (!$row) { - $sql = "INSERT INTO wcf".WCF_N."_collapsible_content + $sql = "INSERT INTO wcf".WCF_N."_user_collapsible_content (objectTypeID, objectID, userID) VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); @@ -151,7 +151,7 @@ class UserCollapsibleContentHandler extends SingletonFactory { */ public function markAsOpened($objectTypeID, $objectID) { if (WCF::getUser()->userID) { - $sql = "DELETE FROM wcf".WCF_N."_collapsible_content + $sql = "DELETE FROM wcf".WCF_N."_user_collapsible_content WHERE objectTypeID = ? AND objectID = ? AND userID = ?"; diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index f91162fb3f..94e0b5c36f 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -133,14 +133,6 @@ CREATE TABLE wcf1_clipboard_page ( actionID INT(10) NOT NULL DEFAULT 0 ); -DROP TABLE IF EXISTS wcf1_collapsible_content; -CREATE TABLE wcf1_collapsible_content ( - objectTypeID INT(10) NOT NULL, - objectID INT(10) NOT NULL, - userID INT(10) NOT NULL, - UNIQUE KEY (objectTypeID, objectID, userID) -); - DROP TABLE IF EXISTS wcf1_core_object; CREATE TABLE wcf1_core_object ( objectID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -616,6 +608,14 @@ CREATE TABLE wcf1_user ( KEY styleID (styleID) ); +DROP TABLE IF EXISTS wcf1_user_collapsible_content; +CREATE TABLE wcf1_user_collapsible_content ( + objectTypeID INT(10) NOT NULL, + objectID INT(10) NOT NULL, + userID INT(10) NOT NULL, + UNIQUE KEY (objectTypeID, objectID, userID) +); + DROP TABLE IF EXISTS wcf1_user_group; CREATE TABLE wcf1_user_group ( groupID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -758,9 +758,6 @@ ALTER TABLE wcf1_clipboard_item_type ADD FOREIGN KEY (packageID) REFERENCES wcf1 ALTER TABLE wcf1_clipboard_page ADD FOREIGN KEY (actionID) REFERENCES wcf1_clipboard_action (actionID) ON DELETE CASCADE; ALTER TABLE wcf1_clipboard_page ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE; -ALTER TABLE wcf1_collapsible_content ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE; -ALTER TABLE wcf1_collapsible_content ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE; - ALTER TABLE wcf1_core_object ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE; ALTER TABLE wcf1_cronjob ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE; @@ -845,6 +842,9 @@ ALTER TABLE wcf1_template ADD FOREIGN KEY (templateGroupID) REFERENCES wcf1_temp ALTER TABLE wcf1_template_listener ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE; +ALTER TABLE wcf1_user_collapsible_content ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE; +ALTER TABLE wcf1_user_collapsible_content ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE; + ALTER TABLE wcf1_user_group_option ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE; ALTER TABLE wcf1_user_group_option_category ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE; -- 2.20.1