4a12b8e105ea5b518de2c1ce33c1b94e3df09a2e
hiram
  Mon Jun 25 10:56:10 2012 -0700
make the wiki track read only be an option in hg.conf
diff --git src/hg/hgGene/wikiTrack.c src/hg/hgGene/wikiTrack.c
index f746d1a..0fdde5f 100644
--- src/hg/hgGene/wikiTrack.c
+++ src/hg/hgGene/wikiTrack.c
@@ -4,32 +4,30 @@
 #include "hash.h"
 #include "linefile.h"
 #include "dystring.h"
 #include "spDb.h"
 #include "web.h"
 #include "hgConfig.h"
 #include "hgGene.h"
 #include "htmlPage.h"
 #include "hgColors.h"
 #include "hdb.h"
 #include "binRange.h"
 #include "wikiLink.h"
 #include "wikiTrack.h"
 
 
-/* enforce read-only 2012-06-22 */
-#ifdef NOT
 static char *hgGeneUrl()
 {
 static char retBuf[1024];
 safef(retBuf, ArraySize(retBuf), "cgi-bin/hgGene?%s=1&%s",
 	hggDoWikiTrack, cartSidUrlString(cart));
 return retBuf;
 }
 
 static char *wikiTrackUserLoginUrl()
 /* Return the URL for the wiki user login page. */
 {
 char *retEnc = encodedReturnUrl(hgGeneUrl);
 char buf[2048];
 
 safef(buf, sizeof(buf),
@@ -40,31 +38,30 @@
 }
 
 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);
 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);
 }
-#endif
 
 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);
 if ((0 == negativeCount) && (plusCount > 0))
     safecpy(bb->strand, sizeof(bb->strand), "+");
 else if ((0 == plusCount) && (negativeCount > 0))
     safecpy(bb->strand, sizeof(bb->strand), "-");
 else
@@ -418,32 +415,32 @@
 /* safety check, both of these lists should be non-zero */
 int locusLocationCount = slCount(clusterList);
 int rawListCount = slCount(allIsoforms);
 if ((0 == rawListCount) || (0 == locusLocationCount))
     {
     hPrintf("<EM>(Feature under development, not available for "
 	"all genome browsers yet)</EM><BR>\n");
     hPrintf("hgGene.doWikiTrack: can not find any genes "
 	"of gene symbol %s<BR>\n",curGeneName);
     cartWebEnd();
     return;
     }
 
 if (isEmpty(userName))
     {
-    ;  /* enforce read-only 2012-06-22 */
-    /* offerLogin(); */
+    if (! wikiTrackReadOnly() ) /* read-only option 2012-06-25 */
+        offerLogin();
     }
 else if (emailVerified(TRUE))  /* prints message when not verified */
     {
     hPrintf("<FORM ID=\"hgg_wikiAddComment\" NAME=\"hgg_wikiAddComment\" "
 	"METHOD=\"POST\" ACTION=\"../cgi-bin/hgGene\">\n\n");
     cartSaveSession(cart);
     cgiMakeHiddenVar(hggDoWikiTrack, "1");
     cgiMakeHiddenVar(hggDoWikiAddComment, "1");
     cgiMakeHiddenVar("db", database);
     cgiMakeHiddenVar("hgg_gene", curGeneId);
     webPrintLinkTableStart();
     /* first row is a title line */
     char label[256];
     safef(label, ArraySize(label), "'%s' adding comments to gene %s\n",
 	userName, curGeneName);