%@ LANGUAGE="JSCRIPT" %><% // // 23-Dec-08 rbd New DB caching hack // 20-Jan-11 rbd GEM:571 - Set our parent iframe's height. // 22-Jan-10 rbd GEM:571 - Do this when receiving POST responses as well. // Make IE fudge distance a manifest constant. Increase IE // fudge to 18. Add manifest constant for extra display dist. // Fix deletion, iframe name changed. // 06-Feb-12 rbd GEM:296 - Enhance for creating new Projects. // 12-Apr-12 rbd GEM:842 - Fix new project for single user case // 22-Jan-14 rbd GEM:1083 No more DBRelay hack :-) // 13-Nov-14 rbd GEM:342 change behavior for pause/resume of projects, also // found code for GEM:1245 in here, and it has been removed. // 22-Mar-15 rbd GEM:1318 Default new Project contact info to Observer/User // if the latter already exists. // 17-Jan-19 rbd GEM:1660 Modern DOCTYPE and HTML declarations // 18-Jan-19 rbd GEM:1663 Modernize alerting with SweetAlert. // 19-Jan-19 rbd GEM:1664 Fix validation, needed an additional call on chained validations. // 07-Feb-18 rbd GEM:1766 Change usage of => to equivalent function() syntax for IE11 // 24-Feb-21 rbd GEM:1746 Add "Are you sure?" to all mass operation buttons. // var DB = Scheduler.Database; var formid = Request.Form("id").Item; // "Item" gets the string from the object var R; var newProject = "no"; if(formid == "NPR") { var cU = DB.Users; var eU = new Enumerator(cU); var uFound = false; for(; !eU.atEnd(); eU.moveNext()) { var dbU = eU.item(); if(dbU.Name == User.Name) { DB.CurrentUser = dbU.ID; // Found existing user match uFound = true; break; // Done! } } if(!uFound) { // Need to create new user dbU = DB.AddNewUser(); dbU.Name = User.Name; dbU.Update(); DB.CurrentUser = dbU.ID; } R = DB.AddNewProject(); R.Name = "New Project " + R.ID; // Uniquify name R.ContactName = User.Name; // Add special ACP linkage info if(User.Name != "Observatory Operator") { R.ContactName += " [ACP " + User.Username + "]"; if(User.WantsCompress) R.ContactName += "#"; } if (uFound) { R.ContactEmail = dbU.Email; // Existing user, start with that contact info R.ContactOrganization = dbU.Organization; } else { R.ContactEmail = "your@email.here"; } R.Update(); newProject = "yes"; DB.CurrentUser = 0; // RESTORE TO ALL USERS! } else { R = DB.Project(Request.Form("id")); // Existing Project } Response.ExpiresAbsolute = new Date("Jan 1, 2000").getVarDate(); // Expire even with clocdk offsets Response.AddHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); if(Request.ServerVariables("REQUEST_METHOD").toLowerCase() != "post") { // === GET === %>