- new version of the notification package
authorMarcel Werk <burntime@woltlab.com>
Thu, 14 Jul 2011 18:03:17 +0000 (20:03 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 14 Jul 2011 18:03:17 +0000 (20:03 +0200)
20 files changed:
com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotification.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationAction.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationEditor.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/UserNotificationList.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEvent.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventAction.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventEditor.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/event/UserNotificationEventList.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectType.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeAction.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeEditor.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/object/type/UserNotificationObjectTypeList.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationType.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeAction.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeEditor.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/data/user/notification/type/UserNotificationTypeList.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/files/lib/system/package/plugin/UserNotificationEventPackageInstallationPlugin.class.php [new file with mode: 0644]
com.woltlab.wcf.notification/install.sql [new file with mode: 0644]
com.woltlab.wcf.notification/package.xml [new file with mode: 0644]
com.woltlab.wcf.notification/pip.xml [new file with mode: 0644]

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 (file)
index 0000000..a23ce7f
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+namespace wcf\data\user\notification;
+use wcf\data\DatabaseObject;
+
+/**
+ * Represents a user notification.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..6c2a2c5
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification;
+use wcf\data\AbstractDatabaseObjectAction;
+
+/**
+ * Executes user notification-related actions.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..27a1148
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification;
+use wcf\data\DatabaseObjectEditor;
+
+/**
+ * Provides functions to edit user notifications.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..0175338
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification;
+use wcf\data\DatabaseObjectList;
+
+/**
+ * Represents a list of user notifications.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..3da47db
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+namespace wcf\data\user\notification\event;
+use wcf\data\DatabaseObject;
+
+/**
+ * Represents a user notification event.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..b9b68ac
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification\event;
+use wcf\data\AbstractDatabaseObjectAction;
+
+/**
+ * Executes user notification event-related actions.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..1efd880
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification\event;
+use wcf\data\DatabaseObjectEditor;
+
+/**
+ * Provides functions to edit user notification events.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..7291baf
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification\event;
+use wcf\data\DatabaseObjectList;
+
+/**
+ * Represents a list of user notification events.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..671f53c
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+namespace wcf\data\user\notification\object\type;
+use wcf\data\DatabaseObject;
+
+/**
+ * Represents a user notification object type.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..ce458e0
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification\object\type;
+use wcf\data\AbstractDatabaseObjectAction;
+
+/**
+ * Executes user notification object type-related actions.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..320bdb0
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification\object\type;
+use wcf\data\DatabaseObjectEditor;
+
+/**
+ * Provides functions to edit user notification object types.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..370061d
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification\object\type;
+use wcf\data\DatabaseObjectList;
+
+/**
+ * Represents a list of user notification object types.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..cd76b25
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+namespace wcf\data\user\notification\type;
+use wcf\data\DatabaseObject;
+
+/**
+ * Represents a user notification type.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..dc117f9
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification\type;
+use wcf\data\AbstractDatabaseObjectAction;
+
+/**
+ * Executes user notification type-related actions.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..b0cefee
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification\type;
+use wcf\data\DatabaseObjectEditor;
+
+/**
+ * Provides functions to edit user notification types.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..829efbe
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+namespace wcf\data\user\notification\type;
+use wcf\data\DatabaseObjectList;
+
+/**
+ * Represents a list of user notification types.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..8b8de31
--- /dev/null
@@ -0,0 +1,88 @@
+<?php
+namespace wcf\system\package\plugin;
+use wcf\system\cache\CacheHandler;
+use wcf\system\WCF;
+
+/**
+ * This PIP installs, updates or deletes user notification events.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..e0fe14d
--- /dev/null
@@ -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 (file)
index 0000000..f7ee015
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package name="com.woltlab.wcf.user.notification" xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com/XSD/package.xsd">
+       <packageinformation>
+               <packagename>User Notification System</packagename>             
+               <version>1.0.0 Alpha 1</version>
+               <date>2010-08-22</date>
+               <isunique>1</isunique>
+       </packageinformation>
+
+       <authorinformation>
+               <author>WoltLab GmbH, Oliver Kliebisch and Tim Düsterhus</author>
+               <authorurl>http://www.woltlab.com</authorurl>
+       </authorinformation>
+       
+       <requiredpackages>
+               <requiredpackage minversion="2.0.0 Alpha 1">com.woltlab.wcf</requiredpackage>
+       </requiredpackages>
+
+       <instructions type="install">
+               <instruction type="packageinstallationplugins">pip.xml</instruction>
+               <instruction type="files">files.tar</instruction>
+               <instruction type="sql">install.sql</instruction>
+       </instructions>
+</package>
\ 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 (file)
index 0000000..5cf8227
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/pip.xsd">
+       <import>
+               <pip name="userNotificationEvent">wcf\system\package\plugin\UserNotificationEventPackageInstallationPlugin</pip>
+               <pip name="userNotificationObjectType">wcf\system\package\plugin\UserNotificationObjectTypePackageInstallationPlugin</pip>
+               <pip name="userNotificationType">wcf\system\package\plugin\UserNotificationTypePackageInstallationPlugin</pip>
+       </import>
+</data>