New webpage needs to close previous page - angularjs

I'm working with a hospital where we are implementing a web-application that is triggered from their own hospital information system (HIS).
The way the app works is that in their HIS, they select a patient and call the web-app with the patientId in the url.
Regarding patient safety, they want only one of those tabs open at the same time.
So if a second patient-tab is opened, the first one should be closed ..
Is this possible? And if it is, how?
Edit following danday74's answer
The url from the HIS is triggered via command line arguments (SAP system).
Firefox "http://url_to_webpage/"

when you link to the patient tab do this ...
<a ng-href="/your/patient/url" target="patientTab">open new patient tab</a>
When the link is clicked it should open the page in a new tab called "patientTab" - if another link is clicked with the target patientTab then it will use the existing "patientTab" - just make sure all your anchor tags that use the patientTab have the target set.
hope that does the job for you :)

So for the people that have a similar problem, the way we fixed it was the following:
On the init script for the page, we check if a session variable tab-token is found and if it contains a UUID
If the variable is not found, it means that no other open tab is found and we leave the tab active + create the variable and store a generated UUID in it
If a UUID is found, that means another tab is also active and we show a screen overlay with the message that another active tab was found
We watch on every change in the session variable and update the screen overlay whenever and wherever it needs to.
It is not a fool-proof solution, but in the context and usage of the application, it is sufficient ..

Related

How to have single store for each tab in redux [reactjs]?

We have a web app composed of several pages containing links of data retrieved from database. Upon clicking one link[data], the user should be directed to another page. For navigation between pages, we have used breadcrumb. The breadcrumb is stored in redux store. Currently, when the user tries to ctrl+click or open link in new tab, we managed to use single store across multiple tabs. Hence, if the user opens 3 separate links [data] in new tabs, the updates made on the breadcrumb affect previously opened tabs when these tabs/pages are refreshed. For example:
In homepage, I have these links:
Data_1
Data_2
Data_3
Current breadcrumb in the homepage is like this:
HomePage/
Once the user opens Data_1 in new tab, the expected breadcrumb in the new tab is:
HomePage/Data_1/
Similarly, if the user tries to open Data_2 and Data_3, in new tabs, the breadcrumbs should appear as follows for tab 1 and tab 2, respectively:
HomePage/Data_2/
HomePage/Data_3/
In the current implementation, I managed to update the state of breadcrumb whenever new links are opened such that breadcrumb[0] would be equivalent to HomePage while breadcrumb[1] was initially Data_1, then became Data_2, and lastly Data_3. Hence, the last value of breadcrumb[1] is Data_3 since that's the last opened link. My problem is that whenever the user refreshes previously opened tabs/pages corresponding to Data_1 and Data_2, since they are all using a single store and breadcrumb[1] has been changed to Data_3, the breadcrumbs in Data_1 and Data_2 pages also become Data_3.
In this case, I can just think of using multiple stores since I perceive that it could be the only solution given my use case. Meanwhile, I can't find any sufficient documentation online regarding using multiple stores in redux. Maybe I can pass the store to the next page in params...? something like that
Can someone please help. Thanks in advance.
To emulate per-tab same site persistency, I would, right before the page is about to be refreshed (window.beforeunload or similar)
1 - Write to localStorage about my breadcrumb
2 - Refresh
3 - Read from localStorage about my breadcrumb to initialize myself properly (so the data here SHOULD be mine because i just wrote it)
4 - remove breadcrumb information from localStorage (to prevent other tabs from reading it)
Now, you still have the case where the user just closes the tab, so you would have stale data about the breadcrumb in your localStorage. You can add a little expiration mechanism (you might consider that data in the localStorage older than 10 seconds is stale and just pretend it isn't here and delete it at step 3.) Cookies would work pretty much the same, with a built-in expiration mechanism.

Weird navigation bug, with side menu, routing views won’t update

I am fairly new to ionic (using the 1.0.0 beta1) and Angular, and I am working on my first project, where I experience weird bugs, I cannot understand.
My app is based on the "Ionic Book" task app, described here: http://ionicframework.com/docs/guide/building.html.
Here's the link to my app: http://plnkr.co/edit/zp49fsbmOfMiQfXDopxt?p=preview1
In my version of the task-app, the tasks are called "instances" and each instance has several "categories" in it. Each category has a title and a status.
The user can enter instances in the side menu, via the '+' button. And each instance is created with some dummy categories.
The user can choose his instances and then choose a category to see its status.
To see what bugs occur, please visit my app http://plnkr.co/edit/zp49fsbmOfMiQfXDopxt?p=preview1 and add a few instances with dummy titles like a, b, c, d. The url form may remain empty, it is not yet needed. Don't click on a category yet. You will notice the switching from one category to another works as expected (though all instances have the same categories).
Now when you click on a category in an instance, say in instance b, the view shows the category status, with the right category title in the nav-bar. When you now click on the back button, the mess starts:
If you now click on any category, the view always displays the category, which you clicked at first! Not the one you want to see. Also, if I now change the instance (say to instance a) and try to switch back to instance b, the switch will not be performed (the title remains a)!
I really can't see where those bugs come from, as the localeStorage seems to be updated on clicks! (check the lastActiveInstance and lastActiveCat variables in localStorage!)
Do you guys see where my mistake is? By this time I think it must be some fundamental problem with the $stateProvider and the back button?
I'd really appreciate your help, since I am pretty desperate right now. Thank you
For what I've seen, it looks like you have only one MainCtrl for the whole application, is that right?
It looks like the variables of this controller are only updated once. So your activeInstance will receive it's value when you click for the first time to see the category, but then if you come back and click again on anything, the value of this variable is not being updated. You're calling selectCat function but I don't see it updating the values of activeInstance.
I hope it's only that!
It is now fixed with the new ionic 1.0 beta 5b.
View title updates as expected.
From the changelog:
- List item
- make it set navbar if title changes back to old value (919d4f8d, closes #1121)

DotNetNuke Switching Between Multple Edit Modules

I have a custom module in DNN 7 that has a data structure where items belong to categories (called "sections", not DNN taxonomy, just a simple list of section names). The module edit screens work so that on the view control you may click on an edit link on each category, which loads the category edit screen (passing the category id). This works great, and when you save I use Globals.NavigateURL() to return to the view screen. This all works as intended.
On each category edit screen I also have a list of the items within that category, each with an edit link. Clicking the edit link opens the item edit screen, passing the correct item id, and allowing me to edit that item. This all works great, until you save. The save works properly, but when I want to send the user back to the edit screen for the category it doesn't work. When I use:
Response.Redirect(EditUrl("SectionId", sectionid.ToString(), "EditSections"), true);
...nothing happens. It simply doesn't redirect anywhere. This is exactly the same URL I'm using to get to the category edit page in the first place:
EditUrl("SectionId", Eval("SectionId").ToString(), "EditSections")
And then I use a similar URL to get to the item edit page:
EditUrl("ItemId", Eval("ItemId").ToString(), "EditItems")
I don't understand why using the same URL to navigate to the same page I already navigated to would simply not do anything. For now I am sending them all the way back to the view, but it's painful if you need to add several items to the same category to have to navigate back into the category and add another item, only to be sent back to the view.
Anyone see anything like this before?
Have you tried to use the overload of NavigateUrl instead of EditUrl?
Globals.NavigateURL(TabId, "EditSections", "mid", ModuleId.ToString(), "SectionId", Eval("SectionId").ToString())
I haven't seen that myself but I would have to assume that somehow the context is being lost with EditURL and you're not getting sent to the proper location due to that.
I would suggest you try one of two things (or both).
Debug the URL that EditURL is returning and see if you can find the
difference.
Use NavigateURL for all your links and pass in MID=## for your
moduleid as a querystring parameter, to ensure that the proper
values are being passed.
UPDATE: If you're trying to have multiple edit views, and move between them, you might look at using a "loader" instead of having separate module definitions for the edit controls. Basically have a single Edit.ascx file defined, and it loads other ASCX files within it, injecting into a Panel. The View control on this module http://dnnsimplearticle.codeplex.com/ does that, but I haven't tried it with an edit control before.

Website "you can do this" script

I want to create a training path for new users accessing my site. This training path must display info bubbles showing what you can do on every page, but only the first time you access it.
So, for example, if a user enters a page where there's an edit button an info box should appear next to the edit button telling the user that he can edit that page.
I will create the script myself, I just want to know what's the best method to check if the user has already seen that box or not. I was thinking about storing in database a boolean value for each info box which will be set to true if the user has seen the box. To save some queries from the DB I think I can also store the same values in localStorage or in Cookies.
What is the best practice for creating user training paths for a website?
The way I suggest is to store user id (ip or username ? ) and a bit value for each bubble like you say.
PS: for your script you can use this:
http://www.maxvergelli.com/jquery-bubble-popup/documentation/
Jérôme

Want to display results of a callout

When a user 'Saves' a Contact (for example), whether it's new or just updated, I need to:
Do an external callout using one of the Contact field values as a lookup
Display the results of the callout, so the user can make a selection
Update the Contact based on the user's selection display the updated Contact
I have found two aproaches, but have reached a point in both that I need to resolve.
Trigger Based Method
In the 'after' trigger pass the lookup string to a callback.
Update the Contact with the selection
Issues
How do you pass the lookup string or results to a visualforce page to display the lookup results?
When the user makes the selection and the update has been done, how do I move back to the updated contact?
Override Base Method
I found a discussion here that seems to suggests using overriding & redirection to someone asking about 'Edit'. I think this could also be done with the 'Save' button.
Issue
This is meant to be a deployable sollution, so I think that the override has to be set in code (I'm using the IDE) and not via Setup (or am I wrong?). I can't find out if this is possible or how to do it
Sorry for detailed question. Didn't want to just ask the wrong question (i.e. assume I know the best approach).
Thanks...
For the trigger-based method, you cannot change the built-in Save functionality, but (per your second solution) you can override the Edit button and recreate the Edit page with Visualforce, which would give you full control over the Save button and how you handle the callout and redirecting.
The release notes for Spring '10 indicate that standard-button overrides are now available for packaging, as they can be created through the Metadata API.

Resources