Commit 2e77cbfa authored by mmn's avatar mmn

FormAction updates, also fixing NoticeForm CSS

parent 1f973768
......@@ -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
*
......
......@@ -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;
......
......@@ -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
......
......@@ -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();
}
}
......@@ -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);
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment