Ejemplo n.º 1
0
    protected void DeletePageBtn_Click(object sender, EventArgs e)
    {
        HtmlTable         Table   = (HtmlTable)LoginView1.FindControl("PageDetails");
        TreeView          pagesTV = (TreeView)LoginView1.FindControl("PagesTreeView");
        SiteMapDataSource source  = (SiteMapDataSource)LoginView1.FindControl("SiteMapDataSource1");

        if (pagesTV.SelectedValue != string.Empty)
        {
            string    temp   = pagesTV.SelectedValue;
            string    pageid = WebPageData.GetWebPageId(temp);
            ArrayList list   = ModuleData.GetAllModules(pageid);
            if ((pageid != "1") && (list.Count == 0))
            {
                WebPageData.DeletePage(pageid);
                editor = new SitemapEditor();
                editor.DeletePage(pageid);
                editor.Save();
                pagesTV.DataSource = source;
                pagesTV.DataBind();
                Table.Visible = false;
            }
        }
    }
Ejemplo n.º 2
0
    protected void LoadPageContent()
    {
        if (!(File.Exists(HttpContext.Current.Server.MapPath("~/Web.sitemap"))))
        {
            SitemapEditor editor = new SitemapEditor();
            editor.Save();
        }
        string temp = Context.Items["VirtualPage"].ToString();

        if (temp == "/")
        {
            temp = "~/default.aspx";
        }
        string pageid = WebPageData.GetWebPageId(temp);

        _page = WebPageData.LoadPageData(pageid);

        if (_page.Title.Trim() != string.Empty)
        {
            Title = _page.Title;
        }
        else
        {
            Title = website.WebSiteTitle;
        }


        // Load all modules

        modulelist = ModuleData.GetAllModules(pageid);
        foreach (int moduleid in modulelist)
        {
            Module module   = ModuleData.LoadModuleData(moduleid);
            string filename = ModuleData.GetModuleType(module.ModuleDefinitionId);
            ModuleControlBaseClass control = new ModuleControlBaseClass(module.ModuleId);
            control          = (ModuleControlBaseClass)LoadControl(filename);
            control.ModuleId = module.ModuleId;

            if ((User.IsInRole(module.EditRoles)) || User.IsInRole("administrators"))
            {
                control.AdminView = true;
            }
            else
            {
                control.AdminView = false;
            }

            if (!IsPostBack)
            {
                control.ViewMode = ViewMode.ReadOnly;
            }
            if ((User.IsInRole(module.EditRoles)) || User.IsInRole("administrators"))
            {
                CenterArea.Controls.Add(control);
            }
            else
            {
                if (module.PanelName == "CenterArea")
                {
                    CenterArea.Controls.Add(control);
                }
                if (module.PanelName == "LeftArea")
                {
                    LeftArea.Controls.Add(control);
                }
                if (module.PanelName == "RightArea")
                {
                    RightArea.Controls.Add(control);
                }
            }
        }

        HtmlMeta keywords = new HtmlMeta();

        keywords.Attributes.Add("name", "keywords");
        keywords.Attributes.Add("content", website.Keywords);
        Header.Controls.Add(keywords);

        HtmlMeta description = new HtmlMeta();

        description.Attributes.Add("name", "description");
        description.Attributes.Add("content", website.Description);
        Header.Controls.Add(description);
    }