I have a standard function in AppController that’s used for various controllers to simply order / re-order users records for various controller.
There are no views as the ordering (drag and drop ) is done on the manage_index view for what ever controller.
It worked in 1.3 but migrating to 2.2.3 and now the request gets black holed.
AppController:
public function manage_order() {
if ( $this->request->is('ajax') && $this->request->is('post')) {
//$this->_ajaxSetup(); //simple function that has $this->autoRender = false; $this->autoLayout = false;
if( !empty( $this->request->data )){
$count = 0;
foreach ( $this->request->data as $record ) {
$count++;
$record = substr( $record, 4 );//remove set_ from beginning of the id
$this->{$this->modelClass}->id = $record;
if ( $this->{$this->modelClass}->hasAny( array( 'id' => $record, 'user_id' => $this->owner_id ) ) ) {
$this->{$this->modelClass}->saveField( 'order', $count );
}
}
}
} else {
$this->redirect( array( 'manage' => true, 'action' => 'index' ) );
}
}
routes.php:
Router::connect('/manage/showcases/order',array(
'controller' => 'showcases',
'action' => 'order',
'prefix' => 'manage',
'manage' => true));
If I access the url directly I get redirected so it gets to the function, but the ajax request results in Error. Address not found your request has been blackholed.
But I see the POST data sent as it should to the correct URL.
I am using security component. Any ideas?
Thanks,
Dave
No comments:
Post a Comment