src/hg/hgNotAvail/hgNotAvail.c 1.1

1.1 2009/03/13 15:33:17 fanhsu
Created hgNotAvail.c.
Index: src/hg/hgNotAvail/hgNotAvail.c
===================================================================
RCS file: src/hg/hgNotAvail/hgNotAvail.c
diff -N src/hg/hgNotAvail/hgNotAvail.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/hg/hgNotAvail/hgNotAvail.c	13 Mar 2009 15:33:17 -0000	1.1
@@ -0,0 +1,86 @@
+/* hgNotAvail - Human Genome Browser. */
+#include "common.h"
+#include "linefile.h"
+#include "hash.h"
+#include "cheapcgi.h"
+#include "htmshell.h"
+#include "obscure.h"
+#include "web.h"
+#include "cart.h"
+#include "hdb.h"
+#include "dbDb.h"
+#include "hgFind.h"
+#include "hCommon.h"
+#include "hui.h"
+#include "customTrack.h"
+
+static char const rcsid[] = "$Id$";
+
+boolean isPrivateHost;		/* True if we're on genome-test. */
+struct cart *cart = NULL;
+struct hash *oldVars = NULL;
+char *clade = NULL;
+char *organism = NULL;
+char *db = NULL;
+char *progName;
+
+void hgNotAvail()
+/* hgNotAvail */
+{
+printf("The function you selected (%s) is currently not available.", progName);
+return;
+}
+
+void doMiddle(struct cart *theCart)
+/* Set up pretty web display and save cart in global. */
+{
+char *scientificName = NULL;
+cart = theCart;
+
+getDbGenomeClade(cart, &db, &organism, &clade, oldVars);
+if (! hDbIsActive(db))
+    {
+    db = hDefaultDb();
+    organism = hGenome(db);
+    clade = hClade(organism);
+    }
+scientificName = hScientificName(db);
+if (hIsMgcServer())
+    cartWebStart(theCart, db, "MGC/ORFeome %s Genome Browser \n", organism);
+else if (hIsGsidServer())
+    cartWebStart(theCart, db, "GSID %s Genome Browser \n", organism);
+else
+    {
+    char buffer[128];
+    char *browserName = (isPrivateHost ? "TEST Genome Browser" : "Genome Browser");
+
+    /* tell html routines *not* to escape htmlOut strings*/
+    htmlNoEscape();
+    buffer[0] = 0;
+    if (*scientificName != 0)
+	{
+	if (sameString(clade,"ancestor"))
+	    safef(buffer, sizeof(buffer), "(<I>%s</I> Ancestor) ", scientificName);
+	else
+	    safef(buffer, sizeof(buffer), "(<I>%s</I>) ", scientificName);
+	}
+    cartWebStart(theCart, db, "%s %s%s\n", organism, buffer, browserName);
+    htmlDoEscape();
+    }
+hgNotAvail();
+cartWebEnd();
+}
+
+char *excludeVars[] = {NULL};
+
+int main(int argc, char *argv[])
+/* Process command line. */
+{
+isPrivateHost = hIsPrivateHost();
+oldVars = hashNew(10);
+cgiSpoof(&argc, argv);
+
+progName = argv[0];
+cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
+return 0;
+}