summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2009-10-05 14:17:55 +0000
committerSarven Capadisli <csarven@status.net>2009-10-05 14:17:55 +0000
commit7a33125a6c05a885a7e4c6d80be4e0fe26499565 (patch)
treef0a47a3586e671205803a4582b07e4f4dcbfe064
parent2f065d687dc76bfbac3e1b7b3dcccf544f4b4987 (diff)
Added hook to wrap the notice form data block
-rw-r--r--EVENTS.txt6
-rw-r--r--lib/noticeform.php70
2 files changed, 43 insertions, 33 deletions
diff --git a/EVENTS.txt b/EVENTS.txt
index fbb2f36a7..02b11a8a6 100644
--- a/EVENTS.txt
+++ b/EVENTS.txt
@@ -93,6 +93,12 @@ StartShowAside: Showing before the Aside container
EndShowAside: Showing after the Aside container
- $action: the current action
+StartShowNoticeFormData: Showing before the notice form data
+- $action: the current action
+
+EndShowNoticeFormData: Showing after the notice form data
+- $action: the current action
+
StartNoticeSave: before inserting a notice (good place for content filters)
- $notice: notice being saved (no ID or URI)
diff --git a/lib/noticeform.php b/lib/noticeform.php
index 186330bf1..9864d15eb 100644
--- a/lib/noticeform.php
+++ b/lib/noticeform.php
@@ -142,40 +142,44 @@ class NoticeForm extends Form
function formData()
{
- $this->out->element('label', array('for' => 'notice_data-text'),
- sprintf(_('What\'s up, %s?'), $this->user->nickname));
- // XXX: vary by defined max size
- $this->out->element('textarea', array('id' => 'notice_data-text',
- 'cols' => 35,
- 'rows' => 4,
- 'name' => 'status_textarea'),
- ($this->content) ? $this->content : '');
-
- $contentLimit = Notice::maxContent();
-
- $this->out->element('script', array('type' => 'text/javascript'),
- 'maxLength = ' . $contentLimit . ';');
-
- if ($contentLimit > 0) {
- $this->out->elementStart('dl', 'form_note');
- $this->out->element('dt', null, _('Available characters'));
- $this->out->element('dd', array('id' => 'notice_text-count'),
- $contentLimit);
- $this->out->elementEnd('dl');
+ if (Event::handle('StartShowNoticeFormData', array($this))) {
+ $this->out->element('label', array('for' => 'notice_data-text'),
+ sprintf(_('What\'s up, %s?'), $this->user->nickname));
+ // XXX: vary by defined max size
+ $this->out->element('textarea', array('id' => 'notice_data-text',
+ 'cols' => 35,
+ 'rows' => 4,
+ 'name' => 'status_textarea'),
+ ($this->content) ? $this->content : '');
+
+ $contentLimit = Notice::maxContent();
+
+ $this->out->element('script', array('type' => 'text/javascript'),
+ 'maxLength = ' . $contentLimit . ';');
+
+ if ($contentLimit > 0) {
+ $this->out->elementStart('dl', 'form_note');
+ $this->out->element('dt', null, _('Available characters'));
+ $this->out->element('dd', array('id' => 'notice_text-count'),
+ $contentLimit);
+ $this->out->elementEnd('dl');
+ }
+
+ if (common_config('attachments', 'uploads')) {
+ $this->out->element('label', array('for' => 'notice_data-attach'),_('Attach'));
+ $this->out->element('input', array('id' => 'notice_data-attach',
+ 'type' => 'file',
+ 'name' => 'attach',
+ 'title' => _('Attach a file')));
+ $this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota'));
+ }
+ if ($this->action) {
+ $this->out->hidden('notice_return-to', $this->action, 'returnto');
+ }
+ $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto');
+
+ Event::handle('StartShowNoticeFormData', array($this));
}
-
- if (common_config('attachments', 'uploads')) {
- $this->out->element('label', array('for' => 'notice_data-attach'),_('Attach'));
- $this->out->element('input', array('id' => 'notice_data-attach',
- 'type' => 'file',
- 'name' => 'attach',
- 'title' => _('Attach a file')));
- $this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota'));
- }
- if ($this->action) {
- $this->out->hidden('notice_return-to', $this->action, 'returnto');
- }
- $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto');
}
/**