This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
Is there an easy way we can share variables across popups? I have a web application that displays documents to the user. It allows user to lock/unlock documents for editing. If one user has locked a document, the other users see a "lock" message. This message is displayed in several places, including popups
Now, because some users forget to unlock their document, or they close the browser halfway, "admin" users have "terminate lock" permission. The Admin user can terminate another user's lock.
My problem is that if a admin user is viewing a document with the lock message on the main screen. He opens a popup which again displays the lock message. The lock message is displayed on the popup. He terminates the lock on the popup, so the message goes away on the popup and he can continue working. Now, if the user closes that popup, the lock message is still displayed on the main screen.
Yes, thank you. I thought about it, but I wanted to avoid navigating across frames and windows.
I guess I didn't give sufficient information. I know how to access variables across windows, frames etc. However, I want to avoid explicitly going across windows and frames to get the the variable. As far as possible I would avoid having windows and frames dependent on other windows and frames. I was wondering if there is a well-established pattern that allows multiple frames/popups to share data.
Since, I am more familar with Java, I was thinking that if I wanted to do something like this in Java, I would have a Singleton pattern coupled with listener pattern. A singleton object can wrap the state of the lock. It can also accept listeners that can be fired whenever the state of the lock changes. So, all the "views" (and I consider the popups and the frames as views) can register to receive the events. Whenever the state of the lock changes, the views will receive the event and update themselves
Joined: Nov 08, 2001
You can think of fancy soultions that use Ajax and what not, but it seems too complex.
I think that if your user closes a pop up window you should just refresh the window.opener and have it auto update. Personally I hate frames and pop ups since they over complicate designs and are not reliable.