예제 #1
0
        public override void Init(long websiteWidgetId)
        {
            WebSiteWidgetId = websiteWidgetId;
            ViewFileName    = "Widgets/NewsHorizontal";

            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                var config     = JsonConvert.DeserializeObject <dynamic>(configJson);
                DisplayTitle  = "";
                Footer        = "";
                Language      = config.language;
                headerTitle   = config.headerTitle;
                category      = config.category;
                columnClass   = config.columnClass;
                columnColor   = config.columnColor;
                columnBgColor = config.columnBgColor;
                footerTitle   = config.footerTitle;
            }

            ConfigViewFileName = "Widgets/NewsConfig";
            ConfigHtml         = _viewRenderService.RenderToStringAsync <NewsWidgetController>(ConfigViewFileName, webSiteWidget).Result;
        }
예제 #2
0
        public override void Init(long websiteWidgetId)
        {
            WebSiteWidgetId = websiteWidgetId;
            ViewFileName    = "Widgets/RecentPost";

            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                var config     = JsonConvert.DeserializeObject <dynamic>(configJson);
                DisplayTitle = config.title;
                Footer       = config.footer;
                Language     = config.language;

                try
                {
                    string pc = config.postCount;
                    PostCount = Convert.ToInt32(pc);
                    string ds = config.isDateShow;
                    if (ds == "on")
                    {
                        IsDateShow = true;
                    }
                    else
                    {
                        IsDateShow = false;
                    }
                }
                catch (Exception) { PostCount = 5; }
            }

            ConfigViewFileName = "Widgets/RecentPostConfig";
            ConfigHtml         = _viewRenderService.RenderToStringAsync <BlogController>(ConfigViewFileName, webSiteWidget).Result;
        }
예제 #3
0
        public override void Init(long websiteWidgetId)
        {
            WebSiteWidgetId = websiteWidgetId;
            ViewFileName    = "Widgets/Category";

            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                var config     = JsonConvert.DeserializeObject <dynamic>(configJson);
                DisplayTitle = config.title;
                Footer       = config.footer;
                Language     = config.language;

                try
                {
                    string temp = config.showCategoryHasPost;
                    ShowCategoryHasPost = (temp == "on") ? true : false;

                    temp          = config.showPostCount;
                    ShowPostCount = (temp == "on") ? true : false;

                    temp          = config.showHierarchy;
                    ShowHierarchy = (temp == "on") ? true : false;

                    temp = config.displayAsDropdown;
                    DisplayAsDropdown = (temp == "on") ? true : false;
                }
                catch (Exception) { }
            }

            ConfigViewFileName = "Widgets/CategoryConfig";
            ConfigHtml         = _viewRenderService.RenderToStringAsync <BlogController>(ConfigViewFileName, webSiteWidget).Result;
        }
예제 #4
0
        public override void Init(long websiteWidgetId, bool renderConfig = false)
        {
            WebSiteWidgetId = websiteWidgetId;
            ViewFileName    = "Widgets/RecentComments";

            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                var config     = JsonHelper.Deserilize <dynamic>(configJson);
                DisplayTitle = config.title;
                Footer       = config.footer;
                Language     = config.language;

                try
                {
                    string cc = config.commentsCount;
                    CommentsCount = string.IsNullOrEmpty(cc) ? 5 : Convert.ToInt32(cc);
                }
                catch (Exception) { CommentsCount = 5; }
            }

            if (renderConfig)
            {
                ConfigViewFileName = "Widgets/RecentCommentsConfig";
                ConfigHtml         = _viewRenderService.RenderToStringAsync <BlogController>(ConfigViewFileName, webSiteWidget).Result;
            }
        }
예제 #5
0
        public override void Init(long websiteWidgetId, bool renderConfig = false)
        {
            WebSiteWidgetId = websiteWidgetId;
            ViewFileName    = "Widgets/TagCloud";

            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                //var config = JsonConvert.DeserializeObject<dynamic>(configJson);
                var config = JsonHelper.Deserilize <dynamic>(configJson);
                DisplayTitle = config.title;
                Footer       = config.footer;
                Language     = config.language;

                try
                {
                    string temp = config.showPostCount;
                    ShowPostCount = (temp == "on") ? true : false;

                    temp           = config.showTagHasPost;
                    ShowTagHasPost = (temp == "on") ? true : false;
                }
                catch (Exception) { }
            }
            if (renderConfig)
            {
                ConfigViewFileName = "Widgets/TagCloudConfig";
                ConfigHtml         = _viewRenderService.RenderToStringAsync <BlogController>(ConfigViewFileName, webSiteWidget).Result;
            }
        }
예제 #6
0
        public override void Init(long websiteWidgetId)
        {
            WebSiteWidgetId = websiteWidgetId;
            ViewFileName    = "Widgets/TopBar";
            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                var config     = JsonConvert.DeserializeObject <dynamic>(configJson);
                DisplayTitle = config.title;
                Language     = config.language;
                Footer       = config.footer;
            }
        }
예제 #7
0
        public override void Init(long websiteWidgetId, bool renderConfig = false)
        {
            WebSiteWidgetId = websiteWidgetId;
            ViewFileName    = "Widgets/CmsSearch";
            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                var config     = JsonHelper.Deserilize <dynamic>(configJson);
                DisplayTitle = config.title;
                Footer       = config.footer;
                Language     = config.language;
            }
        }
        public override void Init(long websiteWidgetId)
        {
            WebSiteWidgetId = websiteWidgetId;
            ViewFileName    = "Widgets/CmsVerticalMenu";
            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                var config     = JsonConvert.DeserializeObject <dynamic>(configJson);
                DisplayTitle = config.title;
                Language     = config.language;
                Footer       = config.footer;
            }

            ConfigViewFileName = "Widgets/CmsVerticalMenuConfig";
            ConfigHtml         = _viewRenderService.RenderToStringAsync <CmsWidgetController>(ConfigViewFileName, webSiteWidget).Result;
        }
예제 #9
0
        public override void Init(long websiteWidgetId, bool renderConfig = false)
        {
            WebSiteWidgetId = websiteWidgetId;
            ViewFileName    = "Widgets/News";

            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                var config     = JsonConvert.DeserializeObject <dynamic>(configJson);
                DisplayTitle = "";
                Footer       = "";
                Language     = config.language;

                category = config.category;
                try
                {
                    newsCount = Convert.ToInt32(config.newsCount);
                }
                catch (Exception) { newsCount = 10; }

                headerTitle   = config.headerTitle;
                headerColor   = config.headerColor;
                headerBgColor = config.headerBgColor;

                columnClass   = config.columnClass;
                columnColor   = config.columnColor;
                columnBgColor = config.columnBgColor;
                scrollamount  = config.scrollamount;
                height        = config.height;

                footerTitle   = config.footerTitle;
                footerColor   = config.footerColor;
                footerBgColor = config.footerBgColor;
            }

            if (renderConfig)
            {
                ConfigViewFileName = "Widgets/NewsConfig";
                ConfigHtml         = _viewRenderService.RenderToStringAsync <NewsWidgetController>(ConfigViewFileName, webSiteWidget).Result;
            }
        }
예제 #10
0
        public override void Init(long websiteWidgetId, bool renderConfig = false)
        {
            WebSiteWidgetId = websiteWidgetId;
            //ViewFileName = "Widgets/CmsVerticalMenu";
            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                var config     = JsonHelper.Deserilize <dynamic>(configJson);
                DisplayTitle = config.title;
                Footer       = config.footer;
                body         = config.bodyContent;
                Language     = config.language;
            }
            if (renderConfig)
            {
                ConfigViewFileName = "Widgets/CmsHtmlDisplayConfig";
                ConfigHtml         = _viewRenderService.RenderToStringAsync <CmsHomeController>(ConfigViewFileName, webSiteWidget).Result;
            }
        }
예제 #11
0
        public override void Init(long websiteWidgetId)
        {
            WebSiteWidgetId = websiteWidgetId;
            ViewFileName    = "Widgets/ImageSlider";

            var webSiteWidget = _websiteWidgetService.Get(websiteWidgetId, true);

            if (webSiteWidget != null && !string.IsNullOrEmpty(webSiteWidget.WidgetConfigJson))
            {
                var configJson = webSiteWidget.WidgetConfigJson;
                var config     = JsonConvert.DeserializeObject <dynamic>(configJson);
                Language                = config.language;
                DisplayTitle            = config.title;
                Footer                  = config.footer;
                selectedImageSliderName = config.name;
            }

            ConfigViewFileName = "Widgets/ImageSliderConfig";
            var itemList = _imageSliderService.LoadAll(true).ToList();

            ConfigHtml = _viewRenderService.RenderToStringAsync <ImageSliderWidgetController>(ConfigViewFileName, itemList /*webSiteWidget*/).Result;
        }