diff --git a/EVENTS.txt b/EVENTS.txt index fd75036894..0a1951d640 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -966,6 +966,9 @@ StartShowNoticeForm: before showing the notice form (before
) EndShowNoticeForm: after showing the notice form (after ) - $action: action being executed +StartShowEntryForms: microapp entry form tab data +- &$tabs: tab assoc array with 'tag' => (title, href to create new entry) + StartGrantRole: when a role is being assigned - $profile: profile that will have the role - $role: string name of the role diff --git a/js/util.js b/js/util.js index 8396484859..5f95595edd 100644 --- a/js/util.js +++ b/js/util.js @@ -1414,6 +1414,8 @@ var SN = { // StatusNet SN.Init.NoticeFormSetup(form); }) .find('.notice_data-text').focus(); + + return false; }, showMoreMenuItems: function (menuid) { diff --git a/lib/action.php b/lib/action.php index 95c88b2299..74ced563fb 100644 --- a/lib/action.php +++ b/lib/action.php @@ -681,7 +681,8 @@ class Action extends HTMLOutputter // lawsuit function showNoticeForm() { // TRANS: Tab on the notice form. - $tabs = array('status' => _m('TAB','Status')); + $tabs = array('status' => array('title' => _m('TAB','Status'), + 'href' => common_local_url('newnotice'))); $this->elementStart('div', 'input_forms'); @@ -689,7 +690,8 @@ class Action extends HTMLOutputter // lawsuit $this->elementStart('ul', array('class' => 'nav', 'id' => 'input_form_nav')); - foreach ($tabs as $tag => $title) { + foreach ($tabs as $tag => $data) { + $tag = htmlspecialchars($tag); $attrs = array('id' => 'input_form_nav_'.$tag, 'class' => 'input_form_nav_tab'); @@ -702,8 +704,9 @@ class Action extends HTMLOutputter // lawsuit $this->elementStart('li', $attrs); $this->element('a', - array('href' => 'javascript:SN.U.switchInputFormTab("'.$tag.'")'), - $title); + array('onclick' => 'return SN.U.switchInputFormTab("'.$tag.'");', + 'href' => $data['href']), + $data['title']); $this->elementEnd('li'); } @@ -716,7 +719,7 @@ class Action extends HTMLOutputter // lawsuit $form->show(); $this->elementEnd('div'); - foreach ($tabs as $tag => $title) { + foreach ($tabs as $tag => $data) { $attrs = array('class' => 'input_form', 'id' => 'input_form_'.$tag); diff --git a/lib/microappplugin.php b/lib/microappplugin.php index 8cb1450788..4da3bef935 100644 --- a/lib/microappplugin.php +++ b/lib/microappplugin.php @@ -162,6 +162,14 @@ abstract class MicroAppPlugin extends Plugin */ abstract function deleteRelated($notice); + /** + * + */ + public function newFormAction() { + // such as 'newbookmark' or 'newevent' route + return 'new'.$this->tag(); + } + /** * Check if a given notice object should be handled by this micro-app * plugin. @@ -536,7 +544,9 @@ abstract class MicroAppPlugin extends Plugin function onStartShowEntryForms(&$tabs) { - $tabs[$this->tag()] = $this->appTitle(); + $tabs[$this->tag()] = array('title' => $this->appTitle(), + 'href' => common_local_url($this->newFormAction()), + ); return true; } diff --git a/plugins/QnA/QnAPlugin.php b/plugins/QnA/QnAPlugin.php index a4709df462..6e2560be35 100644 --- a/plugins/QnA/QnAPlugin.php +++ b/plugins/QnA/QnAPlugin.php @@ -65,6 +65,10 @@ class QnAPlugin extends MicroAppPlugin return true; } + public function newFormAction() { + return 'qnanewquestion'; + } + /** * Map URLs to actions *