*/
function showNoticeForm()
{
- $notice_form = new NoticeForm($this);
- $notice_form->show();
+ $tabs = array('status' => _('Status'));
+
+ $this->elementStart('div', 'input_forms');
+
+ if (Event::handle('StartShowEntryForms', array(&$tabs))) {
+
+ $this->elementStart('ul', array('class' => 'nav',
+ 'id' => 'input_form_nav'));
+
+ foreach ($tabs as $tag => $title) {
+
+ $attrs = array('id' => 'input_form_nav_'.$title);
+
+ if ($tag == 'status') {
+ $attrs['class'] = 'current';
+ }
+
+ $this->elementStart('li', $attrs);
+
+ $this->element('a',
+ array('href' => 'javascript:switchInputFormTab("'.$tag.'")'),
+ $title);
+ $this->elementEnd('li');
+ }
+
+ $this->elementEnd('ul');
+
+ foreach ($tabs as $tag => $title) {
+
+ $attrs = array('class' => 'input_form',
+ 'id' => 'input_form_'.$tag);
+
+ if ($tag == 'status') {
+ $attrs['class'] .= ' active';
+ } else {
+ $attrs['class'] .= ' inactive';
+ }
+
+ $this->elementStart('div', $attrs);
+
+ $form = null;
+
+ if (Event::handle('StartMakeEntryForm', array($tag, $this, &$form))) {
+ if ($tag == 'status') {
+ $form = new NoticeForm($this);
+ }
+ Event::handle('EndMakeEntryForm', array($tag, $this, $form));
+ }
+
+ if (!empty($form)) {
+ $form->show();
+ }
+ }
+ }
}
/**
abstract function appTitle();
abstract function tag();
abstract function types();
- abstract function saveNoticeFromActivity($activity, $actor);
+ abstract function saveNoticeFromActivity($activity, $actor, $options);
abstract function activityObjectFromNotice($notice);
abstract function showNotice($notice, $out);
abstract function entryForm($out);
throw new ClientException(_('Can\'t get author for activity.'));
}
+ $object = $activity->objects[0];
+
+ $options = array('uri' => $object->id,
+ 'url' => $object->link,
+ 'is_local' => Notice::REMOTE_OMB,
+ 'source' => 'ostatus');
+
$this->saveNoticeFromActivity($activity, $actor);
return false;
if (!in_array($uri, $activity->context->attention) &&
(empty($original) ||
$original->profile_id != $target->id)) {
- throw new ClientException(_("Bookmark not posted ".
+ throw new ClientException(_("Object not posted ".
"to this user."));
}
} else {
$actor = Ostatus_profile::ensureActivityObjectProfile($activity->actor);
- $this->saveNoticeFromActivity($activity, $actor);
+ $object = $activity->objects[0];
+
+ $options = array('uri' => $object->id,
+ 'url' => $object->link,
+ 'is_local' => Notice::REMOTE_OMB,
+ 'source' => 'ostatus');
+
+ $this->saveNoticeFromActivity($activity, $actor, $options);
return false;
}
$obj = $activity->objects[0];
- $options = array('uri' => $bookmark->id,
- 'url' => $bookmark->link,
+ $options = array('uri' => $object->id,
+ 'url' => $object->link,
'source' => 'restore');
$saved = $this->saveNoticeFromActivity($activity,
return true;
}
+
+ function onStartShowEntryForms(&$tabs)
+ {
+ $tabs[$this->tag()] = $this->appTitle();
+ return true;
+ }
+
+ function onStartMakeEntryForm($tag, $out, &$form)
+ {
+ $this->log(LOG_INFO, "onStartMakeEntryForm() called for tag '$tag'");
+
+ if ($tag == $this->tag()) {
+ $form = $this->entryForm($out);
+ return false;
+ }
+
+ return true;
+ }
}