parm updates

This commit is contained in:
Matt Wells 2013-12-17 10:53:12 -08:00
parent d03028ea93
commit 39a0b7f85e
2 changed files with 37 additions and 8 deletions

View File

@ -3582,7 +3582,7 @@ bool printCrawlBotPage2 ( TcpSocket *socket ,
);
sb.safePrintf(
"<input type=hidden name=reset value=%li>"
"<input type=hidden name=reset value=1>"
// also show it in the display, so set "c"
"<input type=submit name=button value=\""
"Reset this collection\">"
@ -3595,13 +3595,13 @@ bool printCrawlBotPage2 ( TcpSocket *socket ,
// delete collection form
"<form method=get action=/crawlbot>"
"%s"
, (long)cr->m_collnum
//, (long)cr->m_collnum
, hb.getBufStart()
);
sb.safePrintf(
"<input type=hidden name=delete value=%li>"
"<input type=hidden name=delete value=1>"
"<input type=submit name=button value=\""
"Delete this collection\">"
"</form>"
@ -3613,7 +3613,7 @@ bool printCrawlBotPage2 ( TcpSocket *socket ,
"<td>"
"<form method=get action=/crawlbot>"
"%s"
"<input type=hidden name=restart value=%li>"
"<input type=hidden name=restart value=1>"
"<input type=submit name=button value=\""
"Restart this collection\">"
"</form>"
@ -3622,9 +3622,9 @@ bool printCrawlBotPage2 ( TcpSocket *socket ,
"</tr>"
"</table>"
, (long)cr->m_collnum
//, (long)cr->m_collnum
, hb.getBufStart()
, (long)cr->m_collnum
//, (long)cr->m_collnum
);
}

View File

@ -16831,6 +16831,13 @@ bool Parms::convertHttpRequestToParmList (HttpRequest *hr, SafeBuf *parmList,
collnum_t parmCollnum = -1;
if ( cr ) parmCollnum = cr->m_collnum;
// turn the collnum into an ascii string for providing as args
// when &reset=1 &restart=1 &delete=1 is given along with a
// &c= or a &name=/&token= pair.
char oldCollName[MAX_COLL_LEN+1];
oldCollName[0] = '\0';
if ( cr ) sprintf(oldCollName,"%li",(long)cr->m_collnum);
////////
//
@ -16922,13 +16929,35 @@ bool Parms::convertHttpRequestToParmList (HttpRequest *hr, SafeBuf *parmList,
}
}
// if a collection name was also provided, assume that is
// the target of the reset/delete/restart. we still
// need PageAddDelete.cpp to work...
if ( cr &&
( strcmp(m->m_cgi,"reset" ) == 0 ||
strcmp(m->m_cgi,"delete" ) == 0 ||
strcmp(m->m_cgi,"restart" ) == 0 ) )
// the collnum to reset/restart/del
// given as a string.
val = oldCollName;
// add the cmd parm
if ( ! addNewParmToList2 ( parmList ,
// it might be a collection-less
// command like 'gb stop' which
// uses the "save=1" parm
// uses the "save=1" parm.
// this is the "new" collnum to
// create in the case of
// add/reset/restart, but in the
// case of delete it is -1 or old.
parmCollnum ,
val ,
// the argument to the function...
// in the case of delete, the
// collnum to delete in ascii.
// in the case of add, the name
// of the new coll. in the case
// of reset/restart the OLD
// collnum is ascii to delete.
val,
occNum ,
m ) )
return false;