Added hook to wrap the notice form data block

This commit is contained in:
Sarven Capadisli 2009-10-05 14:17:55 +00:00
parent 2f065d687d
commit 7a33125a6c
2 changed files with 40 additions and 30 deletions

View File

@ -93,6 +93,12 @@ StartShowAside: Showing before the Aside container
EndShowAside: Showing after the Aside container EndShowAside: Showing after the Aside container
- $action: the current action - $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) StartNoticeSave: before inserting a notice (good place for content filters)
- $notice: notice being saved (no ID or URI) - $notice: notice being saved (no ID or URI)

View File

@ -142,40 +142,44 @@ class NoticeForm extends Form
function formData() function formData()
{ {
$this->out->element('label', array('for' => 'notice_data-text'), if (Event::handle('StartShowNoticeFormData', array($this))) {
sprintf(_('What\'s up, %s?'), $this->user->nickname)); $this->out->element('label', array('for' => 'notice_data-text'),
// XXX: vary by defined max size sprintf(_('What\'s up, %s?'), $this->user->nickname));
$this->out->element('textarea', array('id' => 'notice_data-text', // XXX: vary by defined max size
'cols' => 35, $this->out->element('textarea', array('id' => 'notice_data-text',
'rows' => 4, 'cols' => 35,
'name' => 'status_textarea'), 'rows' => 4,
($this->content) ? $this->content : ''); 'name' => 'status_textarea'),
($this->content) ? $this->content : '');
$contentLimit = Notice::maxContent(); $contentLimit = Notice::maxContent();
$this->out->element('script', array('type' => 'text/javascript'), $this->out->element('script', array('type' => 'text/javascript'),
'maxLength = ' . $contentLimit . ';'); 'maxLength = ' . $contentLimit . ';');
if ($contentLimit > 0) { if ($contentLimit > 0) {
$this->out->elementStart('dl', 'form_note'); $this->out->elementStart('dl', 'form_note');
$this->out->element('dt', null, _('Available characters')); $this->out->element('dt', null, _('Available characters'));
$this->out->element('dd', array('id' => 'notice_text-count'), $this->out->element('dd', array('id' => 'notice_text-count'),
$contentLimit); $contentLimit);
$this->out->elementEnd('dl'); $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');
} }
/** /**