Ejemplo n.º 1
0
        private void LoadSettings()
        {
            if (Page.IsPostBack) { return; }

            currentPage = CacheHelper.GetCurrentPage();
            timeOffset = SiteUtils.GetUserTimeOffset();
            timeZone = SiteUtils.GetUserTimeZone();
        }
        public Module GetModule(int moduleId, Guid featureGuid)
        {
            if (CurrentPage == null) { CurrentPage = CacheHelper.GetCurrentPage(); }

            if (CurrentPage == null) { return null; }

            foreach (Module m in CurrentPage.Modules)
            {
                if (
                    (m.ModuleId == moduleId)
                    && ((featureGuid == Guid.Empty) || (m.FeatureGuid == featureGuid))
                    )
                { return m; }
            }

            return null;
        }
Ejemplo n.º 3
0
        public static void CreatePage(SiteSettings siteSettings, ContentPage contentPage, PageSettings parentPage)
        {
            PageSettings pageSettings = new PageSettings();
            pageSettings.PageGuid = Guid.NewGuid();

            if (parentPage != null)
            {
                pageSettings.ParentGuid = parentPage.PageGuid;
                pageSettings.ParentId = parentPage.PageId;
            }

            pageSettings.SiteId = siteSettings.SiteId;
            pageSettings.SiteGuid = siteSettings.SiteGuid;
            pageSettings.AuthorizedRoles = contentPage.VisibleToRoles;
            pageSettings.EditRoles = contentPage.EditRoles;
            pageSettings.DraftEditOnlyRoles = contentPage.DraftEditRoles;
            pageSettings.CreateChildPageRoles = contentPage.CreateChildPageRoles;
            pageSettings.MenuImage = contentPage.MenuImage;
            pageSettings.PageMetaKeyWords = contentPage.PageMetaKeyWords;
            pageSettings.PageMetaDescription = contentPage.PageMetaDescription;

            CultureInfo uiCulture = Thread.CurrentThread.CurrentUICulture;
            if (WebConfigSettings.UseCultureOverride)
            {
                uiCulture = SiteUtils.GetDefaultUICulture(siteSettings.SiteId);
            }

            if (contentPage.ResourceFile.Length > 0)
            {
                pageSettings.PageName = ResourceHelper.GetResourceString(contentPage.ResourceFile, contentPage.Name, uiCulture, false);
                if (contentPage.Title.Length > 0)
                {
                    pageSettings.PageTitle = ResourceHelper.GetResourceString(contentPage.ResourceFile, contentPage.Title, uiCulture, false);
                }
            }
            else
            {
                pageSettings.PageName = contentPage.Name;
                pageSettings.PageTitle = contentPage.Title;
            }

            pageSettings.PageOrder = contentPage.PageOrder;
            pageSettings.Url = contentPage.Url;
            pageSettings.RequireSsl = contentPage.RequireSsl;
            pageSettings.ShowBreadcrumbs = contentPage.ShowBreadcrumbs;

            pageSettings.BodyCssClass = contentPage.BodyCssClass;
            pageSettings.MenuCssClass = contentPage.MenuCssClass;
            pageSettings.IncludeInMenu = contentPage.IncludeInMenu;
            pageSettings.IsClickable = contentPage.IsClickable;
            pageSettings.IncludeInSiteMap = contentPage.IncludeInSiteMap;
            pageSettings.IncludeInChildSiteMap = contentPage.IncludeInChildPagesSiteMap;
            pageSettings.AllowBrowserCache = contentPage.AllowBrowserCaching;
            pageSettings.ShowChildPageBreadcrumbs = contentPage.ShowChildPageBreadcrumbs;
            pageSettings.ShowHomeCrumb = contentPage.ShowHomeCrumb;
            pageSettings.ShowChildPageMenu = contentPage.ShowChildPagesSiteMap;
            pageSettings.HideAfterLogin = contentPage.HideFromAuthenticated;
            pageSettings.EnableComments = contentPage.EnableComments;

            pageSettings.Save();

            if (!FriendlyUrl.Exists(siteSettings.SiteId, pageSettings.Url))
            {
                if (!WebPageInfo.IsPhysicalWebPage(pageSettings.Url))
                {
                    FriendlyUrl friendlyUrl = new FriendlyUrl();
                    friendlyUrl.SiteId = siteSettings.SiteId;
                    friendlyUrl.SiteGuid = siteSettings.SiteGuid;
                    friendlyUrl.PageGuid = pageSettings.PageGuid;
                    friendlyUrl.Url = pageSettings.Url.Replace("~/", string.Empty);
                    friendlyUrl.RealUrl = "~/Default.aspx?pageid=" + pageSettings.PageId.ToInvariantString();
                    friendlyUrl.Save();
                }
            }

            foreach (ContentPageItem pageItem in contentPage.PageItems)
            {

                // tni-20130624: moduleGuidxxxx handling
                Guid moduleGuid2Use = Guid.Empty;
                bool updateModule = false;

                Module findModule = null;

                if (pageItem.ModuleGuidToPublish != Guid.Empty)
                {
                    Module existingModule = new Module(pageItem.ModuleGuidToPublish);
                    if (existingModule.ModuleGuid == pageItem.ModuleGuidToPublish && existingModule.SiteId == siteSettings.SiteId)
                    {
                        Module.Publish(pageSettings.PageGuid, existingModule.ModuleGuid, existingModule.ModuleId, pageSettings.PageId,
                            pageItem.Location, pageItem.SortOrder, DateTime.UtcNow, DateTime.MinValue);

                        // tni: I assume there's nothing else to do now so let's go to the next content...
                        continue;
                    }
                }
                else if (pageItem.ModuleGuid != Guid.Empty)
                {
                    findModule = new Module(pageItem.ModuleGuid);
                    if (findModule.ModuleGuid == Guid.Empty)
                    {
                        // Module does not exist, we can create new one with the specified Guid
                        moduleGuid2Use = pageItem.ModuleGuid;
                    }

                    if (findModule.ModuleGuid == pageItem.ModuleGuid && findModule.SiteId == siteSettings.SiteId)
                    {
                        // The module already exist, we'll update existing one
                        updateModule = true;
                        moduleGuid2Use = findModule.ModuleGuid;
                    }
                }
                //

                ModuleDefinition moduleDef = new ModuleDefinition(pageItem.FeatureGuid);

                // this only adds if its not already there
                try
                {
                    SiteSettings.AddFeature(siteSettings.SiteGuid, pageItem.FeatureGuid);
                }
                catch (Exception ex)
                {
                    log.Error(ex);
                }

                if (moduleDef.ModuleDefId > -1)
                {

                    Module module = null;
                    if (updateModule && (findModule != null))
                    {
                        module = findModule;
                    }
                    else
                    {
                        module = new Module();
                        module.ModuleGuid = moduleGuid2Use;
                    }

                    module.SiteId = siteSettings.SiteId;
                    module.SiteGuid = siteSettings.SiteGuid;
                    module.PageId = pageSettings.PageId;
                    module.ModuleDefId = moduleDef.ModuleDefId;
                    module.FeatureGuid = moduleDef.FeatureGuid;
                    module.PaneName = pageItem.Location;
                    if (contentPage.ResourceFile.Length > 0)
                    {
                        module.ModuleTitle
                            = ResourceHelper.GetResourceString(contentPage.ResourceFile, pageItem.ContentTitle, uiCulture, false);
                    }
                    else
                    {
                        module.ModuleTitle = pageItem.ContentTitle;
                    }
                    module.ModuleOrder = pageItem.SortOrder;
                    module.CacheTime = pageItem.CacheTimeInSeconds;
                    module.Icon = moduleDef.Icon;
                    module.ShowTitle = pageItem.ShowTitle;
                    module.AuthorizedEditRoles = pageItem.EditRoles;
                    module.DraftEditRoles = pageItem.DraftEditRoles;
                    module.ViewRoles = pageItem.ViewRoles;
                    module.IsGlobal = pageItem.IsGlobal;
                    module.HeadElement = pageItem.HeadElement;
                    module.HideFromAuthenticated = pageItem.HideFromAuthenticated;
                    module.HideFromUnauthenticated = pageItem.HideFromAnonymous;

                    module.Save();

                    if ((pageItem.Installer != null) && (pageItem.ConfigInfo.Length > 0))
                    {
                        //this is the newer implementation for populating feature content
                        pageItem.Installer.InstallContent(module, pageItem.ConfigInfo);
                    }
                    else
                    {
                        // legacy implementation for backward compatibility
                        if (
                            (pageItem.FeatureGuid == HtmlContent.FeatureGuid)
                            && (pageItem.ContentTemplate.EndsWith(".config"))
                            )
                        {
                            HtmlContent htmlContent = new HtmlContent();
                            htmlContent.ModuleId = module.ModuleId;
                            htmlContent.Body = ResourceHelper.GetMessageTemplate(uiCulture, pageItem.ContentTemplate);
                            htmlContent.ModuleGuid = module.ModuleGuid;
                            HtmlRepository repository = new HtmlRepository();
                            repository.Save(htmlContent);

                        }
                    }

                    // tni-20130624: handling module settings
                    foreach (KeyValuePair<string, string> item in pageItem.ModuleSettings)
                    {
                        ModuleSettings.UpdateModuleSetting(module.ModuleGuid, module.ModuleId, item.Key, item.Value);
                    }

                }
            }

            foreach (ContentPage childPage in contentPage.ChildPages)
            {
                CreatePage(siteSettings, childPage, pageSettings);
            }
        }
Ejemplo n.º 4
0
        public static void RebuildPageIndexAsync(PageSettings pageSettings)
        {
            if (WebConfigSettings.DisableSearchIndex) { return; }

            pageSettings.IndexPath = GetSearchIndexPath(pageSettings.SiteId);

            if (ThreadPool.QueueUserWorkItem(
                new WaitCallback(RebuildPageIndexAsyncCallback), pageSettings))
            {
                if (debugLog) log.Debug("IndexHelper.RebuildPageIndexCallback queued");
            }
            else
            {
                if (debugLog) log.Debug("Failed to queue a thread for IndexHelper.RebuildPageIndexAsync");
            }
        }
Ejemplo n.º 5
0
        private static bool ClearPageIndex(PageSettings pageSettings)
        {
            if (pageSettings == null) { return false; }
            bool result = false;

            try
            {

            using (Lucene.Net.Store.Directory searchDirectory = GetDirectory(pageSettings.SiteId))
            {

            if (IndexReader.IndexExists(searchDirectory))
                    {

                        using (IndexReader reader = IndexReader.Open(searchDirectory, false))
                        {

                            try
                            {
                                int tot = reader.NumDocs();

                                for (int i = 0; i < tot; i++)
                                {
                                    Document doc = reader.Document(i);

                                    if (doc.GetField("PageID").StringValue ==
                                        pageSettings.PageId.ToString(CultureInfo.InvariantCulture))

                                    {
                                        if (debugLog) log.Debug("ClearPageIndex about to delete doc ");
                                        try
                                        {
                                            reader.DeleteDocument(i);
                                            result = true;
                                        }
                                        catch (IOException ex)
                                        {
                                            log.Info("handled error:", ex);
                                        }
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                log.Info("handled error:", ex);
                            }

                        }

                    }

                }

            }
            catch (ArgumentException ex)
            {
                log.Info("handled error:", ex);
            }

            return result;
        }
Ejemplo n.º 6
0
        private static void SendConfirmEmail(
            CultureInfo defaultCulture,
            CultureInfo currencyCulture,
            SiteSettings siteSettings,
            int pageId,
            CommerceConfiguration commerceConfig, 
            Store store, 
            Order order,
            string subjectTemplate,
            string textBodyTemplate)
        {
            if (store == null) { return; }
            if (order == null) { return; }
            if(siteSettings == null) { return; }

            if (!ShouldSendConfirmation(siteSettings.SiteId, order))
            {
                log.Info("confirmation email for order " + order.OrderGuid.ToString() + " not sent due to disabled by configuration");
                return;
            }

            //SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();
            //CultureInfo currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code);

            //EmailMessageTask messageTask = new EmailMessageTask(SiteUtils.GetSmtpSettings());
            //messageTask.EmailFrom = store.SalesEmail;
            // TODO: implement from alias for store
            //messageTask.EmailFromAlias = siteSettings.DefaultFromEmailAlias;
            string email;
            if (order.CustomerEmail.Length > 0)
            {
                //messageTask.EmailTo = order.CustomerEmail;
                email = order.CustomerEmail;
            }
            else
            {
                SiteUser siteUser = new SiteUser(siteSettings, order.UserGuid);
                //messageTask.EmailTo = siteUser.Email;

                email = siteUser.Email;

            }

            //if (store.OrderBccEmail.Length > 0)
            //{
            //    messageTask.EmailBcc = store.OrderBccEmail;
            //}

            PageSettings page = new PageSettings(siteSettings.SiteId, pageId);

            string siteRoot = SiteUtils.GetNavigationSiteRoot();
            string storeLink = string.Empty;

            if (page.Url.StartsWith("~/"))
            {
                storeLink = siteRoot + page.Url.Replace("~/", "/");
            }
            else
            {
                storeLink = siteRoot;
            }

            string orderLink = siteRoot +
                "/WebStore/OrderDetail.aspx?pageid="
                + pageId.ToInvariantString()
                + "&mid=" + store.ModuleId.ToInvariantString()
                + "&orderid=" + order.OrderGuid.ToString();

            StringBuilder orderDetails = new StringBuilder();
            DataSet dsOffers = Order.GetOrderOffersAndProducts(store.Guid, order.OrderGuid);

            foreach (DataRow row in dsOffers.Tables["Offers"].Rows)
            {
                string og = row["OfferGuid"].ToString();
                orderDetails.Append(row["Name"].ToString() + " ");
                orderDetails.Append(row["Quantity"].ToString() + " @ ");
                orderDetails.Append(string.Format(currencyCulture, "{0:c}", Convert.ToDecimal(row["OfferPrice"])));
                orderDetails.Append("\r\n");

                string whereClause = string.Format("OfferGuid = '{0}'", og);
                DataView dv = new DataView(dsOffers.Tables["Products"], whereClause, "", DataViewRowState.CurrentRows);

                if (dv.Count > 1)
                {
                    foreach (DataRow r in dsOffers.Tables["Products"].Rows)
                    {
                        string pog = r["OfferGuid"].ToString();
                        if (og == pog)
                        {
                            orderDetails.Append(r["Name"].ToString() + " ");
                            orderDetails.Append(r["Quantity"].ToString() + "  \r\n");

                        }

                    }
                }

            }

            //messageTask.Subject = string.Format(
            //    defaultCulture,
            //    subjectTemplate,
            //    store.Name,
            //    order.OrderGuid.ToString()
            //    );

            //messageTask.TextBody = string.Format(
            //    defaultCulture,
            //    textBodyTemplate,
            //    order.CustomerFirstName + " " + order.CustomerLastName,
            //    store.Name,
            //    order.OrderGuid.ToString(),
            //    storeLink,
            //    orderLink,
            //    orderDetails.ToString(),
            //    order.OrderTotal.ToString("c", currencyCulture),
            //    order.ShippingTotal.ToString("c", currencyCulture),
            //    order.TaxTotal.ToString("c", currencyCulture),
            //    order.SubTotal.ToString("c", currencyCulture),
            //    order.Discount.ToString("c", currencyCulture)
            //    ).ToAscii();

            //messageTask.SiteGuid = siteSettings.SiteGuid;
            //messageTask.QueueTask();

            //WebTaskManager.StartOrResumeTasks();

            string fromAddress = store.EmailFrom;
            if (fromAddress.Length == 0) { fromAddress = siteSettings.DefaultEmailFromAddress; }

            Email.Send(
                        SiteUtils.GetSmtpSettings(),
                        fromAddress,
                        string.Empty,
                        string.Empty,
                        email,
                        string.Empty,
                        store.OrderBccEmail,
                        string.Format(defaultCulture, subjectTemplate, store.Name, order.OrderGuid.ToString()),
                        string.Format(
                                defaultCulture,
                                textBodyTemplate,
                                order.CustomerFirstName + " " + order.CustomerLastName,
                                store.Name,
                                order.OrderGuid.ToString(),
                                storeLink,
                                orderLink,
                                orderDetails.ToString(),
                                order.OrderTotal.ToString("c", currencyCulture),
                                order.ShippingTotal.ToString("c", currencyCulture),
                                order.TaxTotal.ToString("c", currencyCulture),
                                order.SubTotal.ToString("c", currencyCulture),
                                order.Discount.ToString("c", currencyCulture)
                                ),
                        false,
                        Email.PriorityNormal);
        }
        private static void IndexItem(HtmlContent content)
        {
            bool disableSearchIndex = ConfigHelper.GetBoolProperty("DisableSearchIndex", false);
            if (disableSearchIndex) { return; }

            Module module = new Module(content.ModuleId);

            Guid htmlFeatureGuid
                = new Guid("881e4e00-93e4-444c-b7b0-6672fb55de10");
            ModuleDefinition htmlFeature
                = new ModuleDefinition(htmlFeatureGuid);

            // get list of pages where this module is published
            List<PageModule> pageModules
                = PageModule.GetPageModulesByModule(content.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                    content.SiteId,
                    pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending) { continue; }

                IndexItem indexItem = new IndexItem();
                if (content.SearchIndexPath.Length > 0)
                {
                    indexItem.IndexPath = content.SearchIndexPath;
                }
                indexItem.SiteId = content.SiteId;
                indexItem.ExcludeFromRecentContent = content.ExcludeFromRecentContent;
                indexItem.PageId = pageModule.PageId;
                indexItem.PageName = pageSettings.PageName;
                indexItem.ViewRoles = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles = module.ViewRoles;
                if (pageSettings.UseUrl)
                {
                    indexItem.ViewPage = pageSettings.Url.Replace("~/", string.Empty);
                    indexItem.UseQueryStringParams = false;
                }

                // generally we should not include the page meta because it can result in duplicate results
                // one for each instance of html content on the page because they all use the smae page meta.
                // since page meta should reflect the content of the page it is sufficient to just index the content
                if ((ConfigurationManager.AppSettings["IndexPageMeta"] != null) && (ConfigurationManager.AppSettings["IndexPageMeta"] == "true"))
                {
                    indexItem.PageMetaDescription = pageSettings.PageMetaDescription;
                    indexItem.PageMetaKeywords = pageSettings.PageMetaKeyWords;
                }

                indexItem.FeatureId = htmlFeatureGuid.ToString();
                indexItem.FeatureName = htmlFeature.FeatureName;
                indexItem.FeatureResourceFile = htmlFeature.ResourceFile;

                indexItem.ItemId = content.ItemId;
                indexItem.ModuleId = content.ModuleId;
                indexItem.ModuleTitle = module.ModuleTitle;
                indexItem.Title = content.Title;
                indexItem.Content = SecurityHelper.RemoveMarkup(content.Body);
                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate = pageModule.PublishEndDate;

                if ((content.CreatedByFirstName.Length > 0) && (content.CreatedByLastName.Length > 0))
                {
                    indexItem.Author = string.Format(CultureInfo.InvariantCulture,
                        Resource.FirstLastFormat, content.CreatedByFirstName, content.CreatedByLastName);
                }
                else
                {
                    indexItem.Author = content.CreatedByName;
                }

                indexItem.CreatedUtc = content.CreatedDate;
                indexItem.LastModUtc = content.LastModUtc;

                if (!module.IncludeInSearch) { indexItem.RemoveOnly = true; }

                IndexHelper.RebuildIndex(indexItem);
            }

            log.Debug("Indexed " + content.Title);
        }
Ejemplo n.º 8
0
        private List<IndexItem> GetRecentContent()
        {
            List<IndexItem> recentContent = null;

            if (pageId == -1) { return recentContent; }
            if (moduleId == -1) { return recentContent; }

            pageSettings = CacheHelper.GetCurrentPage();
            module = GetModule();

            if (module != null)
            {
                moduleSettings = ModuleSettings.GetModuleSettings(moduleId);
                config = new RecentContentConfiguration(moduleSettings);
                shouldRender = config.EnableFeed;
                if (!shouldRender) { return null; }

                bool shouldRedirectToFeedburner = false;
                if (config.FeedburnerFeedUrl.Length > 0)
                {
                    shouldRedirectToFeedburner = true;
                    if ((Request.UserAgent != null) && (Request.UserAgent.Contains("FeedBurner")))
                    {
                        shouldRedirectToFeedburner = false; // don't redirect if the feedburner bot is reading the feed
                    }

                    Guid redirectBypassToken = WebUtils.ParseGuidFromQueryString("r", Guid.Empty);
                    if (redirectBypassToken == Global.FeedRedirectBypassToken)
                    {
                        shouldRedirectToFeedburner = false; // allows time for user to subscribe to autodiscovery links without redirecting
                    }

                }

                if (shouldRedirectToFeedburner)
                {
                    redirectUrl = config.FeedburnerFeedUrl;
                    shouldRender = false;
                    return null;

                }

                feedCacheTimeInMinutes = config.FeedCacheTimeInMinutes;
                channelTitle = config.FeedChannelTitle;
                channelLink = WebUtils.ResolveServerUrl(SiteUtils.GetCurrentPageUrl());
                channelDescription = config.FeedChannelDescription;
                channelCopyright = config.FeedChannelCopyright;
                channelManagingEditor = config.FeedChannelManagingEditor;
                channelTimeToLive = config.FeedTimeToLiveInMinutes;

                if (config.GetCreated)
                {
                    recentContent = IndexHelper.GetRecentCreatedContent(
                        siteSettings.SiteId,
                        config.GetFeatureGuids(),
                        DateTime.UtcNow.AddDays(-config.MaxDaysOldRecentItemsToGet),
                        config.MaxRecentItemsToGet);
                }
                else
                {
                    recentContent = IndexHelper.GetRecentModifiedContent(
                        siteSettings.SiteId,
                        config.GetFeatureGuids(),
                        DateTime.UtcNow.AddDays(-config.MaxDaysOldRecentItemsToGet),
                        config.MaxRecentItemsToGet);
                }
            }

            return recentContent;
        }
Ejemplo n.º 9
0
        private void btnAddFriendlyUrl_Click(object sender, EventArgs e)
        {
            if (this.txtFriendlyUrl.Text.Length > 0)
            {
                if (WebPageInfo.IsPhysicalWebPage("~/" + txtFriendlyUrl.Text))
                {
                    this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning;
                    return;
                }

                if (FriendlyUrl.Exists(siteSettings.SiteId, txtFriendlyUrl.Text))
                {
                    this.lblError.Text = Resource.FriendlyUrlDuplicateWarning;
                    return;
                }

                if (FriendlyUrl.Exists(siteSettings.SiteId, txtFriendlyUrl.Text.ToLower()))
                {
                    this.lblError.Text = Resource.FriendlyUrlDuplicateWarning;
                    return;
                }

                FriendlyUrl url = new FriendlyUrl();
                url.SiteId = siteSettings.SiteId;
                url.SiteGuid = siteSettings.SiteGuid;

                int pageId = -1;
                if (int.TryParse(ddPages.SelectedValue, out pageId))
                {
                    if (pageId > -1)
                    {
                        PageSettings page = new PageSettings(siteSettings.SiteId, pageId);
                        url.PageGuid = page.PageGuid;
                    }

                }

                url.Url = this.txtFriendlyUrl.Text;
                url.RealUrl = "Default.aspx?pageid=" + ddPages.SelectedValue;
                url.Save();

                WebUtils.SetupRedirect(this, Request.RawUrl);
            }
            else
            {
                this.lblError.Text = Resource.FriendlyUrlInvalidFriendlyUrlMessage;
            }
        }
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex) { return; }
            if (pageSettings == null) return;

            //don't index pending/unpublished pages
            if (pageSettings.IsPending) { return; }

            log.Info("CalendarEventIndexBuilderProvider indexing page - "
                + pageSettings.PageName);

            try
            {
                Guid calendarFeatureGuid = new Guid("c5e6a5df-ac2a-43d3-bb7f-9739bc47194e");
                ModuleDefinition calendarFeature = new ModuleDefinition(calendarFeatureGuid);

                List<PageModule> pageModules
                        = PageModule.GetPageModulesByPage(pageSettings.PageId);

                DataTable dataTable = CalendarEvent.GetEventsByPage(pageSettings.SiteId, pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                    indexItem.SiteId = pageSettings.SiteId;
                    indexItem.PageId = pageSettings.PageId;
                    indexItem.PageName = pageSettings.PageName;
                    indexItem.PageIndex = pageSettings.PageIndex;
                    indexItem.ViewRoles = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = row["ViewRoles"].ToString();
                    indexItem.FeatureId = calendarFeatureGuid.ToString();
                    indexItem.FeatureName = calendarFeature.FeatureName;
                    indexItem.FeatureResourceFile = calendarFeature.ResourceFile;

                    indexItem.ItemId = Convert.ToInt32(row["ItemID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleId = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title = row["Title"].ToString();
                    indexItem.Content = row["Description"].ToString();
                    indexItem.ViewPage = "EventCalendar/EventDetails.aspx";

                    indexItem.CreatedUtc = Convert.ToDateTime(row["CreatedDate"]);
                    indexItem.LastModUtc = Convert.ToDateTime(row["LastModUtc"]);

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate = pageModule.PublishEndDate;
                        }
                    }

                    mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (debugLog) log.Debug("Indexed " + indexItem.Title);

                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
        private static void IndexItem(CalendarEvent calendarEvent)
        {
            if (WebConfigSettings.DisableSearchIndex) { return; }
            if (calendarEvent == null) return;

            try
            {
                //SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

                //if ((siteSettings == null)
                //    || (calendarEvent == null))
                //{
                //    return;
                //}

                Module module = new Module(calendarEvent.ModuleId);
                Guid calendarFeatureGuid = new Guid("c5e6a5df-ac2a-43d3-bb7f-9739bc47194e");
                ModuleDefinition calendarFeature = new ModuleDefinition(calendarFeatureGuid);

                // get list of pages where this module is published
                List<PageModule> pageModules
                    = PageModule.GetPageModulesByModule(calendarEvent.ModuleId);

                foreach (PageModule pageModule in pageModules)
                {
                    PageSettings pageSettings
                    = new PageSettings(
                    calendarEvent.SiteId,
                    pageModule.PageId);

                    //don't index pending/unpublished pages
                    if (pageSettings.IsPending) { continue; }

                    mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                    if (calendarEvent.SearchIndexPath.Length > 0)
                    {
                        indexItem.IndexPath = calendarEvent.SearchIndexPath;
                    }
                    indexItem.SiteId = calendarEvent.SiteId;
                    indexItem.PageId = pageSettings.PageId;
                    indexItem.PageName = pageSettings.PageName;
                    indexItem.ViewRoles = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = module.ViewRoles;
                    indexItem.ItemId = calendarEvent.ItemId;
                    indexItem.ModuleId = calendarEvent.ModuleId;
                    indexItem.ViewPage = "EventCalendar/EventDetails.aspx";
                    indexItem.FeatureId = calendarFeatureGuid.ToString();
                    indexItem.FeatureName = calendarFeature.FeatureName;
                    indexItem.FeatureResourceFile = calendarFeature.ResourceFile;
                    indexItem.ModuleTitle = module.ModuleTitle;
                    indexItem.Title = calendarEvent.Title;
                    indexItem.Content = calendarEvent.Description;
                    indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                    indexItem.PublishEndDate = pageModule.PublishEndDate;

                    indexItem.CreatedUtc = calendarEvent.CreatedDate;
                    indexItem.LastModUtc = calendarEvent.LastModUtc;

                    mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem);
                }

                if (debugLog) log.Debug("Indexed " + calendarEvent.Title);

            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error("CalendarEventIndexBuilderProvider.IndexItem", ex);
            }
        }
Ejemplo n.º 12
0
        protected override void OnInit(EventArgs e)
        {
            // Alexander Yushchenko: workaround to make old custom modules work
            // Before 03.19.2007 this method was "new" and called from descendant classes
            // To avoid multiple self-calls a boolean flag is used
            if (IsOnInitExecuted) return;
            IsOnInitExecuted = true;

            base.OnInit(e);

            if (HttpContext.Current == null) { return; }

            siteSettings = CacheHelper.GetCurrentSiteSettings();
            
            currentPage = CacheHelper.GetCurrentPage();
            ScriptController = (ScriptManager)Page.Master.FindControl("ScriptManager1");

            if (siteSettings != null)
            {
                this.siteID = siteSettings.SiteId;
                if (!WebUser.IsAdminOrContentAdmin)
                {
                    forbidModuleSettings = WebUser.IsInRoles(siteSettings.RolesNotAllowedToEditModuleSettings);
                }
            }

            if (Page.Request.IsAuthenticated)
            {
                isSiteEditor = SiteUtils.UserIsSiteEditor();

                //if (WebUser.IsAdminOrContentAdmin || isSiteEditor || WebUser.IsInRoles(currentPage.EditRoles)
                //    || ((moduleConfiguration != null)
                //           && (WebUser.IsInRoles(moduleConfiguration.AuthorizedEditRoles))
                //       )
                //   )
                //{
                //    isEditable = true;
                //}

                isEditable = ShouldAllowEdit();

                if ((moduleConfiguration != null)&&(!moduleConfiguration.IsGlobal))
                {
                    if (WebConfigSettings.EnableContentWorkflow && siteSettings.EnableContentWorkflow && (this is IWorkflow))
                    {
                        enableWorkflow = true;

                        use3LevelWorkflow = WebConfigSettings.Use3LevelContentWorkflow; //joe davis

                        if (!isEditable)
                        {
                            if (
                                (WebUser.IsInRoles(currentPage.DraftEditOnlyRoles)) 
                                || (WebUser.IsInRoles(moduleConfiguration.DraftEditRoles))
                                || (use3LevelWorkflow && WebUser.IsInRoles(moduleConfiguration.DraftApprovalRoles))
                                )
                            {
                                isEditable = true;

                            }

                        }
                    }
                }
                
                if (!isEditable && (moduleConfiguration != null) && (moduleConfiguration.EditUserId > 0))
                {
                    SiteUser siteUser = SiteUtils.GetCurrentSiteUser();
                    if (
                        (siteUser != null)
                        &&(moduleConfiguration.EditUserId == siteUser.UserId)
                        )
                    {
                        isEditable = true;
                    }
                }
            }

            if (moduleConfiguration != null)
            {
                this.m_title = moduleConfiguration.ModuleTitle;
                this.m_description = moduleConfiguration.FeatureName;
            }
        }
Ejemplo n.º 13
0
        public static mojoSiteMapNode GetSiteMapNodeForPage(SiteMapNode rootNode, PageSettings pageSettings)
        {
            if (rootNode == null) { return null; }
            if (pageSettings == null) { return null; }
            if (!(rootNode is mojoSiteMapNode)) { return null; }

            foreach (SiteMapNode childNode in rootNode.ChildNodes)
            {
                if (!(childNode is mojoSiteMapNode)) { return null; }

                mojoSiteMapNode node = childNode as mojoSiteMapNode;
                if (node.PageId == pageSettings.PageId) { return node; }

                mojoSiteMapNode foundNode = GetSiteMapNodeForPage(node, pageSettings);
                if (foundNode != null) { return foundNode; }

            }

            return null;
        }
        /// <summary>
        /// This method is called when the site index is rebuilt
        /// </summary>
        /// <param name="pageSettings"></param>
        /// <param name="indexPath"></param>
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            if (WebConfigSettings.DisableSearchIndex) { return; }
            if (pageSettings == null)
            {
                log.Error("pageSettings object passed to ProductSearchIndexBuilder.RebuildIndex was null");
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending) { return; }

            log.Info("ProductSearchIndexBuilder indexing page - "
                + pageSettings.PageName);

            Guid webStoreFeatureGuid = new Guid("0cefbf18-56de-11dc-8f36-bac755d89593");
            ModuleDefinition webStoreFeature = new ModuleDefinition(webStoreFeatureGuid);

            List<PageModule> pageModules
                    = PageModule.GetPageModulesByPage(pageSettings.PageId);

            // adding a try catch here because this is invoked even for non-implemented db platforms and it causes an error
            try
            {
                DataTable dataTable
                    = Product.GetBySitePage(
                    pageSettings.SiteId,
                    pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                    indexItem.SiteId = pageSettings.SiteId;
                    indexItem.PageId = pageSettings.PageId;
                    indexItem.PageName = pageSettings.PageName;
                    indexItem.ViewRoles = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = row["ViewRoles"].ToString();
                    indexItem.FeatureId = webStoreFeatureGuid.ToString();
                    indexItem.FeatureName = webStoreFeature.FeatureName;
                    indexItem.FeatureResourceFile = webStoreFeature.ResourceFile;

                    indexItem.ItemKey = row["Guid"].ToString();
                    indexItem.ModuleId = Convert.ToInt32(row["ModuleID"], CultureInfo.InvariantCulture);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title = row["Name"].ToString();
                    indexItem.ViewPage = row["Url"].ToString().Replace("/", string.Empty);
                    if (indexItem.ViewPage.Length > 0)
                    {
                        indexItem.UseQueryStringParams = false;
                    }
                    else
                    {
                        indexItem.ViewPage = "WebStore/ProductDetail.aspx";
                    }

                    indexItem.PageMetaDescription = row["MetaDescription"].ToString();
                    indexItem.PageMetaKeywords = row["MetaKeywords"].ToString();

                    indexItem.CreatedUtc = Convert.ToDateTime(row["Created"]);
                    indexItem.LastModUtc = Convert.ToDateTime(row["LastModified"]);

                    indexItem.Content = row["Abstract"].ToString()
                        + " " + row["Description"].ToString()
                        + " " + row["MetaDescription"].ToString()
                        + " " + row["MetaKeywords"].ToString();

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate = pageModule.PublishEndDate;
                        }
                    }

                    mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem, indexPath);

                    if (debugLog) log.Debug("Indexed " + indexItem.Title);

                }

            }
            catch { }
        }
        private static void IndexItem(Product product)
        {
            if (WebConfigSettings.DisableSearchIndex) { return; }
            if (product == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("product object passed to ProductSearchIndexBuilder.IndexItem was null");
                }
                return;
            }

            Store store = new Store(product.StoreGuid);

            Module module = new Module(store.ModuleId);
            Guid webStoreFeatureGuid = new Guid("0cefbf18-56de-11dc-8f36-bac755d89593");
            ModuleDefinition webStoreFeature = new ModuleDefinition(webStoreFeatureGuid);

            //// get list of pages where this module is published
            List<PageModule> pageModules
                = PageModule.GetPageModulesByModule(store.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                    product.SiteId,
                    pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending) { continue; }

                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                if (product.SearchIndexPath.Length > 0)
                {
                    indexItem.IndexPath = product.SearchIndexPath;
                }
                indexItem.SiteId = product.SiteId;
                indexItem.PageId = pageSettings.PageId;
                indexItem.PageName = pageSettings.PageName;
                indexItem.ViewRoles = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles = module.ViewRoles;
                if (product.Url.Length > 0)
                {
                    indexItem.ViewPage = product.Url.Replace("~/", string.Empty);
                    indexItem.UseQueryStringParams = false;
                }
                else
                {
                    indexItem.ViewPage = "/WebStore/ProductDetail.aspx";
                }
                indexItem.ItemKey = product.Guid.ToString();
                indexItem.ModuleId = store.ModuleId;
                indexItem.ModuleTitle = module.ModuleTitle;
                indexItem.Title = product.Name;
                indexItem.PageMetaDescription = product.MetaDescription;
                indexItem.PageMetaKeywords = product.MetaKeywords;

                indexItem.CreatedUtc = product.Created;
                indexItem.LastModUtc = product.LastModified;

                indexItem.Content
                    = product.Teaser
                    + " " + product.Description.Replace(tabScript, string.Empty)
                    + " " + product.MetaDescription
                    + " " + product.MetaKeywords;

                indexItem.FeatureId = webStoreFeatureGuid.ToString();
                indexItem.FeatureName = webStoreFeature.FeatureName;
                indexItem.FeatureResourceFile = webStoreFeature.ResourceFile;
                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate = pageModule.PublishEndDate;

                mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem);
            }

            if (debugLog) log.Debug("Indexed " + product.Name);
        }
        void btnSave_Click(object sender, EventArgs e)
        {
            string paneName = ddPaneNames.SelectedValue;
            DateTime beginDate = DateTime.UtcNow;
            DateTime endDate = DateTime.MinValue;

            //Boolean beginDateInvalid = false;

            if (!DateTime.TryParse(dpBeginDate.Text, out beginDate))
            {
                //beginDateInvalid = true;
            }

            if (dpEndDate.Text.Length > 0)
            {
                if (!DateTime.TryParse(dpEndDate.Text, out endDate))
                {
                    endDate = DateTime.MinValue;
                }
            }
            else
            {
                endDate = DateTime.MinValue;
            }

            if (timeZone != null)
            {
                beginDate = beginDate.ToUtc(timeZone);
                if (endDate != DateTime.MinValue) { endDate = endDate.ToUtc(timeZone); }
            }
            else
            {
                beginDate = beginDate.AddHours(-timeOffset);
                if (endDate != DateTime.MinValue) endDate = endDate.AddHours(-timeOffset);
            }

            int moduleOrder = 1;

            int.TryParse(txtModuleOrder.Text, NumberStyles.Integer, CultureInfo.InvariantCulture, out moduleOrder);

            if (chkPublished.Checked)
            {

                Module.Publish(
                    currentPage.PageGuid,
                    currentModule.ModuleGuid,
                    currentModule.ModuleId,
                    pageId,
                    paneName,
                    moduleOrder,
                    beginDate,
                    endDate);
            }
            else
            {

                if (WebConfigSettings.LogIpAddressForContentDeletions)
                {
                    Module m = new Module(moduleId);
                    PageSettings contentPage = new PageSettings(CurrentSite.SiteId, pageId);
                    string userName = string.Empty;
                    SiteUser currentUser = SiteUtils.GetCurrentSiteUser();
                    if (currentUser != null)
                    {
                        userName = currentUser.Name;
                    }

                    log.Info("user " + userName + " removed module " + m.ModuleTitle + " from page " + contentPage.PageName + " from ip address " + SiteUtils.GetIP4Address());

                }

                Module.DeleteModuleInstance(moduleId, pageId);
            }

            // rebuild page search index

            currentPage.PageIndex = CurrentPage.PageIndex;
            mojoPortal.SearchIndex.IndexHelper.RebuildPageIndexAsync(currentPage);

            pnlUpdate.Visible = false;
            pnlFinished.Visible = true;
        }
        private void LoadSettings()
        {
            isAdmin = WebUser.IsAdmin;
            if (!isAdmin)
            {
                isContentAdmin = WebUser.IsContentAdmin;
                isSiteEditor = SiteUtils.UserIsSiteEditor();
            }

            pageId = WebUtils.ParseInt32FromQueryString("pageid", -1);
            moduleId = WebUtils.ParseInt32FromQueryString("mid", -1);
            includeAltPanes = WebUtils.ParseBoolFromQueryString("ia", includeAltPanes);

            if (WebConfigSettings.AlwaysShowAltPanesInPublishDialog) { includeAltPanes = true; }

            timeOffset = SiteUtils.GetUserTimeOffset();
            timeZone = SiteUtils.GetUserTimeZone();

            currentPage = new PageSettings(CurrentSite.SiteId, pageId);
            if (currentPage.SiteId != CurrentSite.SiteId) { currentPage = null; }
            if (currentPage != null)
            {
                if (
                    ((currentPage.AuthorizedRoles == "Admins;") || (currentPage.EditRoles == "Admins;"))
                    && (!isAdmin)
                    )
                {
                    currentPage = null;
                }
            }

            currentModule = new Module(moduleId);
            if (currentModule.SiteId != CurrentSite.SiteId) { currentModule = null; }
            if (currentModule != null)
            {
                if (
                    ((currentModule.AuthorizedEditRoles == "Admins;") || (currentModule.ViewRoles == "Admins;"))
                    && (!isAdmin)
                 )
                {
                    currentModule = null;
                }

            }
        }
Ejemplo n.º 18
0
        private void dlUrlMap_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            int urlID = Convert.ToInt32(dlUrlMap.DataKeys[e.Item.ItemIndex]);
            FriendlyUrl friendlyUrl = new FriendlyUrl(urlID);

            switch (e.CommandName)
            {
                case "edit":
                    dlUrlMap.EditItemIndex = e.Item.ItemIndex;
                    Control c = e.Item.FindControl("ddPagesEdit");
                    DropDownList dd = null;
                    if ((c != null) && (pageList != null))
                    {
                        dd = (DropDownList)c;
                        dd.DataSource = pageList;
                        dd.DataBind();

                    }
                    PopulateControls();
                    if (dd != null)
                    {
                        String selection = ParsePageId(friendlyUrl.RealUrl);
                        if (selection.Length > 0)
                        {
                            ListItem listItem = dd.Items.FindByValue(selection);
                            if (listItem != null)
                            {
                                dd.ClearSelection();
                                listItem.Selected = true;
                            }
                        }
                    }
                    break;

                case "apply":

                    TextBox txtItemFriendlyUrl
                        = (TextBox)e.Item.FindControl("txtItemFriendlyUrl");

                    if (txtItemFriendlyUrl.Text.Length > 0)
                    {
                        Control cEdit = e.Item.FindControl("ddPagesEdit");
                        if (cEdit != null)
                        {
                            DropDownList ddEdit = (DropDownList)cEdit;
                            friendlyUrl.Url = txtItemFriendlyUrl.Text;
                            if (WebPageInfo.IsPhysicalWebPage("~/" + friendlyUrl.Url))
                            {
                                this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning;
                                return;
                            }

                            int pageId = -1;
                            if (int.TryParse(ddEdit.SelectedValue, out pageId))
                            {
                                if (pageId > -1)
                                {
                                    PageSettings page = new PageSettings(siteSettings.SiteId, pageId);
                                    friendlyUrl.PageGuid = page.PageGuid;
                                }

                            }

                            friendlyUrl.RealUrl = "Default.aspx?pageid=" + ddEdit.SelectedValue;
                            friendlyUrl.Save();

                        }

                        WebUtils.SetupRedirect(this, Request.RawUrl);
                    }
                    else
                    {
                        this.lblError.Text = Resource.FriendlyUrlInvalidFriendlyUrlMessage;

                    }
                    break;

                case "applymanual":

                    if (
                        (
                            (((TextBox)e.Item.FindControl("txtItemFriendlyUrl")).Text.Length > 0)
                        )
                        && (
                            (((TextBox)e.Item.FindControl("txtItemRealUrl")).Text.Length > 0)
                            )
                      )
                    {
                        friendlyUrl.Url = ((TextBox)e.Item.FindControl("txtItemFriendlyUrl")).Text;
                        if (WebPageInfo.IsPhysicalWebPage("~/" + friendlyUrl.Url))
                        {
                            this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning;
                            return;
                        }
                        friendlyUrl.RealUrl = ((TextBox)e.Item.FindControl("txtItemRealUrl")).Text;
                        friendlyUrl.PageGuid = Guid.Empty;
                        friendlyUrl.Save();
                        WebUtils.SetupRedirect(this, Request.RawUrl);
                    }
                    else
                    {
                        this.lblError.Text = Resource.FriendlyUrlInvalidEntryMessage;
                    }
                    break;

                case "delete":

                    FriendlyUrl.DeleteUrl(urlID);
                    WebUtils.SetupRedirect(this, Request.RawUrl);
                    break;

                case "cancel":
                    WebUtils.SetupRedirect(this, Request.RawUrl);
                    break;

            }
        }
        public override void RebuildIndex(
            PageSettings pageSettings,
            string indexPath)
        {
            bool disableSearchIndex = ConfigHelper.GetBoolProperty("DisableSearchIndex", false);
            if (disableSearchIndex) { return; }

            if (pageSettings == null)
            {
                log.Error("pageSettings passed in to HtmlContentIndexBuilderProvider.RebuildIndex was null");
                return;
            }

            //don't index pending/unpublished pages
            if (pageSettings.IsPending) { return; }

            log.Info("HtmlContentIndexBuilderProvider indexing page - "
                + pageSettings.PageName);

            try
            {
                Guid htmlFeatureGuid
                    = new Guid("881e4e00-93e4-444c-b7b0-6672fb55de10");
                ModuleDefinition htmlFeature
                    = new ModuleDefinition(htmlFeatureGuid);

                List<PageModule> pageModules
                        = PageModule.GetPageModulesByPage(pageSettings.PageId);

                HtmlRepository repository = new HtmlRepository();

                DataTable dataTable = repository.GetHtmlContentByPage(
                    pageSettings.SiteId,
                    pageSettings.PageId);

                foreach (DataRow row in dataTable.Rows)
                {
                    bool includeInSearch = Convert.ToBoolean(row["IncludeInSearch"]);
                    bool excludeFromRecentContent = Convert.ToBoolean(row["ExcludeFromRecentContent"]);

                    IndexItem indexItem = new IndexItem();
                    indexItem.ExcludeFromRecentContent = excludeFromRecentContent;
                    indexItem.SiteId = pageSettings.SiteId;
                    indexItem.PageId = pageSettings.PageId;
                    indexItem.PageName = pageSettings.PageName;

                    string authorName = row["CreatedByName"].ToString();
                    string authorFirstName = row["CreatedByFirstName"].ToString();
                    string authorLastName = row["CreatedByLastName"].ToString();

                    if ((authorFirstName.Length > 0) && (authorLastName.Length > 0))
                    {
                        indexItem.Author = string.Format(CultureInfo.InvariantCulture,
                            Resource.FirstNameLastNameFormat, authorFirstName, authorLastName);
                    }
                    else
                    {
                        indexItem.Author = authorName;
                    }

                    if (!includeInSearch) { indexItem.RemoveOnly = true; }

                    // generally we should not include the page meta because it can result in duplicate results
                    // one for each instance of html content on the page because they all use the smae page meta.
                    // since page meta should reflect the content of the page it is sufficient to just index the content
                    if (WebConfigSettings.IndexPageKeywordsWithHtmlArticleContent)
                    {
                        indexItem.PageMetaDescription = pageSettings.PageMetaDescription;
                        indexItem.PageMetaKeywords = pageSettings.PageMetaKeyWords;
                    }

                    indexItem.ViewRoles = pageSettings.AuthorizedRoles;
                    indexItem.ModuleViewRoles = row["ViewRoles"].ToString();
                    if (pageSettings.UseUrl)
                    {
                        if (pageSettings.UrlHasBeenAdjustedForFolderSites)
                        {
                            indexItem.ViewPage = pageSettings.UnmodifiedUrl.Replace("~/", string.Empty);
                        }
                        else
                        {
                            indexItem.ViewPage = pageSettings.Url.Replace("~/", string.Empty);
                        }
                        indexItem.UseQueryStringParams = false;
                    }
                    indexItem.FeatureId = htmlFeatureGuid.ToString();
                    indexItem.FeatureName = htmlFeature.FeatureName;
                    indexItem.FeatureResourceFile = htmlFeature.ResourceFile;

                    indexItem.ItemId = Convert.ToInt32(row["ItemID"]);
                    indexItem.ModuleId = Convert.ToInt32(row["ModuleID"]);
                    indexItem.ModuleTitle = row["ModuleTitle"].ToString();
                    indexItem.Title = row["Title"].ToString();
                    // added the remove markup 2010-01-30 because some javascript strings like ]]> were apearing in search results if the content conatined jacvascript
                    indexItem.Content = SecurityHelper.RemoveMarkup(row["Body"].ToString());

                    indexItem.CreatedUtc = Convert.ToDateTime(row["CreatedDate"]);
                    indexItem.LastModUtc = Convert.ToDateTime(row["LastModUtc"]);

                    // lookup publish dates
                    foreach (PageModule pageModule in pageModules)
                    {
                        if (indexItem.ModuleId == pageModule.ModuleId)
                        {
                            indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                            indexItem.PublishEndDate = pageModule.PublishEndDate;
                        }
                    }

                    IndexHelper.RebuildIndex(indexItem, indexPath);

                    log.Debug("Indexed " + indexItem.Title);

                }
            }
            catch (System.Data.Common.DbException ex)
            {
                log.Error(ex);
            }
        }
Ejemplo n.º 20
0
        void btnSortChildPagesAlpha_Click(object sender, ImageClickEventArgs e)
        {
            if (lbPages.SelectedIndex > -1)
            {
                foreach (mojoSiteMapNode page in sitePages)
                {
                    if (
                        (page.PageId.ToInvariantString() == lbPages.SelectedValue)
                        && ((canEditAnything) || (WebUser.IsInRoles(page.CreateChildPageRoles)))
                        )
                    {
                        PageSettings pageSettings = new PageSettings(siteSettings.SiteId, page.PageId);
                        pageSettings.ResortPagesAlphabetically();

                    }
                }

                CacheHelper.ResetSiteMapCache();

                WebUtils.SetupRedirect(this, Request.RawUrl);
            }
            else
            {
                // no page selected
                litWarning.Text = Resource.PagesNoSelectionWarning;
            }
        }
 public ModuleDecoratedPageSettings(PageSettings pageSettings)
 {
     if (pageSettings == null) throw new ArgumentException("pageSettigns can't be null");
     this.pageSettings = pageSettings;
 }
Ejemplo n.º 22
0
        private void UpDown_Click(Object sender, ImageClickEventArgs e)
        {
            string cmd = ((ImageButton) sender).CommandName;

            if (lbPages.SelectedIndex > -1)
            {
                foreach (mojoSiteMapNode page in sitePages)
                {
                    if (
                        (page.PageId.ToInvariantString() == lbPages.SelectedValue)
                        &&((canEditAnything) ||(WebUser.IsInRoles(page.CreateChildPageRoles)))
                        )
                    {
                        selectedPage = page.PageId;

                        PageSettings pageSettings = new PageSettings(siteSettings.SiteId, page.PageId);
                        if (cmd == "down")
                        {
                            pageSettings.MoveDown();
                        }
                        else
                        {
                            pageSettings.MoveUp();
                        }
                    }
                }

                CacheHelper.ResetSiteMapCache();

                if (selectedPage > -1)
                {
                    WebUtils.SetupRedirect(this, SiteRoot + "/Admin/PageTree.aspx?selpage=" + selectedPage.ToInvariantString());
                }
                else
                {
                    WebUtils.SetupRedirect(this, Page.Request.RawUrl);
                }
            }
            else
            {
                // no page selected
                litWarning.Text = Resource.PagesNoSelectionWarning;
            }
        }
Ejemplo n.º 23
0
        public static int FindStoreModuleId(PageSettings currentPage)
        {
            Guid storeGuid = new Guid("0cefbf18-56de-11dc-8f36-bac755d89593");
            foreach (Module m in currentPage.Modules)
            {
                if (m.FeatureGuid == storeGuid) return m.ModuleId;

                if (m.ControlSource == "WebStore/WebStoreModule.ascx") return m.ModuleId;

            }

            return -1;
        }
Ejemplo n.º 24
0
        private void btnDelete_Click(Object sender, ImageClickEventArgs e)
        {
            if (lbPages.SelectedIndex > -1)
            {
                ContentMetaRespository metaRepository = new ContentMetaRespository();

                foreach (mojoSiteMapNode page in sitePages)
                {
                    if ((page.PageId.ToString() == lbPages.SelectedValue)&&((canEditAnything)||(WebUser.IsInRoles(page.EditRoles))))
                    {
                        if (WebConfigSettings.LogIpAddressForContentDeletions)
                        {
                            log.Info("user deleted page " + page.Url + " from ip address " + SiteUtils.GetIP4Address());

                        }

                        PageSettings pageSettings = new PageSettings(siteSettings.SiteId, page.PageId);
                        metaRepository.DeleteByContent(page.PageGuid);
                        Module.DeletePageModules(page.PageId);
                        PageSettings.DeletePage(page.PageId);
                        FriendlyUrl.DeleteByPageGuid(page.PageGuid);

                        mojoPortal.SearchIndex.IndexHelper.ClearPageIndexAsync(pageSettings);
                    }
                }

                CacheHelper.ResetSiteMapCache();

                WebUtils.SetupRedirect(this, Request.RawUrl);
            }
            else
            {
                // no page selected
                litWarning.Text = Resource.PagesNoSelectionWarning;
            }
        }
Ejemplo n.º 25
0
        private static bool RebuildPageIndex(PageSettings pageSettings)
        {
            if (pageSettings == null) return false;

            log.Info("IndexHelper.RebuildPageIndex - " + pageSettings.PageName);

            if (IndexBuilderManager.Providers == null)
            {
                log.Info("No IndexBuilderProviders found");
                return false;
            }

            string indexPath = GetSearchIndexPath(pageSettings.SiteId);

            ClearPageIndex(pageSettings);

            foreach (IndexBuilderProvider indexBuilder in IndexBuilderManager.Providers)
            {
                indexBuilder.RebuildIndex(pageSettings, indexPath);
            }

            return true;
        }
Ejemplo n.º 26
0
        private void btnSave_Click(Object sender, EventArgs e)
        {
            if (debugLog) log.Debug("ModuleSettingsPage about to call Page.Validate()");

            SiteUser currentUser = SiteUtils.GetCurrentSiteUser();
            string userName = string.Empty;
            if (currentUser != null)
            {
                userName = currentUser.Name;
            }

            Page.Validate("ModuleSettings");
            if(Page.IsValid)
            {
                if (debugLog) log.Debug("ModuleSettingsPage about to call Page IsValid = true");

                bool ok = true;
                bool allSetingsAreValid = true;
                bool needToReIndex = false;
                int currentPageId = module.PageId;
                int newPageId = module.PageId;

                if (module.ModuleId > -1)
                {
                    if(isAdmin || isContentAdmin || isSiteEditor)
                    {
                        if (!useSeparatePagesForRoles)
                        {
                            string viewRoles = string.Empty;
                            if (rbViewAdminOnly.Checked)
                            {
                                viewRoles = "Admins;";

                                log.Info("user " + userName + " changed Module view roles for " + module.ModuleTitle
                                   + " to Admins "
                                   + " from ip address " + SiteUtils.GetIP4Address());
                            }
                            else
                            {
                                foreach (ListItem item in cblViewRoles.Items)
                                {
                                    if (debugLog) log.Debug("ModuleSettingsPage inside loop of Role ListItems");
                                    if (item.Selected == true)
                                    {
                                        viewRoles = viewRoles + item.Value + ";";
                                    }
                                }
                            }
                            string previousViewRoles = module.ViewRoles;
                            module.ViewRoles = viewRoles;
                            if (previousViewRoles != viewRoles)
                            {
                                needToReIndex = true;

                                log.Info("user " + userName + " changed Module view roles for " + module.ModuleTitle
                                    + " to " + viewRoles
                                    + " from ip address " + SiteUtils.GetIP4Address());
                            }

                            string editRoles = string.Empty;
                            if (debugLog) log.Debug("ModuleSettingsPage about to loop through Role ListItems");
                            if (rbEditAdminsOnly.Checked)
                            {
                                editRoles = "Admins;";
                                log.Info("user " + userName + " changed Module Edit roles for " + module.ModuleTitle
                                   + " to Admins "
                                   + " from ip address " + SiteUtils.GetIP4Address());
                            }
                            else
                            {
                                foreach (ListItem item in authEditRoles.Items)
                                {
                                    if (debugLog) log.Debug("ModuleSettingsPage inside loop of Role ListItems");
                                    if (item.Selected == true)
                                    {
                                        editRoles = editRoles + item.Value + ";";
                                    }
                                }
                            }

                            module.AuthorizedEditRoles = editRoles;
                            log.Info("user " + userName + " changed Module Edit roles for " + module.ModuleTitle
                                    + " to " + editRoles
                                    + " from ip address " + SiteUtils.GetIP4Address());

                            string draftEdits = string.Empty;
                            //if (rbDraftAdminsOnly.Checked)
                            //{
                            //    draftEdits = "Admins;";
                            //}
                            //else
                            //{
                            foreach (ListItem item in draftEditRoles.Items)
                            {

                                if (item.Selected == true)
                                {
                                    draftEdits = draftEdits + item.Value + ";";
                                }
                            }
                            //}

                            module.DraftEditRoles = draftEdits;

                            log.Info("user " + userName + " changed Module Draft Edit roles for " + module.ModuleTitle
                                    + " to " + draftEdits
                                    + " from ip address " + SiteUtils.GetIP4Address());

                            if (use3LevelWorkFlow)
                            {
                                //joe davis
                                string draftApprovers = string.Empty;
                                foreach (ListItem item in draftApprovalRoles.Items)
                                {
                                    if (item.Selected == true)
                                    {
                                        draftApprovers = draftApprovers + item.Value + ";";
                                    }
                                }

                                module.DraftApprovalRoles = draftApprovers;

                                log.Info("user " + userName + " changed Module Draft Approval roles for " + module.ModuleTitle
                                        + " to " + draftApprovers
                                        + " from ip address " + SiteUtils.GetIP4Address());
                            }
                        }
                    }

                    if (tabGeneralSettings.Visible)
                    {

                        module.ModuleTitle = moduleTitle.Text;
                        module.CacheTime = int.Parse(cacheTime.Text);
                        if (divTitleElement.Visible)
                        {
                            module.HeadElement = txtTitleElement.Text;
                        }
                        module.ShowTitle = chkShowTitle.Checked;
                        module.PublishMode = Convert.ToInt32(publishType.GetValue(),CultureInfo.InvariantCulture);
                        module.AvailableForMyPage = chkAvailableForMyPage.Checked;
                        module.AllowMultipleInstancesOnMyPage = chkAllowMultipleInstancesOnMyPage.Checked;
                        module.Icon = ddIcons.SelectedValue;
                        module.HideFromAuthenticated = chkHideFromAuth.Checked;
                        module.HideFromUnauthenticated = chkHideFromUnauth.Checked;
                        module.IncludeInSearch = chkIncludeInSearch.Checked;
                        module.IsGlobal = chkIsGlobal.Checked;

                        if (divParentPage.Visible)
                        {
                            if (debugLog) log.Debug("ModuleSettingsPage about to check Page dropdown");
                            newPageId = int.Parse(ddPages.SelectedValue);
                            if (newPageId != currentPageId)
                            {
                                needToReIndex = true;
                                Module.UpdatePage(currentPageId, newPageId, module.ModuleId);
                            }
                            module.PageId = newPageId;
                        }

                        if (isAdmin)
                        {
                            if (debugLog) log.Debug("ModuleSettingsPage about to check user dropdown");
                            if (txtEditUserId.Text.Length > 0)
                            {
                                try
                                {
                                    module.EditUserId = int.Parse(txtEditUserId.Text);
                                }
                                catch (ArgumentException) { }
                                catch (FormatException) { }
                                catch (OverflowException) { }
                            }
                            else
                            {
                                module.EditUserId = 0;
                            }

                        }

                    }

                    if (debugLog) log.Debug("ModuleSettingsPage about to Save Module");
                    module.Save();

                    if (needToReIndex)
                    {
                        // if content is moved from 1 page to another, need to reindex both pages
                        // to keep view permissions in sync

                        mojoPortal.SearchIndex.IndexHelper.RebuildPageIndexAsync(CurrentPage);

                        PageSettings newPage = new PageSettings(siteSettings.SiteId, newPageId);
                        newPage.PageIndex = 0;
                        mojoPortal.SearchIndex.IndexHelper.RebuildPageIndexAsync(newPage);
                    }

                    ArrayList defaultSettings = ModuleSettings.GetDefaultSettings(module.ModuleDefId);

                    foreach(CustomModuleSetting s in defaultSettings)
                    {
                        if (s.SettingControlType == string.Empty) { continue; }
                        ok = true;

                        //Object oSettingLabel = GetGlobalResourceObject("Resource", s.SettingName + "RegexWarning");

                        Object oSettingLabel = null;

                        try
                        {
                            oSettingLabel = GetGlobalResourceObject(s.ResourceFile, s.SettingName + "RegexWarning");
                        }
                        catch (NullReferenceException){ }
                        catch (System.Resources.MissingManifestResourceException) { }

                        string settingLabel = String.Empty;
                        if (oSettingLabel == null)
                        {
                            settingLabel = "Regex Warning";
                        }
                        else
                        {
                            settingLabel = oSettingLabel.ToString();
                        }

                        string settingValue = string.Empty;

                        if (s.SettingName == "WebPartModuleWebPartSetting")
                        {
                            ModuleSettings.UpdateModuleSetting(module.ModuleGuid, moduleId, s.SettingName, ddWebParts.SelectedValue);
                        }
                        else
                        {
                            if (s.SettingControlType == "ISettingControl")
                            {
                                string controlID = "uc" + moduleId.ToInvariantString() + s.SettingName;
                                //Control c = PlaceHolderAdvancedSettings.FindControl(controlID);
                                Control c = pnlcustomSettings.FindControl(controlID);
                                if (c != null)
                                {
                                    if (c is ISettingControl)
                                    {
                                        ISettingControl isc = c as ISettingControl;
                                        settingValue = isc.GetValue();
                                    }
                                    else
                                    {
                                        ok = false;
                                    }

                                }
                                else
                                {
                                    log.Error("could not find control for " + s.SettingName);
                                    ok = false;
                                }

                            }
                            else
                            {

                                settingValue = Request.Params.Get(s.SettingName + moduleId.ToInvariantString());

                                if (s.SettingControlType == "CheckBox")
                                {
                                    if (settingValue == "on")
                                    {
                                        settingValue = "true";
                                    }
                                    else
                                    {
                                        settingValue = "false";
                                    }
                                }
                                else
                                {
                                    if (s.SettingValidationRegex.Length > 0)
                                    {
                                        if (!Regex.IsMatch(settingValue, s.SettingValidationRegex))
                                        {
                                            ok = false;
                                            allSetingsAreValid = false;
                                            lblValidationSummary.Text += "<br />"
                                                + settingLabel;

                                        }
                                    }
                                }
                            }

                            if (ok)
                            {
                                ModuleSettings.UpdateModuleSetting(module.ModuleGuid, moduleId, s.SettingName, settingValue);
                            }
                        }
                    }
                }

                if (allSetingsAreValid)
                {
                    //CacheHelper.TouchCacheDependencyFile(cacheDependencyKey);
                    CacheHelper.ClearModuleCache(module.ModuleId);
                    WebUtils.SetupRedirect(this, SiteUtils.GetCurrentPageUrl());
                    return;

                }

            }
        }
Ejemplo n.º 27
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (WebConfigSettings.DisablejQuery) { return; } //this depends on jquery

            if (!(Page is CmsPage)) { return; }

            currentPage = CacheHelper.GetCurrentPage();

            if (currentPage == null) { return; }
            if ((!WebUser.IsInRoles(currentPage.EditRoles)) && (!WebUser.IsInRoles(currentPage.DraftEditOnlyRoles))) { return; }

            if((!renderAnchor)&&(clickTargetSelector.Length == 0)) { return; }

            StringBuilder script = new StringBuilder();
            script.Append("\n<script type=\"text/javascript\">");

            script.Append("function ToggleEditLinks(isClick)");
            script.Append("{ ");

            script.Append("var editLinksState = Get_Cookie('editLinksState'); ");
            script.Append("if (isClick)");
            script.Append("{ ");
            script.Append("if (editLinksState === null || editLinksState === 'visible') ");
            script.Append("{ ");
            script.Append("Set_Cookie('editLinksState', 'hidden'); ");
            script.Append(" ToggleEditLinks(false); ");

            script.Append("}"); // end linkstate check
            script.Append("else if (editLinksState === 'hidden')");
            script.Append("{ ");
            script.Append("Set_Cookie('editLinksState', 'visible'); ");
            script.Append("ToggleEditLinks(false); ");

            script.Append("}");// end else if
            script.Append("}");// end if isClick
            script.Append("else");
            script.Append("{");

            script.Append("switch (editLinksState)");
            script.Append("{");

            script.Append("case 'hidden': ");
            script.Append("$('.modulelinks, .ModuleEditLink, a.inlineedittoggle').hide(); ");
            //script.Append("$('.ModuleEditLink').hide(); ");
            //script.Append("$('a.inlineedittoggle').hide(); ");

            //script.Append("$('div[contenteditable=\"true\"]').attr('contenteditable', false); ");

            script.Append("break; ");

            script.Append("case 'visible': ");
            script.Append("$('.modulelinks, .ModuleEditLink, a.inlineedittoggle').show(); ");
            //script.Append("$('.ModuleEditLink').show(); ");
            //script.Append("$('a.inlineedittoggle').show(); ");

            //script.Append("$('div[contenteditable=\"false\"]').attr('contenteditable', true); ");

            script.Append("break; ");

            script.Append("case null: ");
            script.Append("$('.modulelinks').show(); ");
            script.Append("$('.ModuleEditLink').show(); ");
            script.Append("$('a.inlineedittoggle').show(); ");
            script.Append("Set_Cookie('editLinksState', 'visible'); ");
            script.Append("break; ");

            script.Append("}"); //end switch

            script.Append("}"); //end else

            script.Append("}"); //end function

            script.Append("\n</script>");

            ScriptManager.RegisterClientScriptBlock(
                this,
                typeof(Page),
                "editlinktogglemain",
                script.ToString(),
                false);

            script = new StringBuilder();
            script.Append("\n<script type=\"text/javascript\">");

            script.Append("$(document).ready(function() {");

            // Check editLinksState cookie and hide if set to 'hidden'
            script.Append(" ToggleEditLinks(false);");

            if (clickTargetSelector.Length > 0)
            {
                script.Append(" $('" + clickTargetSelector + "').click(function() { ToggleEditLinks(true); return false;});");
            }
            else
            {
                script.Append(" $('#" + ClientID + "').click(function() { ToggleEditLinks(true); return false; });");
            }

            script.Append("});");

            script.Append("\n</script>");

            ScriptManager.RegisterStartupScript(
                this,
                typeof(Page),
                "editlinktogglestartup",
                script.ToString(),
                false);
        }
Ejemplo n.º 28
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            currentPage = CacheHelper.GetCurrentPage();
            treatChildPageIndexAsSiteMap = WebConfigSettings.TreatChildPageIndexAsSiteMap;

            EnableViewState = false;

            isAdmin = WebUser.IsAdmin;
            if (!isAdmin) { isContentAdmin = WebUser.IsContentAdmin; }
            if ((!isAdmin) && (!isContentAdmin)) { isSiteEditor = SiteUtils.UserIsSiteEditor(); }

            isMobileSkin = SiteUtils.UseMobileSkin();

            if (WebConfigSettings.UsePageImagesInSiteMap && treatChildPageIndexAsSiteMap)
            {
                usePageImages = true;
            }

            if (
                (currentPage != null)
                && (((currentPage.ShowChildPageMenu) && (Page is CmsPage)) || forceDisplay)

                )
            {
                // moved and commented out 2007-08-07
                //PreviousImplementation();
                Visible = true;
                ShowChildPageMap();

            }
            else
            {
                this.Visible = false;
            }
        }
Ejemplo n.º 29
0
        private void LoadSettings(HttpContext context)
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            if (siteSettings == null) { return; }

            pageId = WebUtils.ParseInt32FromQueryString("pageid", true, pageId);
            moduleId = WebUtils.ParseInt32FromQueryString("mid", true, moduleId);

            if (moduleId == -1) { return; }
            if (pageId == -1) { return; }

            galleryPage = new PageSettings(siteSettings.SiteId, pageId);
            if (galleryPage.PageId == -1) { return; }

            galleryModule = new Module(moduleId, pageId);
            if (galleryModule.ModuleId == -1) { return; }

            if ((!WebUser.IsInRoles(galleryPage.AuthorizedRoles)) && (!WebUser.IsInRoles(galleryModule.ViewRoles))) { return; }

            siteRoot = WebUtils.GetSiteRoot();

            //thumbnailBaseUrl = siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString()
            //    + "/GalleryImages/" + moduleId.ToInvariantString() + "/Thumbnails/";

            //fullSizeBaseUrl = siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString()
            //    + "/GalleryImages/" + moduleId.ToInvariantString() + "/WebImages/";

            string baseUrl;
            if (WebConfigSettings.ImageGalleryUseMediaFolder)
            {
                baseUrl = siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/media/GalleryImages/" + moduleId.ToInvariantString() + "/";
            }
            else
            {
                baseUrl = siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/GalleryImages/" + moduleId.ToInvariantString() + "/";
            }

            thumbnailBaseUrl = baseUrl + "Thumbnails/";

            fullSizeBaseUrl = baseUrl + "WebImages/";

            gallery = new Gallery(moduleId);

            canRender = true;
        }
Ejemplo n.º 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current == null) { return; }

            siteSettings = CacheHelper.GetCurrentSiteSettings();

            SkinBaseUrl = SiteUtils.GetSkinBaseUrl(Page);

            isMobileDevice = SiteUtils.IsMobileDevice();

            if (Page is CmsPage)
            {
                isCmsPage = true;
                currentPage = CacheHelper.GetCurrentPage();
            }

            if (siteSettings == null) { return; }

            siteMapDataSource = (SiteMapDataSource)this.FindControl("SiteMapData");
            if(siteMapDataSource == null){ return;}

            siteMapDataSource.SiteMapProvider
                    = "mojosite" + siteSettings.SiteId.ToInvariantString();

            try {
                rootNode = siteMapDataSource.Provider.RootNode;
            }
            catch(HttpException) {
                return;
            }

            Control c = this.FindControl("StyleSheetCombiner");
            if ((c != null) && (c is StyleSheetCombiner))
            {
                StyleSheetCombiner style = c as StyleSheetCombiner;
                useArtisteer3 = style.UseArtisteer3;
                hideEmptyAlt1 = style.HideEmptyAlt1;
                hideEmptyAlt2 = style.HideEmptyAlt2;
            }

            if (!useArtisteer3)
            {
                Control l = this.FindControl("LayoutDisplaySettings1");
                if ((l != null) && (l is LayoutDisplaySettings))
                {
                    LayoutDisplaySettings layoutSettings = l as LayoutDisplaySettings;
                    leftSideNoRightSideCss = layoutSettings.LeftSideNoRightSideCss;
                    rightSideNoLeftSideCss = layoutSettings.RightSideNoLeftSideCss;
                    leftAndRightNoCenterCss = layoutSettings.LeftAndRightNoCenterCss;
                    leftOnlyCss = layoutSettings.LeftOnlyCss;
                    rightOnlyCss = layoutSettings.RightOnlyCss;
                    centerNoLeftSideCss = layoutSettings.CenterNoLeftSideCss;
                    centerNoRightSideCss = layoutSettings.CenterNoRightSideCss;
                    centerNoLeftOrRightSideCss = layoutSettings.CenterNoLeftOrRightSideCss;
                    centerWithLeftAndRightSideCss = layoutSettings.CenterWithLeftAndRightSideCss;
                    emptyCenterCss = layoutSettings.EmptyCenterCss;
                    hideEmptyCenterIfOnlySidesHaveContent = layoutSettings.HideEmptyCenterIfOnlySidesHaveContent;

                }
            }

            SetupLayout();
        }