0e594d3b2ff344384b4cd9c24761fe2f5ec79a1e
Merge parents 3df0f0e 37a5223
tdreszer
  Thu Nov 10 09:40:02 2011 -0800
merge-o-matic mania
diff --cc src/hg/inc/jsHelper.h
index 5e1dcc2,b597b1a..44ead19
--- src/hg/inc/jsHelper.h
+++ src/hg/inc/jsHelper.h
@@@ -63,87 -63,92 +63,92 @@@
  	char *jsVar, boolean usualVal);
  /* Make a check box filling in with existing value and
   * putting a javascript tracking variable on it. */
  
  void jsTrackedVarCarryOver(struct dyString *dy, char *cgiVar, char *jsVar);
  /* Carry over tracked variable (radio button?) to hidden form. */
  
  char *jsRadioUpdate(char *cgiVar, char *jsVar, char *val);
  /* Make a little javascript to check and uncheck radio buttons
   * according to new value.  To use this you must have called
   * jsWriteFunctions somewhere, and also must use jsMakeTrackingRadioButton
   * to make the buttons. */
  
  char *jsSetVerticalPosition(char *form);
  /* Returns a javascript statement for storing the vertical position of the
 - * page; typically this would go just before a document submit.  
 + * page; typically this would go just before a document submit.
   * jsInit must be called first.
   * Do not free return value!   */
  
  void jsMakeSetClearButton(struct cart *cart,
  			  char *form, char *buttonVar, char *buttonLabel,
  			  char *cartVarPrefix, struct slName *cartVarSuffixList,
  			  char *anchor, boolean currentPos, boolean isSet);
 -/* Make a button for setting or clearing all of a list of boolean 
 - * cart variables (i.e. checkboxes).  If this button was just pressed, 
 +/* Make a button for setting or clearing all of a list of boolean
 + * cart variables (i.e. checkboxes).  If this button was just pressed,
   * set or clear those cart variables.
 - * Optional html anchor is appended to the form's action if given. 
 + * Optional html anchor is appended to the form's action if given.
   * If currentPos, anchor is ignored and jsSetVerticalPosition is used so
   * that the new page gets the same vertical offset as the current page. */
  
  void jsMakeCheckboxGroupSetClearButton(char *buttonVar, boolean isSet);
 -/* Make a button for setting or clearing a set of checkboxes with the same name. 
 +/* Make a button for setting or clearing a set of checkboxes with the same name.
   * Uses only javascript to change the checkboxes, no resubmit. */
  
  char *jsPressOnEnter(char *button);
  /* Returns a javascript statement that clicks button when the Enter key
   * has been pressed; typically this would go in a text input.
 - * jsInit must be called first. 
 + * jsInit must be called first.
   * Do not free return value!  */
  
  void jsIncludeFile(char *fileName, char *noScriptMsg);
  /* Prints out html to include given javascript file from the js directory; suppresses redundant
   *  <script ...> tags if called repeatedly.
   * <noscript>...</noscript> tags are provided automatically. The noscript message may be specified via
   * the noScriptMsg parameter (the string may contain HTML markup). A default msg is provided
   * if noScriptMsg == NULL; noscript msg is suppressed if noScriptMsg == "" (this is useful
   * if you want to more carefully control where the message will appear on the page). */
  
  char *jsCheckAllOnClickHandler(char *idPrefix, boolean state);
 -/* Returns javascript for use as an onclick attribute value to apply "check all"/"uncheck all" 
 - * to all checkboxes with given idPrefix. 
 +/* Returns javascript for use as an onclick attribute value to apply "check all"/"uncheck all"
 + * to all checkboxes with given idPrefix.
   * state parameter determines whether to "check all" or "uncheck all" (TRUE means "check all"). */
  
  void cgiMakeCheckAllSubmitButton(char *name, char *value, char *id, char *idPrefix, boolean state);
  /* Make submit button which uses javascript to apply check all or uncheck all to all
   * checkboxes with given idPrefix.
 - * state parameter determines whether to "check all" or "uncheck all" (TRUE means "check all"). 
 + * state parameter determines whether to "check all" or "uncheck all" (TRUE means "check all").
   * id parameter may be NULL */
  
  char *jsStripJavascript(char *str);
  /* Strip out anything that looks like javascript in html string.
     This function is designed to cleanup user input (e.g. to avoid XSS attacks).
     Returned string should be free'ed after use. */
  
  char *stripRegEx(char *str, char *regEx, int flags);
  /* Strip out text matching regEx from str.
     flags is passed through to regcomp as the cflags argument.
     Returned string should be free'ed after use. */
  
+ char *replaceRegEx(char *str, char *replace, char *regEx, int flags);
+ /* Replace text matching regEx in str with replace string.
+    flags is passed through to regcomp as the cflags argument.
+    Returned string should be free'ed after use. */
+ 
  void jsBeginCollapsibleSection(struct cart *cart, char *track, char *section, char *sectionTitle,
  			       boolean isOpenDefault);
 -/* Make the hidden input, collapse/expand button and <TR id=...> needed for utils.js's 
 +/* Make the hidden input, collapse/expand button and <TR id=...> needed for utils.js's
   * setTableRowVisibility().  Caller needs to have already created a <TABLE> and <FORM>. */
  
  void jsEndCollapsibleSection();
  /* End the collapsible <TR id=...>. */
  
  /* JSON Element code let's you build up a DOM like data structure in memory and then serialize it into
     html for communication with client side code.
   */
  
  // supported types
  
  typedef enum _jsonElementType
  {
      jsonList     = 0,
      jsonHash     = 1,