예제 #1
0
    protected void MoveUpBtn_Click(object sender, ImageClickEventArgs e)
    {
        HtmlTable         Table   = (HtmlTable)LoginView1.FindControl("PageDetails");
        TreeView          pagesTV = (TreeView)LoginView1.FindControl("PagesTreeView");
        SiteMapDataSource source  = (SiteMapDataSource)LoginView1.FindControl("SiteMapDataSource1");
        string            temp    = pagesTV.SelectedValue;
        string            pageid  = WebPageData.GetWebPageId(temp);

        editor = new SitemapEditor();
        editor.MoveUp(pageid);
        editor.Save();
        pagesTV.DataSource = source;
        pagesTV.DataBind();
    }
예제 #2
0
    protected void UpdatePageBtn_Click(object sender, EventArgs e)
    {
        HtmlTable Table = (HtmlTable)LoginView1.FindControl("PageDetails");

        Table.Visible = true;
        TreeView          pagesTV        = (TreeView)LoginView1.FindControl("PagesTreeView");
        SiteMapDataSource source         = (SiteMapDataSource)LoginView1.FindControl("SiteMapDataSource1");
        TextBox           TitleTB        = (TextBox)LoginView1.FindControl("TitleTextBox");
        TextBox           NavigationTB   = (TextBox)LoginView1.FindControl("NavigationTextBox");
        TextBox           VirtualPathTB  = (TextBox)LoginView1.FindControl("VirtualPathTextBox");
        DropDownList      AccessRolesDDL = (DropDownList)LoginView1.FindControl("AccessRolesDropDownList");
        DropDownList      EditRolesDDL   = (DropDownList)LoginView1.FindControl("EditRolesDropDownList");
        CheckBox          VisibleCB      = (CheckBox)LoginView1.FindControl("VisibleCheckBox");

        string  temp   = pagesTV.SelectedValue;
        string  pageid = WebPageData.GetWebPageId(temp);
        WebPage page   = WebPageData.LoadPageData(pageid);

        page.Title = TitleTB.Text;

        page.NavigationName = NavigationTB.Text;
        if ((VirtualPathTB.Text != string.Empty) && (WebPageData.IsValidUrl(VirtualPathTB.Text)))
        {
            page.VirtualPath = VirtualPathTB.Text.ToLower();
        }
        else
        {
            page.VirtualPath = string.Format("~/default{0}.aspx", pageid);
        }
        page.AccessRole = AccessRolesDDL.SelectedValue;
        page.EditRole   = EditRolesDDL.SelectedValue;
        page.Visible    = VisibleCB.Checked;

        WebPageData.UpdatePage(page);
        editor = new SitemapEditor();
        editor.UpdatePage(page);
        editor.Save();
        pagesTV.DataSource = source;
        pagesTV.DataBind();
        Table.Visible = false;
    }
예제 #3
0
    protected void PagesTreeView_SelectedNodeChanged(object sender, EventArgs e)
    {
        HtmlTable Table = (HtmlTable)LoginView1.FindControl("PageDetails");

        Table.Visible = true;
        TreeView          pagesTV        = (TreeView)LoginView1.FindControl("PagesTreeView");
        SiteMapDataSource source         = (SiteMapDataSource)LoginView1.FindControl("SiteMapDataSource1");
        TextBox           TitleTB        = (TextBox)LoginView1.FindControl("TitleTextBox");
        TextBox           NavigationTB   = (TextBox)LoginView1.FindControl("NavigationTextBox");
        TextBox           VirtualPathTB  = (TextBox)LoginView1.FindControl("VirtualPathTextBox");
        DropDownList      AccessRolesDDL = (DropDownList)LoginView1.FindControl("AccessRolesDropDownList");
        DropDownList      EditRolesDDL   = (DropDownList)LoginView1.FindControl("EditRolesDropDownList");
        CheckBox          VisibleCB      = (CheckBox)LoginView1.FindControl("VisibleCheckBox");

        string temp = pagesTV.SelectedValue;

        if (temp != "Site Map")
        {
            string  pageid = WebPageData.GetWebPageId(temp);
            WebPage page   = WebPageData.LoadPageData(pageid);

            TitleTB.Text              = page.Title;
            NavigationTB.Text         = page.NavigationName;
            VirtualPathTB.Text        = page.VirtualPath;
            VisibleCB.Checked         = page.Visible;
            AccessRolesDDL.DataSource = Roles.GetAllRoles();
            AccessRolesDDL.DataBind();
            AccessRolesDDL.Items.Insert(0, new ListItem("Anonymous", "Anonymous"));
            AccessRolesDDL.SelectedValue = page.AccessRole;
            EditRolesDDL.DataSource      = Roles.GetAllRoles();
            EditRolesDDL.DataBind();
            EditRolesDDL.SelectedValue = page.EditRole;
        }
        else
        {
            Response.Redirect("~/administration/navigation.aspx");
        }
    }
예제 #4
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;
            }
        }
    }
예제 #5
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);
    }