13e088f3619ab994fda1c766473b2132c09eb852
larrym
  Wed May 16 15:18:11 2012 -0700
add jsonStringEscape; make .h header comments match .c file
diff --git src/hg/inc/jsHelper.h src/hg/inc/jsHelper.h
index 1bf233b..438d899 100644
--- src/hg/inc/jsHelper.h
+++ src/hg/inc/jsHelper.h
@@ -1,27 +1,16 @@
-/* jsHelper - some little helper routines  to manage our javascript.
- * We don't do much javascript - just occassionally use it so that
- * when they select something from a pull-down, it will go hit the server to
- * figure out how to reload other control options based on the choice.
- * (For instance if they change the group, which items in the track
- * drop-down need to change).
- *
- * We accomplish this by maintaining two forms - a mainForm and a
- * hiddenForm.  The hiddenForm maintains echo's of all the variables
- * in the main form, which get updated onChange of controls that need
- * to 'ripple' to other controls.  The onChange also submits the
- * control. */
+// jsHelper.c - helper routines for interface between CGIs and client-side javascript
 
 #ifndef JSHELPER_H
 #define JSHELPER_H
 
 #include "cart.h"
 #include <regex.h>
 
 #define JS_CLEAR_ALL_BUTTON_LABEL    "Clear all"
 #define JS_SET_ALL_BUTTON_LABEL  "Set all"
 #define JS_DEFAULTS_BUTTON_LABEL "Set defaults"
 
 // Make toggle and [+][-] buttons without image gifs.
 // Not ready for this release.
 //#define BUTTONS_BY_CSS
 
@@ -196,16 +185,21 @@
 // print out a jsonElement
 
 extern struct jsonElement *jsonGlobalsHash; // The "all" globals json hash
 
 void jsonPrintGlobals(boolean wrapWithScriptTags);
 // prints out the "common" globals json hash
 // This hash is the one utils.js and therefore all CGIs know about
 
 void jsonErrPrintf(struct dyString *ds, char *format, ...);
 //  Printf a json error to a dyString for communicating with ajax code; format is:
 //  {"error": error message here}
 
 struct jsonElement *jsonParse(char *str);
 // parse string into an in-memory json representation
 
+char *jsonStringEscape(char *inString);
+/* backslash escape a string for use in a double quoted json string.
+ * More conservative than javaScriptLiteralEncode because
+ * some json parsers complain if you escape & or ' */
+
 #endif /* JSHELPER_H */