How to open page in new tab/window? - google-app-maker

I need to perform something like app.showPage(app.pages.%PAGENAME%)but open the page in new tab.
Is it even possible in appmaker?
I am not opening an external link, I need to open the page of the app in a new tab.

Client property app.buildUrl().__gwt_instance.a; contains app's URL.
Not sure if a good practice, however it fulfilled my needs

Related

How do I make a programatically changed site dashboard refresh without restarting the Alfresco/Tomcat service?

I've created a web-script module extension and have verified that it works correctly. What it does is takes the dashboard.xml and related page.component-X-Y.type~id~dashboard.xml files from one site, deletes all dashboard related files on another site then copies the source files to the new site that had them deleted.
pseudo-code
var siteDashboard = getDashboard("site1-shortname");
var siteDashboard = renameShortNames("site1-shortname", "short2-shortname");
deleteDashboard("site2-shortname");
createDashboard("site2-shortname", siteDashboard);
renameShortNames just renames the site id inside the dashboard files to the new site's id.
This all works, I've tested and verified it. My problem is that when I go to http://alfrescosite.com/alfresco/s/remoteadm/get/s/sitestore/alfresco/site-data/pages/site/site2-shortname/dashboard.xml it shows me the new dashboard layout from site1-shortname which is the correct behavior but when I go to the actual site's dashboard within Alfresco share it shows the old site2-shortname dashboard. The only way I can get the new dashboard to show is by restarting the Alfresco/Tomcat service. I've even tried looking at the dashboard with a different browser just in case it was a local caching issue but it's not.
Any ideas on how to make the dashboards refresh to the new layout without having to restart the Alfresco/Tomcat service every time?
I figured out what the problem was. The problem was that I was deleting and recreating the dashboard via Remote API calls to the Alfresco Repository and doing it that way was making the appropriate changes but not telling Alfresco Share of those changes.
The solution was to use a combination the Share root object sitedata to remove the component bindings, delete the components and recreate them through Share so that the changes are automatically updated on the front end without the need for a service restart.
Basically this ended up being a modified version of the code in customise-dashboard.post.json.js inside Alfresco Share

Session State - multiple browsers

What is the best way to keep session state between browser tabs?
I have the following scenario. I have a page where the user opens a 'project' from a grid.
I keep this project in the session as the "Current Open project".
The problem is that users can open another project from another tab in the browser. Now, they open another project and this becomes the new "Current Open project".
If they go back to the first page ... it is clearly a problem.
Is there a way to solve this situation please?
Thanks,
Joseph
No, you just have to handle it.
When a page tries to do something with a project, the server has to check if it's the current project that the page is trying to change or a different project, so that the server can send an error message back that the wrong project is opened.
Alternatively you can avoid keeping the current project in the session, and allow multiple projects to be opened simultaneously. As long as each page keeps track of which project it is handling (which you have to do anyway), it's not a problem.

How can i change session when open url in another tab in asp.net

I am developing one web application in asp.net. I am opening my all pages on pop up window. I want to expire my session or change the session value when someone copy the url and paste it into another tab. How can i implement it ?
Please help me out.
A simple way would be to check Request.UrlReferrer. The Referrer would be empty if the user copy pastes a URL.
A couple of points you should consider before using this:
Provide exceptions for any pages that can be directly entered by
the user. For e.g. the login page or a page that can be bookmarked
I believe a pop can be opened from Javascript, without a referrer. Make sure your existing code is not using this method to open a pop up.
For a generic way to determine if the user has opened a new tab, see here
I have solved this problem by using this
string referer = Request.ServerVariables["HTTP_REFERER"];
if (string.IsNullOrEmpty(referer))
{
Response.Redirect("../Index.htm");
}

How to get view any file functionality as we get in gmail using asp.net

I have to create code to view any type of file in the browser as we are able to view in gmail.
Even though the user does not have the required software installed he should be able to view it.
The file should not be open in separate window.
The file should be opened in the browser itself
Thanks in advance
You'll need to process it on the server-side into some data structure that can be rendered in html/css/js on the client

file transfer through iframe not propagating

I'm still rebuilding old ASP to new and iframing certain things that take up too much time.
I'm stuck at a search function that normally returns an excel file (browser asks save or open). the result page for this is now iframed but it does not seem to propagate the file anymore, so no more save-file popup.
I must add that this iframe is being filled through a custom httphandler that posts to the old pages based on certain criterie, the searchcriteria in this case.
does anyone have an idea on how I could make the excel propagate once again?
The way to ensure you get a save-file prompt and not a page, do the following:
Open the file in ASP
Send the MIME header for Excel
Stream out the file from ASP
You may also choose to hold the files outside of the web root so they cannot be downloaded directly.
Here are a few examples: 1 2 3
This may come in handy as well:
How to output an Excel *.xls file from classic ASP
It *seems* like a security issue. What happens if you open the URL which is being loaded in the IFrame in a new browser? To confirm it, you can try opening the URL, and see what happens.

Resources