70ef68d210fa4b76c16f7b8e8142a8180f75052a tdreszer Fri Jun 17 20:14:06 2011 -0700 Big checkin of jquery 1.5.1, jquery-ui 1.8 and ui-dropdownchecklist 1.3. Needs more testing and CSS work. DDCL is working on FF, Chrome and IE. Both Chrome and IE support required tiny changes to the DDCL wigit code. DDCL may still have problems with IE. Other jquery wigits have been tested at a cursory level and work fine. Ajax calls may need an extrat dataType: html param. Dialog (popup) needs CSS tuning. diff --git src/hg/hgGateway/hgGateway.c src/hg/hgGateway/hgGateway.c index ff7f8e9..e4563c7 100644 --- src/hg/hgGateway/hgGateway.c +++ src/hg/hgGateway/hgGateway.c @@ -1,316 +1,318 @@ /* hgGateway - Human Genome Browser Gateway. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "cheapcgi.h" #include "htmshell.h" #include "obscure.h" #include "web.h" #include "cart.h" #include "hdb.h" #include "dbDb.h" #include "hgFind.h" #include "hCommon.h" #include "hui.h" #include "customTrack.h" #include "hubConnect.h" #include "hgConfig.h" #include "jsHelper.h" #include "hPrint.h" #include "suggest.h" #include "search.h" static char const rcsid[] = "$Id: hgGateway.c,v 1.117 2010/04/29 02:54:35 larrym Exp $"; struct cart *cart = NULL; struct hash *oldVars = NULL; char *clade = NULL; char *organism = NULL; char *db = NULL; void hgGateway() /* hgGateway - Human Genome Browser Gateway. */ { char *defaultPosition = hDefaultPos(db); char *position = cloneString(cartUsualString(cart, "position", defaultPosition)); boolean gotClade = hGotClade(); char *survey = cfgOptionEnv("HGDB_SURVEY", "survey"); char *surveyLabel = cfgOptionEnv("HGDB_SURVEY_LABEL", "surveyLabel"); boolean supportsSuggest = assemblySupportsGeneSuggest(db); /* JavaScript to copy input data on the change genome button to a hidden form This was done in order to be able to flexibly arrange the UI HTML */ char *onChangeDB = "onchange=\"document.orgForm.db.value = document.mainForm.db.options[document.mainForm.db.selectedIndex].value; document.orgForm.submit();\""; char *onChangeOrg = "onchange=\"document.orgForm.org.value = document.mainForm.org.options[document.mainForm.org.selectedIndex].value; document.orgForm.db.value = 0; document.orgForm.submit();\""; char *onChangeClade = "onchange=\"document.orgForm.clade.value = document.mainForm.clade.options[document.mainForm.clade.selectedIndex].value; document.orgForm.org.value = 0; document.orgForm.db.value = 0; document.orgForm.submit();\""; /* If we are changing databases via explicit cgi request, then remove custom track data which will be irrelevant in this new database . If databases were changed then use the new default position too. */ if (sameString(position, "genome") || sameString(position, "hgBatch")) position = defaultPosition; webIncludeResourceFile("autocomplete.css"); jsIncludeFile("jquery.js", NULL); #ifdef NEW_JQUERY webIncludeResourceFile("jquery-ui.css"); jsIncludeFile("jquery-ui.js", NULL); -#else +printf("\n"); +#else///ifndef NEW_JQUERY jsIncludeFile("jquery.autocomplete.js", NULL); -#endif +printf("\n"); +#endif///ndef NEW_JQUERY jsIncludeFile("ajax.js", NULL); jsIncludeFile("autocomplete.js", NULL); jsIncludeFile("hgGateway.js", NULL); jsIncludeFile("utils.js", NULL); puts( "
" "The UCSC Genome Browser was created by the \n" "Genome Bioinformatics Group of UC Santa Cruz.\n" "
" "Software Copyright (c) The Regents of the University of California.\n" "All rights reserved.\n" "
\n" ); puts( "
\n" "
" "\n" "\n"); puts( "
\n"); puts(""); if (gotClade) puts(""); puts( "\n" "\n" "\n"); if(supportsSuggest) puts("\n"); puts( "\n" "\n" "\n" ); if (gotClade) { puts("\n"); } puts("\n"); puts("\n"); puts("\n"); if(supportsSuggest) { puts("\n"); } cartSetString(cart, "position", position); cartSetString(cart, "db", db); cartSetString(cart, "org", organism); if (gotClade) cartSetString(cart, "clade", clade); freez(&defaultPosition); position = NULL; puts("\n"); puts("\n" "
cladegenomeassemblyposition or search termgeneimage width  
\n"); printCladeListHtml(organism, onChangeClade); puts("\n"); if (gotClade) printGenomeListForCladeHtml(db, onChangeOrg); else printGenomeListHtml(db, onChangeOrg); puts("\n"); printAssemblyListHtml(db, onChangeDB); puts("\n"); cgiMakeTextVar("position", addCommasToPos(db, position), 30); printf("\n"); hPrintf("\n" "\n", assemblyGeneSuggestTrack(db) ); printf("\n"); cgiMakeIntVar("pix", cartUsualInt(cart, "pix", hgDefaultPixWidth), 4); puts(""); if(supportsSuggest) hButtonWithOnClick("Submit", "submit", NULL, "submitButtonOnClick()"); else cgiMakeButton("Submit", "submit"); /* This is a clear submit button that browsers will use by default when enter is pressed in position box. FIXME: This should be done with js onchange event! */ printf(""); cartSaveSession(cart); /* Put up hgsid= as hidden variable. */ puts( "
\n" "

\n" "Click here to reset the browser user interface settings to their defaults."); #define SURVEY 1 #ifdef SURVEY if (survey && differentWord(survey, "off")) printf("   %s", survey, surveyLabel ? surveyLabel : "Take survey"); #endif puts( "
\n" "
\n" "
\n" ); puts(""); puts(""); if(isSearchTracksSupported(db,cart)) { puts(""); } // custom track button. disable hgCustom button on GSID server, until // necessary additional work is authorized. puts(""); if (hubConnectTableExists()) { puts(""); } // configure button puts(""); // clear possition button puts(""); puts("
"); cgiMakeButtonWithMsg(TRACK_SEARCH, TRACK_SEARCH_BUTTON,TRACK_SEARCH_HINT); puts(""); /* disable CT for CGB servers for the time being */ if (!hIsGsidServer() && !hIsCgbServer()) { boolean hasCustomTracks = customTracksExist(cart, NULL); printf("\n", hgCustomName(),hasCustomTracks ? CT_MANAGE_BUTTON_LABEL:CT_ADD_BUTTON_LABEL, hasCustomTracks ? "Manage your custom tracks" : "Add your own custom tracks" ); } puts(""); printf("\n", "../cgi-bin/hgHubConnect", "import tracks", "Import tracks"); puts(""); cgiMakeButtonWithMsg("hgTracksConfigPage", "configure tracks and display","Configure track selections and browser display"); puts(""); if(supportsSuggest) cgiMakeOnClickButton("document.mainForm.position.value=''; document.getElementById('suggest').value='';", "clear position"); else cgiMakeOnClickButton("document.mainForm.position.value=''", "clear position"); puts("
"); puts("
\n" "
\n" ); puts("
"); #ifdef NEW_JQUERY hPrintf("\n"); #endif puts("
"); if (hIsPreviewHost()) { puts("

" "WARNING: This is our preview site. It is a weekly mirror of our internal development server for public access. " "Data and tools here are under construction, have not been quality reviewed, and are subject to change " "at any time. We provide this site for early access, with the warning that it is less available " "and stable than our public site. For high-quality reviewed annotations on our production server, visit " " http://genome.ucsc.edu." "


"); } else if (hIsPrivateHost()) { puts("

WARNING: This is our development and test site. It usually works, but it is filled with tracks in various " "stages of construction, and others of little interest to people outside of our local group. " "It is usually slow because we are building databases on it. The documentation is poor. " "More data than usual is flat out wrong. Maybe you want to go to " "genome.ucsc.edu instead."); } if (hIsGsidServer()) { webNewSection("%s", "Sequence View\n"); printf("%s", "Sequence View is a customized version of the UCSC Genome Browser, which is specifically tailored to provide functions needed for the GSID HIV Data Browser.\n"); } hgPositionsHelpHtml(organism, db); puts("

"); cartSaveSession(cart); /* Put up hgsid= as hidden variable. */ if (gotClade) printf("\n", clade); else printf("\n", "mammal"); printf("\n", organism); printf("\n", db); puts("

"); } void doMiddle(struct cart *theCart) /* Set up pretty web display and save cart in global. */ { char *scientificName = NULL; cart = theCart; getDbGenomeClade(cart, &db, &organism, &clade, oldVars); if (! hDbIsActive(db)) { db = hDefaultDb(); organism = hGenome(db); clade = hClade(organism); } scientificName = hScientificName(db); if (hIsGsidServer()) cartWebStart(theCart, db, "GSID %s Sequence View (UCSC Genome Browser) Gateway \n", organism); else { char buffer[128]; /* tell html routines *not* to escape htmlOut strings*/ htmlNoEscape(); buffer[0] = 0; if (*scientificName != 0) { if (sameString(clade,"ancestor")) safef(buffer, sizeof(buffer), "(%s Ancestor) ", scientificName); else safef(buffer, sizeof(buffer), "(%s) ", scientificName); } cartWebStart(theCart, db, "%s %s%s Gateway\n", organism, buffer, hBrowserName()); htmlDoEscape(); } hgGateway(); cartWebEnd(); } char *excludeVars[] = {NULL}; int main(int argc, char *argv[]) /* Process command line. */ { oldVars = hashNew(10); cgiSpoof(&argc, argv); cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars); return 0; }