Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            const string PARENT_PARAM_NAME = "ParentInstanceID";

            _parentNavId = int.Parse(Request.QueryString[PARENT_PARAM_NAME]);

            if (!IsPostBack)
            {
                WebpageInfo parentPage = Webpage.GetWebpage(_parentNavId);
                if (null == parentPage)
                {
                    throw new ArgumentException(string.Format("Invalid {0}.", PARENT_PARAM_NAME));
                }

                //check user permissions.
                if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(_parentNavId, Page.User))
                {
                    throw new System.Security.SecurityException(BayshoreSolutions.WebModules.Security.Permission.MSG_SECURITY_FAILURE);
                }

                if (_parentNavId == Webpage.RootNavigationId) //system root
                {                                             //root page of a new website, located under the system root.
                    HeaderCtl.InnerHtml     = "New Website";
                    DisplayCheckBox.Visible = false;
                }

                //
                //bind templates list
                //
                TemplateDropDownList.DataSource = BayshoreSolutions.WebModules.WebDirectories.GetTemplates();
                TemplateDropDownList.DataBind();
                string defaultTemplate = parentPage.Website.RootWebpage.TemplateGroup + " - Subpage";
                //if(TemplateDropDownList.Items.FindByValue(
                //default to the "subpage" template for the convenience of the user.
                TemplateDropDownList.SelectedValue = defaultTemplate;

                //
                //bind themes list
                //
                ThemeDropDownList.DataSource = BayshoreSolutions.WebModules.WebDirectories.GetThemes();
                ThemeDropDownList.DataBind();

                Page.SetFocus(TitleTextBox.ClientID);
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _instanceId = int.Parse(Request.QueryString["InstanceId"]);
            _page       = Webpage.GetWebpage(_instanceId);
            sitemapXmlEdit.WebpageInfo = _page;

            ParentPage.HideNavigationId = _instanceId;

            //load controls for dynamic page properties, if any.
            TemplatePropertiesDisplay.ControlPath   = _page.TemplatePath;
            TemplatePropertiesDisplay.DefaultValues = _page.TemplateProperties;

            // set fields to defaults
            if (!IsPostBack)
            {
                //check user permissions.
                if (!BayshoreSolutions.WebModules.Security.NavigationRole.IsUserAuthorized(_instanceId, Page.User))
                {
                    throw new System.Security.SecurityException(BayshoreSolutions.WebModules.Security.Permission.MSG_SECURITY_FAILURE);
                }

                if (_page.ParentInstanceId == null || _page.ParentInstanceId <= Webpage.RootNavigationId)
                {
                    //hide the parent page picker (the portal root must always have a null parent;
                    //website root pages must always be children of the portal root).
                    ParentPage_div.Visible = false;
                    //hide the path name textbox (path name is irrelevant for a website's root page).
                    PathNameEditCtl.Visible         = false;
                    ParentPage.SelectedNavigationId = 0;
                }
                else
                {
                    ParentPage.SelectedNavigationId = _page.ParentInstanceId.Value;
                }

                TitleTextBox.Text          = _page.Title;
                NavigationTextTextBox.Text = _page.Text;
                PathNameEditCtl.PathName   = _page.PathName;
                //DescriptionText.Text = _page.Description;
                MetaKeywordsTextbox.Text    = _page.MetaKeywords;
                MetaDescriptionTextbox.Text = _page.MetaDescription;
                VisibleCheckBox.Checked     = _page.Visible;

                /*
                 * // SitemapXml settings
                 * checkSitemapXmlIncludePage.Checked = _page.SitemapXml_IncludePage;
                 * if (_page.SitemapXml_IncludePage)
                 * {
                 *  checkSitemapXmlIncludeLastMod.Checked = _page.SitemapXml_IncludeLastmod;
                 *
                 *  string strLastMod = null;
                 *  if( checkSitemapXmlIncludeLastMod.Checked )
                 *  {
                 *      if (_page.SitemapXml_LastModified.HasValue)
                 *      {
                 *          strLastMod = _page.SitemapXml_LastModified.Value.ToShortDateString();
                 *          if( _page.SitemapXml_LastModified.Value.TimeOfDay.TotalSeconds > 0)
                 *          {
                 *              strLastMod += " " +_page.SitemapXml_LastModified.Value.ToShortTimeString();
                 *          }
                 *      }
                 *  }
                 *  txtSitemapXmlLastMod.Text = strLastMod;
                 *
                 *  checkSitemapXmlIncludeChangeFreq.Checked = _page.SitemapXml_IncludeChangefreq;
                 *  if (checkSitemapXmlIncludeChangeFreq.Checked)
                 *  {
                 *      string strChangeFreq = _page.SitemapXml_Changefreq;
                 *      if (!string.IsNullOrEmpty(strChangeFreq))
                 *      {
                 *          ListItem liChangeFreq = ddlChangeFreq.Items.FindByValue(strChangeFreq);
                 *          if (liChangeFreq != null)
                 *          {
                 *              ddlChangeFreq.ClearSelection();
                 *              liChangeFreq.Selected = true;
                 *          }
                 *      }
                 *  }
                 *
                 *  checkSitemapXmlIncludePriority.Checked = _page.SitemapXml_IncludePriority;
                 *  if( checkSitemapXmlIncludePriority.Checked )
                 *  {
                 *      decimal dPriority = _page.SitemapXml_Priority;
                 *      if( dPriority >= 1 )
                 *      {
                 *          ddlSitemapXmlPriorityOnes.SelectedValue = "1";
                 *          ddlSitemapXmlPriorityTenths.SelectedValue = "0";
                 *      }
                 *      else
                 *      {
                 *          ddlSitemapXmlPriorityOnes.SelectedValue = "0";
                 *          ddlSitemapXmlPriorityTenths.SelectedValue = ((int)(dPriority * 10M)).ToString();
                 *      }
                 *  }
                 * }
                 * EnableDisableSitemapControls();
                 */

                //templates
                TemplatesDropDownList.DataSource = BayshoreSolutions.WebModules.WebDirectories.GetTemplates();
                TemplatesDropDownList.DataBind();
                TemplatesDropDownList.SelectedValue = _page.TemplateGroup + " - " + _page.Template;

                //themes
                ThemeDropDownList.DataSource = BayshoreSolutions.WebModules.WebDirectories.GetThemes();
                ThemeDropDownList.DataBind();
                ThemeDropDownList.SelectedValue = _page.Theme;
            }
        }