69e8424f77f7d2513fcf8082aea972d539665540 tdreszer Fri Nov 18 13:14:56 2011 -0800 More touches on BUTTONS_BY_CSS diff --git src/hg/lib/hui.c src/hg/lib/hui.c index f77cdc5..958e2e8 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -31,44 +31,44 @@ #include "regexHelper.h" #include "vcfUi.h" #include "vcf.h" #include "errCatch.h" #include "samAlignment.h" #include "makeItemsItem.h" #include "bedDetail.h" #include "pgSnp.h" #define SMALLBUF 128 #define MAX_SUBGROUP 9 #define ADD_BUTTON_LABEL "add" #define CLEAR_BUTTON_LABEL "clear" #define JBUFSIZE 2048 -#ifdef SUBTRACK_CFG -#define BUTTON_PM "<span class='pmButton' onclick=\"setCheckBoxesThatContain('%s',%s,true,'%s','','%s')\">%s</span>" +#ifdef BUTTONS_BY_CSS +#define BUTTON_PM "<span class='pmButton' onclick=\"setCheckBoxesThatContain('%s',%s,true,'%s','','%s')\">%c</span>" #define BUTTON_DEF "<span class='pmButton' onclick=\"setCheckBoxesThatContain('%s',true,false,'%s','','%s'); " \ - "setCheckBoxesThatContain('%s',false,false,'%s','_defOff','%s');\" style='width:50px;font-weight:normal; font-family:default;'>default</span>" + "setCheckBoxesThatContain('%s',false,false,'%s','_defOff','%s');\" style='width:56px;font-weight:normal; font-family:default;'>default</span>" #define DEFAULT_BUTTON(nameOrId,anc,beg,contains) printf(BUTTON_DEF,(nameOrId), (beg),(contains),(nameOrId),(beg),(contains)) -#define PLUS_BUTTON(nameOrId,anc,beg,contains) printf(BUTTON_PM, (nameOrId),"true", (beg),(contains),"+") -#define MINUS_BUTTON(nameOrId,anc,beg,contains) printf(BUTTON_PM, (nameOrId),"false",(beg),(contains),"-") -#else///ifndef SUBTRACK_CFG +#define PLUS_BUTTON(nameOrId,anc,beg,contains) printf(BUTTON_PM, (nameOrId),"true", (beg),(contains),'+') +#define MINUS_BUTTON(nameOrId,anc,beg,contains) printf(BUTTON_PM, (nameOrId),"false",(beg),(contains),'-') +#else///ifndef BUTTONS_BY_CSS #define PM_BUTTON "<IMG height=18 width=18 onclick=\"setCheckBoxesThatContain('%s',%s,true,'%s','','%s');\" id=\"btn_%s\" src=\"../images/%s\" alt=\"%s\">\n" #define DEF_BUTTON "<IMG onclick=\"setCheckBoxesThatContain('%s',true,false,'%s','','%s'); setCheckBoxesThatContain('%s',false,false,'%s','_defOff','%s');\" id=\"btn_%s\" src=\"../images/%s\" alt=\"%s\">\n" #define DEFAULT_BUTTON(nameOrId,anc,beg,contains) printf(DEF_BUTTON,(nameOrId), (beg),(contains),(nameOrId),(beg),(contains),(anc),"defaults_sm.png","default") #define PLUS_BUTTON(nameOrId,anc,beg,contains) printf(PM_BUTTON, (nameOrId),"true", (beg),(contains),(anc),"add_sm.gif", "+") #define MINUS_BUTTON(nameOrId,anc,beg,contains) printf(PM_BUTTON, (nameOrId),"false",(beg),(contains),(anc),"remove_sm.gif","-") -#endif///ndef SUBTRACK_CFG +#endif///ndef BUTTONS_BY_CSS struct trackDb *wgEncodeDownloadDirKeeper(char *db, struct trackDb *tdb, struct hash *trackHash) /* Look up through self and parents, looking for someone responsible for handling * where the downloads are. */ { if (!tdbIsDownloadsOnly(tdb) && !sameString(tdb->table, tdb->track) && trackHash) { tdb = hashFindVal(trackHash, tdb->table); if (tdb == NULL) errAbort("Can't find track for table %s in wgEncodeDownloadDirKeeper", tdb->table); } return trackDbTopLevelSelfOrParent(tdb); } static char *htmlStringForDownloadsLink(char *database, struct trackDb *tdb,char *name,boolean nameIsFile, @@ -6327,56 +6327,56 @@ char * cvSetting = words[ix] + strlen(words[ix]) + 1; const char * cvTerm = metadataFindValue(childTdb,cvSetting); if(cvTerm != NULL) { char *link = controlledVocabLink(words[0],(sameWord(cvSetting,"antibody")?"target":"term"),(char *)cvTerm,(char *)cvTerm,rootLabel,suffix); return link; } } } } freeMem(words[0]); freeMem(rootLabel); return cloneString(label); } -#ifdef SUBTRACK_CFG -#define BUTTON_MAT "<span class='pmButton' onclick=\"matSetMatrixCheckBoxes(%s%s%s%s)\">%s</span>" -#else///ifndef SUBTRACK_CFG +#ifdef BUTTONS_BY_CSS +#define BUTTON_MAT "<span class='pmButton' onclick=\"matSetMatrixCheckBoxes(%s%s%s%s)\">%c</span>" +#else///ifndef BUTTONS_BY_CSS #define PM_BUTTON_UC "<IMG height=18 width=18 onclick=\"return (matSetMatrixCheckBoxes(%s%s%s%s%s%s) == false);\" id='btn_%s' src='../images/%s'>" -#endif///def SUBTRACK_CFG +#endif///def BUTTONS_BY_CSS #define MATRIX_RIGHT_BUTTONS_AFTER 8 #define MATRIX_BOTTOM_BUTTONS_AFTER 20 static void buttonsForAll() { #ifdef SUBTRACK_CFG -printf(BUTTON_MAT,"true", "", "", "", "+"); -printf(BUTTON_MAT,"false","", "", "", "-"); +printf(BUTTON_MAT,"true", "", "", "", '+'); +printf(BUTTON_MAT,"false","", "", "", '-'); #else///ifndef SUBTRACK_CFG printf(PM_BUTTON_UC,"true", "", "", "", "", "", "plus_all", "add_sm.gif"); printf(PM_BUTTON_UC,"false","", "", "", "", "", "minus_all", "remove_sm.gif"); #endif///ndef SUBTRACK_CFG } static void buttonsForOne(char *name,char *class,boolean vertical) { #ifdef SUBTRACK_CFG -printf(BUTTON_MAT, "true", ",'", class, "'", "+"); +printf(BUTTON_MAT, "true", ",'", class, "'", '+'); if (vertical) puts("<BR>"); -printf(BUTTON_MAT, "false", ",'", class, "'", "-"); +printf(BUTTON_MAT, "false", ",'", class, "'", '-'); #else///ifndef SUBTRACK_CFG printf(PM_BUTTON_UC, "true", ",'", class, "'", "", "", name, "add_sm.gif"); if (vertical) puts("<BR>"); printf(PM_BUTTON_UC, "false", ",'", class, "'", "", "", name, "remove_sm.gif"); #endif///ndef SUBTRACK_CFG } #define MATRIX_SQUEEZE 10 #ifdef MATRIX_SQUEEZE static int matrixSqueeze(membersForAll_t* membersForAll) // Returns non-zero if the matrix will be squeezed. Non-zero is actually squeezedLabelHeight { char *browserVersion; if (btIE == cgiClientBrowser(&browserVersion, NULL, NULL) && *browserVersion < '9') @@ -6734,39 +6734,41 @@ { webIncludeResourceFile("ui.dropdownchecklist.css"); jsIncludeFile("ui.dropdownchecklist.js",NULL); jsIncludeFile("ddcl.js",NULL); } cgiDown(0.7); printf("<B>Filter subtracks %sby:</B> (select multiple %sitems - %s)<BR>\n", (membersForAll->members[dimX] != NULL || membersForAll->members[dimY] != NULL ? "further ":""), (membersForAll->dimMax == dimA?"":"categories and "),FILTERBY_HELP_LINK); printf("<TABLE><TR valign='top'>\n"); // Do All [+][-] buttons if(membersForAll->members[dimX] == NULL && membersForAll->members[dimY] == NULL) // No matrix { -#ifdef SUBTRACK_CFG + printf("<TD align='left' width='50px'><B>All:</B><BR>"); +#ifdef BUTTONS_BY_CSS // TODO: Test when a real world case actually calls this. Currently no trackDb.ra cases exist - #define PM_BUTTON_FILTER_COMP "<input type='button' class='pmButton inOutButton' onclick=\"waitOnFunction(filterCompositeSet,this,%s); return false;\" id='btn_%s' value='%c'>" -#else///ifndef SUBTRACK_CFG + #define BUTTON_FILTER_COMP "<span class='pmButton inOutButton' onclick='waitOnFunction(filterCompositeSet,this,%s)'>%c</span>" + printf(BUTTON_FILTER_COMP,"true", '+'); + printf(BUTTON_FILTER_COMP,"false",'-'); +#else///ifndef BUTTONS_BY_CSS #define PM_BUTTON_FILTER_COMP "<input type='button' class='inOutButton' onclick=\"waitOnFunction(filterCompositeSet,this,%s); return false;\" id='btn_%s' value='%c'>" -#endif///ndef SUBTRACK_CFG - printf("<TD align='left' width='50px'><B>All:</B><BR>"); printf(PM_BUTTON_FILTER_COMP,"true", "plus_fc",'+'); printf(PM_BUTTON_FILTER_COMP,"false","minus_fc",'-'); +#endif///ndef BUTTONS_BY_CSS printf("</TD>\n"); } // Now make a filterComp box for each ABC dimension int dimIx=dimA; for(dimIx=dimA;dimIx<membersForAll->dimMax;dimIx++) { //printf("<TD align='right'><B>%s:</B></TD><TD align='left'>\n",labelWithVocabLinkForMultiples(db,parentTdb,membersForAll->members[dimIx])); printf("<TD align='left'><B>%s:</B><BR>\n",labelWithVocabLinkForMultiples(db,parentTdb,membersForAll->members[dimIx])); #ifdef FILTER_COMPOSITE_OPEN_SIZE int fullSize = membersForAll->members[dimIx]->count; #ifdef FILTER_COMPOSITE_ONLYONE if(membersForAll->members[dimIx]->fcType != fctOneOnly) #endif///def FILTER_COMPOSITE_ONLYONE @@ -7024,39 +7026,39 @@ // If any filter additional filter composites, they can be added at the end. compositeUiByFilter(db, cart, parentTdb, formName); return TRUE; } static boolean compositeUiAllButtons(char *db, struct cart *cart, struct trackDb *parentTdb, char *formName) /* UI for composite tracks: all/none buttons only (as opposed to matrix or lots of buttons */ { if (trackDbCountDescendantLeaves(parentTdb) <= 1) return FALSE; if(dimensionsExist(parentTdb)) return FALSE; -#ifdef SUBTRACK_CFG -#define BUTTON_ALL "<span class='pmButton' onclick='matSubCBsCheck(%s)'>%s</span>" -#define BUTTON_PLUS_ALL_GLOBAL() printf(BUTTON_ALL,"true", "+") -#define BUTTON_MINUS_ALL_GLOBAL() printf(BUTTON_ALL,"false","-") -#else///ifndef SUBTRACK_CFG +#ifdef BUTTONS_BY_CSS +#define BUTTON_ALL "<span class='pmButton' onclick='matSubCBsCheck(%s)'>%c</span>" +#define BUTTON_PLUS_ALL_GLOBAL() printf(BUTTON_ALL,"true", '+') +#define BUTTON_MINUS_ALL_GLOBAL() printf(BUTTON_ALL,"false",'-') +#else///ifndef BUTTONS_BY_CSS #define PM_BUTTON_GLOBAL "<IMG height=18 width=18 onclick=\"matSubCBsCheck(%s);\" id='btn_%s' src='../images/%s'>" #define BUTTON_PLUS_ALL_GLOBAL() printf(PM_BUTTON_GLOBAL,"true", "plus_all", "add_sm.gif") #define BUTTON_MINUS_ALL_GLOBAL() printf(PM_BUTTON_GLOBAL,"false","minus_all","remove_sm.gif") -#endif///ndef SUBTRACK_CFG +#endif///ndef BUTTONS_BY_CSS BUTTON_PLUS_ALL_GLOBAL(); BUTTON_MINUS_ALL_GLOBAL(); puts(" <B>Select all subtracks</B><BR>"); return TRUE; } static boolean compositeUiNoMatrix(char *db, struct cart *cart, struct trackDb *parentTdb, char *primarySubtrack, char *formName) /* UI for composite tracks: subtrack selection. This is the default UI without matrix controls. */ { int i, j, k; char *words[SMALLBUF]; char option[SMALLBUF]; int wordCnt;