Example #1
0
    /// <summary>
    /// Bind data to the fields 
    /// </summary>
    protected void BindData()
    {
        ContentPageAdmin pageAdmin = new ContentPageAdmin();
        ContentPage contentPage = new ContentPage();

        if (ItemId > 0)
        {
            contentPage = pageAdmin.GetPageByID(ItemId);

            //set fields
            lblTitle.Text += contentPage.Title;
            txtTitle.Text = contentPage.Title;
            txtSEOMetaDescription.Text = contentPage.SEOMetaDescription;
            txtSEOMetaKeywords.Text = contentPage.SEOMetaKeywords;
            txtSEOTitle.Text = contentPage.SEOTitle;
            txtSEOUrl.Text = contentPage.SEOURL;

            //get content
            ctrlHtmlText.Html = pageAdmin.GetPageHTMLByName(contentPage.Name);
        }
        else
        {
            //nothing to do here
        }
    }
Example #2
0
    /// <summary>
    /// Bind data to the fields 
    /// </summary>
    protected void BindData()
    {
        ContentPageAdmin pageAdmin = new ContentPageAdmin();
        ContentPage contentPage = new ContentPage();

        if (ItemId > 0)
        {
            contentPage = pageAdmin.GetPageByID(ItemId);

            //set fields
            txtName.Text = contentPage.Name.Trim();
            txtSEOMetaDescription.Text = contentPage.SEOMetaDescription;
            txtSEOMetaKeywords.Text = contentPage.SEOMetaKeywords;
            txtSEOTitle.Text = contentPage.SEOTitle;
            txtSEOUrl.Text = contentPage.SEOURL;
            txtTitle.Text = contentPage.Title;
            ddlPageTemplateList.SelectedValue = contentPage.MasterPage;

            //get content
            ctrlHtmlText.Html = pageAdmin.GetPageHTMLByName(contentPage.Name);
            if (contentPage.Name.Contains("Home"))
            {
                pnlSEOURL.Visible = false;
            }
        }
        else
        {
           //nothing to do here
        }
    }
Example #3
0
    /// <summary>
    /// Submit button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        ContentPageAdmin pageAdmin = new ContentPageAdmin();
        ContentPage contentPage = new ContentPage();
        string mappedSEOUrl = "";

        bool allowDelete = true;

        // If edit mode then retrieve data first
        if (ItemId > 0)
        {
            contentPage = pageAdmin.GetPageByID(ItemId);
            allowDelete = contentPage.AllowDelete; //override this setting
            if (contentPage.SEOURL != null)
                mappedSEOUrl = contentPage.SEOURL;
        }

        // set values
        contentPage.ActiveInd = true;
        contentPage.Title = txtTitle.Text;
        contentPage.PortalID = ZNodeConfigManager.SiteConfig.PortalID;
        contentPage.SEOMetaDescription = txtSEOMetaDescription.Text;
        contentPage.SEOMetaKeywords = txtSEOMetaKeywords.Text;
        contentPage.SEOTitle = txtSEOTitle.Text;
        contentPage.SEOURL = null;
        if (txtSEOUrl.Text.Trim().Length > 0)
            contentPage.SEOURL = txtSEOUrl.Text.Trim().Replace(" ", "-");

        bool retval = false;

        if (ItemId > 0)
        {
            // update code here
            retval = pageAdmin.UpdatePage(contentPage, ctrlHtmlText.Html, HttpContext.Current.User.Identity.Name, mappedSEOUrl, chkAddURLRedirect.Checked);
        }

        if (retval)
        {
            // redirect to main page
            Response.Redirect(ManageLink);
        }
        else
        {
            if (contentPage.SEOURL != null)
            {
                // display error message
                lblMsg.Text = "Failed to update page. Please check with SEO Url settings and try again.";
            }
            else
            {
                // display error message
                lblMsg.Text = "Failed to update page. Please try again.";
            }
        }
    }
Example #4
0
    /// <summary>
    /// Bind data to the fields on the screen
    /// </summary>
    protected void BindData()
    {
        ContentPageAdmin pageAdmin = new ContentPageAdmin();
        ContentPage contentPage = pageAdmin.GetPageByID(ItemId);
        PageName = contentPage.Name;

        if (!contentPage.AllowDelete)
        {
            btnDelete.Enabled = false;
            lblMsg.Text = "This page is a reserved page and cannot be deleted.";
        }
    }
Example #5
0
    /// <summary>
    /// Delete button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        ContentPageAdmin pageAdmin = new ContentPageAdmin();
        ContentPage contentPage = pageAdmin.GetPageByID(ItemId);

        bool retval = pageAdmin.DeletePage(contentPage);

        if (!retval)
        {
            lblMsg.Text = "Error: Delete action could not be completed.";
        }
        else
        {
            Response.Redirect("~/admin/secure/design/pages/default.aspx");
        }
    }
Example #6
0
    /// <summary>
    /// Bind data to grid
    /// </summary>
    private void BindGridData()
    {
        ContentPageAdmin pageAdmin = new ContentPageAdmin();
        TList<ContentPageRevision> revisionList = pageAdmin.GetPageRevisions(ItemId);
        revisionList.Sort("UpdateDate Desc");

        ContentPage page = pageAdmin.GetPageByID(ItemId);
        PageName = page.Name;

        uxGrid.DataSource = revisionList;
        uxGrid.DataBind();
    }
Example #7
0
    /// <summary>
    /// Event triggered when a command button is clicked on the grid
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void uxGrid_RowCommand(Object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "page")
        {
        }
        else
        {
            // Convert the row index stored in the CommandArgument
            // property to an Integer.
            int index = Convert.ToInt32(e.CommandArgument);

            // Get the values from the appropriate
            // cell in the GridView control.
            GridViewRow selectedRow = uxGrid.Rows[index];

            TableCell Idcell = selectedRow.Cells[0];
            string Id = Idcell.Text;

            if (e.CommandName == "Edit")
            {
                EditLink = EditLink + "?itemid=" + Id;
                Response.Redirect(EditLink);
            }
            else if (e.CommandName == "Publish")
            {
                ContentPageAdmin pageAdmin = new ContentPageAdmin();
                ContentPage contentPage = pageAdmin.GetPageByID(int.Parse(Id));
                pageAdmin.PublishPage(contentPage);
                Response.Redirect(ListLink);

            }
            else if (e.CommandName == "Revert")
            {
                RevertLink = RevertLink + "?itemid=" + Id;
                Response.Redirect(RevertLink);
            }
            else if (e.CommandName == "Delete")
            {
                Response.Redirect(DeleteLink + "?itemid=" + Id);
            }
        }
    }