private void PrepareZoom(int masterCopySeparationSet, string pageName, int approve, int version, bool isMono, bool forcePDF) { Session["CurrentPageName"] = pageName; Session["CurrentPageFormat"] = ""; Session["CurrentCopySeparationSet"] = masterCopySeparationSet; Session["CurrentApprovalState"] = approve; Session["CurrentVersion"] = version; Session["ImagePath"] = ""; Session["ImagePathMask"] = ""; Session["ImagePathRaster"] = ""; Session["RealImagePath"] = ""; Session["HasTiles"] = false; Session["HasRaster"] = false; double xdim = 0.0; double ydim = 0.0; double bleed = 0.0; string currentComment = ""; int publicationID = 0; DateTime pubDate = DateTime.MinValue; bool hasMask = false; bool hasTiles = false; bool hasRaster = false; string errmsg = ""; CCDBaccess db = new CCDBaccess(); string pagesizeinfo = ""; db.GetSizeInfoForPage(masterCopySeparationSet, ref pagesizeinfo, out errmsg); if (pagesizeinfo != "") { Session["CurrentPageFormat"] = pagesizeinfo; } else { db.GetPageFormatForPage(masterCopySeparationSet, ref xdim, ref ydim, ref bleed, out errmsg); if (xdim > 0.0 && ydim > 0.0) { string s = string.Format("{0:F1} x {1:F1}", xdim, ydim); if (bleed > 0) { s += string.Format(" bleed {0:F1}", bleed); } Session["CurrentPageFormat"] = s; } } DisplayPageName(); bool showSep = (string)Session["ShowSep"] == "C" || (string)Session["ShowSep"] == "M" || (string)Session["ShowSep"] == "Y" || (string)Session["ShowSep"] == "K" || (string)Session["ShowSep"] == "DNS"; db.GetComment(masterCopySeparationSet, out currentComment, out publicationID, out pubDate, out errmsg); if ((bool)Application["SetCommentInPrePollPageTable"]) { currentComment = db.GetPrePollMessage(masterCopySeparationSet, 350, out errmsg); } string previewGUID = Globals.MakePreviewGUID(publicationID, pubDate); Session["CurrentComment"] = (bool)Session["SetCommentOnDisapproval"] ? currentComment : ""; SetCommentBox(currentComment); if ((bool)Application["ThumbnailShowMask"]) { hasMask = db.HasMask(masterCopySeparationSet, out errmsg); } string realRasterPath = ""; string virtualRasterPath = ""; if ((bool)Application["ShowRasterImage"]) { if (Globals.HasRasterTileFolder(masterCopySeparationSet, version, publicationID, pubDate, ref realRasterPath, ref virtualRasterPath)) { hasRaster = true; Session["ImagePathRaster"] = virtualRasterPath; Session["HasRaster"] = true; } } string realPath = ""; string virtualPath = ""; if (Globals.HasTileFolder(masterCopySeparationSet, version, publicationID, pubDate, false, ref realPath, ref virtualPath)) { hasTiles = true; Session["ImagePath"] = virtualPath; Session["HasTiles"] = true; } if (hasMask && hasTiles) { if (Globals.HasTileFolder(masterCopySeparationSet, version, publicationID, pubDate, true, ref realPath, ref virtualPath)) { Session["ImagePathMask"] = virtualPath; } else { hasMask = false; } } bool hasGUIDname = realPath.IndexOf("====") != -1; bool hasCyan, hasMagenta, hasYellow, hasBlack, hasDNS; if (hasGUIDname) { hasCyan = System.IO.File.Exists(Global.sRealImageFolder + "\\" + previewGUID + "====" + masterCopySeparationSet.ToString() + "_C.jpg"); hasMagenta = System.IO.File.Exists(Global.sRealImageFolder + "\\" + previewGUID + "====" + masterCopySeparationSet.ToString() + "_M.jpg"); hasYellow = System.IO.File.Exists(Global.sRealImageFolder + "\\" + previewGUID + "====" + masterCopySeparationSet.ToString() + "_Y.jpg"); hasBlack = System.IO.File.Exists(Global.sRealImageFolder + "\\" + previewGUID + "====" + masterCopySeparationSet.ToString() + "_K.jpg"); hasDNS = System.IO.File.Exists(Global.sRealImageFolder + "\\" + previewGUID + "====" + masterCopySeparationSet.ToString() + "_dns.jpg"); } else { hasCyan = System.IO.File.Exists(Global.sRealImageFolder + "\\" + masterCopySeparationSet.ToString() + "_C.jpg"); hasMagenta = System.IO.File.Exists(Global.sRealImageFolder + "\\" + masterCopySeparationSet.ToString() + "_M.jpg"); hasYellow = System.IO.File.Exists(Global.sRealImageFolder + "\\" + masterCopySeparationSet.ToString() + "_Y.jpg"); hasBlack = System.IO.File.Exists(Global.sRealImageFolder + "\\" + masterCopySeparationSet.ToString() + "_K.jpg"); hasDNS = System.IO.File.Exists(Global.sRealImageFolder + "\\" + masterCopySeparationSet.ToString() + "_dns.jpg"); } string realPdfPagePath; string virtualPdfPagePath; bool hasPDF = Globals.HasPdfPage(masterCopySeparationSet, out realPdfPagePath, out virtualPdfPagePath, (bool)Application["ShowAnnotatedPDF"]); bool hasPDFCMYKSplit = hasPDF && hasTiles; SetRadToolbarVisible2("C", isMono == false && hasCyan && forcePDF == false); SetRadToolbarVisible2("M", isMono == false && hasMagenta && forcePDF == false); SetRadToolbarVisible2("Y", isMono == false && hasYellow && forcePDF == false); SetRadToolbarVisible2("K", isMono == false && hasBlack && forcePDF == false); SetRadToolbarVisible2("Dns", isMono == false && hasDNS && forcePDF == false); SetRadToolbarVisible2("PDF", hasPDF); SetRadToolbarVisible2("CMYK", forcePDF == false); SetRadToolbarVisible2("PDFCMYK", hasPDFCMYKSplit); SetRadToolbarVisible2("Raster", hasRaster); if (hasTiles == false || showSep) { if (Globals.HasPreview(masterCopySeparationSet, version, publicationID, pubDate, false, ref realPath, ref virtualPath, showSep ? (string)Session["ShowSep"] : "")) { Session["ImagePath"] = virtualPath; } if (hasMask) { if (Globals.HasPreview(masterCopySeparationSet, version, publicationID, pubDate, true, ref realPath, ref virtualPath, showSep ? (string)Session["ShowSep"] : "")) { Session["ImagePathMask"] = virtualPath; } else { hasMask = false; } } } SetRadToolbarVisible2("Mask", forcePDF == false && hasMask && (string)Session["ImagePathMask"] != "" && (bool)Application["ThumbnailShowMask"]); if (forcePDF && hasPDF) { simpleFlash = 2; Session["ShowSep"] = "PDF"; Session["ImagePath"] = virtualPdfPagePath; SetRadToolbarVisible2("Forward", false); SetRadToolbarVisible2("Backward", false); SetRadToolbarVisible2("ForwardOnly", false); SetRadToolbarVisible2("BackwardOnly", false); SetRadToolbarVisible2("ForwardDis", false); SetRadToolbarVisible2("BackwardDis", false); SetRadToolbarVisible2("PDF", false); SetRadToolbarVisible2("PDFCMYK", false); SetRadToolbarVisible2("Raster", false); return; } if ((string)Session["ImagePath"] == "") { // Display error message.. return; } if ((string)Session["ImagePath"] != "") { Session["RealImagePath"] = realPath; // For mail attachment only } // Finally - set the global sImagePath var used by flash module sImagePath = (string)Session["ImagePath"] + "/"; // Default to CMYK if missing file(s) if ((string)Session["ShowSep"] == "C" && hasCyan == false || (string)Session["ShowSep"] == "M" && hasMagenta == false || (string)Session["ShowSep"] == "Y" && hasYellow == false || (string)Session["ShowSep"] == "K" && hasBlack == false || (string)Session["ShowSep"] == "DNS" && hasDNS == false || (string)Session["ShowSep"] == "PDF" && hasPDF == false || (string)Session["ShowSep"] == "PDFCMYK" && (hasPDF == false || hasTiles == false) || (string)Session["ShowSep"] == "MASK" && (string)Session["ImagePathMask"] == "" || (string)Session["ShowSep"] == "RASTER" && (string)Session["ImagePathRaster"] == "") { Session["ShowSep"] = "CMYK"; } /* if ((bool)Application["NoCache"]) * { * string randomnumber = "&randowm_number=" + DateTime.Now.Ticks.ToString(); * sFlashVars += randomnumber; * } */ if (hasGUIDname) { printimagepath = (string)Session["ShowSep"] == "MASK" ? Global.sVirtualImageFolder + "/" + previewGUID + "====" + masterCopySeparationSet.ToString() + "_mask.jpg" : Global.sVirtualImageFolder + "/" + previewGUID + "====" + masterCopySeparationSet.ToString() + ".jpg"; } else { printimagepath = (string)Session["ShowSep"] == "MASK" ? Global.sVirtualImageFolder + "/" + masterCopySeparationSet.ToString() + "_mask.jpg" : Global.sVirtualImageFolder + "/" + masterCopySeparationSet.ToString() + ".jpg"; } printimagepath = Globals.EncodePreviewName(printimagepath); if ((bool)Application["LogUserAccess"] == true) { LogUserView(masterCopySeparationSet, (string)Session["UserName"]); } if ((string)Session["ShowSep"] == "PDFCMYK" && hasPDF && hasTiles) { simpleFlash = 1; sImagePath = (string)Session["ImagePath"] + "/"; Session["ImagePath2"] = virtualPdfPagePath; return; } if ((string)Session["ShowSep"] == "PDF" && hasPDF) { simpleFlash = 2; Session["ImagePath"] = virtualPdfPagePath; return; } SetRadToolbarChecked2("Mask", false); if (hasTiles && (string)Session["ShowSep"] == "MASK") { simpleFlash = 0; sImagePath = (string)Session["ImagePathMask"] + "/"; SetRadToolbarChecked2("Mask", true); return; } SetRadToolbarChecked2("Raster", false); if (hasRaster && (string)Session["ShowSep"] == "RASTER" && (bool)Application["ShowRasterImage"]) { simpleFlash = 0; sImagePath = (string)Session["ImagePathRaster"] + "/"; SetRadToolbarChecked2("Raster", true); return; } if (hasTiles && (string)Session["ShowSep"] == "CMYK") { simpleFlash = 0; sImagePath = (string)Session["ImagePath"] + "/"; return; } // All other images are shown without tiles simpleFlash = 3; // (bool)Session["mobiledevice"] || (bool)Session["UseHTML5"] ? 3 : 1; sImagePath = (string)Session["ImagePath"]; }
private void PrepareZoom(int masterCopySeparationSetLeft, int masterCopySeparationSetRight, string pageNameLeft, string pageNameRight, int approve) { Session["CurrentPageName"] = pageNameLeft; Session["CurrentPageName2"] = pageNameRight; Session["CurrentCopySeparationSet"] = masterCopySeparationSetLeft; Session["CurrentCopySeparationSet2"] = masterCopySeparationSetRight; Session["CurrentApprovalState"] = approve; Session["ImagePath"] = ""; Session["ImagePathMask"] = ""; Session["RealImagePath"] = ""; Session["HasTiles"] = false; DisplayPageName(); string currentComment = ""; int publicationID = 0; DateTime pubDate = DateTime.MinValue; bool hasMask = false; bool hasTiles = false; string errmsg = ""; CCDBaccess db = new CCDBaccess(); db.GetComment(masterCopySeparationSetLeft > 0 ? masterCopySeparationSetLeft : masterCopySeparationSetRight, out currentComment, out publicationID, out pubDate, out errmsg); if ((bool)Application["SetCommentInPrePollPageTable"]) { currentComment = db.GetPrePollMessage(masterCopySeparationSetLeft > 0 ? masterCopySeparationSetLeft : masterCopySeparationSetRight, 350, out errmsg); } /*Session["CurrentComment"] = (bool)Session["SetCommentOnDisapproval"] ? currentComment : ""; * Infragistics.WebUI.UltraWebToolbar.TBTextBox commentbox = (Infragistics.WebUI.UltraWebToolbar.TBTextBox)UltraWebToolbar1.Items.FromKey("Comment"); * if (commentbox != null) * commentbox.Text = currentComment; */ if ((bool)Application["ThumbnailShowMask"]) { hasMask = db.HasMask(masterCopySeparationSetLeft > 0 ? masterCopySeparationSetLeft : masterCopySeparationSetRight, out errmsg); } string realPath = ""; string virtualPath = ""; if (Globals.HasTileFolderReadview(masterCopySeparationSetLeft, masterCopySeparationSetRight, publicationID, pubDate, false, ref realPath, ref virtualPath)) { hasTiles = true; Session["ImagePath"] = virtualPath; Session["HasTiles"] = true; } if (hasMask) { if (Globals.HasTileFolderReadview(masterCopySeparationSetLeft, masterCopySeparationSetRight, publicationID, pubDate, true, ref realPath, ref virtualPath)) { Session["ImagePathMask"] = virtualPath; } } string folderToTest = Global.sRealReadViewImageFolder + "\\" + masterCopySeparationSetLeft.ToString() + "_" + masterCopySeparationSetRight.ToString() + "\\"; if (hasTiles == false) { if (Globals.HasPreviewReadview(masterCopySeparationSetLeft, masterCopySeparationSetRight, publicationID, pubDate, false, ref realPath, ref virtualPath)) { Session["ImagePath"] = virtualPath; } if (hasMask) { if (Globals.HasPreviewReadview(masterCopySeparationSetLeft, masterCopySeparationSetRight, publicationID, pubDate, true, ref realPath, ref virtualPath)) { Session["ImagePathMask"] = virtualPath; } } } if ((string)Session["ImagePath"] == "") { // Display error message.. return; } Telerik.Web.UI.RadToolBarButton maskbutton = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("Mask"); if (maskbutton != null) { maskbutton.Visible = hasMask && (string)Session["ImagePathMask"] != "" && (bool)Application["ThumbnailShowMask"]; } if ((string)Session["ImagePath"] != "") { Session["RealImagePath"] = realPath; // For mail attachment only } // Finally - set the global sImagePath var used by flash module sImagePath = (string)Session["ImagePath"]; // Default to CMYK if missing file(s) if ((string)Session["ShowSep"] == "MASK" && (string)Session["ImagePathMask"] == "") { Session["ShowSep"] = "CMYK"; } printimagepath = (string)Session["ShowSep"] == "MASK" ? Global.sVirtualImageFolder + "/" + masterCopySeparationSetLeft.ToString() + "_" + masterCopySeparationSetRight.ToString() + "_mask.jpg" : Global.sVirtualImageFolder + "/" + masterCopySeparationSetLeft.ToString() + "_" + masterCopySeparationSetRight.ToString() + ".jpg"; if ((bool)Application["LogUserAccess"] == true) { LogUserView(masterCopySeparationSetLeft > 0 ? masterCopySeparationSetLeft : masterCopySeparationSetRight, (string)Session["UserName"]); } maskbutton.Checked = false; if (hasTiles && (string)Session["ShowSep"] == "MASK") { simpleFlash = 0; sImagePath = (string)Session["ImagePathMask"] + "/"; maskbutton.Checked = true; return; } if (hasTiles && (string)Session["ShowSep"] == "CMYK") { simpleFlash = 0; sImagePath += "/"; return; } // All other images are shown without tiles simpleFlash = 1; sImagePath += ".jpg"; }