Example #1
0
    protected void DeleteButton_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["id"]))
        {
            // TODO: Debemos eliminar el contenido almacenado por el web part manager para este url.
            _page = CodeFactory.ContentManager.Page.Load(new Guid(Request.QueryString["id"]));

            if (_page != null)
            {
                _page.Delete();
                _page.Save();
            }
        }

        Response.Redirect("~/default.aspx");
    }
Example #2
0
    protected void CancelButton_Click(object sender, EventArgs e)
    {
        WebPartManager currentWebPartManager = WebPartManager.GetCurrentWebPartManager(this.Page);

        _page = CodeFactory.ContentManager.Page.Load(new Guid(Request.QueryString["id"]));

        if (_page != null)
            Response.Redirect(_page.RelativeLink, false);
        else
            Response.Redirect("~/default.aspx", false);

        // esets personalization data for the current page, scope, and user in the underlying data store.
        // As a side effect of the reset, the currently executing page is re-executed by a Transfer call.
        if (currentWebPartManager.Personalization.HasPersonalizationState)
            currentWebPartManager.Personalization.ResetPersonalizationState();
    }
Example #3
0
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && !Page.IsCallback && !string.IsNullOrEmpty(Request.QueryString["id"]))
        {
            _page = CodeFactory.ContentManager.Page.Load(new Guid(Request.QueryString["id"]));
        }

        if (!IsPostBack)
            LayoutHelper.Value = _page != null ? _page.Layout : ContentManagementService.Settings.DefaultLayout;
        else
            LayoutHelper.Value = Request.Params["LayoutHelper"];

        try
        {
            this.LayoutPanel.Controls.Add(LoadControl(LayoutHelper.Value));
        }
        catch (HttpException)
        {
            this.LayoutPanel.Controls.Add(LoadControl(ContentManagementService.Settings.DefaultLayout));
        }
    }
Example #4
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["id"]))
        {
            _page = CodeFactory.ContentManager.Page.Load(new Guid(Request.QueryString["id"]));

            if (_page == null)
                _page = new CodeFactory.ContentManager.Page(new Guid(Request.QueryString["id"]));

            _page.Title = TitleTextBox.Text;
            _page.Slug = SlugTextBox.Text;
            _page.Description = DescriptionTextBox.Text;
            _page.Keywords = KeywordsTextBox.Text;
            _page.Layout = LayoutHelper.Value;
            _page.Author = User.Identity.Name;
            _page.IsVisible = IsVisibleCheckBox.Checked;

            if (IsDefaultCheckBox.Checked)
            {
                ContentManagementService.Settings.DefaultPage = _page.RelativeLink;
                ContentManagementService.SaveSettings();
            }

            _page.Save();
        }

        WebPartManager currentWebPartManager = WebPartManager.GetCurrentWebPartManager(this.Page);
        currentWebPartManager.DisplayMode = WebPartManager.BrowseDisplayMode;
    }
Example #5
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        _page = CodeFactory.ContentManager.Page.Load(new Guid(Request.QueryString["id"]));

        if (_page == null)
            _page = new CodeFactory.ContentManager.Page(new Guid(Request.QueryString["id"]));

        UpdatePage(_page);

        _page.AcceptChanges();

        WebPartManager currentWebPartManager = WebPartManager.GetCurrentWebPartManager(this.Page);

        Response.Redirect(_page.RelativeLink);
    }
Example #6
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Viene de la liga de página nueva? Redireccionando
        if (string.IsNullOrEmpty(Request.QueryString["id"]))
            Response.Redirect(string.Format("~/EditPage.aspx?id={0}", Guid.NewGuid()), true);

        // Intentando recuperar información de la página.
        if (!Page.IsPostBack && !Page.IsCallback && !string.IsNullOrEmpty(Request.QueryString["id"]))
            _page = CodeFactory.ContentManager.Page.Load(new Guid(Request.QueryString["id"]));

        // TODO: Checar si podemos cambiar LayoutHelper.Value por ViewState["Layout"]
        // Mostrando la distribución existente o la default para la página y almacenándola.
        if (!IsPostBack)
            LayoutHelper.Value = _page != null ? _page.Layout : ContentManagementService.Settings.DefaultLayout;
        else
            LayoutHelper.Value = Request.Params["LayoutHelper"];

        try
        {
            this.LayoutPanel.Controls.Add(LoadControl(LayoutHelper.Value));
        }
        catch (HttpException)
        {
            this.LayoutPanel.Controls.Add(LoadControl(ContentManagementService.Settings.DefaultLayout));
        }
    }