Exemple #1
0
        protected void SubCategoriesRepeater_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType.Equals(ListItemType.Item) || e.Item.ItemType.Equals(ListItemType.AlternatingItem))
            {
                var category    = (Category)e.Item.DataItem;
                int assetsCount = category.AvailableAssetCount;

                var subCategoryLink = (LinkButton)e.Item.FindControl("SubCategoryLink");
                subCategoryLink.Text    = category.Name;
                subCategoryLink.ToolTip = string.Concat(category.Brand.Name, " / ", SiteUtils.GetFullCategoryName(category));

                var assetsCountLabel = (Label)e.Item.FindControl("AssetsCountLabel");
                assetsCountLabel.Text = " (" + assetsCount + ")";
            }
        }
        protected void CategoriesRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (GeneralUtils.ValueIsInList(e.Item.ItemType, ListItemType.Item, ListItemType.AlternatingItem))
            {
                // Get the category
                Category category = (Category)e.Item.DataItem;

                // Get the link button
                LinkButton categoryLinkButton = (LinkButton)e.Item.FindControl("CategoryLinkButton");

                if (!category.ParentCategory.IsNull)
                {
                    categoryLinkButton.CommandArgument = category.CategoryId.ToString();
                    categoryLinkButton.Text            = category.Name;
                    categoryLinkButton.ToolTip         = SiteUtils.GetFullCategoryName(category);
                    categoryLinkButton.Visible         = true;
                }
            }
        }
Exemple #3
0
        protected void CategoriesTreeView_TreeNodeCheckChanged(object sender, TreeNodeEventArgs e)
        {
            int categoryId = NumericUtils.ParseInt32(e.Node.Value, 0);

            if (e.Node.Checked)
            {
                Category category = CategoryCache.Instance.GetById(categoryId);
                ListItem li       = new ListItem(SiteUtils.GetFullCategoryName(category), categoryId.ToString());
                SelectedCategoriesListBox.Items.Add(li);
            }
            else
            {
                foreach (ListItem li in SelectedCategoriesListBox.Items)
                {
                    if (li.Value == categoryId.ToString())
                    {
                        SelectedCategoriesListBox.Items.Remove(li);
                        break;
                    }
                }
            }
        }
Exemple #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;
            }
        }