This commit is contained in:
Ren RenJuan 2014-01-19 07:45:43 +00:00
parent 70d3b2d24e
commit 75a8194c07
2 changed files with 73 additions and 16 deletions

View File

@ -20,6 +20,7 @@ const char *xmlWork = "./xml";
extern shared_memory_object shm; extern shared_memory_object shm;
#include "eppargs.h" #include "eppargs.h"
#include "eppxml.h"
int is_numeric(const char *p) { int i = strlen(p),j=0; int is_numeric(const char *p) { int i = strlen(p),j=0;
if (*p) { if (*p) {
@ -105,7 +106,7 @@ void mdCommander::prompt(bool forStrings) {
} }
void mdCommander::driver() { void mdCommander::driver() {
bool rc, x; bool rc, x, eppMainActive =false;
char next,rawString[128],work[128]; char next,rawString[128],work[128];
const char *mdErrCode = ""; const char *mdErrCode = "";
int i,commandLength; int i,commandLength;
@ -140,6 +141,39 @@ void mdCommander::driver() {
rawString[strlen(rawString)-1] = 0; rawString[strlen(rawString)-1] = 0;
} }
if (!strlen(rawString)) continue; if (!strlen(rawString)) continue;
if (eppMainActive) {
int ion,nAll; char cmdChars[9] = {'c','i','p','t','C','R','U','D','T'};
eppMainActive = false;
switch(rawString[0]) {
case '?': help();
break;
case 'L':
for (nAll=0;nAll<6;nAll++)
if (loadSchema(nAll)) beep();
break;
case 'W':
for (nAll=0;nAll<9;nAll++)
writeCommand(cmdChars[nAll]);
break;
case 'V':
ion=atoi(&rawString[1]);
viSchema(ion);
break;
case 'l':
ion=atoi(&rawString[1]);
if (loadSchema(ion)) beep();
break;
case 'w':
writeCommand(rawString[1]);
break;
case 'v':
viBlankForm(rawString[1]);
break;
default: beep();
break;
}
continue;
}
if (strlen(rawString) == 1) { if (strlen(rawString) == 1) {
switch(rawString[0]) { switch(rawString[0]) {
case '1': ; case '2': ; case '3': ; case '4': ; case '5': ; case '1': ; case '2': ; case '3': ; case '4': ; case '5': ;
@ -151,6 +185,7 @@ void mdCommander::driver() {
case '?': help(); case '?': help();
break; break;
case 'e': eppMainMenu(); case 'e': eppMainMenu();
eppMainActive = true;
break; break;
case 'a': acMainMenu(); case 'a': acMainMenu();
break; break;
@ -344,24 +379,26 @@ void mdCommander::eppMainMenu() {
mvprintw(15,10," U - update"); mvprintw(15,10," U - update");
mvprintw(16,10," D - delete"); mvprintw(16,10," D - delete");
mvprintw(17,10," T - transfer"); mvprintw(17,10," T - transfer");
mvprintw(19,10,"IO"); mvprintw(19,10,"IO (active this screen only)");
mvprintw(22,10," v<letter> - vi/xmledit the XML"); mvprintw(20,10," l<n> - load the schema");
mvprintw(23,10," V<n> - vi/xmledit the XSDs"); mvprintw(21,10," L - load ./resources/*");
mvprintw(24,10," w<letter> - write blank XML form for 1 above"); mvprintw(22,10," w<letter> - write blank XML form for 1 above ... ");
mvprintw(25,10," W - write blank forms for all"); mvprintw(23,10," W - or all to ./xml.");
mvprintw(24,10," v<letter> - vi/xmledit a blank XML form");
mvprintw(25,10," V<n> - vi/xmledit a XSDs");
mvprintw(7,50, "Commands are defined by the XSDs"); mvprintw(7,50, "Commands are defined by the XSDs");
mvprintw(8,50, "in ./resources. These are migrating to"); mvprintw(8,50, "in ./resources. These are being migrated from");
mvprintw(9,50,"a what's at 'XML TO USE IN AC' @"); mvprintw(9,50,"what was in in the 2007 toolkit to.");
mvprintw(10,50,"dnseppus.meansofproduction.biz/doc, currently"); mvprintw(10,50, "what's at the 'XML TO USE IN AC' link @");
mvprintw(11,50,"a mix of that and those in the 2007 toolkit."); mvprintw(11,50,"dnseppus.meansofproduction.biz/doc,.");
mvprintw(13,50,"If no XSD loaded you'll see"); mvprintw(13,50,"If no XSD loaded you'll see");
mvprintw(14,50,"stubs in the internal editor."); mvprintw(14,50,"stubs in the internal editor.");
mvprintw(16,50," n = 1 : epp-1.0.xsd 2: domain-1-0.xsd 3: contact-1.0.xsd"); mvprintw(16,50," n = 1 : epp-1.0.xsd 2: domain-1-0.xsd 3: contact-1.0.xsd");
mvprintw(17,50," 4: registrant-1.0.xsd 5: host-1-0.xsd 6: kv-1.0.xsd"); mvprintw(17,50," 4: registrant-1.0.xsd 5: host-1-0.xsd 6: kv-1.0.xsd");
say((char *)"Action letter or ? to exit"); say((char *)"Action sequence or ? to exit");
} }
void mdCommander::acMainMenu() { void mdCommander::acMainMenu() {

View File

@ -18,21 +18,34 @@
} }
eppXML; eppXML;
typedef
struct {
bool hasXML:1;
bool reserved:7;
}
eppState;
class mdCommander { class mdCommander {
bool acceptingInput,deleted[MAX_CMDS]; bool acceptingInput,deleted[MAX_CMDS],schemaLoaded[6];
int activeCommands, argsNow[MAX_CMDS], cmdNow, cmdsNow, mdStdDevIdx; int activeCommands, argsNow[MAX_CMDS], cmdNow, cmdsNow, mdStdDevIdx;
int row,col, thisArg; int row,col, thisArg;
int commandsNow[MAX_CMDS]; // type index into cmdNames int commandsNow[MAX_CMDS]; // type index into cmdNames
eppArgDef *commandArgs[MAX_CMDS][MAX_CMD_ARGS]; eppArgDef *commandArgs[MAX_CMDS][MAX_CMD_ARGS];
eppXML xmlIO[9]; eppXML xmlIO[9];
eppState state[MAX_CMDS];
char wwork[1024]; char wwork[1024];
char* schemaFileName; char* schemaFileNames[6];
public: public:
mdCommander() {mdStdDevIdx=0; cmdsNow=0; cmdNow = 0; mdCommander() {mdStdDevIdx=0; cmdsNow=0; cmdNow = 0;
memset(commandArgs,0,sizeof(commandArgs));
memset(state,0,sizeof(state));
memset(schemaLoaded,0,sizeof(schemaLoaded));
memset(xmlIO,0,sizeof(xmlIO));
xmlIO[0].xml = "check.xml" ; xmlIO[0].xml = "check.xml" ;
xmlIO[1].xml = "info.xml" ; xmlIO[1].xml = "info.xml" ;
xmlIO[2].xml = "tranq.xml" ; xmlIO[2].xml = "tranq.xml" ;
@ -43,9 +56,13 @@ class mdCommander {
xmlIO[7].xml = "delete.xml"; xmlIO[7].xml = "delete.xml";
xmlIO[8].xml = "transf.xml"; xmlIO[8].xml = "transf.xml";
schemaFileName="epp-1.0.xsd"; schemaFileNames[0]="epp-1.0.xsd";
schemaFileNames[1]="domain-1.0.xsd";
schemaFileNames[2]="contact-1.0.xsd";
schemaFileNames[3]="registrant-1.0.xsd";
schemaFileNames[4]="host-1.0.xsd";
schemaFileNames[5]="kv-1.0.xsd";
memset(commandArgs,0,sizeof(commandArgs));
} }
~mdCommander() {} ~mdCommander() {}
@ -69,6 +86,7 @@ class mdCommander {
if (which && deleted[which-1]) return false; if (which && deleted[which-1]) return false;
return true; return true;
} }
bool loadSchema(int which);
void poll(bool run); void poll(bool run);
void prompt(bool forStrings); void prompt(bool forStrings);
void queryTransfer(bool run); void queryTransfer(bool run);
@ -78,8 +96,10 @@ class mdCommander {
void showCommand(bool all); void showCommand(bool all);
void trash(bool run); void trash(bool run);
void transfer(bool run); void transfer(bool run);
void viSchema(int which);
void viBlankForm(char which);
void update(bool run); void update(bool run);
void writeCommand(char which);
bool editingCommand(bool run); bool editingCommand(bool run);
bool runCommand(bool all); bool runCommand(bool all);