%@ LANGUAGE="JSCRIPT" %><% // 23-Dec-08 rbd New DB caching hack // 09-Jun-09 rbd 3.0 HF1 - Allow Dither if only 1 image (enforcement code commented out) // 06-Nov-09 rbd 3.1 GEM:285 Allow input of dither pixels // 28-Nov-10 rbd 3.3 GEM:398 Protect against apostrophes in status and fail messages // by double-quoting them in form ASP code. // 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. // 06-Feb-12 rbd GEM:296 - Enhance for creating new ImageSets. Correct "are you sure" // popup text. // 31-Oct-12 rbd Fix displayed numbers and counts for GEM:296. // No GEM (found testing ACP 7) // 22-Jan-14 rbd GEM:1083 No more DBRelay hack :-) // 17-Nov-14 rbd GEM:1249 Add auto-calibration and hot-pix checkboxes // 16-Dec-14 rbd GEM:1055 Add Duplicate ImageSet button and logic for duplicating ImageSets // 24-Jan-15 rbd GEM:1055 Improvements in ide/Show when running/not. // 27-Jan-15 rbd GEM:1280 Get filter names and binnings from ACP cache. // 30-Jan-15 rbd GEM:1184 Accept , as decimal point. Numeric strings have // already been validated at POST time. // 10-Dec-18 rbd GEM:1657 Fix for system with no filters. // 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. // Show and hide the hox pix checkbox instead of dimming. // 07-Feb-18 rbd GEM:1766 Change usage of => to equivalent function() syntax for IE11 // // // Enhance String with a trim() method // String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }; var DB = Scheduler.Database; var formid = Request.Form("id").Item; // "Item" gets the string from the object var I, PStatus; var newImg = "no"; if(formid.substr(0, 3) == "NIM") { // If new, NIMnnnn where nnnn is OBS ID var obsID = formid.substr(3); PStatus = DB.Observation(obsID).Plan.Status; if(PStatus != 2) { // 2 = Running newImg = "yes"; I = DB.AddNewImage(obsID); I.Name = "New ImageSet " + I.ID; I.Update(false); } else { Response.Write("Cannot create new ImageSet in running Plan"); Response.End(); } } else { I = DB.Image(formid); PStatus = I.Observation.Plan.Status; } 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 === var FSO = new ActiveXObject("Scripting.FileSystemObject"); function makeFilterList(cur) { var buf = ""; try { var filtFn = Prefs.WebRoot + "\\FilterNames.txt"; if(FSO.FileExists(filtFn)) { var filtSt = FSO.OpenTextFile(filtFn, 1); filtSt.ReadLine(); // Always starts with comment line (typ.) var buf2 = filtSt.ReadLine(); // Second line is count of filters, or if(buf2.search(/no filters/i) == -1) { // We have a list while(!filtSt.AtEndOfStream) { var f = filtSt.ReadLine().trim(); if(f !== "") buf += "\r\n"; } } filtSt.Close(); } if(buf === "") buf = "\r\n" } catch(ex) { buf = "\r\n"; } return buf; } function makeBinningList(cur) { var buf = ""; try { var binFn = Prefs.WebRoot + "\\BinningVals.txt" if(!FSO.FileExists(binFn)) return "(??)"; // Must have binning file! var binSt = FSO.OpenTextFile(binFn, 1); binSt.ReadLine(); while(!binSt.AtEndOfStream) { var b = binSt.ReadLine().trim(); if(b !== "") buf += "\r\n"; } binSt.Close(); } catch(ex) { buf = "\r\n"; } return buf; } Response.Expires = 0; // Immediate Expires: header Response.AddHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); %>