588a728e03f054a0c0908c8ea08f2be4c494282b
galt
  Fri Mar 11 00:31:57 2011 -0800
added new dropdown column "importance" with values from Redmine issue, as requested by Ann
diff --git src/hg/qaPushQ/qaPushQ.c src/hg/qaPushQ/qaPushQ.c
index fd6b770..9839733 100644
--- src/hg/qaPushQ/qaPushQ.c
+++ src/hg/qaPushQ/qaPushQ.c
@@ -56,39 +56,39 @@
 #define MAXBLOBSHOW 128
 
 
 #define TITLE "Push Queue v"CGI_VERSION
 
 time_t curtime;
 struct tm *loctime;
 
 struct utsname utsName;
 
 struct users myUser;
 
 char *showColumns = NULL;
 
 char *defaultColumns =
-    "pqid,qid,priority,qadate,track,dbs,tbls,cgis,files,currLoc,makeDocYN,onlineHelp,ndxYN,stat,sponsor,reviewer,extSource,notes";
+    "pqid,qid,priority,importance,qadate,track,dbs,tbls,cgis,files,currLoc,makeDocYN,onlineHelp,ndxYN,stat,sponsor,reviewer,extSource,notes";
 
 char *newRandState = NULL;    
 char *oldRandState = NULL;    
     
 /*
 "qid,pqid,priority,rank,qadate,newYN,track,dbs,tbls,cgis,files,sizeMB,currLoc,"
 "makeDocYN,onlineHelp,ndxYN,joinerYN,stat,sponsor,reviewer,extSource,openIssues,notes,"
-pushState,initdate,bounces,lockUser,lockDateTime,releaseLog,featureBits,releaseLogUrl";
+pushState,initdate,bounces,lockUser,lockDateTime,releaseLog,featureBits,releaseLogUrl,importance";
 */
 
 /* structural improvements suggested by MarkD:
 
 static struct {
 enum colEnum col;
 char *name;
 char *hdr;
 } colTbl [] = {
 {e_qid, "qid"},
 {0,      NULL},
 }
 
 ArraySize(colTbl)
 
@@ -117,31 +117,32 @@
  "joinerYN"  ,
  "stat"      ,
  "featureBits",
  "sponsor"   ,
  "reviewer"  ,
  "extSource" ,
  "openIssues",
  "notes"     ,
  "pushState" ,
  "initdate"  ,  
  "lastdate"  ,  
  "bounces"   , 
  "lockUser"  , 
  "lockDateTime",
  "releaseLog", 
- "releaseLogUrl"
+ "releaseLogUrl",
+ "importance"
 };
 
 
 enum colEnum {
 e_qid       ,
 e_pqid      ,
 e_priority  ,
 e_rank      ,
 e_qadate    ,
 e_newYN     ,
 e_track     ,
 e_dbs       ,
 e_tbls      ,
 e_cgis      ,
 e_files     ,
@@ -154,30 +155,31 @@
 e_stat      ,
 e_featureBits,
 e_sponsor   ,
 e_reviewer  ,
 e_extSource ,
 e_openIssues,
 e_notes     ,
 e_pushState ,
 e_initdate  ,
 e_lastdate  ,
 e_bounces   ,
 e_lockUser  ,
 e_lockDateTime,
 e_releaseLog,
 e_releaseLogUrl,
+e_importance,
 e_NUMCOLS
 };
 
 
 
 char *colHdr[] = {
 "Queue ID",
 "Parent Queue ID",
 "Priority",
 "Rank",
 "    Date    ",
 "New?",
 "Track",
 "Databases",
 "Tables",
@@ -191,31 +193,32 @@
 "All. Joiner",
 "          Status          ",
 "Feature Bits",
 "Sponsor (local)",
 "Reviewer",
 "External Source or Collaborator",
 "Open Issues",
 "              Notes              ",
 "PushState",
 "Initial   Submission   Date",
 "Last   QA   Date",
 "Bounce Count",
 "Lock User",
 "Lock Date Time",
 "Release Log",
-"Release Log Url"
+"Release Log Url",
+"Importance"
 };
 
 char *numberToMonth[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
 
 char pushQtbl[256] = "pushQ";   /* default */
 
 char month[256] = "";  
 
 enum colEnum colOrder[e_NUMCOLS];
 int numColumns = 0;
 
 int randInt(int N)
 /* generate random number from 0 to N-1 */
 {
 return (int) N * (rand() / (RAND_MAX + 1.0));
@@ -561,30 +564,31 @@
 replaceSelectOptions("currLoc"  , "hgwdev,hgwbeta" , ki->currLoc   );
 replaceSelectOptions("makeDocYN", "Y,N,X"          , ki->makeDocYN );
 replaceInStr(html, sizeof(html) , "<!onlineHelp>"  , ki->onlineHelp); 
 replaceSelectOptions("ndxYN"    , "Y,N,X"          , ki->ndxYN     );
 replaceSelectOptions("joinerYN" , "Y,N,X"          , ki->joinerYN  );
 replaceInStr(html, sizeof(html) , "<!stat>"        , ki->stat      ); 
 replaceInStr(html, sizeof(html) , "<!featureBits>" , ki->featureBits); 
 replaceInStr(html, sizeof(html) , "<!sponsor>"     , ki->sponsor   ); 
 replaceInStr(html, sizeof(html) , "<!reviewer>"    , ki->reviewer  ); 
 replaceInStr(html, sizeof(html) , "<!extSource>"   , ki->extSource ); 
 replaceInStr(html, sizeof(html) , "<!openIssues>"  , ki->openIssues); 
 replaceInStr(html, sizeof(html) , "<!notes>"       , ki->notes     );
 replaceInStr(html, sizeof(html) , "<!initdate>"    , ki->initdate  ); 
 replaceInStr(html, sizeof(html) , "<!releaseLog>"  , ki->releaseLog); 
 replaceInStr(html, sizeof(html) , "<!releaseLogUrl>", ki->releaseLogUrl); 
+replaceSelectOptions("importance", " ,B,L,M,H,U"   , ki->importance  );
 
 replaceInStr(html, sizeof(html) , "<!cb>"          , newRandState  ); 
 
 if (isNew)
     {
     replaceInStr(html, sizeof(html), "<!DISABLED>", ""); 
     replaceInStr(html, sizeof(html), "<!READONLY>", ""); 
     replaceInStr(html, sizeof(html), "<!submitbutton>", "<input TYPE=SUBMIT NAME=\"submit\" VALUE=\"Submit\" >&nbsp;&nbsp;"); 
     replaceInStr(html, sizeof(html), "<!delbutton>", ""); 
     replaceInStr(html, sizeof(html), "<!pushbutton>", ""); 
     replaceInStr(html, sizeof(html), "<!clonebutton>", ""); 
     replaceInStr(html, sizeof(html), "<!bouncebutton>", ""); 
     replaceInStr(html, sizeof(html), "<!lockbutton>", ""); 
     replaceInStr(html, sizeof(html), "<!refreshlink>", ""); 
     replaceInStr(html, sizeof(html), "<!transferbutton>", ""); 
@@ -725,30 +729,31 @@
 if (sameString(myUser.role,"qa"))
     {
     safef(q.reviewer, sizeof(q.reviewer), "%s", qaUser);   /* if role is qa, default reviewer to this user */
     }
 if (sameString(myUser.role,"dev"))
     {
     safef(q.sponsor , sizeof(q.sponsor) , "%s", qaUser);   /* if role is dev, default sponsor to current user */
     }
 safef(q.extSource , sizeof(q.extSource) , "%s", "" );
 q.openIssues   = "";
 q.notes   = "";
 strftime (q.initdate, sizeof(q.initdate), "%Y-%m-%d", loctime); /* automatically use today date */
 safef(q.lastdate, sizeof(q.lastdate), "%s", "" );
 q.releaseLog = "";
 q.releaseLogUrl = "";
+safef(q.importance, sizeof(q.importance), "%s", " ");  /* default importance */
 
 if (sameString(myUser.role,"dev"))
     {
     safef(msg, sizeof(msg), "%s", 
 	"Developer: Please leave priority and date alone. "
 	"Do specify if the track is new. Enter the shortLabel for the track name. "
 	"Be sure to fill out the database, tables,  and external files, if any. "
 	"If relevant cgis have changed since last branch, please list them. "
 	"Enter collaborator if applicable. "
 	"Leave the other fields for QA. You may leave a note for QA staff in the notes field. "
 	"Thanks very much!"
 	);
     }
 
 replacePushQFields(&q, TRUE);  /* new rec = true */
@@ -766,31 +771,31 @@
 s[l-1]='.';
 s[l-2]='.';
 s[l-3]='.';
 s[l-4]=' ';
 }
 
 char *fixLineBreaks(char *s)
 /* insert <br> before \n to have an effect inside html */
 {
 return replaceChars(s,"\n","<br>\n");
 }
 
 
 void drawDisplayLine(enum colEnum col, struct pushQ *ki)
 {
-
+char *temp = NULL;
 switch(col)
     {
     case e_qid:
 	printf("<td><A href=\"/cgi-bin/qaPushQ?action=edit&qid=%s&cb=%s\">%s</A>%s",
 	    ki->qid, newRandState, ki->qid, sameString(ki->lockUser,"") ? "":"*" );
 	if (ki->pushState[0]=='Y')
 	    {
 	    printf("<BR><A href=\"/cgi-bin/qaPushQ?action=pushDone&qid=%s&cb=%s\">Done!</A>",
 		ki->qid, newRandState );
 	    }
 	printf("</td>\n");
 	break;
 
     case e_pqid:
 	printf("<td>%s</td>\n", ki->pqid   );
@@ -936,30 +941,47 @@
 	
     case e_lockDateTime:
 	printf("<td>%s</td>\n", ki->lockDateTime );
 	break;
 	
     case e_releaseLog:
 	dotdotdot(ki->releaseLog,MAXBLOBSHOW);  /* chr(255) */
 	printf("<td>%s</td>\n", ki->releaseLog   );
 	break;
 	
     case e_releaseLogUrl:
 	dotdotdot(ki->releaseLogUrl,MAXBLOBSHOW);  /* chr(255) */
 	printf("<td>%s</td>\n", ki->releaseLogUrl  );
 	break;
 
+    case e_importance:
+        temp = "";
+        if (sameString(ki->importance, "") || sameString(ki->importance, " "))
+	    temp = "Unprioritized";
+        else if (sameString(ki->importance, "B"))
+	    temp = "Background";
+        else if (sameString(ki->importance, "L"))
+	    temp = "Low";
+        else if (sameString(ki->importance, "M"))
+	    temp = "Medium";
+        else if (sameString(ki->importance, "H"))
+	    temp = "High";
+        else if (sameString(ki->importance, "U"))
+	    temp = "Urgent";
+	printf("<td>%s</td>\n", temp );
+	break;
+	
     default:
 	errAbort("drawDisplayLine: unexpected case enum %d.",col);
 	
 
     }
 
 }
 
 
 
 void doDisplay()
 /* handle display request, shows pushQ records, also this is the default action  */
 {
 struct pushQ *ki, *kiList = NULL;
 struct sqlResult *sr;
@@ -1358,81 +1380,82 @@
 }
 
 
 /* too bad this isn't part of autoSql's code generation */
 
 void pushQUpdateEscaped(struct sqlConnection *conn, struct pushQ *el, char *tableName, int updateSize)
 /* Update pushQ row to the table specified by tableName. 
  * As blob fields may be arbitrary size updateSize specifies the approx size.
  * of a string that would contain the entire query. Automatically 
  * escapes all simple strings (not arrays of string) but may be slower than pushQSaveToDb().
  * For example automatically copies and converts: 
  * "autosql's features include" --> "autosql\'s features include" 
  * before inserting into database. */ 
 {
 struct dyString *update = newDyString(updateSize);
-char  *qid, *pqid, *priority, *qadate, *newYN, *track, *dbs, *tbls, *cgis, *files, *currLoc, *makeDocYN, *onlineHelp, *ndxYN, *joinerYN, *stat, *featureBits, *sponsor, *reviewer, *extSource, *openIssues, *notes, *pushState, *initdate, *lastdate, *lockUser, *lockDateTime, *releaseLog, *releaseLogUrl;
+char  *qid, *pqid, *priority, *qadate, *newYN, *track, *dbs, *tbls, *cgis, *files, *currLoc, *makeDocYN, *onlineHelp, *ndxYN, *joinerYN, *stat, *featureBits, *sponsor, *reviewer, *extSource, *openIssues, *notes, *pushState, *initdate, *lastdate, *lockUser, *lockDateTime, *releaseLog, *releaseLogUrl, *importance;
 qid = sqlEscapeString(el->qid);
 pqid = sqlEscapeString(el->pqid);
 priority = sqlEscapeString(el->priority);
 qadate = sqlEscapeString(el->qadate);
 newYN = sqlEscapeString(el->newYN);
 track = sqlEscapeString(el->track);
 dbs = sqlEscapeString(el->dbs);
 tbls = sqlEscapeString(el->tbls);
 cgis = sqlEscapeString(el->cgis);
 files = sqlEscapeString(el->files);
 currLoc = sqlEscapeString(el->currLoc);
 makeDocYN = sqlEscapeString(el->makeDocYN);
 onlineHelp = sqlEscapeString(el->onlineHelp);
 ndxYN = sqlEscapeString(el->ndxYN);
 joinerYN = sqlEscapeString(el->joinerYN);
 stat = sqlEscapeString(el->stat);
 featureBits = sqlEscapeString(el->featureBits);
 sponsor = sqlEscapeString(el->sponsor);
 reviewer = sqlEscapeString(el->reviewer);
 extSource = sqlEscapeString(el->extSource);
 openIssues = sqlEscapeString(el->openIssues);
 notes = sqlEscapeString(el->notes);
 pushState = sqlEscapeString(el->pushState);
 initdate = sqlEscapeString(el->initdate);
 lastdate = sqlEscapeString(el->lastdate);
 lockUser = sqlEscapeString(el->lockUser);
 lockDateTime = sqlEscapeString(el->lockDateTime);
 releaseLog = sqlEscapeString(el->releaseLog);
 releaseLogUrl = sqlEscapeString(el->releaseLogUrl);
+importance = sqlEscapeString(el->importance);
 
 /* had to split this up because dyStringPrintf only up to 4000 chars at one time */
 dyStringPrintf(update, 
     "update %s set "
     "pqid='%s',priority='%s',rank=%u,qadate='%s',newYN='%s',track='%s',",
     tableName,  pqid,  priority, el->rank,  qadate, newYN, track);
 dyStringPrintf(update, "dbs='%s',",dbs);
 dyStringPrintf(update, "tbls='%s',",tbls);
 dyStringPrintf(update, "cgis='%s',",cgis);
 dyStringPrintf(update, "files='%s',",files);
 dyStringPrintf(update, "sizeMB=%u,currLoc='%s',"
     "makeDocYN='%s',onlineHelp='%s',ndxYN='%s',joinerYN='%s',stat='%s',"
     "sponsor='%s',reviewer='%s',extSource='%s',",
     el->sizeMB ,  currLoc,  makeDocYN,  
     onlineHelp,  ndxYN,  joinerYN,  stat,  
     sponsor,  reviewer,  extSource);
 dyStringPrintf(update, "openIssues='%s',",openIssues);
 dyStringPrintf(update, "notes='%s',",notes);
-dyStringPrintf(update, "pushState='%s', initdate='%s', lastdate='%s', bounces='%u',lockUser='%s',lockDateTime='%s',releaseLog='%s',featureBits='%s',releaseLogUrl='%s' "
+dyStringPrintf(update, "pushState='%s', initdate='%s', lastdate='%s', bounces='%u',lockUser='%s',lockDateTime='%s',releaseLog='%s',featureBits='%s',releaseLogUrl='%s',importance='%s' "
 	"where qid='%s'", 
-	pushState, initdate, lastdate, el->bounces, lockUser, lockDateTime, releaseLog, featureBits, releaseLogUrl,
+	pushState, initdate, lastdate, el->bounces, lockUser, lockDateTime, releaseLog, featureBits, releaseLogUrl, importance,
 	qid
 	);
 
 sqlUpdate(conn, update->string);
 freeDyString(&update);
 freez(&qid);
 freez(&pqid);
 freez(&priority);
 freez(&qadate);
 freez(&newYN);
 freez(&track);
 freez(&dbs);
 freez(&tbls);
 freez(&cgis);
 freez(&files);
@@ -1442,30 +1465,31 @@
 freez(&ndxYN);
 freez(&joinerYN);
 freez(&stat);
 freez(&sponsor);
 freez(&reviewer);
 freez(&extSource);
 freez(&openIssues);
 freez(&notes);
 freez(&pushState);
 freez(&initdate);
 freez(&lastdate);
 freez(&lockUser);
 freez(&lockDateTime);
 freez(&releaseLog);
 freez(&releaseLogUrl);
+freez(&importance);
 }
 
 void getCgiData(bool *isOK, bool isPtr, void *ptr, int size, char *name)
 /* get data, truncate to fit in field to prevent safef buf overflows */
 {
 int l = 0;
 char **pfld = NULL;
 char *fld = NULL;
 char *cgi = NULL;
 cgi = cgiString(name);
 l = strlen(cgi);
 if (isPtr)
     {
     pfld = (char **) ptr;
     }
@@ -1607,30 +1631,31 @@
     }
 
 
 safef(newPriority, sizeof(newPriority), cgiString("priority"));
 
     
 /* dates */
 getCgiData(&isOK, FALSE, q->qadate    , sizeof(q->qadate    ), "qadate"    );
 getCgiData(&isOK, FALSE, q->initdate  , sizeof(q->initdate  ), "initdate"  );
 
 /* YN select listboxes */
 getCgiData(&isOK, FALSE, q->newYN     , sizeof(q->newYN     ), "newYN"     );
 getCgiData(&isOK, FALSE, q->makeDocYN , sizeof(q->makeDocYN ), "makeDocYN" );
 getCgiData(&isOK, FALSE, q->ndxYN     , sizeof(q->ndxYN     ), "ndxYN"     );
 getCgiData(&isOK, FALSE, q->joinerYN  , sizeof(q->joinerYN  ), "joinerYN"  );
+getCgiData(&isOK, FALSE, q->importance, sizeof(q->importance), "importance"  );
 
 /* chr(255) strings */
 getCgiData(&isOK, TRUE ,&q->track     , 256                 , "track"     );
 getCgiData(&isOK, TRUE ,&q->dbs       , 256                 , "dbs"       );
 getCgiData(&isOK, TRUE ,&q->cgis      , 256                 , "cgis"      );
 getCgiData(&isOK, TRUE ,&q->stat      , 256                 , "stat"      );
 
 /* integers */
 if (sscanf(cgiString("sizeMB"),"%u",&q->sizeMB) != 1) 
     {
     q->sizeMB = 0;
     }
 
 /* strings of various sizes */
 getCgiData(&isOK, FALSE, q->currLoc   , sizeof(q->currLoc   ), "currLoc"   );
@@ -3174,30 +3199,31 @@
 }
 
 
 void doShowEditHelp()
 /* show the sizes of all the track tables, cgis, and general files in separate window target= _blank  */
 {
 struct pushQ q;
 ZeroVar(&q);
 safef(q.qid,sizeof(q.qid),cgiString("qid"));
 printf("<h4>Details/Edit Help</h4>\n");
 printf("<br>\n");
 printf("CANCEL - click to return to main display without saving changes.<br>\n");
 printf("HELP - click to see this help.<br>\n");
 printf("<br>\n");
 printf("Initial submission - displays date automatically generated when push queue record is created.<br>\n");
+printf("Importance - from Redmine.<br>\n");
 printf("Date Opened - date QA (re)opened. (YYYY-MM-DD) Defaults originally to current date to save typing.<br>\n");
 printf("New track? - choose Y if this is a new track (i.e. has never before appeared on beta).<br>\n");
 printf("Track - enter the track name as it will appear in the genome browser (use the shortLabel).<br>\n");
 printf("Release Log- enter the short Label (usually) followed by notes in parentheses if any. This appears in the release log unless empty.<br>\n");
 printf("Databases - enter db name. May be comma-separated list if more than one organism, etc.<br>\n");
 printf("Tables - enter as comma-separated list all tables that apply. They must exist in the database specified. Wildcard * supported. (Put comments in parentheses).<br>\n");
 printf("CGIs - enter names of any new cgis that are applicable. Must be found on hgwbeta.<br>\n");
 printf("Files - enter pathnames of any additional files if needed.<br>\n");
 printf("Size(MB) - enter the size of the total push in megabytes (MB).<br>\n");
 printf("Show Sizes button - click to see a complete list of sizes of all tables and cgis.  Tables are relative to Current Location specified.<br>\n");
 printf("Current Location - chooose the current location of the files.  Should default to hgwdev at start, after sudo mypush to hgwbeta, change this to hgwbeta.<br>\n");
 printf("Makedoc verified? - choose Y if you have verified the MakeAssembly.doc in kent/src/hg/makeDb.<br>\n");
 printf("Online help - enter status of online help. Verify <a href=http://hgwbeta.cse.ucsc.edu/goldenPath/help/hgTracksHelp.html#IndivTracks>hgTracksHelp</a><br>\n");
 printf("Index verified? - choose Y if the index has been verified. Use the ShowSizes button for a quick view.<br>\n");
 printf("All.joiner verified? - choose Y if the all.joiner in /hg/makeDb/schema has been verified.<br>\n");