示例#1
0
        public static string BuildEditLink(News news, CmsBasePage basePage, bool userCanUpdate, SiteUser currentUser)
        {
            if (PageView.UserViewMode == PageViewMode.View)
            {
                return(string.Empty);
            }

            if (!basePage.UserCanAuthorizeZone(news.ZoneID))
            {
                return(string.Empty);
            }



            if (WebConfigSettings.EnableContentWorkflow && basePage.SiteInfo.EnableContentWorkflow && !news.IsPublished)
            {
                if (news.StateId.HasValue)
                {
                    int workflowId           = WorkflowHelper.GetWorkflowId(News.FeatureGuid);
                    int firstWorkflowStateId = WorkflowHelper.GetFirstWorkflowStateId(workflowId);

                    if (news.StateId.Value == firstWorkflowStateId)
                    {
                        if (currentUser == null)
                        {
                            return(string.Empty);
                        }
                    }
                }
            }

            return(string.Empty);
        }
示例#2
0
 override protected void OnInit(EventArgs e)
 {
     this.Load += new EventHandler(this.Page_Load);
     base.OnInit(e);
     //this.EnableViewState = this.UserCanEditPage();
     basePage = Page as CmsBasePage;
     siteRoot = basePage.SiteRoot;
 }
示例#3
0
        override protected void OnInit(EventArgs e)
        {
            this.Load += new EventHandler(this.Page_Load);
            base.OnInit(e);

            basePage = Page as CmsBasePage;
            siteRoot = basePage.SiteRoot;
        }
示例#4
0
        private void PopulateControls()
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml("<ProductList></ProductList>");
            XmlElement root = doc.DocumentElement;

            XmlHelper.AddNode(doc, root, "ModuleTitle", this.Title);
            XmlHelper.AddNode(doc, root, "ZoneTitle", CurrentZone.Name);
            XmlHelper.AddNode(doc, root, "ViewMore", ProductResources.ViewMoreLabel);

            if (ModuleConfiguration.ResourceFileDef.Length > 0 && ModuleConfiguration.ResourceKeyDef.Length > 0)
            {
                List <string> lstResourceKeys = ModuleConfiguration.ResourceKeyDef.SplitOnCharAndTrim(';');

                foreach (string item in lstResourceKeys)
                {
                    XmlHelper.AddNode(doc, root, item, ResourceHelper.GetResourceString(ModuleConfiguration.ResourceFileDef, item));
                }
            }

            CmsBasePage basePage      = Page as CmsBasePage;
            bool        userCanUpdate = ProductPermission.CanUpdate;
            SiteUser    currentUser   = SiteUtils.GetCurrentSiteUser();

            List <Product> lstProducts = new List <Product>();

            if (ProductConfiguration.RecentlyViewedProductsEnabled && config.Position == 0)
            {
                lstProducts = ProductHelper.GetRecentlyViewedProducts(config.MaxProductsToGet);
            }
            else if (config.ZoneId > -1)
            {
                int zoneId = config.ZoneId;
                if (zoneId == 0)
                {
                    zoneId = CurrentZone.ZoneId;
                }

                string zoneRangeIds = ProductHelper.GetRangeZoneIdsToSemiColonSeparatedString(siteSettings.SiteId, zoneId);
                lstProducts = Product.GetPageBySearch(1, config.MaxProductsToGet, siteSettings.SiteId, zoneRangeIds, 1, WorkingCulture.LanguageId, -1, -1, null, null, config.Position);
            }
            else
            {
                lstProducts = Product.GetPage(SiteId, -1, WorkingCulture.LanguageId, config.Position, 1, config.MaxProductsToGet);
            }

            foreach (Product product in lstProducts)
            {
                XmlElement productXml = doc.CreateElement("Product");
                root.AppendChild(productXml);

                ProductHelper.BuildProductDataXml(doc, productXml, product, timeZone, timeOffset, ProductHelper.BuildEditLink(product, basePage, userCanUpdate, currentUser));
            }

            XmlHelper.XMLTransform(xmlTransformer, SiteUtils.GetXsltBasePath("product", ModuleConfiguration.XsltFileName), doc);
        }
示例#5
0
        private void PopulateControls()
        {
            if (config.LoadFirstProduct || forceLoadDetail)
            {
                Control c = Page.LoadControl("~/Product/Controls/ProductViewControl.ascx");
                if (c == null)
                {
                    return;
                }

                if (c is ProductViewControl)
                {
                    ProductViewControl productView = (ProductViewControl)c;
                    productView.module = this.ModuleConfiguration;
                    productView.Config = config;
                }

                placeHolder.Controls.Add(c);
            }
            else
            {
                Control c = Page.LoadControl("~/Product/Controls/ProductListControl.ascx");
                if (c == null)
                {
                    return;
                }

                if (c is ProductListControl)
                {
                    ProductListControl productList = (ProductListControl)c;
                    productList.ModuleId      = ModuleId;
                    productList.Config        = config;
                    productList.SiteRoot      = SiteRoot;
                    productList.ImageSiteRoot = ImageSiteRoot;
                    productList.ModuleTitle   = this.Title;
                }

                placeHolder.Controls.Add(c);

                if (!Page.IsPostBack)
                {
                    CartHelper.LastContinueShoppingPage = ProductHelper.BuildFilterUrlLeaveOutPageNumber(Request.RawUrl);
                }
            }

            if (forceLoadDetail)
            {
                CmsBasePage basePage = Page as CmsBasePage;
                if (basePage != null)
                {
                    basePage.LoadSideContent(config.ShowLeftContent, config.ShowRightContent, config.ShowHiddenContents);
                    basePage.LoadAltContent(ProductConfiguration.ShowTopContent, ProductConfiguration.ShowBottomContent, config.ShowHiddenContents);
                }
            }
        }
        private void LoadSettings()
        {
            regexEmail.ValidationExpression   = SecurityHelper.RegexEmailValidationPattern;
            regexToEmail.ValidationExpression = SecurityHelper.RegexEmailValidationPattern;

            CmsBasePage basePage = Page as CmsBasePage;

            if (basePage != null)
            {
                basePage.ScriptConfig.IncludeFancyBox = true;
            }
        }
示例#7
0
        private void LoadSettings()
        {
            canUpdate = ProductPermission.CanUpdate;

            lnkInsert.Visible = ProductPermission.CanCreate;
            btnUpdate.Visible = canUpdate;
            btnDelete.Visible = ProductPermission.CanDelete;

            currentUser   = SiteUtils.GetCurrentSiteUser();
            isAllowedZone = WebUser.IsAdminOrContentAdmin || SiteUtils.UserIsSiteEditor();

            siteSettings = CacheHelper.GetCurrentSiteSettings();
            basePage     = Page as CmsBasePage;
            siteRoot     = basePage.SiteRoot;

            canEditAnything = WebUser.IsAdminOrContentAdmin || SiteUtils.UserIsSiteEditor() || WebUser.IsInRoles("Order Administrators");

            breadcrumb.CurrentPageTitle = pageTitle;
            breadcrumb.CurrentPageUrl   = pageUrl;

            lnkInsert.NavigateUrl = siteRoot + EditPageUrl;
            if (ddZones.SelectedValue != "-1" && ddZones.SelectedValue.Length > 0)
            {
                lnkInsert.NavigateUrl = siteRoot + EditPageUrl + "?start=" + ddZones.SelectedValue;
            }
            else
            {
                if (startZone.Length > 0)
                {
                    lnkInsert.NavigateUrl = siteRoot + EditPageUrl + "?start=" + startZone.ToString();
                }
            }

            var column = grid.MasterTableView.Columns.FindByUniqueName("ProductCode");

            if (column != null)
            {
                column.Visible = displaySettings.ShowProductCode;
            }

            column = grid.MasterTableView.Columns.FindByUniqueName("Price");
            if (column != null)
            {
                column.Visible = displaySettings.ShowPrice;
            }

            column = grid.MasterTableView.Columns.FindByUniqueName("OldPrice");
            if (column != null)
            {
                column.Visible = displaySettings.ShowOldPrice;
            }
        }
示例#8
0
        override protected void OnInit(EventArgs e)
        {
            this.Load += new EventHandler(this.Page_Load);
            this.btnPostComment.Click     += new EventHandler(this.btnPostComment_Click);
            this.dlComments.ItemCommand   += new RepeaterCommandEventHandler(dlComments_ItemCommand);
            this.dlComments.ItemDataBound += new RepeaterItemEventHandler(dlComments_ItemDataBound);

            base.OnInit(e);
            basePage = Page as CmsBasePage;
            SiteRoot = basePage.SiteRoot;

            SiteUtils.SetupEditor(this.edComment, true, Page);
        }
示例#9
0
        private void PopulateControls()
        {
            if (config.LoadFirstItem || forceLoadDetail)
            {
                Control c = Page.LoadControl("~/News/Controls/NewsViewControl.ascx");
                if (c == null)
                {
                    return;
                }

                if (c is NewsViewControl)
                {
                    NewsViewControl newsView = (NewsViewControl)c;
                    newsView.module = this.ModuleConfiguration;
                    newsView.Config = config;
                }

                placeHolder.Controls.Add(c);
            }
            else
            {
                Control c = Page.LoadControl("~/News/Controls/NewsListControl.ascx");
                if (c == null)
                {
                    return;
                }

                if (c is NewsListControl)
                {
                    NewsListControl newsList = (NewsListControl)c;
                    newsList.ModuleId      = ModuleId;
                    newsList.Config        = config;
                    newsList.SiteRoot      = SiteRoot;
                    newsList.ImageSiteRoot = ImageSiteRoot;
                    newsList.ModuleTitle   = this.Title;
                }

                placeHolder.Controls.Add(c);
            }

            if (forceLoadDetail)
            {
                CmsBasePage basePage = Page as CmsBasePage;
                if (basePage != null)
                {
                    basePage.LoadSideContent(config.ShowLeftContent, config.ShowRightContent, config.ShowHiddenContents);
                    basePage.LoadAltContent(NewsConfiguration.ShowTopContent, NewsConfiguration.ShowBottomContent, config.ShowHiddenContents);
                }
            }
        }
示例#10
0
        private void LoadSettings()
        {
            EnsureConfiguration();

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

            languageId = WorkingCulture.LanguageId;
            newsId     = WebUtils.ParseInt32FromQueryString("NewsId", -1);

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

            basePage      = Page as CmsBasePage;
            userCanUpdate = NewsPermission.CanUpdate;
            currentUser   = SiteUtils.GetCurrentSiteUser();

            useFullUrlsForWebPage = WebConfigSettings.UseFullUrlsForWebPage;
            resolveFullUrlsForMenuItemProtocolDifferences = WebConfigSettings.ResolveFullUrlsForMenuItemProtocolDifferences;
            navigationSiteRoot = WebUtils.GetSiteRoot();
            if (resolveFullUrlsForMenuItemProtocolDifferences)
            {
                secureSiteRoot   = WebUtils.GetSecureSiteRoot();
                insecureSiteRoot = secureSiteRoot.Replace("https", "http");
            }

            isSecureRequest   = SiteUtils.IsSecureRequest();
            isMobileSkin      = SiteUtils.UseMobileSkin();
            siteMapDataSource = new SiteMapDataSource();
            siteMapDataSource.SiteMapProvider = "canhcamsite" + siteSettings.SiteId.ToInvariantString();

            rootNode     = siteMapDataSource.Provider.RootNode;
            currentNode  = SiteUtils.GetCurrentZoneSiteMapNode(rootNode);
            startingNode = rootNode;

            if (config.IsSubZone)
            {
                startingNode = currentNode;
            }
        }
示例#11
0
        protected virtual void LoadSettings()
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            zoneId       = WebUtils.ParseInt32FromQueryString("zoneid", zoneId);
            currentUser  = SiteUtils.GetCurrentSiteUser();
            timeOffset   = SiteUtils.GetUserTimeOffset();
            timeZone     = SiteUtils.GetUserTimeZone();
            pageNumber   = WebUtils.ParseInt32FromQueryString("pagenumber", pageNumber);

            if (Page is CmsBasePage)
            {
                basePage = Page as CmsBasePage;
                module   = basePage.GetModule(moduleId, News.FeatureGuid);
            }

            userCanUpdate = NewsPermission.CanUpdate;

            if (module == null)
            {
                return;
            }

            allowComments = Config.AllowComments && showCommentCounts;

            if (config.AllowComments)
            {
                //if ((DisqusSiteShortName.Length > 0) && (config.CommentSystem == "disqus"))
                //{
                //    disqusFlag = "#disqus_thread";
                //    disqus.SiteShortName = DisqusSiteShortName;
                //    disqus.RenderCommentCountScript = true;
                //}

                //if ((IntenseDebateAccountId.Length > 0) && (config.CommentSystem == "intensedebate"))
                //{
                //    showCommentCounts = false;
                //}

                if (config.CommentSystem == "facebook")
                {
                    showCommentCounts = false;
                }
            }
        }
示例#12
0
        private void LoadSettings()
        {
            timeOffset   = SiteUtils.GetUserTimeOffset();
            timeZone     = SiteUtils.GetUserTimeZone();
            canUpdate    = ProductPermission.CanUpdateComment;
            canDelete    = ProductPermission.CanDeleteComment;
            canApprove   = ProductPermission.CanApproveComment;
            pgr.PageSize = grid.PageSize;

            btnApprove.Visible     = canApprove;
            btnNotApproved.Visible = canApprove;
            btnDelete.Visible      = canDelete;

            CmsBasePage basePage = Page as CmsBasePage;

            if (basePage != null)
            {
                basePage.ScriptConfig.IncludeFancyBox = true;
            }

            AddClassToBody("admin-productreview");
        }
示例#13
0
        private void PopulateControls()
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml("<NewsList></NewsList>");
            XmlElement root = doc.DocumentElement;

            XmlHelper.AddNode(doc, root, "ModuleTitle", this.Title);
            XmlHelper.AddNode(doc, root, "ZoneTitle", CurrentZone.Name);
            XmlHelper.AddNode(doc, root, "ViewMore", NewsResources.NewsMoreLinkText);

            if (ModuleConfiguration.ResourceFileDef.Length > 0 && ModuleConfiguration.ResourceKeyDef.Length > 0)
            {
                List <string> lstResourceKeys = ModuleConfiguration.ResourceKeyDef.SplitOnCharAndTrim(';');

                foreach (string item in lstResourceKeys)
                {
                    XmlHelper.AddNode(doc, root, item, ResourceHelper.GetResourceString(ModuleConfiguration.ResourceFileDef, item));
                }
            }

            CmsBasePage basePage      = Page as CmsBasePage;
            bool        userCanUpdate = NewsPermission.CanUpdate;
            SiteUser    currentUser   = SiteUtils.GetCurrentSiteUser();

            List <News> lstNews    = new List <News>();
            int         languageId = WorkingCulture.LanguageId;

            if (config.ZoneId > -1 || config.ZoneIds.Length > 0 || config.SortBy > 0)
            {
                string zoneRangeIds = string.Empty;

                if (config.ZoneIds.Length > 0)
                {
                    zoneRangeIds = config.ZoneIds;
                }
                else
                {
                    int zoneId = config.ZoneId;
                    if (zoneId == 0)
                    {
                        zoneId = CurrentZone.ZoneId;
                    }

                    zoneRangeIds = NewsHelper.GetChildZoneIdToSemiColonSeparatedString(siteSettings.SiteId, zoneId);
                }

                lstNews = News.GetPageBySearch2(1, config.MaxItemsToGet, siteSettings.SiteId, zoneRangeIds, 1, languageId, config.NewsType, config.Position, -1, null, null, null, null, null, null, null, config.SortBy);
            }
            else
            {
                lstNews = News.GetPage(SiteId, -1, languageId, config.NewsType, config.Position, 1, config.MaxItemsToGet);
            }

            foreach (News news in lstNews)
            {
                XmlElement newsXml = doc.CreateElement("News");
                root.AppendChild(newsXml);

                NewsHelper.BuildNewsDataXml(doc, newsXml, news, timeZone, timeOffset, NewsHelper.BuildEditLink(news, basePage, userCanUpdate, currentUser));

                if (config.ShowAllImagesInNewsList)
                {
                    BuildNewsImagesXml(doc, newsXml, news, languageId);
                }
            }

            XmlHelper.XMLTransform(xmlTransformer, SiteUtils.GetXsltBasePath("news", ModuleConfiguration.XsltFileName), doc);
        }