234612182d96bc41b47dc39cf4b550fdad58fb84
kent
Tue Mar 3 12:28:27 2015 -0800
Adding 'shortVal' parameter to webTableOutputWrapperType. This is so can use the full value for constructing urls and the like, but display the short value in the table so as to keep it from getting too wide.
diff --git src/hg/lib/tablesTables.c src/hg/lib/tablesTables.c
index 7b1a444..f31b929 100644
--- src/hg/lib/tablesTables.c
+++ src/hg/lib/tablesTables.c
@@ -122,51 +122,52 @@
static void showTableDataRows(struct fieldedTable *table, int pageSize, int maxLenField,
struct hash *tagOutputWrappers, void *wrapperContext)
/* Render data rows into HTML */
{
int count = 0;
struct fieldedRow *row;
for (row = table->rowList; row != NULL; row = row->next)
{
if (++count > pageSize)
break;
printf("
\n");
int fieldIx = 0;
for (fieldIx=0; fieldIxfieldCount; ++fieldIx)
{
char shortVal[maxLenField+1];
- char *val = emptyForNull(row->row[fieldIx]);
+ char *longVal = emptyForNull(row->row[fieldIx]);
+ char *val = longVal;
int valLen = strlen(val);
if (maxLenField > 0 && maxLenField < valLen)
{
if (valLen > maxLenField)
{
memcpy(shortVal, val, maxLenField-3);
shortVal[maxLenField-3] = 0;
strcat(shortVal, "...");
val = shortVal;
}
}
webPrintLinkCellStart();
boolean printed = FALSE;
if (tagOutputWrappers != NULL && !isEmpty(val))
{
char *field = table->fields[fieldIx];
webTableOutputWrapperType *printer = hashFindVal(tagOutputWrappers, field);
if (printer != NULL)
{
- printer(table, row, field, val, wrapperContext);
+ printer(table, row, field, longVal, val, wrapperContext);
printed = TRUE;
}
}
if (!printed)
printf("%s", val);
webPrintLinkCellEnd();
}
printf("
\n");
}
}
static void showTablePaging(struct fieldedTable *table, struct cart *cart, char *varPrefix,
struct fieldedTableSegment *largerContext, int pageSize)
/* If larger context exists and is bigger than current display, then draw paging controls. */