示例#1
0
        // GET: Header
        public ActionResult Index(CardsModels model)
        {
            WorkV3.Common.SitePage curPage = WorkV3.Models.DataAccess.CardsDAO.GetPage(model.No);
            ViewBag.SiteID = curPage.SiteID;
            List <MenusModels> Menus     = Models.DataAccess.MenusDAO.GetFrontMenus(curPage.SiteID);
            SitesModels        SitesInfo = SitesDAO.GetInfo(curPage.SiteID);

            WorkV3.Areas.Backend.Models.DataAccess.KeywordDAO keywordDao = new Areas.Backend.Models.DataAccess.KeywordDAO();    // neil 20180331 新增關鍵字搜尋
            ViewBag.SitesInfo = SitesInfo;

            #region WebLang
            List <SiteLangMenuModel> SiteLang = new List <SiteLangMenuModel>();
            if (uCheck.IsNumeric(curPage.SiteID))
            {
                if (SitesInfo.IsLang)//有開放再抓語言別資料
                {
                    SiteLang = SiteLangMenuDAO.GetDatas(curPage.SiteID);
                }
            }
            ViewBag.SiteLang = SiteLang;
            #endregion

            #region Socal
            List <SitesModels.socialSettingCont> social = new List <SitesModels.socialSettingCont>();
            if (SitesInfo != null)
            {
                if (!string.IsNullOrEmpty(SitesInfo.socialSetting))
                {
                    social = JsonConvert.DeserializeObject <List <SitesModels.socialSettingCont> >(SitesInfo.socialSetting);
                }
            }
            ViewBag.social = social;
            #endregion
            #region  會員功能機制

            Areas.Backend.Models.MemberShipRegSetModels MemberSetModel = Areas.Backend.Models.DataAccess.MemberShipRegSetDAO.GetItem(model.SiteID);
            bool IsEnabledMember = false;
            if (MemberSetModel != null)
            {
                IsEnabledMember = MemberSetModel.IsOpenReg;
            }
            ViewBag.IsEnabledMember = IsEnabledMember;
            #endregion

            ViewBag.SearchPage  = SearchResultDAO.GetSearchPage(curPage.SiteID);
            ViewBag.VPath       = WorkV3.Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, "Header");
            ViewBag.VMemberPath = WorkV3.Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, "Member");
            ViewBag.Keywords    = keywordDao.GetAllKeywords(true);
            ViewBag.VMenuPath   = Golbal.UpdFileInfo.GetVPathBySiteID(curPage.SiteID, "Menus");
            int style = model.StylesID;
            return(View("Style" + style, Menus));
        }
示例#2
0
        public ActionResult Template(long siteId, long menuId, long templateId, long sourceId)
        {
            ViewBag.SiteID     = siteId;
            ViewBag.MenuID     = menuId;
            ViewBag.TemplateID = templateId;

            string uploadUrl = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/') + "/";

            WorkV3.Models.TemplateModels template = ArticleDAO.GetTemplate(templateId);
            if (template == null || string.IsNullOrWhiteSpace(template.Thumb))
            {
                WorkV3.Models.ArticleModels article = WorkV3.Models.DataAccess.ArticleDAO.GetItem(sourceId);
                WorkV3.Common.SitePage      page    = WorkV3.Models.DataAccess.CardsDAO.GetPage(article.CardNo);

                string url = Request.Url.ToString();
                url  = System.Text.RegularExpressions.Regex.Match(url, @"^https?://[^/]+/").Value.TrimEnd('/');
                url += Url.Action("Index", "Home", new { SiteSN = page.SiteSN, PageSN = page.PageSN, area = string.Empty });
                //WorkV3.Common.PageToImage imgConverter = new WorkV3.Common.PageToImage(url);

                string uploadPath = WorkV3.Golbal.UpdFileInfo.GetUPathByMenuID(siteId, menuId).TrimEnd('\\') + "\\";
                string thumb      = WorkLib.GetItem.NewSN().ToString() + ".jpg";
                //imgConverter.SaveImage(uploadPath + thumb);
                WorkV3.Models.DataAccess.SiteCoverRecreateSchedule snapCoverItem = new WorkV3.Models.DataAccess.SiteCoverRecreateSchedule(Request.ApplicationPath.Trim('/'));
                snapCoverItem.SnapCoverNow(url, uploadPath + thumb);
                string name = "自訂範本" + DateTime.Now.ToString("yyyyMMdd");
                ArticleDAO.SetTemplateName(templateId, name, thumb);

                template = new WorkV3.Models.TemplateModels {
                    ID = templateId, Name = name, Thumb = uploadUrl + thumb
                };
            }
            else
            {
                if (!string.IsNullOrWhiteSpace(template.Thumb))
                {
                    template.Thumb = uploadUrl + template.Thumb;
                }
            }

            return(View(template));
        }