void webIncludeFile(char *file) /* Include an HTML file in a CGI. * The file path may begin with hDocumentRoot(); if it doesn't, it is * assumed to be relative and hDocumentRoot() will be prepended. */ { char *str = hFileContentsOrWarning(file); puts(str); freeMem(str); }
static void getStaticHtml(struct cartJson *cj, struct hash *paramHash) /* Read HTML text from a relative path under browser.documentRoot and * write it as an encoded JSON string */ { char *tag = cartJsonOptionalParam(paramHash, "tag"); if (isEmpty(tag)) tag = "html"; char *file = cartJsonRequiredParam(paramHash, "file", cj->jw, "getStaticHtml"); char *html = hFileContentsOrWarning(file); //#*** TODO: move jsonStringEscape inside jsonWriteString char *encoded = jsonStringEscape(html); jsonWriteString(cj->jw, tag, encoded); }
void wikiTrackDb(struct trackDb **list) /* create a trackDb entry for the wiki track */ { struct trackDb *tdb; AllocVar(tdb); tdb->track = WIKI_TRACK_TABLE; tdb->table = WIKI_TRACK_TABLE; tdb->shortLabel = WIKI_TRACK_LABEL; tdb->longLabel = WIKI_TRACK_LONGLABEL; tdb->visibility = tvFull; tdb->priority = WIKI_TRACK_PRIORITY; tdb->html = hFileContentsOrWarning(hHelpFile(tdb->track)); tdb->type = "none"; tdb->grp = "map"; tdb->canPack = FALSE; tdb->settingsHash = newHash(5); slAddHead(list, tdb); slSort(list, trackDbCmp); }