count: %d |
Note: the session has at least one active custom " "track (in database "); for (sln = liveDbList; sln != NULL; sln = sln->next) dyStringPrintf(dyMessage, "%s%s", cartSidUrlString(cart), sln->name, sln->name, (sln->next ? sln->next->next ? ", " : " and " : "")); dyStringAppend(dyMessage, "; click on the database link " "to manage custom tracks). "); } if (gotExpiredCT) { slSort(&expiredDbList, slNameCmp); dyStringPrintf(dyMessage, "
Note: the session has at least one expired custom " "track (in database "); for (sln = expiredDbList; sln != NULL; sln = sln->next) dyStringPrintf(dyMessage, "%s%s", sln->name, (sln->next ? sln->next->next ? ", " : " and " : "")); dyStringPrintf(dyMessage, "), so it may not appear as originally intended. "); } if (gotErrorCT) { slSort(&errorDbList, slNameCmp); dyStringPrintf(dyMessage, "
Note: the session has at least one custom " "track with errors (in database "); for (sln = errorDbList; sln != NULL; sln = sln->next) dyStringPrintf(dyMessage, "%s%s", sln->name, (sln->next ? sln->next->next ? ", " : " and " : "")); dyStringPrintf(dyMessage, "), so it may not appear as originally intended. "); } dyStringPrintf(dyMessage, "These custom tracks should not expire, however, " "the UCSC Genome Browser is not a data storage service; " "please keep a local backup of your sessions contents " "and custom track data.
"); slNameFreeList(&liveDbList); slNameFreeList(&expiredDbList); } /* Check for saved blat results (quasi custom track). */ char *ss = cartOptionalString(cart, "ss"); if (isNotEmpty(ss)) { char buf[1024]; char *words[2]; int wordCount; boolean exists = FALSE; safecpy(buf, sizeof(buf), ss); wordCount = chopLine(buf, words); if (wordCount < 2) exists = FALSE; else exists = fileExists(words[0]) && fileExists(words[1]); if (exists) dyStringPrintf(dyMessage, "Note: the session contains BLAT results. "); else dyStringPrintf(dyMessage, "
Note: the session contains an expired reference to " "previously saved BLAT results, so it may not appear as " "originally intended. "); dyStringPrintf(dyMessage, "BLAT results are subject to an " "" "expiration policy."); } } char *cartGetPosition(struct cart *cart, char *database, struct cart **pLastDbPosCart) /* get the current position in cart as a string chr:start-end. * This can handle the special CGI params 'default' and 'lastDbPos' * Returned value has to be freed. Returns * default position of assembly is no position set in cart nor as CGI var. * Returns NULL if no position set anywhere and no default position. * For virtual modes, returns the type and extraState. */ { // position=lastDbPos in URL? -> go back to the last browsed position for this db char *position = NULL; char *defaultPosition = hDefaultPos(database); struct cart *lastDbPosCart = cartOfNothing(); boolean gotCart = FALSE; char dbPosKey[256]; safef(dbPosKey, sizeof(dbPosKey), "position.%s", database); if (sameOk(cgiOptionalString("position"), "lastDbPos")) { char *dbLocalPosContent = cartUsualString(cart, dbPosKey, NULL); if (dbLocalPosContent) { if (strchr(dbLocalPosContent, '=')) { gotCart = TRUE; cartParseOverHash(lastDbPosCart, cloneString(dbLocalPosContent)); // this function chews up input position = cloneString(cartUsualString(lastDbPosCart, "position", NULL)); } else { position = dbLocalPosContent; // old style value } } else { position = defaultPosition; // no value was set } } if (position == NULL) { position = windowsToAscii(cloneString(cartUsualString(cart, "position", NULL))); } /* default if not set at all, as would happen if it came from a URL with no * position. Otherwise tell them to go back to the gateway. Also recognize * "default" as specifying the default position. */ if (((position == NULL) || sameString(position, "default")) && (defaultPosition != NULL)) position = cloneString(defaultPosition); if (!gotCart) { cartSetBoolean(lastDbPosCart, "virtMode", FALSE); cartSetString(lastDbPosCart, "virtModeType", "default"); cartSetString(lastDbPosCart, "lastVirtModeType", "default"); cartSetString(lastDbPosCart, "position", position); cartSetString(lastDbPosCart, "nonVirtPosition", position); cartSetString(lastDbPosCart, "lastVirtModeExtra", ""); } if (pLastDbPosCart) *pLastDbPosCart = lastDbPosCart; return position; } void cartSetDbPosition(struct cart *cart, char *database, struct cart *lastDbPosCart) /* Set the 'position.db' variable in the cart.*/ { char dbPosKey[256]; safef(dbPosKey, sizeof dbPosKey, "position.%s", database); struct dyString *dbPosValue = newDyString(4096); cartEncodeState(lastDbPosCart, dbPosValue); cartSetString(cart, dbPosKey, dbPosValue->string); } void cartTdbFetchMinMaxPixels(struct cart *theCart, struct trackDb *tdb, int defaultMin, int defaultMax, int defaultVal, int *retMin, int *retMax, int *retDefault, int *retCurrent) /* Configure maximum track height for variable height tracks (e.g. wiggle, barchart) * Initial height and limits may be defined in trackDb with the maxHeightPixels string, * Or user requested limits are defined in the cart. */ { boolean parentLevel = isNameAtParentLevel(tdb, tdb->track); char *heightPer = NULL; /* string from cart */ int minHeightPixels = defaultMin; int maxHeightPixels = defaultMax; int defaultHeightPixels = defaultVal; int defaultHeight; /* truncated by limits */ char defaultDefault[16]; safef(defaultDefault, sizeof defaultDefault, "%d", defaultVal); char *tdbDefault = cloneString( trackDbSettingClosestToHomeOrDefault(tdb, MAXHEIGHTPIXELS, defaultDefault)); if (sameWord(defaultDefault, tdbDefault)) { struct hashEl *hel; /* no maxHeightPixels from trackDb, maybe it is in tdb->settings * (custom tracks keep settings here) */ if ((tdb->settings != (char *)NULL) && (tdb->settingsHash != (struct hash *)NULL)) { if ((hel = hashLookup(tdb->settingsHash, MAXHEIGHTPIXELS)) != NULL) { freeMem(tdbDefault); tdbDefault = cloneString((char *)hel->val); } } } /* the maxHeightPixels string can be one, two, or three words * separated by : * All three would be: max:default:min * When only two: max:default * When only one: max * (this works too: min:default:max) * Where min is minimum allowed, default is initial default setting * and max is the maximum allowed * If it isn't available, these three have already been set * in their declarations above */ if (differentWord(defaultDefault, tdbDefault)) { char *words[3]; char *sep = ":"; int wordCount; wordCount=chopString(tdbDefault,sep,words,ArraySize(words)); switch (wordCount) { case 3: minHeightPixels = atoi(words[2]); defaultHeightPixels = atoi(words[1]); maxHeightPixels = atoi(words[0]); // flip max and min if min>max if (maxHeightPixels < minHeightPixels) { int pixels; pixels = maxHeightPixels; maxHeightPixels = minHeightPixels; minHeightPixels = pixels; } if (defaultHeightPixels > maxHeightPixels) defaultHeightPixels = maxHeightPixels; if (minHeightPixels > defaultHeightPixels) minHeightPixels = defaultHeightPixels; break; case 2: defaultHeightPixels = atoi(words[1]); maxHeightPixels = atoi(words[0]); if (defaultHeightPixels > maxHeightPixels) defaultHeightPixels = maxHeightPixels; if (minHeightPixels > defaultHeightPixels) minHeightPixels = defaultHeightPixels; break; case 1: maxHeightPixels = atoi(words[0]); defaultHeightPixels = maxHeightPixels; if (minHeightPixels > defaultHeightPixels) minHeightPixels = defaultHeightPixels; break; default: break; } } heightPer = cartOptionalStringClosestToHome(theCart, tdb, parentLevel, HEIGHTPER); /* Clip the cart value to range [minHeightPixels:maxHeightPixels] */ if (heightPer) defaultHeight = min( maxHeightPixels, atoi(heightPer)); else defaultHeight = defaultHeightPixels; defaultHeight = max(minHeightPixels, defaultHeight); *retMin = minHeightPixels; *retMax = maxHeightPixels; *retDefault = defaultHeightPixels; *retCurrent = defaultHeight; freeMem(tdbDefault); }