|
#11
|
|||
|
|||
|
Wonderful feature having the manage functions, however, i found a problem.
Im not quite sure if it's my code or not, but here's what happens. I have the following manage function: PHP Code:
self::$module->addAction("Change Password", array($this, "changePassword")); self::$module->addAction("Show Logs", array($this, "getLogs")); where getLogs is a function that returns some dummy data. Here's what happens, the Change Password ajax tab is shown first, as it's supposed to. If i do my operations there, its no problem, i can change the password as many times as i want. But, if i go to Show Logs, then back to Change Password and i click on change button, the browser is redirected to a different URL, like this: a-center.php?uid=1500&action=servicestatus&sid=1008& ajax=manage&p=0&type=changePassword and the manage contents are shown in the browser. It appears to be a problem of $_SERVER['REQUEST_URI'] because if i "compose" the url manually it works just fine, except that in admin and user mode the URL seems to be different and take different parameters. Any suggestions ? Regards, Viorel LE: it would also be nice, to have manage functions visible only to admins, such as editing ip addresses and such ... Last edited by synologic; 03-10-2010 at 04:57 PM. |
|
#12
|
||||
|
||||
|
Hi Viorel,
The problem is you're doing a header redirect from an AJAX request. The manage section operates on AJAX requests to replace content within its body (which is comprised of a <div> section), so performing a header redirect here will only redirect the body of the AJAX window. In a way it acts much like an iframe. Instead of doing a redirect you should render the HTML to cover the scenario being presented, and I recommend using the built-in template system to accomplish this task much easier. Just create a directory called 'templates' in /inc/modules/your_module_name/, then load your template in your module using: PHP Code:
self::$module->addAction("Overview", array($this, "getOverview"), "admin"); // for admins only self::$module->addAction("Overview", array($this, "getOverview"), "client"); // for clients only |
|
#13
|
|||
|
|||
|
Hi,
thanks for the tips, i dropped the redirect within the module and all works fine. However, i encountered another issue. I have a second management function that needs to post data. Problem is, after the data is posted, how do i make sure the management tab for that function gets visible, and not the first tab ? Im not very well versed in AJAX so throw me a bone here ![]() Thanks, Viorel |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Module error - Requesting configuration before adding package | kdg | Modules & Gateways | 1 | 04-22-2009 03:35 PM |
| Plesk Module Handling | agerszt | Feature Requests | 2 | 07-04-2008 03:57 PM |
| howto disable enom module check in order form ? | naja7host | API & Order Forms | 9 | 06-02-2008 07:50 PM |