This is rather theoretical question, so in the first line I’m looking for the answer if this is even possible to implement and only then - how to implement it in Yii.
I have a bunch of very time consuming operations in my project, for which I designed a simple jQuery loader. It is fired in on click of element, shows jQuery UI dialog (CJuiDialog) with “x” button hidden and no other buttons for closing it. Right after showing this dialog, JS function redirects to destination URL. I’m using a little trick here - since redirection is in progress, there is no need to hide dialog - destination page won’t show it.
The problem I have is that I keep forgetting to attach this loader to link executing such time-consuming operation, as the same operation might be called from many sources - menu, sidebar, footer, header, links in page, etc. So I was thinking is there any idea or way to implement such solution (OnBeginRequest?) that would try to detect if destination URL is among array holding all such time-consuming URLs and if so, would display that loader before. If destination URL wouldn’t be on so called black list, a normal redirection, without progress dialog would be done.
Another problem is, how to block user from refreshing the page? Since “x” is hidden there is no way to manually close that dialog, but user can hit F5 to refresh page during long time-consuming operation an all the beautiful idea goes to hell. I heard that jQuery plugin called Block UI can prevent this and solve this problem, but I wasn’t able to get it work in Yii (was working fine in my old, pure-PHP project) and heard that this blocking is not working to well in such dumb browsers like IE.
Third problem is, how to implement Cancel button functionality, but I fear that this wouldn’t be possible at all, since redirection to a destination pages is done right after displaying the dialog, and source page code has no way how to break it, since it lost all the control in favor of a new page, being displayed as a result of redirection.
Thank you in advance for all ideas here.