diff --git a/actions/newnotice.php b/actions/newnotice.php index 060f1ecd7d..b13245e13a 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -47,6 +47,8 @@ if (!defined('STATUSNET')) { */ class NewnoticeAction extends FormAction { + protected $form = 'Notice'; + /** * Title of the page * @@ -276,69 +278,6 @@ class NewnoticeAction extends FormAction parent::showForm($msg, $success); } - /** - * // XXX: Should we be showing the notice form with microapps here? - * - * Overload for replies or bad results - * - * We show content in the notice form if there were replies or results. - * - * @return void - */ - function showNoticeForm() - { - $content = $this->trimmed('status_textarea'); - if (!$content) { - $replyto = $this->trimmed('replyto'); - $inreplyto = $this->trimmed('inreplyto'); - $profile = Profile::getKV('nickname', $replyto); - if ($profile) { - $content = '@' . $profile->nickname . ' '; - } - } else { - // @fixme most of these bits above aren't being passed on above - $inreplyto = null; - } - - $this->elementStart('div', 'input_forms'); - $this->elementStart( - 'div', - array( - 'id' => 'input_form_status', - 'class' => 'input_form current nonav' - ) - ); - - $notice_form = new NoticeForm( - $this, - array( - 'content' => $content, - 'inreplyto' => $inreplyto - ) - ); - - $notice_form->show(); - - $this->elementEnd('div'); - $this->elementEnd('div'); - } - - /** - * Show an error message - * - * Shows an error message if there is one. - * - * @return void - * - * @todo maybe show some instructions? - */ - function showPageNotice() - { - if ($this->msg) { - $this->element('p', array('id' => 'error'), $this->msg); - } - } - /** * Output a notice * diff --git a/lib/action.php b/lib/action.php index 508145da40..65ef84cdf1 100644 --- a/lib/action.php +++ b/lib/action.php @@ -206,6 +206,10 @@ class Action extends HTMLOutputter // lawsuit */ function showPage() { + if (StatusNet::isAjax()) { + self::showAjax(); + return; + } if (Event::handle('StartShowHTML', array($this))) { $this->startHTML(); $this->flush(); @@ -226,6 +230,19 @@ class Action extends HTMLOutputter // lawsuit } } + public function showAjax() + { + $this->startHTML('text/xml;charset=utf-8'); + $this->elementStart('head'); + // TRANS: Title for conversation page. + $this->element('title', null, _m('TITLE','Notice')); + $this->elementEnd('head'); + $this->elementStart('body'); + $this->showContent(); + $this->elementEnd('body'); + $this->endHTML(); + } + function endHTML() { global $_startTime; diff --git a/lib/formaction.php b/lib/formaction.php index 60d9b3ce13..08cb3fe147 100644 --- a/lib/formaction.php +++ b/lib/formaction.php @@ -98,6 +98,26 @@ class FormAction extends ManagedAction return null; } + public function showForm($msg=null, $success=false) + { + $this->msg = $msg; + $this->success = $success; + $this->showPage(); + } + + public function showContent() + { + $form = $this->getForm(); + $form->show(); + } + + protected function getForm() + { + $class = $this->form.'Form'; + $form = new $class($this); + return $form; + } + /** * Gets called from handle() if isPost() is true; * @return void diff --git a/lib/managedaction.php b/lib/managedaction.php index 318df320e1..3df73731ae 100644 --- a/lib/managedaction.php +++ b/lib/managedaction.php @@ -47,28 +47,11 @@ class ManagedAction extends Action } } - if (StatusNet::isAjax()) { - $this->showAjax(); - } else { - $this->showPage(); - } + $this->showPage(); } protected function handlePost() { // This will only be run if the Action has the property canPost==true } - - public function showAjax() - { - $this->startHTML('text/xml;charset=utf-8'); - $this->elementStart('head'); - // TRANS: Title for conversation page. - $this->element('title', null, _m('TITLE','Notice')); - $this->elementEnd('head'); - $this->elementStart('body'); - $this->showContent(); - $this->elementEnd('body'); - $this->endHTML(); - } } diff --git a/lib/noticeform.php b/lib/noticeform.php index e6385e495e..012619a0ba 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -107,7 +107,7 @@ class NoticeForm extends Form // Do we have to worry about sub-second race conditions? // XXX: Needs to be above the parent::__construct() call...? - $this->id_suffix = time(); + $this->id_suffix = rand(); parent::__construct($action); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 9203beacc6..276a5368a4 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -121,7 +121,12 @@ option { right: 239px; background-color: #fff; border-right: 1px solid #ccc; -} +} + +#content_inner { + display: block; + position: relative; +} #site_nav_local_views_wrapper { width: 100%; @@ -279,10 +284,6 @@ address .poweredby { display: block; } -#input_form_status, #input_form_direct { - padding-bottom: 50px; -} - .form_notice { margin-bottom: 10px; } @@ -544,9 +545,8 @@ address .poweredby { .form_notice input.submit { position: absolute; - top: 100%; - left: 0px; - margin-top: -49px; + right: 0px; + margin-top: -1.5em; float: left; width: 100px; padding: 0px; @@ -959,9 +959,8 @@ content: ":"; right: 50px; } -.threaded-replies .form_notice #notice_action-submit { - left: 10px; - margin-top: -44px; +.threaded-replies .form_notice input.submit { + bottom: 0; } .threaded-replies .form_notice .error,