[Vtigercrm-developers] [2.] How to redirect a view in vtiger 6.1 ?
Holbok István
holbok at gmail.com
Tue Jul 15 15:49:10 GMT 2014
Prasad,
Thank you very much for the suggestion.
It is clear for my custom module, and I understood it and tested, it
works well.
My Current page is *Contacts *and the last performed action was Save
Contacts record (after updating or creating a new)
( index.php?module=Contacts&view=Detail&record=$RecordID )
and I would like to notify the vtiger user about a necessary action with
a related Custom module of this Contacts record,
and I would like to get a feedback from the user and if the choice is YES,
I would like to redirect the User to the page create a new Custom module
record. I think using the quick create record link it is possible with
autofill of necessary fields.
Is it possible to inject necessary Javascript code to the Contacts
module pages without modifying the core files of Contacts module to
perform all this above?
Kindest regards:
Istvan
2014.07.15. 14:36 keltezéssel, Prasad írta:
> 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.
> o On success - redirect to target page.
> o 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
> <mailto: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
>> <mailto: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 <mailto: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 <mailto: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/24745dea/attachment-0001.html>
More information about the vtigercrm-developers
mailing list