$cur = common_current_user();
if ($cur && $cur->id == $user->id) {
- common_notice_form();
+ common_notice_form('all');
}
$this->views_menu();
}
common_broadcast_notice($notice);
- common_redirect(common_local_url('shownotice',
- array('notice' => $id)), 303);
+ $returnto = $this->trimmed('returnto');
+ if ($returnto) {
+ $url = common_local_url($returnto,
+ array('nickname' => $user->nickname));
+ } else {
+ $url = common_local_url('shownotice',
+ array('notice' => $id));
+ }
+ common_redirect($url, 303);
}
- function show_form($msg=NULL) {
- common_show_header(_t('New notice'));
+ function show_top($msg=NULL) {
if ($msg) {
common_element('div', 'error', $msg);
}
+ }
+
+ function show_form($msg=NULL) {
+ common_show_header(_t('New notice'), NULL, $msg, array($this, 'show_top'));
common_notice_form();
common_show_footer();
}
function show_top() {
if (common_logged_in()) {
- common_notice_form();
+ common_notice_form('public');
}
}
$cur = common_current_user();
if ($cur && $cur->id == $user->id) {
- common_notice_form();
+ common_notice_form('showstream');
}
$this->views_menu();
# Don't call if nobody's logged in
-function common_notice_form() {
+function common_notice_form($action=NULL) {
$user = common_current_user();
assert(!is_null($user));
common_element_start('form', array('id' => 'status_form',
common_element('textarea', array('id' => 'status_textarea',
'name' => 'status_textarea'),
' ');
+ if ($action) {
+ common_hidden('returnto', $action);
+ }
common_element('input', array('id' => 'status_submit',
'name' => 'status_submit',
'type' => 'submit',