developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Closed 12 years ago

#744 closed enhancement (wontfix)

Flash Message

Reported by: foxmask Owned by: laurentj
Priority: normal Milestone:
Component: jelix:core response Version: 1.1 beta 1
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

this patch allow to display a message on a page and then go to url of our choice after a given time.

for example :

I submit a news on a portal, and in the news controller i save the data and do :

            $rep = $this->getResponse('html');            
            $url_refresh = jUrl::get("news~default:index");
            $tpl = new jTpl();    
            $tpl->assign('message','Thanks you for your contribution');
            $rep->setFlash('3',$url_refresh);
            $rep->body->assign("MAIN", $tpl->fetch('flash'));    
            return $rep;

this will display the message 3 secondes and return to the given url

Attachments (1)

jResponseHtml.class.php.patch (1.6 KB) - added by foxmask 12 years ago.
patch of jResponseHtml to implement a redirection + msg

Download all attachments as: .zip

Change History (4)

Changed 12 years ago by foxmask

patch of jResponseHtml to implement a redirection + msg

comment:1 follow-up: Changed 12 years ago by laurentj

  • review changed from review? to review-

Since it is a very specific use of an html response, I prefer an implementation in an other class, jResponseHtmlRedirect for example, which inherits of course of jResponseHtml. I know we have a problem here because outputHeaders is final. A solution outputHeaders could call a new _outputHeader method that a child class could override to do additional things.

And I prefer this following methods instead of setFlash (we could confuse with flash technologie from adobe :-)

   public function setRedirection($action, $params, $time=3);
   public function setUrlRedirection($url, $time=3);

Don't forget to update also defaultconfig.ini.php to declare this new response. use htmlredirect as type name.

comment:2 in reply to: ↑ 1 Changed 12 years ago by foxmask

Replying to laurentj:

Since it is a very specific use of an html response, I prefer an implementation in an other class, jResponseHtmlRedirect for example, which inherits of course of jResponseHtml. I know we have a problem here because outputHeaders is final. A solution outputHeaders could call a new _outputHeader method that a child class could override to do additional things.

Ok i will do this

And I prefer this following methods instead of setFlash (we could confuse with flash technologie from adobe :-)

that term comes from RoR ;)

http://api.rubyonrails.org/classes/ActionController/Flash.html

Don't forget to update also defaultconfig.ini.php to declare this new response. use htmlredirect as type name.

What's the goal of setRedirection method ?

I see that setFlash becomes setUrlRedirection but i dont see where come from setRedirection ?

Regards.

comment:3 Changed 12 years ago by foxmask

  • Resolution set to wontfix
  • Status changed from new to closed

After a looooooooooooooooong brainstorming :)

jResponseredirect + jMessage would do the trick ;)

Note: See TracTickets for help on using tickets.