we have a CRM-like application written in GWT/GXT with help of our library which wraps some GXT widgets like ComboBox or Grid from GXT to simplify interaction with relational database. When the application starts a user have to log in and after successfully login the user can see main horizontal menu and some welcome information. If the user want to do something (e. g. to find a customer) he/she has to click somewhere in the menu and a new GXT modal window appears. Now we want to give the user a possibility to open a new session (e. g. to handle a second customer and visually compare customer's data with the first customer) in a new browser window.
How to do it?
Best Regards,
Jacek
The best way I know to comunicate between browser tabs is to use HTML 5 localStorage. Here is a good tutorial. In GWT you can use gwt-storage to easily manipulate the localStorage.
If you want to open a new Window or browsertab you will need to solve two problems:
You will need to specify the session. This can be done by simply create some kind of session token-cookie. This should be flagged with http-only for security reasons). New windows will send the same cookie (and the user is logged in)
You need to specify the item, you want to show. This can be done by using the history API and store the token in the URL
Related
I want an spfx made webpart that I've made be able to send an email (I'm using IEmailProperties at the moment) which provides a link to a modal form?
For example:
User clicks button in webpart, form loads.
User fills out form and submits it to SP list.
Form sends email on submission. Email has a link to the actual item created, so when the user clicks the provided email link, it opens up the modal form.
I would presume that the user would HAVE to be sent to the SP page where the webpart is unconditionally, but would it be possible to open up the modal corresponding to the SP list item?
Is this feature available in SharePoint framework, because if it isn't, compared to something like InfoPath 2013 or PowerApps it's quite a limitation.
I've researched this with several shallow Google searches and on gitHub for any premade stuff, but alas there is nothing that I've spotted.
I've been told IT IS possible:
"Yeah, they’d have to visit the page. Email clients don’t do JavaScript so you can’t really do interactive stuff there. If you want to take them directly to a page that then displays a modal, that’s plenty possible though. (e.g. display the modal based on if the URL contains a certain string)"
But wouldn't know how to do the above, can anyone start me on the right path?
Regards,
T
In the email, pass a query string containing the item ID/list ID etc of the item, then have the webpart read the See: How can I get query string values in JavaScript? If your values exist. If they do exist, then open the modal using some kind of framework like bootstrap or fluent UI. You can write your own form using PnPjs or use an iframe potentially to display the OOTB edit form.
Additionally, you can link to any page in SharePoint provided you use an extension instead of a webpart to host the modal. You can install extensions tenant wide, and have it listen for the query string.
I need to add a button for each user in admin's user list (admin/user.php).
is it possible to do it from my local plugin? if yes how?
Or I need to edit the user modules manually?
The only way to do this without a core code modification, would be to use the theme (or possibly a local plugin) to inject some javascript into the page to add the button after the page has loaded.
The page itself is quite old, so it doesn't use a renderer, so overriding the generated HTML via the theme is not an option. The user actions aren't designed to be pluginable either.
Depending on what you are wanting to do, you could, of course, create a local plugin that adds a new link to the 'Site administration' tree. On the page this links to, you could add your own list of users, with whatever buttons you wanted on them.
I wrote relatively simple web app in Spring MVC. I have following multipage forms:
Fill in
Check preview and eventually go back to 1. by form button or back button in your browser
Confirm
I used annotation #SessionAttributes and everything goes well, besides of going back to edit form after preview.
Then I have an information that document has expired in browser and I have to renew my POST request hence creating new objects. I resolved this problem by creating another method which loads view with form and loads there information from session, but still I can't use 'back button' in my browser. I would like to avoid javascript in this problem. Any ideas?
EDIT: I can see when session is active header is always set to 'no cache no store', maybe there is a way to configure Spring Session to enable cache and store? I searched but didn't find anything helpful.
In my web application, I am using Cookie Based session, and thus that session is being shared among all browser tabs, Is there a way to restrict user to have access of application in one tab at a time with the use of tokens(Token Interceptor)? Opening up in a new tab will invalidate the previous tab pages (i.e all application jsp pages including login page)
In short this is not possible and only solution which come to my mind is force user to use a single instance of your application by writing URLs on the fly use a sessionID.
I am not sure why you need this and what exactly is your use case.If i am correct there is such feature in spring security which help us to keep only one instance per logged in user and all you need to set a property in your spring-security xml file like
<session-management>
<concurrency-control max-sessions="1" />
</session-management>
For details refer to these threads
how-to-differ-sessions-in-browser-tabs
allow-only-one-session-per-user
Please give me idea about the management of data in GWT. I am using Gwt in my travel portal project and my web pages is related to previous page data but when i press the refresh button of browser's then my data is lost . so please inform me if there is any way to manage this problem.
GWT History class cannot be used to manage page refresh (only back/forward).
A click on the refresh button send a request to the server and the state of the application is reloaded from the server. That's all. You have to deal with it.
If you don't want to lose your data, you have to find a way to save it on the server when it's needed.
If your users have modern browsers, you can use the HTML5 feature localStorage to store the data in the browser between page-refresh.
Check this thread for supported browser.
You can create a url fragment to encode your data.
String location = "ny";
History.newItem("location="+location);
will result with a url fragment of www.example.com#location=ny
Then if the browser is refreshed, you can decode the url fragment and determine that the location is ny.
For multiple parameters you can create a complex fragment and parse it.
History.newItem("start="+startLocation+"&end="+endLocation);
Then the url would look like www.example.com#start=newyork&end=boston
The basic idea is to store some state in the URL fragment (the part of the URL after the #) -- for example your-site.com/app#page-1
To listen for changes to the fragment, use GWT's History class. The fragment will change when the user goes back/forward, or refreshes the page.
So you could have your app do different things when the URL has #page-1 vs #page-2, etc.
A more generalized and scalable solution to this is something like gwt-platform's Place architecture (along with Presenters, which are also a good idea for large apps)