Redirect and Delegate after evaluating a form?

cient

Joined: 2006-06-01
Posts: 26
Posted: Tue, 2006-07-04 08:29

hello,

iam currently writing a module where users can send messages to other users. now i have a problem. after submitting a form, the forwarding to confirmation page or other doesn't work, the system always does his job and reloads the current page.

for example the ReadMessage page, where a message could be read:
at the bottom of the page you can submit the page with reply, back and delete. by clicking on reply i want to redirect to WriteMessage - doesn't work, he always loads the ReadMessage page with current message.

the variable $redirect is set, so the block
else {
$results['delegate']['view'] = 'message.ReadMessage';
}

will not be reached.

class ReadMessageController extends GalleryController {

    function handleRequest($form) {
	$redirect = $status = $error = array();

	if (isset($form['action']['reply'])) {
	    $redirect['view'] = 'message.WriteMessage';
	} else if (isset($form['action']['back'])) {
	    $redirect['view'] = 'message.MessageInbox';
	} else if (isset($form['action']['delete'])) {
	    $redirect['view'] = 'message.DeleteMessage';
	}
	
	// Prepare our results \\
	if (!empty($redirect)) {
	    $results['return'] = 1;
	    $results['redirect'] = $redirect;
	} else {
	    $results['delegate']['view'] = 'message.ReadMessage';
	}

	$results['status'] = $status;
	$results['error'] = $error;
	return array(null, $results);
    }
}

/**
 * This view shows the message
 *
 * @package message 
 */
 
class ReadMessageView extends GalleryView {

    /**
     * @see GalleryView::loadTemplate
     */
    function loadTemplate(&$template, &$form) {
	global $gallery;
      ...
      ...
      ...
 
cient

Joined: 2006-06-01
Posts: 26
Posted: Wed, 2006-07-05 09:03

set $results['return'] = 0

 
cient

Joined: 2006-06-01
Posts: 26
Posted: Wed, 2006-07-05 09:57

does anybody know, if it's possible to delegate to a controller instead of a view, like

$redirect['controller'] = 'message.DeleteMessage';

(doesn't work)

 
cient

Joined: 2006-06-01
Posts: 26
Posted: Fri, 2006-07-07 07:41