716acb7dabc447ddf157ec96ad615a195b4df3d2
chinhli
  Fri Apr 6 15:59:16 2012 -0700
Finished hgLogin UI
diff --git src/hg/hgSession/hgSession.c src/hg/hgSession/hgSession.c
index 01b3e25..78452e0 100644
--- src/hg/hgSession/hgSession.c
+++ src/hg/hgSession/hgSession.c
@@ -74,64 +74,63 @@
 cartWebStart(cart, NULL, "Sign in to UCSC Genome Bioinformatics");
 jsInit();
 printf("Signing in enables you to save current settings into a "
        "named session, and then restore settings from the session later.\n"
        "If you wish, you can share named sessions with other users.\n");
 printf("<P>The sign-in page is handled by our "
        "<A HREF=\"http://%s/\" TARGET=_BLANK>wiki system</A>:\n", wikiHost);
 printf("<A HREF=\"%s\"><B>click here to sign in.</B></A>\n",
        wikiLinkUserLoginUrl(cartSessionId(cart)));
 printf("The wiki also serves as a forum for users "
        "to share knowledge and ideas.\n");
 }
 
 void welcomeGBUser(char *hgLoginUserName)
 /* Tell the user they are not logged in to the hgLogin and tell them how
- * to
- * do so. */
+ * to do so. */
 {
 char *hgLoginHost = hgLoginLinkHost();
 
 cartWebStart(cart, NULL, "Welcome %s", hgLoginUserName);
 jsInit();
 printf("If you are not %s (on the hgLogin at "
        "<A HREF=\"http://%s/\" TARGET=_BLANK>%s</A>) "
        "and would like to sign out or change identity, \n",
        hgLoginUserName, hgLoginHost, hgLoginHost);
 printf("<A HREF=\"%s\"><B>click here to sign out XXXX from hgLogin.</B></A>\n",
        hgLoginLinkUserLogoutUrl(cartSessionId(cart)));
 }
 
 
 void offerGBLogin()
 /* Tell the user they are not logged in to the hgLogin and tell them how
- * to
- * do so. */
+ * to do so. */
 {
 char *hgLoginHost = hgLoginLinkHost();
-
+char *hgLoginSysName = hgLoginLinkSysName();
 cartWebStart(cart, NULL, "Sign in to UCSC Genome Bioinformatics");
 jsInit();
 printf("Signing in enables you to save current settings into a "
        "named session, and then restore settings from the session later.\n"
        "If you wish, you can share named sessions with other users.\n");
-printf("<P>The sign-in page is handled by our XXXX hgLogin "
-       "<A HREF=\"http://%s/\" TARGET=_BLANK>hgLogin system</A>:\n", hgLoginHost);
+printf("<P>The sign-in page is handled by our %s system: "
+       ,hgLoginSysName);
 printf("<A HREF=\"%s\"><B>click here to sign in.</B></A>\n",
        hgLoginLinkUserLoginUrl(cartSessionId(cart)));
-printf("The hgLogin also serves as a forum for users "
-       "to share knowledge and ideas.\n");
+printf("To register for an account, "
+       "<A HREF=\"http://%s/cgi-bin/hgLogin?do.signupPage=1\">"
+       "<B>click here to sign up.</B></A>\n",hgLoginHost);
 }
 
 
 char *getLinkUserName()
 /* Return the user name specified in cookies from the browser, or NULL
  * if 
  * the user doesn't appear to be logged in. */
 {
 if (hgLoginLinkEnabled())
     return cloneString(hgLoginLinkUserName());
 else     
     if (wikiLinkEnabled())
        {
        return cloneString(wikiLinkUserName());
        }
@@ -486,131 +485,139 @@
 
 printf("See the <A HREF=\"../goldenPath/help/hgSessionHelp.html\" "
        "TARGET=_BLANK>Sessions User's Guide</A> "
        "for more information about this tool.<P/>\n");
 
 showCartLinks();
 
 printf("<FORM ACTION=\"%s\" NAME=\"mainForm\" METHOD=%s "
        "ENCTYPE=\"multipart/form-data\">\n",
        hgSessionName(), formMethod);
 cartSaveSession(cart);
 
 if (isNotEmpty(userName))
     showExistingSessions(userName);
 else if (savedSessionsSupported)
+         {
+         if (hgLoginLinkEnabled())
+             {
+             printf("<P>If you <A HREF=\"%s\">sign in</A>, "
+	     "you will also have the option to save named sessions.\n",
+	     hgLoginLinkUserLoginUrl(cartSessionId(cart)));
+             } else {
     printf("<P>If you <A HREF=\"%s\">sign in</A>, "
 	   "you will also have the option to save named sessions.\n",
 	   wikiLinkUserLoginUrl(cartSessionId(cart)));
+             }
+          }
 showSavingOptions(userName);
 showLoadingOptions(userName, savedSessionsSupported);
 printf("</FORM>\n");
 }
 
 void showLinkingTemplates(char *userName)
 /* Explain how to create links to us for sharing sessions. */
 {
 struct dyString *dyUrl = dyStringNew(1024);
 webNewSection("Sharing Sessions");
 printf("There are several ways to share saved sessions with others.\n");
 printf("<UL>\n");
 if (userName != NULL)
     {
     printf("<LI>Each previously saved named session appears with "
 	   "Browser and Email links.  "
 	   "The Browser link takes you to the Genome Browser "
 	   "with that session loaded.  The resulting Genome Browser page "
 	   "can be bookmarked in your web browser and/or shared with others.  "
 	   "The Email link invokes your email tool with a message "
 	   "containing the Genome Browser link.</LI>\n");
     }
 else if (wikiLinkEnabled())
     {
-    printf("<LI>If you <A HREF=\"%s\">sign in</A>, you will be able to save "
-	   "named sessions which will be displayed with Browser and Email "
-	   "links.</LI>\n", wikiLinkUserLoginUrl(cartSessionId(cart)));
+         if (hgLoginLinkEnabled())
+             {
+             printf("<LI>If you <A HREF=\"%s\">sign in</A>, you will be able "
+                    " to save named sessions which will be displayed with "
+                    " Browser and Email links.</LI>\n", 
+                    hgLoginLinkUserLoginUrl(cartSessionId(cart)));
+             } else {
+             printf("<LI>If you <A HREF=\"%s\">sign in</A>, you will be able " 
+                    " to save named sessions which will be displayed with "
+                    " Browser and Email links.</LI>\n",
+                    wikiLinkUserLoginUrl(cartSessionId(cart)));
+             }
     }
 dyStringPrintf(dyUrl, "http://%s%s", cgiServerNamePort(), cgiScriptName());
 
 printf("<LI>If you have saved your settings to a local file, you can send "
        "email to others with the file as an attachment and direct them to "
        "<A HREF=\"%s\">%s</A> .</LI>\n",
        dyUrl->string, dyUrl->string);
 dyStringPrintf(dyUrl, "?hgS_doLoadUrl=submit&hgS_loadUrlName=");
 printf("<LI>If a saved settings file is available from a web server, "
        "you can send email to others with a link such as "
        "%s<B>U</B> where <B>U</B> is the URL of your "
        "settings file, e.g. http://www.mysite.edu/~me/mySession.txt .  "
        "In this type of link, you can replace "
        "\"hgSession\" with \"hgTracks\" in order to proceed directly to "
        "the Genome Browser.</LI>\n",
        dyUrl->string);
 printf("</UL>\n");
 dyStringFree(&dyUrl);
 }
 
 void doMainPage(char *message)
 /* Login status/links and session controls. */
 {
 puts("Content-Type:text/html\n");
 if (hgLoginLinkEnabled())
   {
-  /* XXXX hgLogin  */
-printf("HELLO HGLOGIN\n");
     char *hgLoginUserName = hgLoginLinkUserName();
-/* DEBUG: */ printf("<BR>DEBUG X: hgLoginUserName is %s<BR>",hgLoginUserName);
 
     if (hgLoginUserName)
         welcomeGBUser(hgLoginUserName);
     else
         offerGBLogin();
 
-/* DEBUG: */ printf("<BR>DEBUG Y: hgLoginUserName is %s<BR>",hgLoginUserName);
-/* DEBUG: */ printf("<BR>DEBUG Z: message is %s<BR>",message);
-
     if (isNotEmpty(message))
         {
-/* DEBUG: */ printf("<BR>DEBUG A: message is %s<BR>", message);
         if (cartVarExists(cart, hgsDoSessionDetail))
             webNewSection("Session Details");
         else
             webNewSection("Updated Session");
         puts(message);
-/* DEBUG: */ printf("<BR>DEBUG B: message is %s<BR>", message);
-
         }
     showSessionControls(hgLoginUserName, TRUE, TRUE);
     showLinkingTemplates(hgLoginUserName);
 
 
   } else { /* use wiki login */
 if (wikiLinkEnabled())
     {
     char *wikiUserName = wikiLinkUserName();
     if (wikiUserName)
 	welcomeUser(wikiUserName);
     else
 	offerLogin();
     if (isNotEmpty(message))
 	{
 	if (cartVarExists(cart, hgsDoSessionDetail))
 	    webNewSection("Session Details");
 	else
 	    webNewSection("Updated Session");
 	puts(message);
 	}
-/* DEBUG: */ printf("<BR>DEBUG WIKI message is %s<BR>", message);
     showSessionControls(wikiUserName, TRUE, TRUE);
     showLinkingTemplates(wikiUserName);
     }
 else 
     {
     if (isNotEmpty(message))
 	{
 	if (cartVarExists(cart, hgsDoSessionDetail))
 	    webNewSection("Session Details");
 	else
 	    cartWebStart(cart, NULL, "Updated Session");
 	jsInit();
 	puts(message);
 	showSessionControls(NULL, FALSE, TRUE);
 	}