a7455028205c94b674aa9d495558b1bac2845fdf braney Fri Nov 18 13:36:45 2016 -0800 tagStorm file support for track hubs. NEEEDS DOC!!! diff --git src/hg/lib/hui.c src/hg/lib/hui.c index 7a06f4e..c4edbc4 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -34,31 +34,31 @@ #include "regexHelper.h" #include "snakeUi.h" #include "vcfUi.h" #include "vcf.h" #include "errCatch.h" #include "samAlignment.h" #include "makeItemsItem.h" #include "bedDetail.h" #include "pgSnp.h" #include "memgfx.h" #include "trackHub.h" #include "gtexUi.h" #include "genbank.h" #include "htmlPage.h" #include "longRange.h" -#include "tagStorm.h" +#include "tagRepo.h" #define SMALLBUF 256 #define MAX_SUBGROUP 9 #define ADD_BUTTON_LABEL "add" #define CLEAR_BUTTON_LABEL "clear" #define JBUFSIZE 2048 #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") @@ -173,51 +173,38 @@ { char *encFile = cgiEncode(file); dyLink = dyStringCreate(VOCAB_LINK_WITH_FILE,encFile,encTerm,encValue,title,label); freeMem(encFile); } else dyLink = dyStringCreate(VOCAB_LINK,encTerm,encValue,title,label); if (suffix != NULL) dyStringAppend(dyLink,suffix); // Don't encode since this may contain HTML freeMem(encTerm); freeMem(encValue); return dyStringCannibalize(&dyLink); } -// static global that maps tagStorm file names to hashes on the "track" value -static struct hash *tagStanzaHash; - char *tagStormAsHtmlTable(char *tagStormFile, struct trackDb *tdb,boolean showLongLabel,boolean showShortLabel) /* Return a string which is an HTML table of the tags for this track. */ { -if (tagStanzaHash == NULL) - tagStanzaHash = newHash(5); -struct hash *stanzaHash = hashFindVal(tagStanzaHash, tagStormFile); -if (stanzaHash == NULL) - { - struct tagStorm *tags = tagStormFromFile(tagStormFile); - stanzaHash = tagStormUniqueIndex(tags, "track"); - hashAdd(tagStanzaHash, tagStormFile, stanzaHash); - } +struct slPair *pairs = tagRepoPairs(tagStormFile, "track", trackHubSkipHubName(tdb->track)); -struct tagStanza *stanza = hashFindVal(stanzaHash, trackHubSkipHubName(tdb->track)); -if (stanza == NULL) +if (pairs == NULL) return ""; -struct slPair *pairs = tagListIncludingParents(stanza); struct dyString *dyTable = dyStringCreate("<table style='display:inline-table;'>"); if (showLongLabel) dyStringPrintf(dyTable,"<tr valign='bottom'><td colspan=2 nowrap>%s</td></tr>",tdb->longLabel); if (showShortLabel) dyStringPrintf(dyTable,"<tr valign='bottom'><td align='right' nowrap><i>shortLabel:</i></td>" "<td nowrap>%s</td></tr>",tdb->shortLabel); for(; pairs; pairs = pairs->next) { if (!isEmpty((char *)pairs->val)) dyStringPrintf(dyTable,"<tr valign='bottom'><td align='right' nowrap><i>%s:</i></td>" "<td nowrap>%s</td></tr>",pairs->name, (char *)pairs->val); } dyStringAppend(dyTable,"</table>");