(edit)
Hide minor edits - Show changes to markup
<TODO: mlunzena> http://www.goodbyehelicopter.com/?p=259
Dazu gibt es bisher keine gültige Richtlinie. Offenbar scheint sich aber abzuzeichnen, dass der Name in CamelCase geschrieben und eine Handlung beschreibt. Da das NotificationCenter an die Originalimplementation aus NextStep angelehnt ist, macht es vermutlich Sinnn, ähnliche Konventionen wie dort zu verwenden. So beschreibt der Artikel NSNotfication Not Working, But Looks Right? :: Find That Bug! ein BestPractice, wonach die Notifications:
JJColorChange
und:
JJColorChanged
nur schwer im Code zu unterscheiden sind, da sie sich lediglich um einen Buchstaben unterscheiden. Die Empfehlung lautet statt:
lieber:
zu verwenden. Aus diesen Gründen wurden bei den Notifications für Dateien, Wikiseiten und Forumsbeiträgen die Namen entsprechend gewählt.
<TODO: elmar oder anoack>
CourseRemovedFromModule
CourseAddedToModule
lib/classes/StudipSemTree.class.php: NotificationCenter::postNotification('CourseRemovedFromModule', $studyarea, array('module_id' => $sem_tree_id, 'course_id' => $seminar_id)); lib/classes/StudipSemTree.class.php: NotificationCenter::postNotification('CourseAddedToModule', $studyarea, array('module_id' => $sem_tree_id, 'course_id' => $seminar_id));
lib/dates.inc.php: NotificationCenter::postNotification('PostingWillDelete', $topic_id); lib/dates.inc.php: NotificationCenter::postNotification('PostingDidDelete', $topic_id); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageWillUpdate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageDidUpdate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageWillCreate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageDidCreate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageWillDelete', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageDidDelete', array($range_id, $keyword)); public/forum.php: NotificationCenter::postNotification('PostingWillCreate', $update); public/forum.php: NotificationCenter::postNotification('PostingDidCreate', $update); public/forum.php: NotificationCenter::postNotification('PostingWillUpdate', $update); public/forum.php: NotificationCenter::postNotification('PostingDidUpdate', $update);
Wenn ein Forumsbeitrag verfasst wurde, wird vor dem tatsächlichen Speichern die Notification PostingWillCreate und nach dem Speichern PostingDidCreate versendet. Das subject ist die ID des Forumsbeitrags.
PostingWillCreate
PostingDidCreate
subject
Wenn ein Forumsbeitrag verändert wurde, wird vor dem tatsächlichen Speichern die Notification PostingWillUpdate und nach dem Speichern PostingDidUpdate versendet. Das subject ist die ID des Forumsbeitrags.
PostingWillUpdate
PostingDidUpdate
Auch wenn ein Forumsbeitrag gelöscht wird, gibt es Notifications: PostingWillDelete und PostingDidDelete. Auch dort wird der Vollständigkeit halber die ID des Forumsbeitrags übergeben.
PostingWillDelete
PostingDidDelete
Wenn eine Wikiseite verfasst wurde, wird vor dem tatsächlichen Speichern die Notification PostingWillCreate und nach dem Speichern PostingDidCreate versendet. Das subject ist ein Array mit range_id und keyword der Wikiseite.
range_id
keyword
Wenn eine Wikiseite verändert wurde, wird vor dem tatsächlichen Speichern die Notification PostingWillUpdate und nach dem Speichern PostingDidUpdate versendet. Das subject ist ein Array mit range_id und keyword der Wikiseite.
Auch wenn eine Wikiseite gelöscht wird, gibt es Notifications: PostingWillDelete und PostingDidDelete. Auch dort wird der Vollständigkeit halber ein Array mit range_id und keyword der Wikiseite übergeben.
ConfigValueChanged
Dies Notification wird versendet, wenn sich ein in der Klasse Config enthaltener Parameter geändert hat. Als subject wird die Config-Instanz mitgegeben und als userdata der neue und alte Wert.
Config
userdata
lib/classes/StudipDocument.class.php: NotificationCenter::postNotification('DocumentWillDelete', $to_delete); lib/classes/StudipDocument.class.php: NotificationCenter::postNotification('DocumentDidDelete', $to_delete); lib/classes/StudipDocument.class.php: NotificationCenter::postNotification($notifications[0], $doc); lib/classes/StudipDocument.class.php: NotificationCenter::postNotification($notifications[1], $doc); lib/classes/StudipSemTree.class.php: NotificationCenter::postNotification('CourseRemovedFromModule', $studyarea, array('module_id' => $sem_tree_id, 'course_id' => $seminar_id)); lib/classes/StudipSemTree.class.php: NotificationCenter::postNotification('CourseAddedToModule', $studyarea, array('module_id' => $sem_tree_id, 'course_id' => $seminar_id)); lib/dates.inc.php: NotificationCenter::postNotification('PostingWillDelete', $topic_id); lib/dates.inc.php: NotificationCenter::postNotification('PostingDidDelete', $topic_id); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageWillUpdate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageDidUpdate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageWillCreate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageDidCreate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageWillDelete', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageDidDelete', array($range_id, $keyword)); public/forum.php: NotificationCenter::postNotification('PostingWillCreate', $update); public/forum.php: NotificationCenter::postNotification('PostingDidCreate', $update); public/forum.php: NotificationCenter::postNotification('PostingWillUpdate', $update); public/forum.php: NotificationCenter::postNotification('PostingDidUpdate', $update);
Wenn eine Datei hochgeladen wird, wird vor dem tatsächlichen Anlegen die Notification DocumentWillCreate und nach dem Anlegen DocumentDidCreate versendet. Als subject dient dabei stets die zugehörige Instanz der Klasse StudipDocument.
DocumentWillCreate
DocumentDidCreate
StudipDocument
Wenn der Inhalt einer Datei upgedatet wird, wird analog vorher die Notification DocumentWillUpdate und hinterher DocumentDidUpdate verschickt. Auch hier ist das subject wieder die Instanz der Klasse StudipDocument.
DocumentWillUpdate
DocumentDidUpdate
Auch wenn eine Datei gelöscht wird, werden Notifications versendet: DocumentWillDelete und DocumentDidDelete. Auch in diesen Fällen werden als subject Instanzen der Klasse StudipDocument verwendet, wenn gleich diese gerade bei DocumentDidDelete eher dokumentarisch verwendet werden können, da sie ja gelöscht wurden.
DocumentWillDelete
DocumentDidDelete
lib/classes/NotificationCenter.class.php: * Event notifications are sent via the postNotification() method: lib/classes/NotificationCenter.class.php: * NotificationCenter::postNotification('shutdown', $sender); lib/classes/NotificationCenter.class.php: public static function postNotification($event, $object, $user_data = NULL)
@]
lib/classes/Config.class.php: NotificationCenter::postNotification('ConfigValueChanged', $this, array('field' => $field, 'old_value' => $old_value, 'new_value' => $value_entry->value)); lib/classes/NotificationCenter.class.php: * Event notifications are sent via the postNotification() method: lib/classes/NotificationCenter.class.php: * NotificationCenter::postNotification('shutdown', $sender); lib/classes/NotificationCenter.class.php: public static function postNotification($event, $object, $user_data = NULL) lib/classes/StudipDocument.class.php: NotificationCenter::postNotification('DocumentWillDelete', $to_delete); lib/classes/StudipDocument.class.php: NotificationCenter::postNotification('DocumentDidDelete', $to_delete); lib/classes/StudipDocument.class.php: NotificationCenter::postNotification($notifications[0], $doc); lib/classes/StudipDocument.class.php: NotificationCenter::postNotification($notifications[1], $doc); lib/classes/StudipSemTree.class.php: NotificationCenter::postNotification('CourseRemovedFromModule', $studyarea, array('module_id' => $sem_tree_id, 'course_id' => $seminar_id)); lib/classes/StudipSemTree.class.php: NotificationCenter::postNotification('CourseAddedToModule', $studyarea, array('module_id' => $sem_tree_id, 'course_id' => $seminar_id)); lib/dates.inc.php: NotificationCenter::postNotification('PostingWillDelete', $topic_id); lib/dates.inc.php: NotificationCenter::postNotification('PostingDidDelete', $topic_id); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageWillUpdate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageDidUpdate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageWillCreate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageDidCreate', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageWillDelete', array($range_id, $keyword)); lib/wiki.inc.php: NotificationCenter::postNotification('WikiPageDidDelete', array($range_id, $keyword)); public/forum.php: NotificationCenter::postNotification('PostingWillCreate', $update); public/forum.php: NotificationCenter::postNotification('PostingDidCreate', $update); public/forum.php: NotificationCenter::postNotification('PostingWillUpdate', $update); public/forum.php: NotificationCenter::postNotification('PostingDidUpdate', $update);
<TODO: elmar>
Die im offiziellen verwendeten Notifications werden im folgenden beschrieben.
Source: Basis-Wiki-Hilfe | Last change: March 08, 2011, at 10:33 AM, mlunzena | Local view: Basis-Hilfe