From: Marcel Werk Date: Thu, 14 Jul 2011 18:03:17 +0000 (+0200) Subject: - new version of the notification package X-Git-Tag: 2.0.0_Beta_1~2041^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7be46e0c860a1bf964ac06a15ba9743534ecdd05;p=GitHub%2FWoltLab%2FWCF.git - new version of the notification package --- diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotification.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotification.class.php new file mode 100644 index 0000000000..a23ce7f5b2 --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotification.class.php @@ -0,0 +1,26 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification + * @category Community Framework + */ +class UserNotification extends DatabaseObject { + /** + * @see DatabaseObject::$databaseTableName + */ + protected static $databaseTableName = 'user_notification'; + + /** + * @see DatabaseObject::$databaseTableIndexName + */ + protected static $databaseTableIndexName = 'notificationID'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationAction.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationAction.class.php new file mode 100644 index 0000000000..6c2a2c5a3a --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationAction.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification + * @category Community Framework + */ +class UserNotificationAction extends AbstractDatabaseObjectAction { + /** + * @see AbstractDatabaseObjectAction::$className + */ + protected $className = 'wcf\data\user\notification\UserNotificationEditor'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationEditor.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationEditor.class.php new file mode 100644 index 0000000000..27a1148edf --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationEditor.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification + * @category Community Framework + */ +class UserNotificationEditor extends DatabaseObjectEditor { + /** + * @see DatabaseObjectEditor::$baseClass + */ + protected static $baseClass = 'wcf\data\user\notification\UserNotification'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationList.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationList.class.php new file mode 100644 index 0000000000..01753381cc --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationList.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification + * @category Community Framework + */ +class UserNotificationList extends DatabaseObjectList { + /** + * @see DatabaseObjectList::$className + */ + public $className = 'wcf\data\user\notification\UserNotification'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEvent.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEvent.class.php new file mode 100644 index 0000000000..3da47db829 --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEvent.class.php @@ -0,0 +1,26 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.event + * @category Community Framework + */ +class UserNotificationEvent extends DatabaseObject { + /** + * @see DatabaseObject::$databaseTableName + */ + protected static $databaseTableName = 'user_notification_event'; + + /** + * @see DatabaseObject::$databaseTableIndexName + */ + protected static $databaseTableIndexName = 'eventID'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventAction.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventAction.class.php new file mode 100644 index 0000000000..b9b68acc9a --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventAction.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.event + * @category Community Framework + */ +class UserNotificationEventAction extends AbstractDatabaseObjectAction { + /** + * @see AbstractDatabaseObjectAction::$className + */ + protected $className = 'wcf\data\user\notification\event\UserNotificationEventEditor'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventEditor.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventEditor.class.php new file mode 100644 index 0000000000..1efd880125 --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventEditor.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.event + * @category Community Framework + */ +class UserNotificationEventEditor extends DatabaseObjectEditor { + /** + * @see DatabaseObjectEditor::$baseClass + */ + protected static $baseClass = 'wcf\data\user\notification\event\UserNotificationEvent'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventList.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventList.class.php new file mode 100644 index 0000000000..7291baf460 --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventList.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.event + * @category Community Framework + */ +class UserNotificationEventList extends DatabaseObjectList { + /** + * @see DatabaseObjectList::$className + */ + public $className = 'wcf\data\user\notification\event\UserNotificationEvent'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectType.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectType.class.php new file mode 100644 index 0000000000..671f53c3ed --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectType.class.php @@ -0,0 +1,26 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.object.type + * @category Community Framework + */ +class UserNotificationObjectType extends DatabaseObject { + /** + * @see DatabaseObject::$databaseTableName + */ + protected static $databaseTableName = 'user_notification_object_type'; + + /** + * @see DatabaseObject::$databaseTableIndexName + */ + protected static $databaseTableIndexName = 'objectTypeID'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeAction.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeAction.class.php new file mode 100644 index 0000000000..ce458e0df3 --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeAction.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.object.type + * @category Community Framework + */ +class UserNotificationObjectTypeAction extends AbstractDatabaseObjectAction { + /** + * @see AbstractDatabaseObjectAction::$className + */ + protected $className = 'wcf\data\user\notification\object\type\UserNotificationObjectTypeEditor'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeEditor.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeEditor.class.php new file mode 100644 index 0000000000..320bdb0568 --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeEditor.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.object.type + * @category Community Framework + */ +class UserNotificationObjectTypeEditor extends DatabaseObjectEditor { + /** + * @see DatabaseObjectEditor::$baseClass + */ + protected static $baseClass = 'wcf\data\user\notification\object\type\UserNotificationObjectType'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeList.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeList.class.php new file mode 100644 index 0000000000..370061d5df --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeList.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification + * @category Community Framework + */ +class UserNotificationObjectTypeList extends DatabaseObjectList { + /** + * @see DatabaseObjectList::$className + */ + public $className = 'wcf\data\user\notification\object\type\UserNotificationObjectType'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationType.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationType.class.php new file mode 100644 index 0000000000..cd76b2593d --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationType.class.php @@ -0,0 +1,26 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.type + * @category Community Framework + */ +class UserNotificationType extends DatabaseObject { + /** + * @see DatabaseObject::$databaseTableName + */ + protected static $databaseTableName = 'user_notification_type'; + + /** + * @see DatabaseObject::$databaseTableIndexName + */ + protected static $databaseTableIndexName = 'notificationTypeID'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeAction.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeAction.class.php new file mode 100644 index 0000000000..dc117f9960 --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeAction.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.type + * @category Community Framework + */ +class UserNotificationTypeAction extends AbstractDatabaseObjectAction { + /** + * @see AbstractDatabaseObjectAction::$className + */ + protected $className = 'wcf\data\user\notification\type\UserNotificationTypeEditor'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeEditor.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeEditor.class.php new file mode 100644 index 0000000000..b0cefee03b --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeEditor.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.type + * @category Community Framework + */ +class UserNotificationTypeEditor extends DatabaseObjectEditor { + /** + * @see DatabaseObjectEditor::$baseClass + */ + protected static $baseClass = 'wcf\data\user\notification\type\UserNotificationType'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeList.class.php b/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeList.class.php new file mode 100644 index 0000000000..829efbe013 --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeList.class.php @@ -0,0 +1,21 @@ + + * @package com.woltlab.wcf.notification + * @subpackage data.user.notification.type + * @category Community Framework + */ +class UserNotificationTypeList extends DatabaseObjectList { + /** + * @see DatabaseObjectList::$className + */ + public $className = 'wcf\data\user\notification\type\UserNotificationType'; +} +?> \ No newline at end of file diff --git a/com.woltlab.wcf.notification/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php b/com.woltlab.wcf.notification/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php new file mode 100644 index 0000000000..8b8de31735 --- /dev/null +++ b/com.woltlab.wcf.notification/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php @@ -0,0 +1,88 @@ + + * @package com.woltlab.wcf.notification + * @subpackage system.package.plugin + * @category Community Framework + */ +class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin { + /** + * @see AbstractXMLPackageInstallationPlugin::$className + */ + public $className = 'wcf\data\user\notification\event\UserNotificationEventEditor'; + + /** + * @see AbstractXMLPackageInstallationPlugin::$tableName + */ + public $tableName = 'user_notification_event'; + + /** + * @see AbstractXMLPackageInstallationPlugin::$tagName + */ + public $tagName = 'event'; + + /** + * @see AbstractXMLPackageInstallationPlugin::handleDelete() + */ + protected function handleDelete(array $items) { + $sql = "DELETE FROM wcf".WCF_N."_".$this->tableName." + WHERE packageID = ? + AND eventName = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + foreach ($items as $item) { + $statement->execute(array( + $this->installation->getPackageID(), + $item['elements']['name'] + )); + } + } + + /** + * @see AbstractXMLPackageInstallationPlugin::prepareImport() + */ + protected function prepareImport(array $data) { + $objectTypeID = 0; + $defaultNotificationTypeID = 0; + + return array( + 'eventName' => $data['elements']['name'], + 'className' => $data['elements']['classname'], + 'objectTypeID' => $objectTypeID, + 'defaultNotificationTypeID' => $defaultNotificationTypeID, + 'languageCategory' => (isset($data['elements']['languagecategory']) ? $data['elements']['languagecategory'] : ''), + 'requiresConfirmation' => (isset($data['elements']['requiresconfirmation']) ? intval($data['elements']['requiresconfirmation']) : 0), + 'acceptURL' => (isset($data['elements']['accepturl']) ? $data['elements']['accepturl'] : ''), + 'declineURL' => (isset($data['elements']['declineurl']) ? $data['elements']['declineurl'] : ''), + 'permissions' => (isset($data['elements']['permissions']) ? $data['elements']['permissions'] : ''), + 'options' => (isset($data['elements']['options']) ? $data['elements']['options'] : '') + ); + } + + /** + * @see AbstractXMLPackageInstallationPlugin::findExistingItem() + */ + protected function findExistingItem(array $data) { + $sql = "SELECT * + FROM wcf".WCF_N."_".$this->tableName." + WHERE packageID = ? + AND eventName = ?"; + $parameters = array( + $this->installation->getPackageID(), + $data['eventName'] + ); + + return array( + 'sql' => $sql, + 'parameters' => $parameters + ); + } +} +?> diff --git a/com.woltlab.wcf.notification/install.sql b/com.woltlab.wcf.notification/install.sql new file mode 100644 index 0000000000..e0fe14d0cc --- /dev/null +++ b/com.woltlab.wcf.notification/install.sql @@ -0,0 +1,91 @@ +-- notifications +DROP TABLE IF EXISTS wcf1_user_notification; +CREATE TABLE wcf1_user_notification ( + notificationID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, + packageID INT(10) NOT NULL, + eventID INT(10) NOT NULL, + objectID INT(10) NOT NULL DEFAULT 0, + time INT(10) NOT NULL DEFAULT 0, + shortOutput VARCHAR(255) DEFAULT NULL, + mediumOutput TEXT, + longOutput TEXT, + additionalData TEXT +); + +-- notification recipients +DROP TABLE IF EXISTS wcf1_user_notification_to_user; +CREATE TABLE wcf1_user_notification_to_user ( + notificationID INT(10) NOT NULL, + userID INT(10) NOT NULL, + confirmed TINYINT(1) NOT NULL, + confirmationTime INT(10) NOT NULL DEFAULT 0, + UNIQUE KEY notificationID (notificationID, userID) +); + +-- events that create notifications +DROP TABLE IF EXISTS wcf1_user_notification_event; +CREATE TABLE wcf1_user_notification_event ( + eventID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, + packageID INT(10) NOT NULL, + eventName VARCHAR(255) NOT NULL DEFAULT '', + objectTypeID INT(10) NOT NULL, + className VARCHAR(255) NOT NULL DEFAULT '', + languageCategory VARCHAR(255) NOT NULL, + defaultNotificationTypeID INT(10) NULL, + requiresConfirmation TINYINT(1) NOT NULL DEFAULT 0, + acceptURL VARCHAR(255) NOT NULL DEFAULT '', + declineURL VARCHAR(255) NOT NULL DEFAULT '', + permissions TEXT, + options TEXT, + UNIQUE KEY packageID (packageID, eventName) +); + +-- user configuration for events +DROP TABLE IF EXISTS wcf1_user_notification_event_to_user; +CREATE TABLE wcf1_user_notification_event_to_user ( + userID INT(10) NOT NULL, + eventID INT(10) NOT NULL, + notificationTypeID INT(10) NOT NULL, + enabled TINYINT(1) NOT NULL DEFAULT 0 +); + +-- objects that create notifications +DROP TABLE IF EXISTS wcf1_user_notification_object_type; +CREATE TABLE wcf1_user_notification_object_type ( + objectTypeID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, + packageID INT(10) NOT NULL, + objectType VARCHAR(255) NOT NULL, + className VARCHAR(255) NOT NULL, + permissions TEXT, + options TEXT, + UNIQUE KEY packageID (packageID, objectType) +); + +-- notification types (pm, mail, ...) +DROP TABLE IF EXISTS wcf1_user_notification_type; +CREATE TABLE wcf1_user_notification_type ( + notificationTypeID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, + packageID INT(10) NOT NULL, + notificationType VARCHAR(255) NOT NULL, + className VARCHAR(255) NOT NULL, + permissions TEXT, + options TEXT +); + +ALTER TABLE wcf1_user_notification ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE; +ALTER TABLE wcf1_user_notification ADD FOREIGN KEY (eventID) REFERENCES wcf1_user_notification_event (eventID) ON DELETE CASCADE; + +ALTER TABLE wcf1_user_notification_to_user ADD FOREIGN KEY (notificationID) REFERENCES wcf1_user_notification (notificationID) ON DELETE CASCADE; +ALTER TABLE wcf1_user_notification_to_user ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE; + +ALTER TABLE wcf1_user_notification_event ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE; +ALTER TABLE wcf1_user_notification_event ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_user_notification_object_type (objectTypeID) ON DELETE CASCADE; +ALTER TABLE wcf1_user_notification_event ADD FOREIGN KEY (defaultNotificationTypeID) REFERENCES wcf1_user_notification_type (notificationTypeID) ON DELETE SET NULL; + +ALTER TABLE wcf1_user_notification_event_to_user ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE; +ALTER TABLE wcf1_user_notification_event_to_user ADD FOREIGN KEY (eventID) REFERENCES wcf1_user_notification_event (eventID) ON DELETE CASCADE; +ALTER TABLE wcf1_user_notification_event_to_user ADD FOREIGN KEY (notificationTypeID) REFERENCES wcf1_user_notification_type (notificationTypeID) ON DELETE CASCADE; + +ALTER TABLE wcf1_user_notification_object_type ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE; + +ALTER TABLE wcf1_user_notification_type ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE; \ No newline at end of file diff --git a/com.woltlab.wcf.notification/package.xml b/com.woltlab.wcf.notification/package.xml new file mode 100644 index 0000000000..f7ee01560b --- /dev/null +++ b/com.woltlab.wcf.notification/package.xml @@ -0,0 +1,24 @@ + + + + User Notification System + 1.0.0 Alpha 1 + 2010-08-22 + 1 + + + + WoltLab GmbH, Oliver Kliebisch and Tim Düsterhus + http://www.woltlab.com + + + + com.woltlab.wcf + + + + pip.xml + files.tar + install.sql + + \ No newline at end of file diff --git a/com.woltlab.wcf.notification/pip.xml b/com.woltlab.wcf.notification/pip.xml new file mode 100644 index 0000000000..5cf8227c15 --- /dev/null +++ b/com.woltlab.wcf.notification/pip.xml @@ -0,0 +1,8 @@ + + + + wcf\system\package\plugin\UserNotificationEventPackageInstallationPlugin + wcf\system\package\plugin\UserNotificationObjectTypePackageInstallationPlugin + wcf\system\package\plugin\UserNotificationTypePackageInstallationPlugin + +