protected override void OnPreRender(EventArgs e) { if (!IsDesignTime && UploadModule.IsEnabled) { if (!Page.IsClientScriptBlockRegistered("NeatUploadMultiFile")) { Page.RegisterClientScriptBlock("NeatUploadMultiFile", @" <script type='text/javascript' language='javascript' src='" + UploadModule.BustCache(ResolveUrl("~/NeatUpload/SWFUpload.js")) + @"'></script>"); } if (!Page.IsClientScriptBlockRegistered("NeatUploadJs")) { Page.RegisterClientScriptBlock("NeatUploadJs", @" <script type='text/javascript' language='javascript' src='" + UploadModule.BustCache(ResolveUrl("~/NeatUpload/NeatUpload.js")) + @"'></script>"); } } if (!IsDesignTime) { Page.RegisterRequiresPostBack(this); } base.OnPreRender(e); }
protected override void OnPreRender(EventArgs e) { if (!Page.IsClientScriptBlockRegistered("NeatUploadJs")) { Page.RegisterClientScriptBlock("NeatUploadJs", @" <script type='text/javascript' language='javascript' src='" + UploadModule.BustCache(ResolveUrl("~/NeatUpload/NeatUpload.js")) + @"'></script>"); } this.Page.RegisterStartupScript("NeatUploadUnloadConfirmer-" + this.UniqueID, GetStartupScript()); base.OnPreRender(e); }
protected override void OnPreRender(EventArgs e) { if (!Width.IsEmpty && Width.Type != UnitType.Pixel) { throw new System.ArgumentOutOfRangeException("Width must use pixel(px) units when using a GreyBoxProgressBar."); } if (!Height.IsEmpty && Height.Type != UnitType.Pixel) { throw new System.ArgumentOutOfRangeException("Height must use pixel(px) units when using a GreyBoxProgressBar."); } base.OnPreRender(e); if (!UploadModule.IsEnabled) { return; } string expandedGreyBoxRoot = GreyBoxRoot; if (expandedGreyBoxRoot == null) { expandedGreyBoxRoot = "~/greybox"; } expandedGreyBoxRoot = ResolveUrl(expandedGreyBoxRoot); if (!Page.IsClientScriptBlockRegistered("GreyBoxJs")) { Page.RegisterClientScriptBlock("GreyBoxJs", String.Format(@" <script type='text/javascript' language='javascript'> var GB_ROOT_DIR = '{0}/'; </script> <script type='text/javascript' language='javascript' src='{1}'></script> <script type='text/javascript' language='javascript' src='{2}'></script> <script type='text/javascript' language='javascript' src='{3}'></script> <script type='text/javascript'> // Opera can't do fade-in effect during postback if (window.opera) AJS.fx = null; </script> <link href='{0}/gb_styles.css' rel='stylesheet' type='text/css' /> ", expandedGreyBoxRoot, UploadModule.BustCache(expandedGreyBoxRoot + "/AJS.js"), UploadModule.BustCache(expandedGreyBoxRoot + "/AJS_fx.js"), UploadModule.BustCache(expandedGreyBoxRoot + "/gb_scripts.js"))); } }
protected override void OnPreRender(EventArgs e) { if (UploadModule.IsEnabled) { // If we don't have a session yet and the session mode is not "Off", we need to create a // session so that it can be used to pass information between the progress display and the // upload request. Apparently the only way to force the session to be created is to put // something in it. if (HttpContext.Current.Session != null && Page.Session.Mode != System.Web.SessionState.SessionStateMode.Off && Page.Session.Count == 0 && !Page.Session.IsReadOnly) { Page.Session["NeatUpload_value"] = "ignored"; } InitializeVars(); if (!Page.IsClientScriptBlockRegistered("NeatUploadJs")) { Page.RegisterClientScriptBlock("NeatUploadJs", @" <script type='text/javascript' language='javascript' src='" + UploadModule.BustCache(ResolveUrl("~/NeatUpload/NeatUpload.js")) + @"'></script>"); } if (!Page.IsClientScriptBlockRegistered("NeatUploadProgressBar")) { Page.RegisterClientScriptBlock("NeatUploadProgressBar", @" <script type='text/javascript' language='javascript'> NeatUploadPB.prototype.ClearFileNamesAlert = '" + ResourceManagerSingleton.GetResourceString("ClearFileNamesAlert") + @"'; // --> </script> " ); } this.Page.RegisterStartupScript("NeatUploadProgressBarBase-" + this.UniqueID, GetStartupScript()); } base.OnPreRender(e); }
protected override void OnLoad(EventArgs e) { RegisterClientScriptBlock("NeatUpload-ProgressPage", "<script type='text/javascript' language='javascript' src='" + UploadModule.BustCache(ResolveUrl("Progress.js")) + @"'></script>"); SetupContext(); SetupBindableProps(); // Set the status to Cancelled if requested. if (Request.Params["cancelled"] == "true") { UploadModule.CancelPostBack(PostBackID); } if (Request.Params["useXml"] == "true") { Response.ContentType = "text/xml"; Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); Response.Write(@"<?xml version=""1.0"" encoding=""utf-8"" ?>"); } string prevStatus = Request.Params["prevStatus"]; if (prevStatus == null) { prevStatus = UploadStatus.Unknown.ToString(); } string curStatus = Status.ToString(); // If the status is unchanged from the last refresh and it is not Unknown nor *InProgress, // then the page is not refreshed. Instead, if an UploadException occurred we try to cancel // the upload. Otherwise, no exception occurred we close the progress display window (if it's a pop-up) if (curStatus == prevStatus && (Status != UploadStatus.Unknown && Status != UploadStatus.NormalInProgress && Status != UploadStatus.ChunkedInProgress && Status != UploadStatus.ProcessingInProgress )) { if (Status == UploadStatus.Rejected || (Status == UploadStatus.Failed && Failure is HttpException && ((HttpException)Failure).GetHttpCode() == 400)) { if (CanCancel) { RegisterStartupScript("scrNeatUploadError", @" <script type=""text/javascript"" language=""javascript""> <!-- window.onload = function() { NeatUploadStop('" + Status + @"'); } // --> </script>"); } } else if (Status != UploadStatus.Failed) { RegisterStartupScript("scrNeatUploadClose", @"<script type='text/javascript' language='javascript'> <!-- NeatUploadClose('" + ProgressBarID + @"'); // --> </script>"); } } // Otherwise, if we are refreshing, we refresh the page in one second else if (IsRefreshing) { // And add a prevStatus param to the url to track the previous status. string refreshUrl = RefreshUrl + "&prevStatus=" + curStatus; Refresh(refreshUrl); } base.OnLoad(e); }