Post to a RAW view
13 years 9 months ago #83247
by likandev
Eduardo Chongkan - Likan Development
likandevelopment.com
Post to a RAW view was created by likandev
Hi guys,
Ww are working on a messaging view for Vendores, we added a new button to the Vendor's Cpanel that reads "Messages", when clicked, it takes us to a new view called messagemarket, layout = inbox.
This works fine.
I need to be able to post to the same view but in RAW format ( AJAX ), I added a new controller and the RAW view, in the normal MVC model, I would create this and it will automatically direct me to the correct view file ( view.raw.php) and I would receive a response in the correct format ( no template) TEXT or JSON.
Instead of receiving this response, I get a 403 error: Access Denied.
Q: What is the correct way of post with AJAX and receive RAW response in Hikamarket?
Ww are working on a messaging view for Vendores, we added a new button to the Vendor's Cpanel that reads "Messages", when clicked, it takes us to a new view called messagemarket, layout = inbox.
This works fine.
I need to be able to post to the same view but in RAW format ( AJAX ), I added a new controller and the RAW view, in the normal MVC model, I would create this and it will automatically direct me to the correct view file ( view.raw.php) and I would receive a response in the correct format ( no template) TEXT or JSON.
Instead of receiving this response, I get a 403 error: Access Denied.
Q: What is the correct way of post with AJAX and receive RAW response in Hikamarket?
Eduardo Chongkan - Likan Development
likandevelopment.com
Please Log in or Create an account to join the conversation.
13 years 9 months ago #83256
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Post to a RAW view
Hi,
HikaMarket use the "authorization" function. Each task has to be listed in the controller.
Some task categories ask for a token (modify / delete). The display category is the default one.
If a task is not listed in this array, the controller would refused it.
I have implemented for the next release of HikaMarket a way to override every classes (or some helpers). I think I will provide such solution for overriding views and controllers.
The idea is to create a new file in the same directory. If you want to override the vendor controller, you would create a file named "vendor.override.php".
This file would be include instead of the classical controller.
The idea is to extend to controller without rewrite it.
Like that, you can add and override all you want without loosing any compatibility.
If a controller changes in HikaMarket, some new task are added, you could still update and use the new features ; without loosing yours.
(And I think I will add a function in order to provide a good way to merge rights)
Regards,
HikaMarket use the "authorization" function. Each task has to be listed in the controller.
Code:
protected $rights = array(
'display' => array('cpanel', 'show', 'register', 'form'),
'add' => array(),
'edit' => array('save'),
'modify' => array(),
'delete' => array()
);
If a task is not listed in this array, the controller would refused it.
I have implemented for the next release of HikaMarket a way to override every classes (or some helpers). I think I will provide such solution for overriding views and controllers.
The idea is to create a new file in the same directory. If you want to override the vendor controller, you would create a file named "vendor.override.php".
This file would be include instead of the classical controller.
The idea is to extend to controller without rewrite it.
Code:
<?php
include dirname(__FILE__).DS.'vendor.php';
class vendorMarketOverrideController extends vendorMarketController {
public function __construct($config = array(), $skip = false) {
$this->rights['display'][] = 'mytask';
parent::__construct($config, $skip);
}
public function mytask() {
JRequest::setVar('layout', 'mytask');
return parent::display();
}
}
Like that, you can add and override all you want without loosing any compatibility.
If a controller changes in HikaMarket, some new task are added, you could still update and use the new features ; without loosing yours.
(And I think I will add a function in order to provide a good way to merge rights)
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: likandev
Please Log in or Create an account to join the conversation.
13 years 9 months ago #83291
by likandev
Eduardo Chongkan - Likan Development
likandevelopment.com
Replied by likandev on topic Post to a RAW view
Hi Thanks,
I'll keep it in mind for next time. Yesterday I decided to just use a component I made for posting to it via ajax from anywhere ( modules in example )
That way I can keep my code separated. I did keep the additional views I made.
I'll keep it in mind for next time. Yesterday I decided to just use a component I made for posting to it via ajax from anywhere ( modules in example )
That way I can keep my code separated. I did keep the additional views I made.
Eduardo Chongkan - Likan Development
likandevelopment.com
Please Log in or Create an account to join the conversation.
Moderators: Obsidev
Time to create page: 0.267 seconds