]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
posting from a form takes you back to the same page
authorEvan Prodromou <evan@controlyourself.ca>
Thu, 19 Jun 2008 16:18:14 +0000 (12:18 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Thu, 19 Jun 2008 16:18:14 +0000 (12:18 -0400)
darcs-hash:20080619161814-5ed1f-5add55346470e71a53a676d39617062acc0f19bf.gz

actions/all.php
actions/newnotice.php
actions/public.php
actions/showstream.php
lib/util.php

index 44e3fd2394be28d1ff6dfc1e5edf3b8b71dcf514..a8b08565aa83e1884fcaba3b08cdbfd08544c68e 100644 (file)
@@ -65,7 +65,7 @@ class AllAction extends StreamAction {
                $cur = common_current_user();
                
                if ($cur && $cur->id == $user->id) {
-                       common_notice_form();
+                       common_notice_form('all');
                }
                
                $this->views_menu();
index b65edf4c30596470d94bd1a47bbe9bdc5b01ad56..a3ba4c9ccf77570a98eb182ff7e9ab2303ada249 100644 (file)
@@ -69,15 +69,25 @@ class NewnoticeAction extends Action {
                }
                
                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();
        }
index 5d06c3c2951a887fe11d7c5c8df0fdf26fd43139..23d9f039788749d2b45a9528fc3d9f1b8a8464f8 100644 (file)
@@ -43,7 +43,7 @@ class PublicAction extends StreamAction {
 
        function show_top() {
                if (common_logged_in()) {
-                       common_notice_form();
+                       common_notice_form('public');
                }
        }
        
index d9637c377520da50621b0780c6395405ceaac8d9..7ccdc894ff82c12e2ce9f09316e83971a89fa989 100644 (file)
@@ -68,7 +68,7 @@ class ShowstreamAction extends StreamAction {
                $cur = common_current_user();
                
                if ($cur && $cur->id == $user->id) {
-                       common_notice_form();
+                       common_notice_form('showstream');
                }
                
                $this->views_menu();
index a4c30cbe4edb001a024b099762acda75517197a3..88ddbcc006044f4dd03e0ddaeecf6619d3c45f55 100644 (file)
@@ -650,7 +650,7 @@ function common_profile_url($nickname) {
 
 # 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',
@@ -663,6 +663,9 @@ function common_notice_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',