[Vtigercrm-developers] [2.] How to redirect a view in vtiger 6.1 ?

Prasad prasad at vtiger.com
Tue Jul 15 12:36:41 GMT 2014


Istvan,

If you expect user-feedback post-request I would suggest the following:

   - On the Current page - show progress bar / message.
   - Perform an call to Action Controller through Ajax (look at
   resources/app.js - AppConnector.request)- parse the response.
   - On success - redirect to target page.
      - On error - show feedback to user.

Regards,
Prasad



*Connect with us on: *Twitter <http://twitter.com/vtigercrm> *I* Facebook
<http://www.facebook.com/pages/vtiger/226866697333578?sk=wall> *I* Blog
<https://blogs.vtiger.com/>* I* Wiki
<http://wiki.vtiger.com/index.php/Main_Page> *I *Forums
<https://discussions.vtiger.com>*I* Website <https://www.vtiger.com/>


On Tue, Jul 15, 2014 at 5:32 PM, Holbok István <holbok at gmail.com> wrote:

>  Dear Prasad,
>
> Thank you for the suggestion.
>
> If I understand well, I can use the event handler to do some things
> triggered by the vtiger.entity.aftersave event.
> To continue the flow is the best to redirect to the action controller,
> with
>     $redirectUrl = 'index.php?module=Custommodule&*action*
> =Customaction&mode=Custommode';
>
>     header("Location: $redirectUrl");
>     exit();
>
> And in the process function of the Customaction Controller is suggested to
> make the control flow decision.
>
> And if I would like to insert a modal popup window to notify the vtiger
> user and ask him to decide something, then I can insert into the page HTML
> using Vtiger_Response::Emit() the HTML content of this modal popup window
> from the Customaction Controller.
>
> It was your suggestion?
>
>
> Kindest regards:
> Istvan
>
>  2014.07.15. 7:49 keltezéssel, Prasad írta:
>
> NOTE:
>
> Its either View or Action Controller which should make the control flow
> decision.
>
>  Delegating it to (mode / record - like event handler) would create
> trouble when its gets executed through Webservices.
>
>
>
> *Connect with us on: *Twitter <http://twitter.com/vtigercrm> *I* Facebook
> <http://www.facebook.com/pages/vtiger/226866697333578?sk=wall> *I* Blog
> <https://blogs.vtiger.com/>* I* Wiki
> <http://wiki.vtiger.com/index.php/Main_Page> *I *Forums
> <https://discussions.vtiger.com>*I* Website <https://www.vtiger.com/>
>
>
> On Tue, Jul 15, 2014 at 11:17 AM, Prasad <prasad at vtiger.com> wrote:
>
>>  Reference:
>>
>> http://community.vtiger.com/help/vtigercrm/developers/extensions/internals.html#ui-request-processing
>>
>>  The View request flow would go through
>>
>>  preProcess
>> process
>> postProcess
>>
>>  Redirection in process would fail as preProcess emits some content -
>> you many have to override this.
>> Action is best candidate since preProcess and postProcess is not
>> triggered.
>>
>>  Regards,
>> Prasad
>>
>>
>> *Connect with us on: *Twitter <http://twitter.com/vtigercrm> *I* Facebook
>> <http://www.facebook.com/pages/vtiger/226866697333578?sk=wall> *I* Blog
>> <https://blogs.vtiger.com/>* I* Wiki
>> <http://wiki.vtiger.com/index.php/Main_Page> *I *Forums
>> <https://discussions.vtiger.com>*I* Website <https://www.vtiger.com/>
>>
>>
>>  On Tue, Jul 15, 2014 at 12:37 AM, Holbok István <holbok at gmail.com>
>> wrote:
>>
>>>   Dear Vtiger Community,
>>>
>>> I would like to redirect a view in vtiger 6.1. What is the best
>>> suggested way to do it?
>>>
>>> Case:
>>> There is an event handler registered to the Contacts (standard) module
>>> in my Custom module.
>>> The Save action in the Contacts module triggered the event handler and I
>>> could see, the program executed. The red line log the info to the logfile.
>>>
>>>         if($eventName == 'vtiger.entity.aftersave') {
>>>             // Entity has been saved, take next action
>>>             *$log->debug('Contacts: vtiger.entity.aftersave --- fired
>>> in Custommodule directory');*
>>>
>>>            // Check some conditions
>>>
>>>              // If the conditions true, redirect the view
>>>             $redirectUrl = 'index.php?module=*Custommodule*&view=
>>> *Customview*';
>>>             header("Location: $redirectUrl");
>>>             * exit();*
>>>
>>>         }
>>>
>>> Adding the command *exit();* after the line of header the redirection
>>> started work.
>>>
>>> But the question is still exist: *Is this way the best method to change
>>> vtiger view depending a condition?*
>>>
>>>
>>> Other question is: How to do different modal popup windows related to
>>> the 'vtiger.entity.aftersave' event of the Contacts module without
>>> rewriting the original code?
>>>
>>>
>>> Any suggestion is appreciated.
>>>
>>> Kindest regards:
>>> Istvan
>>>
>>>
>>> --
>>> üdvözlettel:
>>>
>>> *Holbok István*
>>>
>>> +3670-342-0900
>>> *e-mail:* holbok at gmail.com
>>> *SkyPe:* holboki
>>>
>>>
>>>  _______________________________________________
>>> http://www.vtiger.com/
>>>
>>
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140715/aed266a9/attachment-0001.html>


More information about the vtigercrm-developers mailing list