ae3969602106c0229160648f6ff6c87c3ad0de2d
giardine
Tue Dec 7 14:13:12 2010 -0800
Addition of wiki track and supporting tracks for microattribution reviews (part of the variome project)
diff --git src/hg/lib/wikiTrack.c src/hg/lib/wikiTrack.c
index 408c079..c726288 100644
--- src/hg/lib/wikiTrack.c
+++ src/hg/lib/wikiTrack.c
@@ -729,31 +729,31 @@
/* fetch the edit page to get the wpEditToken, and current contents */
safef(wikiPageUrl, sizeof(wikiPageUrl), "%s/index.php/%s?action=edit",
cfgOptionDefault(CFG_WIKI_URL, NULL), descriptionKey);
char *fullText = htmlSlurpWithCookies(wikiPageUrl,cookie);
struct htmlPage *page = htmlPageParseOk(wikiPageUrl, fullText);
/* fullText pointer is placed in page->fullText */
/* the submit on the edit is going to need these cookies */
page->cookies = cookie;
return (page);
}
void prefixComments(struct wikiTrack *item, char *comments, char *userName,
char *seqName, int winStart, int winEnd, char *database,
- char *extraHeader, char *extraTag)
+ char *extraHeader, char *extraTag, char *category)
/* add comments at the beginning of an existing wiki item */
{
/* do nothing if given nothing */
if (NULL == comments)
return;
struct dyString *content = newDyString(1024);
struct htmlPage *page = fetchEditPage(item->descriptionKey);
/* create a stripped down edit form, we don't want all the variables */
struct htmlForm *strippedEditForm;
AllocVar(strippedEditForm);
struct htmlForm *currentEditForm = htmlFormGet(page,"editform");
@@ -798,38 +798,38 @@
userSignature = cloneString("~~~~");
else
{
struct dyString *tt = newDyString(1024);
dyStringPrintf(tt, "[[User:%s|%s]] ", item->owner, item->owner);
dyStringPrintf(tt, "%s", item->creationDate);
userSignature = dyStringCannibalize(&tt);
recreateHeader = TRUE;
}
snprintf(position, 128, "%s:%d-%d", seqName, winStart+1, winEnd);
newPos = addCommasToPos(database, position);
if (extraHeader)
{
dyStringPrintf(content, "%s\n%s\n",
- NEW_ITEM_CATEGORY, extraHeader);
+ category, extraHeader);
}
else
{
dyStringPrintf(content, "%s\n"
"[http://%s/cgi-bin/hgTracks?db=%s&wikiTrack=pack&position=%s:%d-%d %s %s]"
" '%s' ",
- NEW_ITEM_CATEGORY,
+ category,
cfgOptionDefault(CFG_WIKI_BROWSER, DEFAULT_BROWSER), database,
seqName, winStart+1, winEnd, database, newPos, item->name);
}
dyStringPrintf(content, "''created: %s''", userSignature);
if (extraTag)
dyStringPrintf(content, " '''%s'''", extraTag);
}
/* append previous content, if any */
if (wpTextbox1->curVal && (strlen(wpTextbox1->curVal) > 2))
{
char *rawText = fetchWikiRawText(item->descriptionKey);
dyStringPrintf(content, "\n\n%s", rawText);
}
else
@@ -864,31 +864,31 @@
char *fixedString = replaceChars(newUrl, "&", "&");
currentEditForm->action = cloneString(fixedString);
strippedEditForm->action = cloneString(fixedString);
struct htmlPage *editPage = htmlPageFromForm(page,strippedEditForm,"submit", "Submit");
freeMem(fixedString);
if (NULL == editPage)
errAbort("prefixComments: the edit is failing ?");
freeDyString(&content);
} /* void prefixComments() */
void addDescription(struct wikiTrack *item, char *userName,
char *seqName, int winStart, int winEnd, struct cart *cart,
- char *database, char *extraHeader, char *extraTag)
+ char *database, char *extraHeader, char *extraTag, char *category)
/* add description to the end of an existing wiki item */
{
char *newComments = cartNonemptyString(cart, NEW_ITEM_COMMENT);
struct dyString *content = newDyString(1024);
/* was nothing changed in the add comments entry box ? */
if (sameWord(ADD_ITEM_COMMENT_DEFAULT,newComments))
return;
struct htmlPage *page = fetchEditPage(item->descriptionKey);
/* create a stripped down edit form, we don't want all the variables */
struct htmlForm *strippedEditForm;
AllocVar(strippedEditForm);
@@ -935,38 +935,38 @@
if (sameWord(userName, item->owner))
userSignature = cloneString("~~~~");
else
{
struct dyString *tt = newDyString(1024);
dyStringPrintf(tt, "[[User:%s|%s]] ", item->owner, item->owner);
dyStringPrintf(tt, "%s", item->creationDate);
userSignature = dyStringCannibalize(&tt);
recreateHeader = TRUE;
}
snprintf(position, 128, "%s:%d-%d", seqName, winStart+1, winEnd);
newPos = addCommasToPos(database, position);
if (extraHeader)
{
dyStringPrintf(content, "%s\n%s\n",
- NEW_ITEM_CATEGORY, extraHeader);
+ category, extraHeader);
}
else
{
dyStringPrintf(content, "%s\n"
"[http://%s/cgi-bin/hgTracks?db=%s&wikiTrack=pack&position=%s:%d-%d %s %s]"
" '%s' ",
- NEW_ITEM_CATEGORY,
+ category,
cfgOptionDefault(CFG_WIKI_BROWSER, DEFAULT_BROWSER), database,
seqName, winStart+1, winEnd, database, newPos, item->name);
}
dyStringPrintf(content, "''created: %s''", userSignature);
if (extraTag)
dyStringPrintf(content, " '''%s'''", extraTag);
dyStringPrintf(content, "\n\n");
if (recreateHeader)
{
dyStringPrintf(content, "''comments added: ~~~~''");
if (extraTag)
dyStringPrintf(content, " '''%s'''\n\n", extraTag);
else
dyStringPrintf(content, "\n\n");
}