090d4afcaf0482dfa3f5eaec25d915f1d4a9fa9e max Thu Jun 15 13:34:32 2017 -0700 Cleanup of hgSession to make the distinction between the login server and local server clearer in the code. Renaming and moving two functions from wikiLink to hdb, as at least one is not necessarily wikiLink-related and it's good to keep them together. Also adding a warning to hgSession.c (probably useless). refs #19632 and also see related tickets there. diff --git src/hg/hgSession/hgSession.c src/hg/hgSession/hgSession.c index b151f3c..a427070 100644 --- src/hg/hgSession/hgSession.c +++ src/hg/hgSession/hgSession.c @@ -1,20 +1,29 @@ /* hgSession - Interface with wiki login and do session saving/loading. */ /* Copyright (C) 2014 The Regents of the University of California * See README in this or parent directory for licensing information. */ +/* WARNING: testing this CGI on hgwbeta can lead to missed bugs. This is + * because on hgwbeta, the login links go just to hgwbeta. But on genome-euro + * and genome-asia, the login links go to genome.ucsc.edu and session links to + * genome-euro/asia. For proper testing of session loading on hgSession and + * hgLogin, configure your sandbox to use genome.ucsc.edu as a "remote login" + * (wiki.host=genome.ucsc.edu). Make sure that links to load sessions go to + * your sandbox, but login links go to genome.ucsc.edu. For QA, tell them to + * use genome-preview to test this CGI. */ + #include "common.h" #include "hash.h" #include "htmshell.h" #include "cheapcgi.h" #include "linefile.h" #include "net.h" #include "textOut.h" #include "hCommon.h" #include "hui.h" #include "cart.h" #include "jsHelper.h" #include "web.h" #include "hdb.h" #include "ra.h" #include "wikiLink.h" @@ -106,65 +115,68 @@ cartWebStart(cart, NULL, "Sign in to UCSC Genome Bioinformatics"); jsInit(); if (loginSystemEnabled()) { printf("
Signing in enables you to save current settings into a "
"named session, and then restore settings from the session later.
"
"If you wish, you can share named sessions with other users.
The sign-in page is handled by our " "wiki system:\n", wikiHost); printf("click here to sign in.\n", wikiLinkUserLoginUrl(cartSessionId(cart))); printf("The wiki also serves as a forum for users " "to share knowledge and ideas.\n"); } } void showCartLinks() /* Print out links to cartDump and cartReset. */ { char *session = cartSidUrlString(cart); char returnAddress[512]; safef(returnAddress, sizeof(returnAddress), "%s?%s", hgSessionName(), session); printf("Click here to " "reset the browser user interface settings to their defaults.\n", session, cgiEncodeFull(returnAddress)); } void addSessionLink(struct dyString *dy, char *userName, char *sessionName, boolean encode) /* Add to dy an URL that tells hgSession to load a saved session. - * If encode, cgiEncodeFull the URL. */ + * If encode, cgiEncodeFull the URL. + * The link is an absolute link that includes the server name so people can + * copy-paste it into emails. */ { struct dyString *dyTmp = dyStringNew(1024); -dyStringPrintf(dyTmp, "%s%s?hgS_doOtherUser=submit&" +dyStringPrintf(dyTmp, "%shgTracks?hgS_doOtherUser=submit&" "hgS_otherUserName=%s&hgS_otherUserSessionName=%s", - wikiServerAndCgiDir(), "hgTracks", userName, sessionName); + hLocalHostCgiBinUrl(), userName, sessionName); if (encode) { dyStringPrintf(dy, "%s", cgiEncodeFull(dyTmp->string)); } else { dyStringPrintf(dy, "%s", dyTmp->string); } dyStringFree(&dyTmp); } char *getSessionLink(char *encUserName, char *encSessionName) /* Form a link that will take the user to a bookmarkable page that * will load the given session. */ { @@ -183,32 +195,32 @@ dyStringPrintf(dy, "Email\n"); return dyStringCannibalize(&dy); } void addUrlLink(struct dyString *dy, char *url, boolean encode) /* Add to dy an URL that tells hgSession to load settings from the given url. * If encode, cgiEncodeFull the whole thing. */ { struct dyString *dyTmp = dyStringNew(1024); char *encodedUrl = cgiEncodeFull(url); -dyStringPrintf(dyTmp, "%s%s?hgS_doLoadUrl=submit&hgS_loadUrlName=%s", - wikiServerAndCgiDir(), "hgTracks", encodedUrl); +dyStringPrintf(dyTmp, "%shgTracks?hgS_doLoadUrl=submit&hgS_loadUrlName=%s", + hLocalHostCgiBinUrl(), encodedUrl); if (encode) { dyStringPrintf(dy, "%s", cgiEncodeFull(dyTmp->string)); } else { dyStringPrintf(dy, "%s", dyTmp->string); } freeMem(encodedUrl); dyStringFree(&dyTmp); } char *getUrlLink(char *url) /* Form a link that will take the user to a bookmarkable page that * will load the given url. */ @@ -571,31 +583,31 @@ "