9a83298f18860ef6d05232bf7e10f2df3c1c2b1d
braney
Sat Aug 22 10:26:22 2026 -0700
hgc: route inline javascript through the standard helpers
Three places in hgc wrote script markup by hand instead of using the
helpers the rest of the tree uses.
printIframe now emits its script block the way hgIntegrator does. The
wiki track create-item form builds its function with jsInlineF, so the
function lands in the same block as the handler that calls it.
showSomePartialDnaAlignment sets the body frame's start position through
the frame URL, which is how the sibling index links already address that
frame, and matches showSomeAlignment just above it.
No change to what any of the three pages contain.
diff --git src/hg/hgc/wikiTrack.c src/hg/hgc/wikiTrack.c
index 5f2337581f5..c10adb8b746 100644
--- src/hg/hgc/wikiTrack.c
+++ src/hg/hgc/wikiTrack.c
@@ -1,588 +1,589 @@
/* Handle details pages for wiggle tracks. */
/* Copyright (C) 2013 The Regents of the University of California
* See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
#include "common.h"
#include "cart.h"
#include "hgc.h"
#include "hCommon.h"
#include "hgColors.h"
#include "hgConfig.h"
#include "obscure.h"
#include "binRange.h"
#include "web.h"
#include "net.h"
#include "grp.h"
#include "hui.h"
#include "htmlPage.h"
#include "wikiLink.h"
#include "wikiTrack.h"
#define ITEM_SCORE_DEFAULT "1000"
#define ADD_ITEM_COMMENT_DEFAULT "add comments"
static void colorMenuOutput()
/* the item color pull-down menu in the create item form */
{
hPrintf("\n");
hPrintf("\n");
}
static char *encodedHgcReturnUrl(int id, char *table)
/* Return a CGI-encoded hgc URL with hgsid and given id. Free when done. */
{
char retBuf[1024];
int o = cartUsualInt(cart, "o", winStart);
safef(retBuf, sizeof(retBuf), "http%s://%s/cgi-bin/hgc?%s&g=%s&c=%s&o=%d&l=%d&r=%d&db=%s&i=%d",
cgiAppendSForHttps(), cgiServerNamePort(), cartSidUrlString(cart), table, seqName,
o, winStart, winEnd, database, id);
return cgiEncode(retBuf);
}
static char *wikiTrackUserLoginUrl(int id, char *table)
/* Return the URL for the wiki user login page. */
{
char *retEnc = encodedHgcReturnUrl(id, table);
char buf[2048];
if (! wikiLinkEnabled())
errAbort("wikiLinkUserLoginUrl called when wiki is not enabled (specified "
"in hg.conf).");
safef(buf, sizeof(buf),
"%s/index.php?title=Special:UserloginUCSC&returnto=%s",
cfgOptionDefault(CFG_WIKI_URL, NULL), retEnc);
freez(&retEnc);
return(cloneString(buf));
}
void offerLogin(int id, char *loginType, char *table)
/* display login prompts to the wiki when user isn't already logged in */
{
char *wikiHost = wikiLinkHost();
char *loginUrl = wikiTrackUserLoginUrl(id, table);
printf("
Please login to %s the annotation track.
\n", loginType);
printf("
The login page is handled by our "
"wiki system:\n", cgiAppendSForHttps(), wikiHost);
printf("click here to login. \n", loginUrl);
printf("The wiki also serves as a forum for users "
"to share knowledge and ideas.\n
\n");
freeMem(loginUrl);
freeMem(wikiHost);
webIncludeHelpFile("wikiTrackAddCommentHelp", TRUE);
webIncludeHelpFile("wikiTrack", TRUE);
}
static void startForm(char *name, char *actionType)
{
hPrintf("\n");
}
hPrintf("View the wiki article "
"%s: to see "
"existing comments. \n",
url, item->descriptionKey, item->descriptionKey);
if (NULL != userName)
hPrintf("Mark this wiki article as "
"watched"
" to receive email notices of any comment additions. \n",
url, item->descriptionKey);
hPrintf("\n");
if (NULL == userName)
{
if (! wikiTrackReadOnly() ) /* read-only option 2012-06-25 */
offerLogin(item->id, "add comments to items on", WIKI_TRACK_TABLE);
}
else if (emailVerified(TRUE)) /* do print message when not verified */
{
startForm("addComments", G_ADD_WIKI_COMMENTS);
char idString[128];
safef(idString, ArraySize(idString), "%d", item->id);
cgiMakeHiddenVar("i", idString);
hPrintf("\n");
webPrintLinkTableStart();
/* first row is a title line */
char label[256];
safef(label, ArraySize(label),
"'%s' quick add comments to item '%s'\n", userName, item->name);
webPrintWideLabelCell(label, 2);
webPrintLinkTableNewRow();
/* second row is initial comment/description text entry */
webPrintWideCellStart(2, HG_COL_TABLE);
cgiMakeTextArea(NEW_ITEM_COMMENT, ADD_ITEM_COMMENT_DEFAULT, 3, 70);
webPrintLinkCellEnd();
webPrintLinkTableNewRow();
/*webPrintLinkCellStart(); more careful explicit alignment */
hPrintf("