69339a3239e9643fbde81b7dd43bc2978a02e13e hiram Wed May 25 10:38:27 2011 -0700 changing uses of cgiServerName to better cgiServerNamePort diff --git src/hg/cartDump/cartDump.c src/hg/cartDump/cartDump.c index d273e90..bc71f6f 100644 --- src/hg/cartDump/cartDump.c +++ src/hg/cartDump/cartDump.c @@ -1,114 +1,114 @@ /* cartDump - Dump contents of cart. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "cheapcgi.h" #include "cart.h" #include "hdb.h" #include "jsHelper.h" #include "hui.h" static char const rcsid[] = "$Id: cartDump.c,v 1.14 2008/12/09 00:41:20 angie Exp $"; #define CART_DUMP_REMOVE_VAR "n/a" struct hash *oldVars = NULL; void doMiddle(struct cart *cart) /* cartDump - Dump contents of cart. */ { #define MATCH_VAR "match" char *vName = "cartDump.varName"; char *vVal = "cartDump.newValue"; char *wildcard; boolean asTable = cartVarExists(cart,CART_DUMP_AS_TABLE); if (cgiVarExists("submit")) { char *varName = cgiOptionalString(vName); char *newValue = cgiOptionalString(vVal); if (isNotEmpty(varName) && isNotEmpty(newValue)) { varName = skipLeadingSpaces(varName); eraseTrailingSpaces(varName); if (sameString(newValue, CART_DUMP_REMOVE_VAR) || sameString(newValue, CART_VAR_EMPTY)) cartRemove(cart, varName); else cartSetString(cart, varName, newValue); } cartRemove(cart, vVal); cartRemove(cart, "submit"); } if (cgiVarExists("noDisplay")) { char *trackName = cgiOptionalString("g"); if(trackName != NULL && hashNumEntries(oldVars) > 0) { char *db = cartString(cart, "db"); struct trackDb *tdb = hTrackDbForTrack(db, trackName); if(tdb != NULL && tdbIsComposite(tdb)) cartTdbTreeCleanupOverrides(tdb,cart,oldVars); } return; } if (asTable) { jsIncludeFile("utils.js",NULL); jsIncludeFile("ajax.js",NULL); printf("Show as plain text.
",CART_DUMP_AS_TABLE); printf("
\n"); cartSaveSession(cart); printf("Variables can be altered by changing the values and then leaving the field (onchange event will use ajax).\n"); printf("Enter %s or %s to remove a variable.", COLOR_DARKBLUE,CART_DUMP_REMOVE_VAR,COLOR_DARKBLUE,CART_VAR_EMPTY); printf("
Add a variable named: "); cgiMakeTextVar(vName, "", 12); printf(" value: "); cgiMakeTextVar(vVal, "", 24); printf(" "); cgiMakeButton("submit", "refresh");// Says refresh but works as a submit. printf("      " "\n", COLOR_RED); printf("
\n"); } else { printf("Show as updatable table.
",CART_DUMP_AS_TABLE); } printf("
");
 wildcard = cgiOptionalString(MATCH_VAR);
 if (wildcard)
     cartDumpLike(cart, wildcard);
 else
     cartDump(cart);
 printf("
"); if (!asTable) { printf("
\n"); cartSaveSession(cart); printf("Add/alter a variable named: "); cgiMakeTextVar(vName, cartUsualString(cart, vName, ""), 12); printf(" new value "); cgiMakeTextVar(vVal, "", 24); printf(" "); cgiMakeButton("submit", "submit"); printf("
Put %s in for the new value to clear a variable.", COLOR_DARKBLUE,CART_DUMP_REMOVE_VAR); printf("
\n"); } printf("

Cookies passed to %s:
\n%s\n

\n", - cgiServerName(), getenv("HTTP_COOKIE")); + cgiServerNamePort(), getenv("HTTP_COOKIE")); } char *excludeVars[] = { "submit", "Submit", "noDisplay", MATCH_VAR, NULL }; int main(int argc, char *argv[]) /* Process command line. */ { cgiSpoof(&argc, argv); oldVars = hashNew(10); cartHtmlShell("Cart Dump", doMiddle, hUserCookie(), excludeVars, oldVars); return 0; }