Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                var categories = ExtensionMethods.GetCategories();

                ExtensionMethods.PopulateNodes(categories, CategoriesTreeView);
                CategoriesTreeView.CollapseAll();
            }
        }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         MasterPagePresenter p = new MasterPagePresenter(new MasterPageViewModel(), this);
         p.PopulateMasterPage();
         TreeHelper.PopulateNodes(tv, CategoriesTreeView);
         CategoriesTreeView.CollapseAll();
         if (!UserHelper.IsUserLoggedIn())
         {
             CreateAuctionLabel.Visible = false;
         }
     }
 }
Esempio n. 3
0
        protected void RemoveCategoryButton_Click(object sender, EventArgs e)
        {
            if (SelectedCategoriesListBox.SelectedIndex < 0)
            {
                return;
            }

            string selectedValue = SelectedCategoriesListBox.SelectedValue;

            foreach (ListItem li in SelectedCategoriesListBox.Items)
            {
                if (li.Value == selectedValue)
                {
                    SelectedCategoriesListBox.Items.Remove(li);
                    CategoriesTreeView.UncheckNode(NumericUtils.ParseInt32(selectedValue, 0));
                    break;
                }
            }
        }
Esempio n. 4
0
        private void DisplayHomepage(Homepage homepage)
        {
            if (homepage.BrandId != EditingBrandId)
            {
                MessageLabel1.Pinned = true;
                MessageLabel1.SetErrorMessage("This brand does not have its own homepage and is using the homepage from the master brand.");
            }

            HomepageId = homepage.HomepageId.GetValueOrDefault();

            // Rebind the categories list
            CategoriesTreeView.BrandId = EditingBrandId;
            CategoriesTreeView.BindList();
            CategoriesTreeView.ExpandAll();

            // Clear the selected categories
            SelectedCategoriesListBox.Items.Clear();

            // Update bumper page settings
            IncludeBumperPageCheckBox.Checked = homepage.HasBumperPage;
            SkipBumperPageCheckBox.Checked    = homepage.BumperPageSkip;
            BumperPageTextBox.Text            = homepage.BumperPageHtml;
            BumperPageHtmlWrapper.Visible     = IncludeBumperPageCheckBox.Checked;

            // Update the homepage type selector
            HomepageTemplateTypeDropDownList.SafeSelectValue(homepage.HomepageTypeId);
            StandardTemplateEditorPanel.Visible   = (homepage.HomepageType.ShortName.ToLower() == "standard");
            CustomHtmlTemplateEditorPanel.Visible = (!StandardTemplateEditorPanel.Visible);

            // Update the user interface
            IntroTextBox.Text        = homepage.IntroText;
            HomepageImageEditor1.Url = homepage.Url1;
            HomepageImageEditor2.Url = homepage.Url2;
            HomepageImageEditor3.Url = homepage.Url3;
            HomepageImageEditor4.Url = homepage.Url4;
            HomepageImageEditor1.Image.HomepageId = HomepageId;
            HomepageImageEditor2.Image.HomepageId = HomepageId;
            HomepageImageEditor3.Image.HomepageId = HomepageId;
            HomepageImageEditor4.Image.HomepageId = HomepageId;
            CustomHtmlTextBox.Text = homepage.CustomHtml;
            LastModifiedLabel.Text = string.Format("Last modified by {0} on {1}", homepage.LastModifiedByUser.FullName, homepage.LastModifiedDate.ToString(Global.DateFormat));

            // Select all categories in the UI and update the selected categories listbox
            // But only do this if the homepage being viewed is for the correct brand
            // Ie. if we're viewing the master homepage for another brand because we want to copy it
            // when published, then don't display the category bindings as the homepage being edited
            // won't have access to another brand's categories.
            if (homepage.BrandId == EditingBrandId)
            {
                foreach (Category category in homepage.CategoryList)
                {
                    CategoriesTreeView.CheckNode(category.CategoryId.GetValueOrDefault());

                    string   categoryName = SiteUtils.GetFullCategoryName(category);
                    string   categoryId   = category.CategoryId.ToString();
                    ListItem listItem     = new ListItem(categoryName, categoryId);

                    SelectedCategoriesListBox.Items.Add(listItem);
                }
            }

            // Can only cancel if homepage is not published
            CancelButton.Visible = (!homepage.IsPublished);

            if (!homepage.IsPublished)
            {
                MessageLabel1.SetErrorMessage("This homepage is currently in draft mode.  To make live, click on 'publish'.");
                MessageLabel1.Pinned = true;
            }
        }