87a833f995f6bfc6879c95f4c882da0ae0feaa72
tdreszer
Thu Sep 2 13:23:32 2010 -0700
After changing cartDump to encode vars and vals, I decided to make it all ajaxy
diff --git src/hg/cartDump/cartDump.c src/hg/cartDump/cartDump.c
index 136105f..e6ab622 100644
--- src/hg/cartDump/cartDump.c
+++ src/hg/cartDump/cartDump.c
@@ -1,71 +1,99 @@
/* cartDump - Dump contents of cart. */
#include "common.h"
#include "linefile.h"
#include "hash.h"
#include "cheapcgi.h"
#include "cart.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"
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"))
{
return;
}
+if (asTable)
+ {
+ jsIncludeFile("utils.js",NULL);
+ jsIncludeFile("ajax.js",NULL);
+ printf("Show as plain text.
",CART_DUMP_AS_TABLE);
+ printf("
"); wildcard = cgiOptionalString(MATCH_VAR); if (wildcard) cartDumpLike(cart, wildcard); else cartDump(cart); printf(""); +if (!asTable) + { printf("\n"); + } +printf("
Cookies passed to %s:
\n%s\n