95433400da33b5bae4c4c8475f1305fc08510f66 jcasper Sat Jun 11 14:25:14 2016 -0700 Store the sort/filter state of jQuery-DataTables-enabled tables in hgSession and hgPublicSessions to the cart, without including that state in saved sessions. Block IE versions before 11 from seeing the DataTables table version, due to checkbox issues. Bonus: fix for a minor session deletion bug. refs #15312, #17509 diff --git src/hg/inc/jsHelper.h src/hg/inc/jsHelper.h index 5398b9d..38c6943 100644 --- src/hg/inc/jsHelper.h +++ src/hg/inc/jsHelper.h @@ -93,30 +93,42 @@ * 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). */ void jsIncludeReactLibs(); /* Prints out <script src="..."> tags for external libraries including ReactJS & ImmutableJS * and our own model libs, React mixins and components. */ +void jsIncludeDataTablesLibs(); +/* Prints out <script src="..."> tags for external libraries: jQuery 1.12.3, the jQuery DataTables + * plugin (version 1.10.12), and the accompanying standard CSS file for DataTables. */ + +char *jsDataTableStateSave (char *cartPrefix); +/* Prints out a javascript function to save the state of a DataTables jQuery plugin-enabled + * table to the cart, using the specified cart prefix to help name the variable. */ + +char *jsDataTableStateLoad (char *cartPrefix, struct cart *cart); +/* Prints out a javascript function to load the state of a DataTables jQuery plugin-enabled + * table from the cart variable whose prefix is specified in the first argument */ + 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. * 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"). * 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. */