4272e1c7a2d10741a096eb7868c680bdb11e9895 braney Thu Mar 22 11:37:42 2018 -0700 changes in response to code review #21090 diff --git src/hg/hgCollection/hgCollection.c src/hg/hgCollection/hgCollection.c index d93be73..a58bfd7 100644 --- src/hg/hgCollection/hgCollection.c +++ src/hg/hgCollection/hgCollection.c @@ -9,33 +9,33 @@ #include "hubConnect.h" #include "hui.h" #include "grp.h" #include "cheapcgi.h" #include "jsHelper.h" #include "web.h" #include "knetUdc.h" #include "api.h" #include "genbank.h" #include "htmshell.h" #include "jsonParse.h" #include "customComposite.h" #include "stdlib.h" /* Tool tips */ -#define COLLECTIONTITLE "Double-click to edit name and color" -#define FOLDERTITLE "Click to open node" -#define TRACKTITLE "Press Green Plus to add track to collection" +#define COLLECTION_TITLE "Double-click to edit name and color" +#define FOLDER_TITLE "Click to open node" +#define TRACK_TITLE "Press Green Plus to add track to collection" /* Global Variables */ struct hash *oldVars = NULL; /* The cart before new cgi stuff added. */ // Null terminated list of CGI Variables we don't want to save permanently: char *excludeVars[] = {"Submit", "submit", "cmd", "track", "collection", "jsonp", NULL,}; struct track { struct track *next; struct track *trackList; struct trackDb *tdb; char *name; char *shortLabel; char *longLabel; unsigned long color; @@ -151,35 +151,35 @@ *eptr++ = *label; } *eptr = 0; return cloneString(buffer); } static void trackToClient(char *parent, struct trackDb *tdb, boolean user) // output list elements for a group { char *userString = ""; char *title; if (user) - title = COLLECTIONTITLE; + title = COLLECTION_TITLE; else if (tdb->subtracks) - title = FOLDERTITLE; + title = FOLDER_TITLE; else - title = TRACKTITLE; + title = TRACK_TITLE; if (tdb->subtracks) userString = "icon:'../images/folderC.png',children:true,"; else if (user) userString = "icon:'fa fa-minus-square',"; else userString = "icon:'fa fa-plus',"; #define IMAKECOLOR_32(r,g,b) ( ((unsigned int)b<<0) | ((unsigned int)g << 8) | ((unsigned int)r << 16)) jsInlineF("{%s id:'%s',li_attr:{title:'%s',shortlabel:'%s', longlabel:'%s',color:'#%06x',name:'%s'},text:'%s (%s)',parent:'%s'}",userString, trackHubSkipHubName(tdb->track),title, escapeLabel(tdb->shortLabel), escapeLabel(tdb->longLabel), IMAKECOLOR_32(tdb->colorR,tdb->colorG,tdb->colorB),trackHubSkipHubName(tdb->track),escapeLabel(tdb->shortLabel),escapeLabel(tdb->longLabel),parent); } static void outHubHeader(FILE *f, char *db) // output a track hub header @@ -342,31 +342,31 @@ { struct trackDb *tdb; struct trackDbRef *tdbRefList = NULL, *tdbRef; for(tdb = trackList; tdb; tdb = tdb->next) { struct grp *grp = hashMustFindVal(groupHash, tdb->grp); double priority = grp->priority + tdb->priority/100.0; checkForVisible(cart, grp, &tdbRefList, tdb, priority, 1.0/100.0); } slSort(&tdbRefList, tdbRefCompare); if (!isEmpty(rootChildren->string)) dyStringPrintf(rootChildren, ","); -dyStringPrintf(rootChildren, "{icon:'../images/folderC.png',id:'visible', text:'Visible Tracks', parent:'#', li_attr:{title:'%s'} ", FOLDERTITLE); +dyStringPrintf(rootChildren, "{icon:'../images/folderC.png',id:'visible', text:'Visible Tracks', parent:'#', li_attr:{title:'%s'} ", FOLDER_TITLE); if (tdbRefList != NULL) dyStringPrintf(rootChildren, ",children:true"); dyStringPrintf(rootChildren, "}"); jsInlineF("trackData['visible'] = ["); for(tdbRef = tdbRefList; tdbRef; tdbRef = tdbRef->next) { trackToClient("visible", tdbRef->tdb, FALSE); if (tdbRef->next != NULL) jsInlineF(","); } jsInlineF("];"); } void subTracksToClient(char *arrayName, struct trackDb *parentTdb, boolean user) @@ -458,55 +458,55 @@ else jsInlineF("collectionData['#'] = [];"); jsInlineF("%s", dyNames->string); jsInlineF("%s", dyLabels->string); jsInlineF("var trackData = []; "); struct dyString *rootChildren = newDyString(512); addVisibleTracks(groupHash, rootChildren, cart, trackList); for(curGroup = groupList; curGroup; curGroup = curGroup->next) { if ((hubName != NULL) && sameString(curGroup->name, hubName)) continue; if (!isEmpty(rootChildren->string)) dyStringPrintf(rootChildren, ","); - dyStringPrintf(rootChildren, "{icon:'../images/folderC.png',id:'%s', text:'%s', parent:'#', children:true,li_attr:{title:'%s'}}", curGroup->name, curGroup->label, FOLDERTITLE); + dyStringPrintf(rootChildren, "{icon:'../images/folderC.png',id:'%s', text:'%s', parent:'#', children:true,li_attr:{title:'%s'}}", curGroup->name, curGroup->label, FOLDER_TITLE); struct trackDb *tdb; jsInlineF("trackData['%s'] = [", curGroup->name); boolean first = TRUE; for(tdb = trackList; tdb; tdb = tdb->next) { if ( sameString(tdb->grp, curGroup->name)) { if (!first) jsInlineF(","); trackToClient(curGroup->name, tdb, FALSE); first = FALSE; } } jsInlineF("];"); for(tdb = trackList; tdb; tdb = tdb->next) { if ( sameString(tdb->grp, curGroup->name)) subTracksToClient("trackData", tdb, FALSE); } } jsInlineF("trackData['#'] = [%s];", rootChildren->string); -jsInlineF("var collectionTitle='%s';\n", COLLECTIONTITLE); -jsInlineF("var folderTitle='%s';\n", FOLDERTITLE); -jsInlineF("var trackTitle='%s';\n", TRACKTITLE); +jsInlineF("var collectionTitle='%s';\n", COLLECTION_TITLE); +jsInlineF("var folderTitle='%s';\n", FOLDER_TITLE); +jsInlineF("var trackTitle='%s';\n", TRACK_TITLE); jsInlineF("hgCollection.init();\n"); } static void printHelp() // print out the help page { puts( "<br><a name='INFO_SECTION'></a>\n" " <div class='row gbsPage'>\n" " <div ><h1>Track Collection Builder Help</h1></div>\n" " <div >\n" ); puts( " </div>\n" " </div>\n"