<%@ 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" } 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"; } return buf; } Response.Expires = 0; // Immediate Expires: header Response.AddHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0"); %> Image Set


Status:

Image Name:
Description:
Filter:
Exposure:   (seconds)
Binning:
Repeat Count:
Dither:   (pixels rms -1.0 for auto)
Auto Calibrate: checked<% } %> size="20" />  Perform full calibration after acquiring


 Delete  Duplicate     Save Changes

<% } else { // === POST === try { DB.BeginTransaction(); // Preserve database integrity! switch(Request.Form("op").Item.toLowerCase()) { case "del": DB.DeleteImage(I); Response.Write("Image successfully deleted"); break; case "upd": I.Name = Request.Form("iName").Item; I.Description = Request.Form("iDesc").Item; I.Filter = Request.Form("iFilter").Item; I.ExposureInterval = Request.Form("iExposure").Item.replace(",","."); I.Binning = Request.Form("iBinning").Item; I.RepeatCount = Request.Form("iRepeat"); I.Dither = Request.Form("iDither").Item.replace(",","."); if(I.Dither < 0) I.Dither = -1.0; // Safety if(Request.Form("iAutoCal")) { I.Dark = I.Bias = I.Flat = true; } else { I.Dark = I.Bias = I.Flat = false; } if(Request.Form("iHotPix")) { I.HotPix = true; } else { I.HotPix = false; } I.Update(false); Response.Write("Image successfully updated"); break; case "dup": var NI = I.Duplicate(); Response.Write("<" + NI.ID + "><" + NI.Name + ">You should not see this"); // Feed new Obs ID & Name back to form for completion break; default: break; } DB.CommitTransaction(); } catch(ex) { DB.RollbackTransaction(); Response.Write("Failed: (" + ex.name + ") " + ex.description); } } %>