function emitModifyEntry(request) { var oldcmd, oldobj, oldhome, oldstart, oldlib, oldmode, oldmaxdb; var app = new appObject(); if (defined(request.oldcmd)) oldcmd = request.oldcmd; else oldcmd = request.cmd; if (request.cmd == "modify") { app.setFromName(request.name); // Always remember the initial values // in case we need to remodify oldobj = app.obj; oldmode = app.mode; oldhome = app.home; oldstart = app.start; oldlib = app.library; oldmaxdb = app.maxdbconnect; } if (request.cmd == "remodify") { app.setFromName(request.name); // Restore old configuration info into jsa.conf var oldapp = new appObject(); oldapp.setFromName(request.name); oldapp.obj = request.oldobj; oldapp.mode = request.oldmode; oldapp.home = request.oldhome; oldapp.start = request.oldstart; oldapp.library = request.oldlib; oldapp.maxdbconnect = request.oldmaxdb; oldapp.setConfig(); // Always remember the initial values // in case we need to remodify oldobj = oldapp.obj; oldmode = oldapp.mode; oldhome = oldapp.home; oldstart = oldapp.start; oldlib = oldapp.library; oldmaxdb = oldapp.maxdbconnect; } if (request.cmd == "retry") { app.setFromObject(request); // Remove entry from jsa.conf if (app.index != 0) { app.Remove(); app.index = 0; } } if (request.cmd == "add") { var defaults = new appDefaults(); app.obj = defaults.obj; app.home = defaults.home; app.start = defaults.start; app.library = defaults.library; app.maxdbconnect = defaults.maxdbconnect; app.mode = defaults.mode; } var isNew = (app.index == 0); // emit title writeln(''); writeln(' '); write(' ') writeln(' '); writeln('

'); writeln((isNew) ? 'Add Application' : 'Modify "' + app.name + '"' ,'
'); writeln('

'); writeln('

'); writeln(''); if (isNew) { write(''); writeln(''); writeln(''); } else { writeln(''); } write(''); writeln(''); write(''); writeln(''); write(''); writeln(''); write(''); writeln(''); write(''); app.library = replace(app.library, ";", "\n"); writeln(""); write(''); writeln(''); writeln('
Name:
Web File Path:
Default Page:
Initial Page:
Built-in Maximum 
Database Connections:
External Libraries:
Client Object 
Maintenance:
'); writeln('
'); writeln('
'); writeln(''); writeln(''); writeln(''); writeln('
'); // Used to pass information when form is submitted writeln(''); writeln(''); writeln(''); writeln(''); writeln(''); writeln(''); writeln(''); writeln(''); writeln(''); writeln(''); writeln('
'); writeln(''); writeln(''); } function emitModifyCommit(request) { var success = true; if (!defined(request.start)) request.start = ""; if (!defined(request.library)) request.library = ""; // Strip out things like CRLF, spaces, and slashes where applicable request.obj = replace(request.obj, "\\", "/"); request.library = replace(request.library, "\r", ""); request.library = replace(request.library, "\n", ";"); request.library = replace(request.library, "\\", "/"); request.library = rTrim(request.library, ";"); request.name = replace(request.name, "\\", ""); request.name = replace(request.name, "/", ""); request.name = replace(request.name, " ", ""); request.home = replace(request.home, " ", ""); request.start = replace(request.start, " ", ""); var app = new appObject(); if (!used(request.frame)) { if (request.cmd == "modify") { if (isInAppList(request.name)) { app.setFromName(request.name); } else { writeError('Unable to modify application: "' + request.name + '" is not installed'); return; } } request.index = app.index; } app.setFromObject(request); success = app.isValidName() && app.isValidWeb() && app.isValidHome() && app.isValidLib() && app.isValidMaxDBConn(); if (success) { success = !app.isDuplicate() && app.isManageable(); if (success) { if (app.isActive()) { success = app.Stop(); } if (success) { success = app.setConfig(); if (success) { success = app.Start(); } } } } if (success) { if (used(request.frame)) { writeln(''); } else { writeSuccess(); } } else { if (used(request.frame)) { writeln(''); request.index = app.index; if (request.oldcmd == "modify") request.cmd = "remodify"; else request.cmd = "retry"; emitModifyEntry(request); } else { writeError(app.error); } } } client.expiration(60*60*24*30); // Save configuration for 30 days writeln(''); writeln('


'); if (used(request.frame)) { writeln(''); if (request.cmd == "commit") { emitModifyCommit(request); } else { emitModifyEntry(request); } } else { emitModifyCommit(request); } writeln('');