0a511288a7c39e7e3a0fba04a75610ba5c1ce7b1
larrym
Fri Oct 21 17:12:45 2011 -0700
use js to do client side check all/clear all; fix tooltip for update checkboxes
diff --git src/hg/hgCustom/hgCustom.c src/hg/hgCustom/hgCustom.c
index e7077a3..dcbf9f8 100644
--- src/hg/hgCustom/hgCustom.c
+++ src/hg/hgCustom/hgCustom.c
@@ -450,31 +450,31 @@
puts("
%s | ", wrapWhiteFont(label));
}
void showCustomTrackList(struct customTrack *ctList, int numCts)
/* print table of custom tracks with controls */
{
struct customTrack *ct;
char buf[256];
char *pos = NULL;
char *dataUrl;
int colSpan = 4;
-/* handle 'set all' and 'clr all' */
+/* handle 'set all' and 'clr all' (won't be used if user has javascript enabled). */
boolean setAllDelete = FALSE;
boolean setAllUpdate = FALSE;
if (cartVarExists(cart, hgCtDoDeleteSet))
setAllDelete = TRUE;
if (cartVarExists(cart, hgCtDoRefreshSet))
setAllUpdate = TRUE;
/* determine which columns to display (avoid empty columns) */
int updateCt = 0, itemCt = 0, posCt = 0, errCt = 0;
for (ct = ctList; ct != NULL; ct = ct->next)
{
if (ctDataUrl(ct))
updateCt++;
if (ctItemCount(ct) > 0)
itemCt++;
@@ -579,64 +579,68 @@
}
if (errCt)
{
if (ct->networkErrMsg)
{
printf("\nShow | \n",
javaScriptLiteralEncode(ct->networkErrMsg));
}
else
puts(" | ");
}
/* Delete checkboxes */
printf("", showAllButtons ? 2 : 1);
safef(buf, sizeof(buf), "%s_%s", hgCtDeletePrefix,
ct->tdb->track);
- cgiMakeCheckBox(buf, setAllDelete);
+ cgiMakeCheckBoxJS(buf, setAllDelete, "class='deleteCheckbox'");
puts(" | ");
/* Update checkboxes */
if (updateCt)
{
printf("", showAllButtons ? 2 : 1);
safef(buf, sizeof(buf), "%s_%s", hgCtRefreshPrefix,
ct->tdb->track);
if ((dataUrl = ctDataUrl(ct)) != NULL)
- cgiMakeCheckBoxWithMsg(buf, setAllUpdate, dataUrl);
+ {
+ char js[1024];
+ safef(js, sizeof(js), "class='updateCheckbox' title='refresh data from: %s'", dataUrl);
+ cgiMakeCheckBoxJS(buf, setAllUpdate, js);
+ }
else
puts(" ");
puts(" | ");
}
puts("\n");
}
if (showAllButtons)
{
cgiSimpleTableRowStart();
printf("check all / clear all | ", colSpan);
cgiSimpleTableFieldStart();
- cgiMakeButtonWithMsg(hgCtDoDeleteSet, "+", "Select all for deletion");
+ cgiMakeButtonWithOnClick(hgCtDoDeleteSet, "+", "Select all for deletion", "$('.deleteCheckbox').attr('checked', true); return false;");
cgiTableFieldEnd();
cgiSimpleTableFieldStart();
- cgiMakeButtonWithMsg(hgCtDoDeleteClr, "-", "Clear all for deletion");
+ cgiMakeButtonWithOnClick(hgCtDoDeleteClr, "-", "Clear all for deletion", "$('.deleteCheckbox').attr('checked', false); return false;");
cgiTableFieldEnd();
if (updateCt)
{
cgiSimpleTableFieldStart();
- cgiMakeButtonWithMsg(hgCtDoRefreshSet, "+", "Select all for update");
+ cgiMakeButtonWithOnClick(hgCtDoRefreshSet, "+", "Select all for update", "$('.updateCheckbox').attr('checked', true); return false;");
cgiTableFieldEnd();
cgiSimpleTableFieldStart();
- cgiMakeButtonWithMsg(hgCtDoRefreshClr, "-", "Clear all for update");
+ cgiMakeButtonWithOnClick(hgCtDoRefreshClr, "-", "Clear all for update", "$('.updateCheckbox').attr('checked', false); return false;");
cgiTableFieldEnd();
}
cgiTableRowEnd();
}
hTableEnd();
}
struct dbDb *getCustomTrackDatabases()
/* Get list of databases having custom tracks for this user.
* Dispose of this with dbDbFreeList. */
{
struct dbDb *dbList = NULL, *dbDb;
char *db;
/* Get list of assemblies with custom tracks */
@@ -897,30 +901,31 @@
char *longLabel = htmlEncode(ct->tdb->longLabel);
cartWebStart(cart, database, "Update Custom Track: %s [%s]",
longLabel, database);
freeMem(longLabel);
cartSetString(cart, hgCtDocText, ct->tdb->html);
addCustomForm(ct, err);
helpCustom();
cartWebEnd(cart);
}
static void doManageCustom(char *warn)
/* display form for deleting & updating custom tracks.
* Include warning message, if any */
{
cartWebStart(cart, database, "Manage Custom Tracks");
+jsIncludeFile("jquery.js", NULL);
manageCustomForm(warn);
webNewSection("Managing Custom Tracks");
webIncludeHelpFile("customTrackManage", FALSE);
cartWebEnd(cart);
}
char *fixNewData(struct cart *cart)
/* append a newline to incoming data, to keep custom preprocessor happy */
{
char *customText = cartUsualString(cart, hgCtDataText, "");
if (isNotEmpty(customText))
{
struct dyString *ds = dyStringNew(0);
dyStringPrintf(ds, "%s\n", customText);
customText = dyStringCannibalize(&ds);