/// <summary>Raises the load event.</summary>
        /// <param name="e">
        /// The <see cref="T:System.EventArgs" /> instance containing the event data.
        /// </param>
        /// <contract>
        ///   <requires name="e" condition="not null" />
        /// </contract>
        protected override void OnLoad(EventArgs e)
        {
            Assert.ArgumentNotNull((object)e, "e");
            base.OnLoad(e);
            Dictionary <string, string> settings = new Dictionary <string, string>();

            this.UploadID        = Guid.NewGuid().ToString();
            settings["uploadID"] = this.UploadID;
            if (UIUtil.IsFirefox() || UIUtil.IsWebkit())
            {
                string sessionId = HttpContext.Current.Session.SessionID;
                Assert.IsNotNullOrEmpty(sessionId, "session id");
                settings["uploadSessionID"]  = sessionId;
                settings["uploadSessionID1"] = TicketManager.GetCurrentTicketId();
            }
            this.Versioned.Checked = Settings.Media.UploadAsVersionableByDefault;
            this.AsFiles.Visible   = !Settings.Media.DisableFileMedia;
            this.AsFiles.Checked   = Settings.Media.UploadAsFiles;
            if (!Settings.Upload.UserSelectableDestination)
            {
                this.AsFiles.Visible = false;
            }
            settings["uploadLimit"]             = !this.AsFiles.Checked ? Math.Min(Settings.Media.MaxSizeInDatabase, Settings.Runtime.EffectiveMaxRequestLengthBytes).ToString() : Settings.Runtime.EffectiveMaxRequestLengthBytes.ToString();
            settings["uploadFileLimit"]         = Settings.Runtime.EffectiveMaxRequestLengthBytes.ToString();
            settings["uploadingAsFilesMessage"] = Translate.Text("At least one of the files is too large to be uploaded to the database.");

            settings["uploadImageLimit"] = Sitecore.Configuration.Settings.GetSetting("Media.MaxImageSizeInDatabase");

            this.RenderSettings(settings);
        }
Example #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"></see> event.
        /// </summary>
        /// <param name="e">
        /// The <see cref="T:System.EventArgs"></see> object that contains the event data.
        /// </param>
        protected override void OnLoad(EventArgs e)
        {
            Assert.ArgumentNotNull((object)e, "e");
            base.OnLoad(e);
            if (XamlControl.AjaxScriptManager.IsEvent)
            {
                return;
            }
            Button descendantControl = this.FindDescendantControl("OK") as Button;

            if (descendantControl != null)
            {
                this.Text = Translate.Text("Click Browse to select the file that you want to upload.");
                descendantControl.Visible = false;
            }
            this.UploadID            = Guid.NewGuid().ToString();
            this.InputUploadID.Value = this.UploadID;
            if (!UIUtil.IsFirefox() && !UIUtil.IsWebkit())
            {
                return;
            }
            string sessionId = this.Context.Session.SessionID;

            Assert.IsNotNullOrEmpty(sessionId, "session id");
            this.UploadSessionID.Value  = sessionId;
            this.UploadSessionID1.Value = TicketManager.GetCurrentTicketId();

            this.uploadImageLimit.Value = Sitecore.Configuration.Settings.GetSetting("Media.MaxImageSizeInDatabase");
        }
Example #3
0
        private static bool TryRelogin()
        {
            string currentTicketId = TicketManager.GetCurrentTicketId();

            return(!string.IsNullOrEmpty(currentTicketId) &&
                   TicketManager.IsTicketValid(currentTicketId) &&
                   TicketManager.Relogin(currentTicketId));
        }
Example #4
0
        protected void Logout(object sender, EventArgs e)
        {
            CacheManager.ClearSecurityCache(Sitecore.Context.User.Name);
            RecentDocuments.Remove(Sitecore.Context.User.Name);
            Sitecore.Shell.Framework.Security.Abandon();
            string currentTicketId = TicketManager.GetCurrentTicketId();

            if (string.IsNullOrEmpty(currentTicketId))
            {
                return;
            }
            TicketManager.RemoveTicket(currentTicketId);


            Response.Redirect(WebUtil.GetFullUrl(Factory.GetSiteInfo("shell").LoginPage) + "?redirect=" + Request.RawUrl);
        }