10afed273e6c71a7f8d42531fe5256e9b12a9b02
galt
  Wed Sep 20 17:22:14 2023 -0700
hgGene - Making links work better to support http or https. refs #32257

diff --git src/hg/hgGene/wikiTrack.c src/hg/hgGene/wikiTrack.c
index 5dbab23..ad0a130 100644
--- src/hg/hgGene/wikiTrack.c
+++ src/hg/hgGene/wikiTrack.c
@@ -35,31 +35,31 @@
 
 safef(buf, sizeof(buf),
       "%s/index.php?title=Special:UserloginUCSC&returnto=%s",
       cfgOptionDefault(CFG_WIKI_URL, NULL), retEnc);
 freez(&retEnc);
 return(cloneString(buf));
 }
 
 static void offerLogin()
 /* display login prompts to the wiki when user isn't already logged in */
 {
 char *wikiHost = wikiLinkHost();
 char *loginUrl = wikiTrackUserLoginUrl();
 printf("<P>Please login to add annotations to this UCSC gene.</P>\n");
 printf("<P>The login page is handled by our "
-       "<A HREF=\"http://%s/\" TARGET=_BLANK>wiki system</A>:\n", wikiHost);
+       "<A HREF=\"http%s://%s/\" TARGET=_BLANK>wiki system</A>:\n", cgiAppendSForHttps(), wikiHost);
 printf("<A HREF=\"%s\"><B>click here to login.</B></A><BR>\n", loginUrl);
 printf("The wiki also serves as a forum for users "
        "to share knowledge and ideas.\n</P>\n");
 freeMem(loginUrl);
 }
 
 static struct bed *bedItem(char *chr, int start, int end, char *name,
     int plusCount, int negativeCount)
 {
 struct bed *bb;
 AllocVar(bb);
 bb->chrom = chr; /* do not need to clone chr string, it is already a clone */
 bb->chromStart = start;
 bb->chromEnd = end;
 bb->name = cloneString(name);
@@ -280,45 +280,45 @@
 {
 char *userName = NULL;
 int score = 0;
 int id = 0;
 char *description = descriptionString(curGeneId, conn);
 char *aliases = aliasString(curGeneId, conn);
 struct dyString *extraHeader = dyStringNew(0);
 char *protein = NULL;
 char *canonical = canonicalGene(conn, curGeneId, &protein);
 char transcriptTag[1024];
 
 safef(transcriptTag, ArraySize(transcriptTag), "%s", curGeneId);
 
 if (canonical)
     dyStringPrintf(extraHeader,
-	"Canonical gene details [http://%s/cgi-bin/hgGene?hgg_chrom=none&org=%s&db=0&hgg_gene=%s "
+	"Canonical gene details [http%s://%s/cgi-bin/hgGene?hgg_chrom=none&org=%s&db=0&hgg_gene=%s "
 	    "%s %s]<BR>\n",
-	    cfgOptionDefault(CFG_WIKI_BROWSER, DEFAULT_BROWSER), genome,
+	    cgiAppendSForHttps(), cfgOptionDefault(CFG_WIKI_BROWSER, DEFAULT_BROWSER), genome,
 	    canonical, name, canonical);
 if ((slCount(allIsoforms) > 1) || (!canonical))
     {
     dyStringPrintf(extraHeader, "Other loci: ");
     struct bed *el;
     for (el = allIsoforms; el; el = el->next)
 	{
 	if (isNotEmpty(canonical) && sameWord(canonical,el->name))
 	    continue;
 	dyStringPrintf(extraHeader,
-	    "[http://%s/cgi-bin/hgGene?hgg_chrom=none&org=%s&db=0&hgg_gene=%s %s]",
-		cfgOptionDefault(CFG_WIKI_BROWSER, DEFAULT_BROWSER),
+	    "[http%s://%s/cgi-bin/hgGene?hgg_chrom=none&org=%s&db=0&hgg_gene=%s %s]",
+		cgiAppendSForHttps(), cfgOptionDefault(CFG_WIKI_BROWSER, DEFAULT_BROWSER),
 		    genome, el->name, el->name);
 	if (el->next)
 	    dyStringPrintf(extraHeader,", ");
 	}
     dyStringPrintf(extraHeader, "<BR>\n");
     }
 dyStringPrintf(extraHeader, "%s", description);
 /* add a date/time stamp to the description comments */
 dyStringPrintf(extraHeader, "\n(description snapshot ~~~~~)<BR>\n");
 if (aliases)
     {
     dyStringPrintf(extraHeader, "%s\n", aliases);
     freeMem(aliases);
     }