489bd982dd3eeb7eba197733e3c9b43abe8d90dd max Mon May 6 14:18:27 2013 -0700 fixed publisher filter and publisher logo bugs diff --git src/hg/hgTracks/pubsTracks.c src/hg/hgTracks/pubsTracks.c index 708d0e9..2341c5d 100644 --- src/hg/hgTracks/pubsTracks.c +++ src/hg/hgTracks/pubsTracks.c @@ -1,26 +1,26 @@ /* pubsTracks - code for the publications tracks */ #include "common.h" #include "hgTracks.h" #include "hgFind.h" #include "bedCart.h" // we distinguish between four levels of impact factors <1, <3, <10 and >10 static struct rgbColor impact1Color = {80, 80, 80}; static struct rgbColor impact2Color = {0, 80, 255}; static struct rgbColor impact3Color = {0, 100, 0}; -static struct rgbColor impact4Color = {255, 0, 0}; +static struct rgbColor impact4Color = {255, 255, 0}; static char* pubsArticleTable(struct track *tg) /* return the name of the pubs articleTable, either * the value from the trackDb statement 'articleTable' * or the default value: Article */ { char *articleTable = trackDbSettingClosestToHome(tg->tdb, "pubsArticleTable"); if (isEmpty(articleTable)) { char buf[256]; safef(buf, sizeof(buf), "%sArticle", tg->track); articleTable = cloneString(buf); } return articleTable; } @@ -238,35 +238,37 @@ va_end(args); } static void pubsLoadKeywordYearItems(struct track *tg) /* load items that fulfill keyword and year filter */ { pubsParseClassColors(); struct sqlConnection *conn = hAllocConn(database); char *keywords = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsFilterKeywords"); char *yearFilter = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsFilterYear"); char *publFilter = cartOptionalStringClosestToHome(cart, tg->tdb, FALSE, "pubsFilterPublisher"); char *articleTable = pubsArticleTable(tg); if(yearFilter == NULL || sameWord(yearFilter, "anytime")) yearFilter = NULL; +if(sameWord(publFilter, "all")) + publFilter = NULL; if(isNotEmpty(keywords)) keywords = makeMysqlMatchStr(sqlEscapeString(keywords)); -if(isEmpty(yearFilter) && isEmpty(keywords)) +if(isEmpty(yearFilter) && isEmpty(keywords) && isEmpty(publFilter)) { loadGappedBed(tg); } else { char* oldLabel = tg->longLabel; tg->longLabel = catTwoStrings(oldLabel, " (filter activated)"); freeMem(oldLabel); char yearWhere[256], keywordsWhere[1024], prefix[256]; char **row; struct linkedFeatures *lfList = NULL; struct trackDb *tdb = tg->tdb; int scoreMin = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMin", "0")); int scoreMax = atoi(trackDbSettingClosestToHomeOrDefault(tdb, "scoreMax", "1000")); @@ -278,30 +280,31 @@ // new table schema: filter fields are on main bed table { if (isNotEmpty(keywords)) dyStringPrintf(extraDy, "name IN (SELECT articleId FROM %s WHERE " "MATCH (citation, title, authors, abstract) AGAINST ('%s' IN BOOLEAN MODE))", articleTable, keywords); if (isNotEmpty(yearFilter)) dyStringPrintfWithSep(extraDy, " AND ", " year >= '%s'", sqlEscapeString(yearFilter)); if (isNotEmpty(publFilter)) dyStringPrintfWithSep(extraDy, " AND ", " publisher = '%s'", sqlEscapeString(publFilter)); extra = extraDy->string; } else // old table schema, filter by doing a join on article table { + printf("extra %s", extra); char extraTmp[4096]; safef(prefix, sizeof(prefix), "name IN (SELECT articleId FROM %s WHERE", articleTable); if(isNotEmpty(keywords)) safef(keywordsWhere, sizeof(keywordsWhere), \ "MATCH (citation, title, authors, abstract) AGAINST ('%s' IN BOOLEAN MODE)", keywords); if(isNotEmpty(yearFilter)) safef(yearWhere, sizeof(yearWhere), "year >= '%s'", sqlEscapeString(yearFilter)); if(isEmpty(keywords)) safef(extraTmp, sizeof(extraTmp), "%s %s)", prefix, yearWhere); else if(isEmpty(yearFilter)) safef(extraTmp, sizeof(extraTmp), "%s %s)", prefix, keywordsWhere); else safef(extraTmp, sizeof(extraTmp), "%s %s AND %s)", prefix, yearWhere, keywordsWhere); extra = extraTmp;