4f1b44a9c8959ac7f1528f2d526623117d7ee6a9
max
Thu Aug 22 17:41:32 2013 -0700
small changes to limit text
diff --git src/hg/hgc/pubs.c src/hg/hgc/pubs.c
index d5abca1..02ef5b0 100644
--- src/hg/hgc/pubs.c
+++ src/hg/hgc/pubs.c
@@ -178,31 +178,35 @@
web2StartDivCI("section", id);
web2StartDivC("subheadingBar windowSize");
vprintf(format, args);
web2EndDiv("subheadingBar");
va_end(args);
}
static void web2EndSection()
/* end section */
{
web2EndDiv("section");
}
/* ------ */
-
+static void printDebug(char *text)
+{
+if (pubsDebug)
+ printf("%s
", text);
+}
static char *mangleUrl(char *url)
/* add publisher specific parameters to url and return new url*/
{
if (!stringIn("sciencedirect.com", url))
return url;
// cgi param to add the "UCSC matches" sciverse application to elsevier's sciencedirect
char *sdAddParam = "?svAppaddApp=298535";
char *longUrl = catTwoStrings(url, sdAddParam);
char *newUrl = replaceChars(longUrl, "article", "svapps");
return newUrl;
}
static void printPositionAndSize(int start, int end, bool showSize)
@@ -290,32 +294,31 @@
if (isNotEmpty(artExtIdFilter))
safef(artFilterSql, sizeof(artFilterSql), " AND extId='%s' ", artExtIdFilter);
// no need to check for illegal characters in sectionList
sqlSafef(query, sizeof(query), "SELECT distinct %s.articleId, url, title, authors, citation, year, "
"pmid FROM %s "
//"group_concat(snippet, concat(\" (section: \", section, \")\") SEPARATOR ' (...) ') FROM %s "
"JOIN %s USING (articleId) "
"WHERE markerId='%s' AND section in (%-s) "
"%-s"
//"GROUP by articleId "
"ORDER BY year DESC "
"LIMIT %d",
markerTable, markerTable, articleTable, item, sectionList, artFilterSql, itemLimit);
-if (pubsDebug)
- printf("%s", query);
+ printDebug(query);
struct sqlResult *sr = sqlGetResult(conn, query);
return sr;
}
static struct sqlResult *querySnippets(struct sqlConnection *conn, char *markerTable, \
char *articleId, char *markerId, char *sectionList)
/* query marker snippet rows from mysql for an article, markerId combination */
{
char query[4000];
sqlSafef(query, sizeof(query), "SELECT section, snippet FROM %s "
"WHERE articleId=%s AND markerId='%s' AND section in (%-s) ",
markerTable, articleId, markerId, sectionList);
struct sqlResult *sr = sqlGetResult(conn, query);
@@ -364,31 +367,31 @@
printf("
");
printf("\n");
printf("
\n");
}
static void printLimitWarning(struct sqlConnection *conn, char *markerTable,
char *item, int itemLimit, char *sectionList)
{
char query[4000];
// no need to check for illegal characters in sectionList
sqlSafef(query, sizeof(query), "SELECT COUNT(*) from %s WHERE markerId='%s' AND section in (%-s) ", markerTable, item, sectionList);
if (sqlNeedQuickNum(conn, query) > itemLimit)
{
printf("This marker is mentioned more than %d times
\n", itemLimit);
printf("The results would take too long to load in your browser and are "
- "therefore limited to %d articles.
\n", itemLimit); + "therefore limited to the %d most recent articles.
\n", itemLimit);
}
}
static void printAddWbr(char *text, int distance)
/* a crazy hack for firefox/mozilla that is unable to break long words in tables
* We need to add a
", url, title);
// cut author string at 40 chars, like scholar
printf("");
if (strlen(authors)>40)
{
authors[60] = 0;
@@ -450,31 +453,31 @@
char *journal = words[0];
printf("%s - %s ", year, journal);
if (!isEmpty(pmid) && strcmp(pmid, "0")!=0 )
printf(", PMID%s\n", pmid, pmid);
printf("\n");
printf("\n");
printf("
\n");
if (pubsDebug)
printf("articleId=%s", articleId);
return articleId;
}
-void printSnippets(struct sqlResult *srSnip)
+static void printSnippets(struct sqlResult *srSnip)
{
char **snipRow;
struct hash *doneSnips = newHash(0); // avoid printing a sentence twice
int snipCount = 0;
struct slPair *secSnips = NULL;
// add all pairs to the list, remove duplicated snippets (ignore all lowercase chars)
while ((snipRow = sqlNextRow(srSnip)) != NULL)
{
char *section = cloneString(snipRow[0]);
char *snippet = cloneString(snipRow[1]);
char *snipHash = cloneString(snippet);
eraseAllButUpper(snipHash);
if (hashLookup(doneSnips, snipHash)!=NULL)
{
@@ -546,30 +549,31 @@
// better readable if not across the whole screen
printf("
");
}
printf("
", query);
+ printDebug(query);
// split comma-sep list into parts
char *seqIdCoordString = sqlQuickString(conn, query);
char *seqIdCoords[1024];
if (isEmpty(seqIdCoordString))
return NULL;
int partCount = chopString(seqIdCoordString, ",", seqIdCoords, ArraySize(seqIdCoords));
int i;
struct hash *seqIdHash = NULL;
seqIdHash = newHash(0);
for (i=0; i