public void Copy(long siteId, long menuId, long[] ArticleIds, long TargetMenuID) { ViewBag.SiteID = siteId; ViewBag.MenuID = menuId; ViewBag.ActionType = "copy"; if (ArticleIds.Length == 0) { return; } var targetMenu = MenusDAO.GetInfo(TargetMenuID); foreach (long ArticleId in ArticleIds) { ArticleModels articleItem = ArticleDAO.GetItem(ArticleId); CardsModels cardItem = CardsDAO.GetByNo(articleItem.CardNo); ZonesModels zoneItem = ZonesDAO.GetByNo(cardItem.ZoneNo.Value); PagesModels pageItem = PagesDAO.GetPageInfo(zoneItem.PageNo); long newCardNo = WorkV3.Golbal.PubFunc.CopyPage(pageItem, targetMenu.SiteID, targetMenu.ID); long newArticleId = WorkLib.GetItem.NewSN(); bool IsForceRelative = false; if (pageItem.SiteID == targetMenu.SiteID && pageItem.MenuID == targetMenu.ID) { IsForceRelative = true; } ArticleDAO.CopyArticle(ArticleId, newArticleId, newCardNo, targetMenu.ID, targetMenu.SiteID, IsForceRelative); WorkV3.Golbal.PubFunc.CopyIcon(articleItem.Icon, siteId, menuId, targetMenu.SiteID, targetMenu.ID); WorkV3.Golbal.PubFunc.CopyParagraphPhotos(articleItem.ID, siteId, menuId, targetMenu.SiteID, targetMenu.ID); } }
public ActionResult Setting(long siteId, long menuId) { ViewBag.Menu = MenusDAO.GetInfo(siteId, menuId); IEnumerable <ArticleTypesModels> types = ArticleTypesDAO.GetIssueItems(menuId); ViewBag.Types = types; //ViewBag.ListCards = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article").Where(c => c.ID != menuId); ViewBag.ListCards = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article"); // shan 20180102 依 CC 要求修改為本單元亦列入, 且預設勾選 ViewBag.ListCards2 = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article"); // shan 20180102 依 CC 要求修改為本單元亦列入, 且預設勾選 ViewBag.ListIdentity = CategoryDAO.GetIssueItems(IdentityType); ViewBag.SiteID = siteId; ViewBag.MenuID = menuId; ViewBag.UploadUrl = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/') + "/"; ViewBag.MemberRegSet = MemberShipRegSetDAO.GetItem(siteId); List <WorkV3.ViewModels.CommentType> ReplyItemList = WorkV3.ViewModels.CommentTypeLibs.GetCommitTypeList(); ViewBag.ReplyItemList = ReplyItemList; WorkV3.Models.ArticleSettingModels item = WorkV3.Models.DataAccess.ArticleSettingDAO.GetItem(menuId); if (item.Types == "all") { item.Types = string.Join(",", types.Select(t => t.ID)); } return(View(item)); }
public ActionResult MenuEdit_File(long?id) { ViewBag.HasChildren = false; //檔案上限 ViewBag.FileLimit = 1; ViewBag.FileExtensions = UpdFileInfo.FileExtensionsType.Custom;//Joe 20190925 問題單:後台單一檔案允許格式 if (uCheck.IsNumeric(id)) { long SiteId = GetItem.SiteID(); string vPath = UpdFileInfo.GetVPathBySiteID(SiteId, "Menus"); MenusModels mm = MenusDAO.GetInfo(SiteId, (long)id); ResourceFilesModels newFile = ResourceFilesDAO.GetInfo(SiteId, (long)id, (byte)SourceType.Menu, 1, 1, 1); if (newFile != null) { ViewBag.FileExists = new HtmlString(ResourceFilesDAO.fileuploader(newFile, vPath)); } var childList = MenusDAO.GetChildren(id.Value); if (childList != null && childList.Count() > 0) { ViewBag.HasChildren = true; } return(View(mm)); } return(View()); }
/// <summary> /// 取得瀏覽目錄by SiteID /// </summary> /// <param name="SiteID"></param> /// <param name="MenuID"></param> /// <returns></returns> public static string GetVPathByMenuID(long SiteID, long MenuID) { string Path = GetItem.ViewUpdUrl().TrimEnd('/'); MenusModels datas = MenusDAO.GetInfo(SiteID, MenuID); if (datas != null) { Path += "/" + datas.SiteSN + "/" + datas.SN + "/"; } return(Path); }
/// <summary> /// 取得實體上傳目錄by SiteID /// </summary> /// <param name="MenuID"></param> /// <param name="SiteID"></param> /// <returns></returns> public static string GetUPathByMenuID(long SiteID, long MenuID) { string Path = GetItem.UpdPath(); MenusModels datas = MenusDAO.GetInfo(SiteID, MenuID); if (datas != null) { Path += "\\" + datas.SiteSN + "\\" + datas.SN + "\\"; } return(Path); }
public ActionResult MenuEdit_Folder(long?id) { ViewBag.HasChildren = false; if (uCheck.IsNumeric(id)) { MenusModels mm = MenusDAO.GetInfo(GetItem.SiteID(), (long)id); var childList = MenusDAO.GetChildren(id.Value); if (childList != null && childList.Count() > 0) { ViewBag.HasChildren = true; } return(View(mm)); } return(View()); }
public void GetAddMenuTag(long?id) { long SiteID = GetItem.SiteID(); if (uCheck.IsNumeric(id)) { MenusModels mm = MenusDAO.GetInfo(SiteID, (long)id); string Fmt = "<li class=\"dd-item\" data-id=\"" + mm.ID + "\">" + "<div class=\"dd-handle\">" + " <i class=\"\"></i>" + " <span class=\"menu-title\">" + mm.Title + "</span>" + " <span class=\"icons-box\">" + " <i class=\""+ mm.GetShowStatusClass() + "\"></i>" + " <a class=\"openEdit\" href=\""+ Url.Action(mm.MenuURLAction, "Menus", new { id = mm.ID, SiteID = mm.SiteID }) + "\" data-height=\"" + mm.MenuiFrameH + "\" data-width=\"" + mm.MenuiFrameW + "\"><i class=\"cc cc-settings\"></i></a>" + " </span>" + "</div>" + "</li>"; Response.Write(Fmt); } }
public void Move(long siteId, long menuId, long[] ArticleIds, long TargetMenuID) { ViewBag.SiteID = siteId; ViewBag.MenuID = menuId; ViewBag.ActionType = "move"; if (ArticleIds.Length == 0) { return; } foreach (long ArticleId in ArticleIds) { ArticleModels articleItem = ArticleDAO.GetItem(ArticleId); CardsModels cardItem = CardsDAO.GetByNo(articleItem.CardNo); ZonesModels zoneItem = ZonesDAO.GetByNo(cardItem.ZoneNo.Value); PagesModels pageItem = PagesDAO.GetPageInfo(zoneItem.PageNo); var targetMenu = MenusDAO.GetInfo(TargetMenuID); WorkV3.Golbal.PubFunc.MovePage(pageItem, targetMenu.SiteID, targetMenu.ID); ArticleDAO.Move(ArticleId, targetMenu.ID, targetMenu.SiteID); WorkV3.Golbal.PubFunc.CopyIcon(articleItem.Icon, siteId, menuId, targetMenu.SiteID, targetMenu.ID); WorkV3.Golbal.PubFunc.CopyParagraphPhotos(articleItem.ID, siteId, menuId, targetMenu.SiteID, targetMenu.ID); } }
public ActionResult CleanIndex(string SiteSN, string PageSN, long?id) { bool PageisExist = false; byte ShowStatus = 3; SitesModels mSites = SitesDAO.GetSiteInfo(SiteSN); PageCache pageCache = new PageCache(); if (mSites != null) { ViewBag.SiteID = mSites.Id; PagesModels mPages = PagesDAO.GetPageInfo(mSites.Id, PageSN); if (mPages != null) { pageCache.SiteID = mPages.SiteID; pageCache.MenuID = mPages.MenuID; pageCache.PageNO = mPages.No; pageCache.PageSN = mPages.SN; pageCache.SiteName = mSites.Title; pageCache.SiteSN = mSites.SN; MenusModels mMenus = MenusDAO.GetInfo(mPages.SiteID, mPages.MenuID); if (mMenus != null) { ShowStatus = mMenus.ShowStatus; } if (ShowStatus != 3) { ShowStatus = mPages.ShowStatus; } PageisExist = true; ViewBag.PageNo = mPages.No; ViewBag.Title = mPages.Title; ViewBag.SiteName = mSites.Title; } #region GA List <SitesModels.GAInfoCont> GA = new List <SitesModels.GAInfoCont>(); if (mSites.GAInfo != string.Empty) { GA = JsonConvert.DeserializeObject <List <SitesModels.GAInfoCont> >(mSites.GAInfo); } ViewBag.GA = GA; #endregion } ViewBag.SiteSN = SiteSN; ViewBag.PageSN = PageSN; ViewBag.Id = id; PageCache.SetTempDataPageCache(TempData, pageCache); ViewBag.CustomCont = LoadCustomCont(pageCache); if (PageisExist == true) { if (ShowStatus == 3) { Response.Redirect(Url.Action("PageNotFound", "ErrorPages")); } else { #region 網頁點擊LOG long?memberID = null; WorkV3.Common.Member curUser = WorkV3.Common.Member.Current; if (curUser != null) { memberID = curUser.ID; } string referUrl = "", referUrlTitle = "", referrerUrlPageNo = ""; if (Request.UrlReferrer != null) { referUrl = Request.UrlReferrer.AbsoluteUri; if (referUrl.StartsWith(WorkLib.uUrl.GetURL())) { if (referUrl.Split('/').Length > 0) { string pageSN = referUrl.Split('/')[referUrl.Split('/').Length - 1]; Models.PagesModels pageInfo = Models.DataAccess.PagesDAO.GetPageInfo(pageCache.SiteID, pageSN); if (pageInfo != null) { referUrlTitle = pageInfo.Title; referrerUrlPageNo = pageInfo.No.ToString(); } else { Models.MenusModels menuInfo = Models.DataAccess.MenusDAO.GetInfo(pageCache.SiteID, pageSN); if (menuInfo != null) { referUrlTitle = menuInfo.Title; referrerUrlPageNo = menuInfo.Id.ToString(); } } } } } AddPageLog((long)pageCache.PageNO, mSites.Lang, 3, mSites.Id, getSessionID(), memberID, referUrl, referUrlTitle, referrerUrlPageNo); #endregion return(View()); } } else { string DefaultSiteSN = GetItem.appSet("DefaultSiteSN").ToString(); if (DefaultSiteSN != "") { Response.Redirect("~/w/" + DefaultSiteSN + "/index"); } } return(View("EmptyPage")); }
public ActionResult IndexWithoutLayout(string SiteSN, string PageSN, long?id, string lay = "") { PageCache pageCache = new PageCache(); bool PageisExist = false; byte ShowStatus = 3; SitesModels mSites = SitesDAO.GetSiteInfo(SiteSN); if (mSites != null) { ViewBag.SiteID = mSites.Id; PagesModels mPages = PagesDAO.GetPageInfo(mSites.Id, PageSN); if (mPages != null) { pageCache.SiteID = mPages.SiteID; pageCache.MenuID = mPages.MenuID; pageCache.PageNO = mPages.No; pageCache.PageSN = mPages.SN; pageCache.SiteName = mSites.Title; pageCache.SiteSN = mSites.SN; MenusModels mMenus = MenusDAO.GetInfo(mPages.SiteID, mPages.MenuID); if (mMenus != null) { ShowStatus = mMenus.ShowStatus; } if (ShowStatus != 3) { ShowStatus = mPages.ShowStatus; } PageisExist = true; ViewBag.PageNo = mPages.No; ViewBag.Title = mPages.Title; ViewBag.SiteName = mSites.Title; #region 網頁SEO wei 20180914 對集點 if (mPages != null) { string imgUrl = "", description = "", author = "", Title = ""; var pageSEO = PagesDAO.GetPageSEO(mPages.SiteID, mPages.No, mPages.Title); var siteSEO = Areas.Backend.Models.DataAccess.SiteSeoSettingDAO.GetItem(mPages.SiteID); var contentSEO = PagesDAO.GetContentSEO(mPages.SiteID, mPages.MenuID, mPages.No); string typeKeywords = contentSEO.Keywords;//PagesDAO.GetContentTypeKeyword(mPages.SiteID, mPages.MenuID, mPages.No); if (!string.IsNullOrEmpty(mPages.Title)) { ViewBag.SEO_Title = mPages.Title; // 以單頁的先給值 } //先設定頁面的 SEO //若PAGE SEO 存在, 則取代碼 => PAGE > SITE if (pageSEO != null) { string UploadUrl = UpdFileInfo.GetVPathByMenuID(mPages.SiteID, mPages.MenuID).TrimEnd('/') + "/"; if (!string.IsNullOrEmpty(pageSEO.Title)) { ViewBag.SEO_Title = pageSEO.Title; } if (!string.IsNullOrEmpty(pageSEO.Description)) { ViewBag.SEO_Description = pageSEO.Description; } if (!string.IsNullOrEmpty(pageSEO.Author)) { author = pageSEO.Author; } if (!string.IsNullOrEmpty(pageSEO.Copyright)) { ViewBag.SEO_Copyright = pageSEO.Copyright; } if (!string.IsNullOrEmpty(pageSEO.Keywords)) { ViewBag.SEO_Keywords = pageSEO.Keywords; } if (!string.IsNullOrEmpty(pageSEO.Image)) { ViewBag.SEO_Image = UploadUrl + pageSEO.Image; } description = ViewBag.SEO_Description; Title = ViewBag.SEO_Title; } if (contentSEO != null) { if (!string.IsNullOrEmpty(contentSEO.SocialImage)) { ViewBag.SEO_Image = contentSEO.SocialImage; } if (string.IsNullOrEmpty(description) && !string.IsNullOrEmpty(contentSEO.Description)) { ViewBag.SEO_Description = contentSEO.Description; } if (string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(contentSEO.Title)) { ViewBag.SEO_Title = contentSEO.Title; } if (contentSEO != null && !string.IsNullOrEmpty(contentSEO.Author)) { author = author.Trim(';') + ";" + contentSEO.Author; } } imgUrl = ViewBag.SEO_Image; ViewBag.SEO_Keywords = typeKeywords; //以SITE SEO 先給值, 若PAGE SEO 存在, 則取代碼 => PAGE > SITE if (siteSEO != null) { if (!string.IsNullOrEmpty(siteSEO.Title) && string.IsNullOrEmpty(ViewBag.SEO_Title)) { ViewBag.SEO_Title = siteSEO.Title; } if (!string.IsNullOrEmpty(siteSEO.Description) && string.IsNullOrEmpty(ViewBag.SEO_Description)) { ViewBag.SEO_Description = siteSEO.Description; } if (!string.IsNullOrEmpty(siteSEO.Author)) { author = author.Trim(';') + ";" + siteSEO.Author; } if (!string.IsNullOrEmpty(siteSEO.Copyright) && string.IsNullOrEmpty(ViewBag.SEO_Copyright)) { ViewBag.SEO_Copyright = siteSEO.Copyright; } if (!string.IsNullOrEmpty(siteSEO.Keywords)) { ViewBag.SEO_Keywords += (string.IsNullOrEmpty(ViewBag.SEO_Keywords) ? "" : ";") + siteSEO.Keywords; } WorkV3.Areas.Backend.Models.SocialSettingModels siteSocialSetting = WorkV3.Areas.Backend.Models.DataAccess.SocialSettingDAO.GetItem(mPages.SiteID); if (siteSocialSetting != null && !string.IsNullOrEmpty(siteSocialSetting.SocialDefaultImage)) { if (string.IsNullOrEmpty(imgUrl) && !string.IsNullOrEmpty(siteSocialSetting.SocialDefaultImage)) { string customImageFolder = "SocialImage"; WorkV3.Models.ImageModel imgModel = Newtonsoft.Json.JsonConvert.DeserializeObject <WorkV3.Models.ImageModel>(siteSocialSetting.SocialDefaultImage); string UploadUrl = UpdFileInfo.GetVPathBySiteID(mPages.SiteID, customImageFolder).TrimEnd('/') + "/"; ViewBag.SEO_Image = UploadUrl + imgModel.Img; } } } ViewBag.SEO_Author = author.Trim(';'); } #endregion } #region GA List <SitesModels.GAInfoCont> GA = new List <SitesModels.GAInfoCont>(); if (!string.IsNullOrEmpty(mSites.GAInfo)) { GA = JsonConvert.DeserializeObject <List <SitesModels.GAInfoCont> >(mSites.GAInfo); } ViewBag.GA = GA; #endregion } PageCache.SetTempDataPageCache(TempData, pageCache); ViewBag.SiteSN = SiteSN; ViewBag.PageSN = PageSN; ViewBag.Id = id; ViewBag.CustomCont = LoadCustomCont(pageCache); if (PageisExist == true) { if (ShowStatus == 3) { Response.Redirect(Url.Action("PageNotFound", "ErrorPages")); } else { #region 網頁點擊LOG long?memberID = null; WorkV3.Common.Member curUser = WorkV3.Common.Member.Current; if (curUser != null) { memberID = curUser.ID; } string referUrl = "", referUrlTitle = "", referrerUrlPageNo = ""; if (Request.UrlReferrer != null) { referUrl = Request.UrlReferrer.AbsoluteUri; if (referUrl.StartsWith(WorkLib.uUrl.GetURL())) { if (referUrl.Split('/').Length > 0) { string pageSN = referUrl.Split('/')[referUrl.Split('/').Length - 1]; Models.PagesModels pageInfo = Models.DataAccess.PagesDAO.GetPageInfo(pageCache.SiteID, pageSN); if (pageInfo != null) { referUrlTitle = pageInfo.Title; referrerUrlPageNo = pageInfo.No.ToString(); } else { Models.MenusModels menuInfo = Models.DataAccess.MenusDAO.GetInfo(pageCache.SiteID, pageSN); if (menuInfo != null) { referUrlTitle = menuInfo.Title; referrerUrlPageNo = menuInfo.Id.ToString(); } } } } } AddPageLog((long)pageCache.PageNO, mSites.Lang, 3, mSites.Id, getSessionID(), memberID, referUrl, referUrlTitle, referrerUrlPageNo); #endregion ViewBag.lay = null; if (lay != "") { ViewBag.lay = lay; } return(View()); } } else { string DefaultSiteSN = GetItem.appSet("DefaultSiteSN").ToString(); if (DefaultSiteSN != "") { Response.Redirect("~/w/" + DefaultSiteSN + "/index"); } } return(View("EmptyPage")); }
public ActionResult Index(string SiteSN, string PageSN, long?id) { bool PageisExist = false; byte ShowStatus = 3; SitesModels mSites = SitesDAO.GetSiteInfo(SiteSN); PageCache pageCache = new PageCache(); if (mSites != null) { if (mSites.IsDelete || !mSites.Issue) { var member = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent; if (member == null) { return(HttpNotFound()); } } ViewBag.SiteID = mSites.Id; Areas.Backend.Models.SiteSeoSettingModels siteSeoSetting = Areas.Backend.Models.DataAccess.SiteSeoSettingDAO.GetItem(mSites.Id); if (siteSeoSetting != null) { if (!siteSeoSetting.Robot) { ViewBag.NoRobot = true; } ViewBag.GoogleSearchCode = siteSeoSetting.GoogleSearch; ViewBag.BaidoSearchCode = siteSeoSetting.BaiduMA; ViewBag.BingSearchCode = siteSeoSetting.Bing; if (!string.IsNullOrEmpty(siteSeoSetting.GA)) { ViewBag.GACode = "<script async src=\"https://www.googletagmanager.com/gtag/js?id=" + siteSeoSetting.GA + "\"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', '" + siteSeoSetting.GA + "');</script>"; } if (!string.IsNullOrEmpty(siteSeoSetting.Baidu)) { ViewBag.Baidu = @"<script> var _hmt = _hmt || []; (function() { var hm = document.createElement('script'); hm.src = 'https://hm.baidu.com/hm.js?" + siteSeoSetting.Baidu + @"'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(hm, s); })(); </script> "; } if (!string.IsNullOrEmpty(siteSeoSetting.GTM)) { ViewBag.GTM_Head = @"<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','" + siteSeoSetting.GTM + @"');</script> <!-- End Google Tag Manager -->"; ViewBag.GTM_Body = "<noscript><iframe src=\"https://www.googletagmanager.com/ns.html?id=" + siteSeoSetting.GTM + "\" height=\"0\" width=\"0\" style = \"display:none;visibility:hidden\"></iframe></noscript>"; } if (siteSeoSetting.IsExtraCode) { ViewBag.ExtraCode = siteSeoSetting.ExtraCode; } } pageCache.SiteID = mSites.Id; pageCache.SiteName = mSites.Title; pageCache.SiteSN = mSites.SN; PagesModels mPages = PagesDAO.GetPageInfo(mSites.Id, PageSN); if (mPages != null) { pageCache.SiteID = mPages.SiteID; pageCache.MenuID = mPages.MenuID; pageCache.PageNO = mPages.No; pageCache.PageSN = mPages.SN; pageCache.SiteName = mSites.Title; pageCache.SiteSN = mSites.SN; MenusModels mMenus = MenusDAO.GetInfo(mPages.SiteID, mPages.MenuID); if (mMenus != null) { ShowStatus = mMenus.ShowStatus; } if (ShowStatus != 3) { ShowStatus = mPages.ShowStatus; } PageisExist = true; ViewBag.PageNo = mPages.No; ViewBag.Title = mPages.Title; ViewBag.MenuID = mPages.MenuID; ViewBag.SiteName = mSites.Title; ViewBag.FaviconPath = $"{WorkV3.Golbal.UpdFileInfo.GetVPathBySiteID(mSites.Id, "Header")}/{mSites.Favicon}"; #region 網頁SEO if (mPages != null) { string imgUrl = "", description = "", author = "", Title = ""; SEOModels pageSEO = null; if (PageSN == "RecruitDetail") //20190516 Nina 徵才需用ID取得SEO { long Id = 0; bool result = long.TryParse(Request.QueryString["ID"], out Id); if (result) { pageSEO = PagesDAO.GetPageSEO(mPages.SiteID, mPages.No, mPages.Title, Id); } } else { pageSEO = PagesDAO.GetPageSEO(mPages.SiteID, mPages.No, mPages.Title); } var siteSEO = Areas.Backend.Models.DataAccess.SiteSeoSettingDAO.GetItem(mPages.SiteID); var contentSEO = PagesDAO.GetContentSEO(mPages.SiteID, mPages.MenuID, mPages.No); string typeKeywords = contentSEO.Keywords;//PagesDAO.GetContentTypeKeyword(mPages.SiteID, mPages.MenuID, mPages.No); if (!string.IsNullOrEmpty(mPages.Title)) { ViewBag.SEO_Title = mPages.Title; // 以單頁的先給值 } //先設定頁面的 SEO //若PAGE SEO 存在, 則取代碼 => PAGE > SITE if (pageSEO != null) { string UploadUrl = UpdFileInfo.GetVPathByMenuID(mPages.SiteID, mPages.MenuID).TrimEnd('/') + "/"; if (!string.IsNullOrEmpty(pageSEO.Title)) { ViewBag.SEO_Title = pageSEO.Title; } if (!string.IsNullOrEmpty(pageSEO.Description)) { ViewBag.SEO_Description = pageSEO.Description; } if (!string.IsNullOrEmpty(pageSEO.Author)) { author = pageSEO.Author; } if (!string.IsNullOrEmpty(pageSEO.Copyright)) { ViewBag.SEO_Copyright = pageSEO.Copyright; } if (!string.IsNullOrEmpty(pageSEO.Keywords)) { ViewBag.SEO_Keywords = pageSEO.Keywords; } if (!string.IsNullOrEmpty(pageSEO.Image)) { ViewBag.SEO_Image = UploadUrl + pageSEO.Image; } description = ViewBag.SEO_Description; Title = ViewBag.SEO_Title; } if (contentSEO != null) { if (!string.IsNullOrEmpty(contentSEO.SocialImage)) { ViewBag.SEO_Image = contentSEO.SocialImage; } if (string.IsNullOrEmpty(description) && !string.IsNullOrEmpty(contentSEO.Description)) { ViewBag.SEO_Description = contentSEO.Description; } if (string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(contentSEO.Title)) { ViewBag.SEO_Title = contentSEO.Title; } if (contentSEO != null && !string.IsNullOrEmpty(contentSEO.Author)) { author = author.Trim(';') + ";" + contentSEO.Author; } } imgUrl = ViewBag.SEO_Image; ViewBag.SEO_Keywords = typeKeywords; //以SITE SEO 先給值, 若PAGE SEO 存在, 則取代碼 => PAGE > SITE if (siteSEO != null) { if (!string.IsNullOrEmpty(siteSEO.Title) && string.IsNullOrEmpty(ViewBag.SEO_Title)) { ViewBag.SEO_Title = siteSEO.Title; } if (!string.IsNullOrEmpty(siteSEO.Description) && string.IsNullOrEmpty(ViewBag.SEO_Description)) { ViewBag.SEO_Description = siteSEO.Description; } if (!string.IsNullOrEmpty(siteSEO.Author)) { author = author.Trim(';') + ";" + siteSEO.Author; } if (!string.IsNullOrEmpty(siteSEO.Copyright) && string.IsNullOrEmpty(ViewBag.SEO_Copyright)) { ViewBag.SEO_Copyright = siteSEO.Copyright; } if (!string.IsNullOrEmpty(siteSEO.Keywords)) { ViewBag.SEO_Keywords += (string.IsNullOrEmpty(ViewBag.SEO_Keywords) ? "" : ";") + siteSEO.Keywords; } WorkV3.Areas.Backend.Models.SocialSettingModels siteSocialSetting = WorkV3.Areas.Backend.Models.DataAccess.SocialSettingDAO.GetItem(mPages.SiteID); if (siteSocialSetting != null && !string.IsNullOrEmpty(siteSocialSetting.SocialDefaultImage)) { if (string.IsNullOrEmpty(imgUrl) && !string.IsNullOrEmpty(siteSocialSetting.SocialDefaultImage)) { string customImageFolder = "SocialImage"; WorkV3.Models.ImageModel imgModel = Newtonsoft.Json.JsonConvert.DeserializeObject <WorkV3.Models.ImageModel>(siteSocialSetting.SocialDefaultImage); string UploadUrl = UpdFileInfo.GetVPathBySiteID(mPages.SiteID, customImageFolder).TrimEnd('/') + "/"; ViewBag.SEO_Image = UploadUrl + imgModel.Img; } } } ViewBag.SEO_Author = author.Trim(';'); } #endregion } #region GA List <SitesModels.GAInfoCont> GA = new List <SitesModels.GAInfoCont>(); if (!string.IsNullOrEmpty(mSites.GAInfo)) { GA = JsonConvert.DeserializeObject <List <SitesModels.GAInfoCont> >(mSites.GAInfo); } ViewBag.GA = GA; #endregion } ViewBag.SiteSN = SiteSN; ViewBag.PageSN = PageSN; ViewBag.Id = id; PageCache.SetTempDataPageCache(TempData, pageCache); ViewBag.CustomCont = LoadCustomCont(pageCache); if (PageisExist == true) { if (ShowStatus == 3) { Response.Redirect(Url.Action("PageNotFound", "ErrorPages")); } else { #region 網頁點擊LOG long?memberID = null; WorkV3.Common.Member curUser = WorkV3.Common.Member.Current; if (curUser != null) { memberID = curUser.ID; } string referUrl = "", referUrlTitle = "", referrerUrlPageNo = ""; if (Request.UrlReferrer != null) { referUrl = Request.UrlReferrer.AbsoluteUri; if (referUrl.StartsWith(WorkLib.uUrl.GetURL())) { if (referUrl.Split('/').Length > 0) { string pageSN = referUrl.Split('/')[referUrl.Split('/').Length - 1]; Models.PagesModels pageInfo = Models.DataAccess.PagesDAO.GetPageInfo(pageCache.SiteID, pageSN); if (pageInfo != null) { referUrlTitle = pageInfo.Title; referrerUrlPageNo = pageInfo.No.ToString(); } else { Models.MenusModels menuInfo = Models.DataAccess.MenusDAO.GetInfo(pageCache.SiteID, pageSN); if (menuInfo != null) { referUrlTitle = menuInfo.Title; referrerUrlPageNo = menuInfo.Id.ToString(); } } } } } AddPageLog((long)pageCache.PageNO, mSites.Lang, 3, mSites.Id, getSessionID(), memberID, referUrl, referUrlTitle, referrerUrlPageNo); #endregion return(View()); } } else { //客製start string DefaultWebSite = Request.Url.AbsoluteUri; if (DefaultWebSite.Contains("webdemo") || DefaultWebSite.Contains("localhost")) { string DefaultSiteSN = GetItem.appSet("DefaultSiteSN").ToString(); if (DefaultSiteSN != null) { Response.Redirect("~/w/" + DefaultSiteSN + "/index"); } } else { DefaultWebSite = DefaultWebSite.Replace("www.", "").Replace("http://", "").Replace(".com.tw/", ""); if (DefaultWebSite == "nhmc") { DefaultWebSite = "NewHopeMarketing"; } else if (DefaultWebSite == "edec") { DefaultWebSite = "ELITEDREAM"; } Response.Redirect("~/w/" + DefaultWebSite + "/index"); } //客製end } return(View("EmptyPage")); }
/// <summary> /// 最新消息列表, 需傳入Token /// </summary> /// <param name="data"></param> /// <returns></returns> public ApiResultWithPage <List <NewsListResult> > Post([FromBody] ArticlesListRequest data) { ApiResultWithPage <List <NewsListResult> > result = new ApiResultWithPage <List <NewsListResult> >(); List <NewsListResult> contentItem = new List <NewsListResult>(); try { NewsListResultCode rcode = NewsListResultCode.Success; if (string.IsNullOrEmpty(data.SiteSN)) { rcode = NewsListResultCode.SiteNull; result.Success = false; result.Code = (int)rcode; result.Message = rcode.GetMessage(); return(result); } if (string.IsNullOrEmpty(data.SN)) { rcode = NewsListResultCode.ModuleSNNull; result.Success = false; result.Code = (int)rcode; result.Message = rcode.GetMessage(); return(result); } long SiteID = GetSiteID(data.SiteSN); if (SiteID <= 0) { rcode = NewsListResultCode.SiteNull; result.Success = false; result.Code = (int)rcode; result.Message = rcode.GetMessage(); return(result); } var menuItem = MenusDAO.GetInfo(SiteID, data.SN); if (menuItem == null || menuItem.Id <= 0) { rcode = NewsListResultCode.MenuNull; result.Success = false; result.Code = (int)rcode; result.Message = rcode.GetMessage(); return(result); } string uploadUrl = Golbal.UpdFileInfo.GetVPathByMenuID(SiteID, menuItem.Id).TrimEnd('/') + "/"; var setting = ArticleSettingDAO.GetItem(menuItem.Id); int pageIndex = data.Index ?? 1; int totalRecord; //var types = WorkV3.Areas.Backend.Models.DataAccess.ArticleTypesDAO.GetIssueItems(menuItem.Id); //if (types == null || types.Count()<=0) //{ // result.Success = true; // result.Code = (int)rcode; // result.Message = rcode.GetMessage(); // result.Content = contentItem; // return result; //} string typeCond = ""; if (data.Types != null && data.Types.Count() > 0) { typeCond = string.Join(",", data.Types); } List <ArticleModels> items = ArticleDAO.GetItems(setting, "", typeCond, null, pageIndex, out totalRecord); Dictionary <long, List <ArticleTypesModels> > ItemTypes = ArticleDAO.GetItemTypes(items.Select(item => item.ID)); foreach (var item in items) { #region 文章類別 List <ArticleTypes> articleTypesItem = new List <ArticleTypes>(); var HasItemTypes = ItemTypes.ContainsKey(item.ID); if (HasItemTypes) { foreach (var type in ItemTypes[item.ID]) { articleTypesItem.Add(new ArticleTypes() { Name = type.Name, Color = GetColorCode(type.Color) }); } } #endregion string link = string.Empty; if (item.Type == "link") { link = item.Link; } else if (item.Type == "archive") { if (!string.IsNullOrWhiteSpace(item.Archive)) { ResourceFilesModels file = Newtonsoft.Json.JsonConvert.DeserializeObject <ResourceFilesModels>(item.Archive); link = uploadUrl + file.FileInfo; } } contentItem.Add(new NewsListResult() { ID = item.ID, CardNo = item.CardNo, Type = item.Type, Title = item.Title, IssueDate = item.IssueDate?.ToString("yyyy.MM.dd"), Link = link, ArticleTypes = articleTypesItem }); } result.Success = true; result.Code = (int)rcode; result.Message = rcode.GetMessage(); result.Content = contentItem; return(result); } catch (Exception ex) { result.Code = (int)NewsListResultCode.Exception; result.Success = false; result.Message = ex.ToString(); } return(result); }
public ActionResult Setting(long siteId, WorkV3.Models.ArticleSettingModels item, string[] ExtendReadMenus, string[] ExtendReadMenus2, string[] ReadModeSet) { long menuId = item.MenuID; ViewBag.Menu = MenusDAO.GetInfo(siteId, menuId); ViewBag.Types = ArticleTypesDAO.GetIssueItems(menuId); //ViewBag.ListCards = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article").Where(c => c.ID != menuId); ViewBag.ListCards = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article"); // shan 20180102 依 CC 要求修改為本單元亦列入, 且預設勾選 ViewBag.ListCards2 = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article"); // shan 20180102 依 CC 要求修改為本單元亦列入, 且預設勾選 ViewBag.ListIdentity = CategoryDAO.GetIssueItems(IdentityType); ViewBag.SiteID = siteId; ViewBag.MenuID = menuId; ViewBag.UploadUrl = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/'); ViewBag.MemberRegSet = MemberShipRegSetDAO.GetItem(siteId); List <WorkV3.ViewModels.CommentType> ReplyItemList = WorkV3.ViewModels.CommentTypeLibs.GetCommitTypeList(); ViewBag.ReplyItemList = ReplyItemList; if (item.SortMode == "隨機排序") { item.SortField = "NewID()"; } if (ExtendReadMenus != null) { string eMenus = ""; foreach (string ExtendReadMenu in ExtendReadMenus) { if (!string.IsNullOrEmpty(ExtendReadMenu)) { eMenus += ExtendReadMenu + ","; } } eMenus = eMenus.Trim(','); item.ExtendReadMenus = eMenus; } else { item.ExtendReadMenus = string.Empty; } if (ExtendReadMenus2 != null) { string eMenus = ""; foreach (string ExtendReadMenu in ExtendReadMenus2) { if (!string.IsNullOrEmpty(ExtendReadMenu)) { eMenus += ExtendReadMenu + ","; } } eMenus = eMenus.Trim(','); item.ExtendReadMenus2 = eMenus; } else { item.ExtendReadMenus2 = string.Empty; } if (ReadModeSet != null) { string readModeSetStr = ""; foreach (string readModeSet in ReadModeSet) { if (!string.IsNullOrEmpty(readModeSet)) { readModeSetStr += readModeSet + ","; } } readModeSetStr = readModeSetStr.Trim(','); item.ReadModeSet = readModeSetStr; } else { item.ReadModeSet = string.Empty; } if (!string.IsNullOrWhiteSpace(item.DefaultImg)) { ResourceImagesModels imgModel = Newtonsoft.Json.JsonConvert.DeserializeObject <ResourceImagesModels>(item.DefaultImg); if (imgModel.ID == 0) { // 新上傳的圖片 HttpPostedFileBase postedFile = Request.Files["fDefaultImg"]; string fDefaultImgBase64 = Request.Form["fDefaultImgBase64"]; string fDefaultImgBase64_Resize = Request.Form["fDefaultImgBase64_Resize"]; if (postedFile == null || postedFile.ContentLength == 0) { item.DefaultImg = string.Empty; } else { string saveName = WorkV3.Golbal.UpdFileInfo.SaveFilesByMenuID(postedFile, siteId, menuId, fDefaultImgBase64, fDefaultImgBase64_Resize); imgModel.ID = 1; imgModel.Img = saveName; item.DefaultImg = Newtonsoft.Json.JsonConvert.SerializeObject(imgModel); } } } WorkV3.Models.DataAccess.ArticleSettingDAO.SetItem(item); ViewBag.Success = true; return(View(item)); }
public ActionResult Edit(long siteId, long menuId, string type, long?id, long?templateId) { ViewBag.SiteID = siteId; ViewBag.MenuID = menuId; ViewBag.Types = ArticleTypesDAO.GetIssueItems(menuId); ViewBag.Series = ArticleSeriesDAO.GetIssueItems(menuId); ViewBag.Categories = CategoryDAO.GetItems(FavorityType); ViewBag.Sites = WorkV3.Models.DataAccess.SitesDAO.GetDatas(); ViewBag.UploadUrl = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId); ViewBag.ListIdentity = CategoryDAO.GetIssueItems(IdentityType); int cardStyleID = 1; List <CardsModels> cardItem = CardsDAO.GetPageData(siteId, menuId); foreach (var cards in cardItem) { if (cards.CardsType == "Article") { cardStyleID = cards.StylesID; break; } } ArticleModels item = null; if (id != null) { item = ArticleDAO.GetItem((long)id); SetLinkDetailViewBag(item.LinkDetail); } if (item == null && templateId != null) { MenusModels menu = MenusDAO.GetInfo(siteId, menuId); long newArticleId = WorkLib.GetItem.NewSN(); long cardNo = WorkV3.Golbal.PubFunc.AddPage(siteId, menuId, menu.SN, "Article", "Content", true, CardStyleId: cardStyleID); ArticleDAO.Copy((long)templateId, newArticleId, cardNo, menuId, siteId, true); item = ArticleDAO.GetItem(newArticleId); item.VideoType = "youtube"; ViewBag.FromTemplate = true; } if (item == null) { item = new ArticleModels { ID = WorkLib.GetItem.NewSN(), Type = type, IsIssue = true }; ViewBag.ArticleTypes = new long[] { }; ViewBag.ArticleSeries = new long[] { }; ViewBag.ArticleCategories = new long[] { }; ViewBag.ArticlePosters = new ArticlePosterModels[] { }; } else { ViewBag.ArticleTypes = ArticleDAO.GetItemTypes(item.ID); ViewBag.ArticleSeries = ArticleDAO.GetItemSeries(item.ID); ViewBag.ArticleCategories = ArticleDAO.GetItemCategories(item.ID); IEnumerable <ArticlePosterModels> posters = ArticleDAO.GetItemPosters(item.ID); foreach (ArticlePosterModels p in posters) { if (!string.IsNullOrWhiteSpace(p.Photo)) { ResourceImagesModels photo = Newtonsoft.Json.JsonConvert.DeserializeObject <ResourceImagesModels>(p.Photo); if (photo.Img != string.Empty) { p.Photo = photo.Img; } } } ViewBag.ArticlePosters = posters; } ViewBag.showMainVideo = false; if (item.VideoID != "") { ViewBag.showMainVideo = true; } return(View(item)); }
public ActionResult MenuEdit_Link(long?id) { ViewBag.HasChildren = false; List <long> MenuIDs = new List <long>(); Dictionary <int, WorkV3.Models.MenusModels> MenuList = new Dictionary <int, WorkV3.Models.MenusModels>(); if (uCheck.IsNumeric(id)) { long SiteID = GetItem.SiteID(); MenusModels mm = MenusDAO.GetInfo(GetItem.SiteID(), (long)id); ResourceLinksModels newLink = ResourceLinksDAO.GetInfo(SiteID, (long)id, (byte)SourceType.Menu, 1, 1, 1); ViewBag.LinkInfo = newLink; var childList = MenusDAO.GetChildren(id.Value); if (childList != null && childList.Count() > 0) { ViewBag.HasChildren = true; } int menuLev = 0; if (!string.IsNullOrEmpty(newLink.Detail)) { var menuInfo = WorkV3.Models.DataAccess.MenusDAO.GetInfo(long.Parse(newLink.Detail)); if (menuInfo != null && !string.IsNullOrEmpty(menuInfo.Title)) { ViewBag.DefaultSiteID = menuInfo.SiteID; menuLev++; MenuList.Add(menuLev, menuInfo); while (menuInfo.ParentID != 0) { menuInfo = WorkV3.Models.DataAccess.MenusDAO.GetInfo(menuInfo.ParentID); if (menuInfo != null && !string.IsNullOrEmpty(menuInfo.Title)) { menuLev++; MenuList.Add(menuLev, menuInfo); } else { break; } } } else { var pageInfo = WorkV3.Areas.Backend.Models.DataAccess.PagesDAO.GetPageInfo(long.Parse(newLink.Detail)); if (pageInfo != null && !string.IsNullOrEmpty(pageInfo.Title)) { ViewBag.DefaultSiteID = pageInfo.SiteID; ViewBag.DefaultPageTitle = pageInfo.Title; var page_menuInfo = WorkV3.Models.DataAccess.MenusDAO.GetInfo(pageInfo.MenuID); if (page_menuInfo != null) { menuLev++; MenuList.Add(menuLev, page_menuInfo); while (page_menuInfo.ParentID != 0) { page_menuInfo = WorkV3.Models.DataAccess.MenusDAO.GetInfo(page_menuInfo.ParentID); if (page_menuInfo != null && !string.IsNullOrEmpty(page_menuInfo.Title)) { menuLev++; MenuList.Add(menuLev, page_menuInfo); } else { break; } } } } } if (MenuList != null && MenuList.Count > 0) { var orderMenus = MenuList.OrderByDescending(p => p.Key).Select(p => p.Value.Id); MenuIDs = orderMenus.ToList(); } ViewBag.DefaultMenus = MenuIDs; } return(View(mm)); } return(View()); }
public ActionResult Index(CardsModels model, string key, string type, long?typeId, int?index) { ViewBag.SiteID = model.SiteID; long menuId = CardsDAO.GetMenuID(model.No); ViewBag.Menu = MenusDAO.GetInfo(model.SiteID, menuId); ViewBag.SitePage = CardsDAO.GetPage((long)MenusDAO.GetFirstCardNo(menuId, "Article")); SitePage page = CardsDAO.GetPage(model.No); ArticleSettingModels setting = ArticleSettingDAO.GetItem(menuId); #region 文章列表是否限制會員觀看 if (setting.ReadMode == 1 && !string.IsNullOrWhiteSpace(setting.ReadModeSet)) { Member curUser = Member.Current; string IdentityName = ""; //限制身分的名稱 IEnumerable <Areas.Backend.Models.CategoryModels> listReadModeCategorie = Areas.Backend.Models.DataAccess.CategoryDAO.GetItems(IdentityType, setting.ReadModeSet); foreach (var readModeList in listReadModeCategorie) { IdentityName += readModeList.Title + "、"; } IdentityName = IdentityName.TrimEnd('、'); ViewBag.IdentityName = IdentityName; if (curUser == null) { ViewBag.CheckReadMode = false; ViewBag.IsLogin = false; } else { bool checkReadMode = ArticleDAO.ListCheckReadMode(curUser.ID, IdentityType, listReadModeCategorie); if (!checkReadMode) { ViewBag.CheckReadMode = false; } } } #endregion if (setting.PagingMode == "不分頁") { setting.PageSize = int.MaxValue; } IEnumerable <ArticleTypesModels> types = ArticleTypesDAO.GetItems(menuId); if (setting.Types != "all") { IEnumerable <long> allowTypeIds = setting.GetTypes(); types = types.Where(t => allowTypeIds.Contains(t.ID)); setting.Types = string.Join(",", types.Select(t => t.ID)); } ViewBag.Types = types; int pageIndex = index ?? 1; int totalRecord; IEnumerable <ArticleModels> items = ArticleDAO.GetItems(setting, key, type, typeId, pageIndex, out totalRecord); ViewBag.ItemTypes = ArticleDAO.GetItemTypes(items.Select(item => item.ID)); ViewBag.ItemPages = CardsDAO.GetPages(items.Select(item => item.CardNo)); ViewBag.UploadUrl = UpdFileInfo.GetVPathByMenuID(model.SiteID, menuId).TrimEnd('/') + "/"; ViewBag.Pagination = new Pagination { PageSize = setting.PageSize, PageIndex = pageIndex, TotalRecord = totalRecord }; ViewBag.Setting = setting; ViewBag.Type = type; int style = model.StylesID == 0 ? 1 : model.StylesID; // style = 6; return(View("ListStyle" + style, items)); }