Example #1
0
        protected string GetPreviewText(OrganisationalUnitPage page)
        {
            if (PreviewTextLength <= 0)
            {
                return(string.Empty);
            }

            string previewText = String.Empty;

            /*
             * if (page.MainBody != null)
             * {
             *  previewText = page.MainBody.ToHtmlString();
             * }
             */

            if (String.IsNullOrEmpty(previewText))
            {
                return(string.Empty);
            }

            //If the MainBody contains DynamicContents, replace those with an empty string
            StringBuilder regexPattern = new StringBuilder(@"<span[\s\W\w]*?classid=""");

            regexPattern.Append(DynamicContentFactory.Instance.DynamicContentId.ToString());
            regexPattern.Append(@"""[\s\W\w]*?</span>");
            previewText = Regex.Replace(previewText, regexPattern.ToString(), string.Empty, RegexOptions.IgnoreCase | RegexOptions.Multiline);

            return(TextIndexer.StripHtml(previewText, PreviewTextLength));
        }
        public ActionResult Index(OrganisationalUnitPage currentPage)
        {
            var model = currentPage; // PageViewModel.Create(currentPage);

            //Connect the view models logotype property to the start page's to make it editable
            var editHints = ViewData.GetEditHints <OrganisationalUnitPage, OrganisationalUnitPage>();

            editHints.AddConnection(m => m.Category, p => p.Category);
            editHints.AddConnection(m => m.StartPublish, p => p.StartPublish);

            return(View(model));
        }
Example #3
0
        public static IEnumerable <CategoryItemModel> GetCategoryViewModels(OrganisationalUnitPage currentPage)
        {
            List <CategoryItemModel> tags = new List <CategoryItemModel>();

            foreach (var item in currentPage.Category)
            {
                var      categoryRepository = ServiceLocator.Current.GetInstance <CategoryRepository>();
                Category cat = categoryRepository.Get(item); // Category.Find(item);
                tags.Add(new CategoryItemModel()
                {
                    Title = cat.Name, Url = ""
                });                                                               // TagFactory.Instance.GetTagUrl(currentPage, cat) });
            }

            return(tags);
        }
        public ActionResult Full(OrganisationalUnitPage currentPage)
        {
            PreviewTextLength = 200;

            var model = new OrganisationalUnitPageModel(currentPage)
            {
                Category    = currentPage.Category,
                Categories  = CategoryHelper.GetCategoryViewModels(currentPage),
                PreviewText = GetPreviewText(currentPage),
                // MainBody = currentPage.MainBody,
                StartPublish = currentPage.StartPublish
            };

            var editHints = ViewData.GetEditHints <OrganisationalUnitPageModel, OrganisationalUnitPage>();

            editHints.AddConnection(m => m.Category, p => p.Category);
            editHints.AddFullRefreshFor(p => p.Category);
            editHints.AddFullRefreshFor(p => p.StartPublish);



            return(PartialView("Full", model));
        }