src/hg/encode/hgEncodeVocab/hgEncodeVocab.c 1.18

1.18 2009/02/25 18:26:03 kate
1. Add links to cell protocol files 2. Add option to set background color
Index: src/hg/encode/hgEncodeVocab/hgEncodeVocab.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/encode/hgEncodeVocab/hgEncodeVocab.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -b -B -U 4 -r1.17 -r1.18
--- src/hg/encode/hgEncodeVocab/hgEncodeVocab.c	9 Jan 2009 18:49:55 -0000	1.17
+++ src/hg/encode/hgEncodeVocab/hgEncodeVocab.c	25 Feb 2009 18:26:03 -0000	1.18
@@ -15,8 +15,9 @@
  * options:\n"
  *    ra=cv.ra       : Path to cv.ra file (default cv_file())
  *    type=TypeName  : Type to display
  *    tier=N         : If type="Cell Line" then this is the tier to display
+ *    bgcolor=RRGGBB : Change background color (hex digits)
  */
 
 //#define HANDLE_IMPLICIT_CONTROL
 
@@ -200,8 +202,18 @@
             return;
         }
     ++(*total);
     puts("<TR>");
+
+    /* add link to protocol doc if it exists */
+#define PROTOCOL_DIR "/ENCODE/protocols/cell/"
+    char protocolUrl[PATH_LEN];
+    safef(protocolUrl, sizeof(protocolUrl), "%s/%s_protocol.doc", PROTOCOL_DIR, term);
+    char protocolFile[PATH_LEN];
+    safef(protocolFile, sizeof(protocolFile), "%s%s", hDocumentRoot(), protocolUrl);
+    if (fileExists(protocolFile))
+        printf(" <TD><A STYLE=\"text-decoration:none\"HREF=%s TARGET=_BLANK>%s</A></TD>\n", protocolUrl, term);
+    else
     printf("  <TD>%s</TD>\n", term);
     s = hashFindVal(ra, "tier");
     printf("  <TD>%s</TD>\n", s ? s : "&nbsp;" );
     s = hashFindVal(ra, "description");
@@ -348,8 +360,11 @@
 int main(int argc, char *argv[])
 /* Process command line */
 {
 cgiSpoof(&argc, argv);
+char *bgColor = cgiOptionalString("bgcolor");
+if (bgColor)
+    htmlSetBgColor(strtol(bgColor, 0, 16));
 htmShell("ENCODE Controlled Vocabulary", doMiddle, "get");
 return 0;
 }