public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); if (!string.IsNullOrEmpty(bonanzaKategori_regEx)) regEx_bonanzaKategori = new Regex(bonanzaKategori_regEx, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture); if (!string.IsNullOrEmpty(bonanzaSerie_regEx)) regEx_bonanzaSerie = new Regex(bonanzaSerie_regEx, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture); if (!string.IsNullOrEmpty(bonanzaVideolist_regEx)) regEx_bonanzaVideolist = new Regex(bonanzaVideolist_regEx, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture); }
public SiteSettingsViewModel() { BookmarkTitle = "Site Settings"; Settings = Context.SiteSettings.FirstOrDefault(); // Set some initial values if none are found. if (Settings == null) { Settings = new SiteSettings() { SearchIndex = true }; Context.SiteSettings.Add(Settings); Context.SaveChanges(); } SiteRetensionTimeValues = new Dictionary<int, bool> { { 5, Settings.ContentPageRevisionsRetensionCount == 5 }, { 10, Settings.ContentPageRevisionsRetensionCount == 10 }, { 25, Settings.ContentPageRevisionsRetensionCount == 25 }, { 50, Settings.ContentPageRevisionsRetensionCount == 50 } }; RolesList = Roles.GetAllRoles().ToList(); }
private void SettingsFunctions(SiteSettings SiteSettings) { Func<ActionExecutingContext, string> operationsFunc = FilterContext => { var type = FilterContext.HttpContext.Request["Type"]; if (String.IsNullOrWhiteSpace(type)) { var key = FilterContext.RouteData.Values.Keys. FirstOrDefault(x => x.Equals("Type", StringComparison.OrdinalIgnoreCase)); if (key == null) { throw new Exception("No default parameter found in route values. Looking for parameter 'type'."); } type = FilterContext.RouteData.Values[key].ToString(); } var apType = (ApType)Enum.Parse(typeof(ApType), type, true); FilterContext.ActionParameters["ApType"] = apType; switch (apType) { case ApType.blog: return "Default"; default: throw new Exception("Unable to find area name for type " + apType); } }; SiteSettings.Actions.Add("Operations", operationsFunc); }
public void TestMethod() { HockeyStreams hs = new HockeyStreams(); hs.setUsername("geoffstewart"); hs.setPassword("homer"); // System.Collections.Generic.List<VideoInfo> videoList = hs.getVideoList(null); // // foreach (VideoInfo vi in videoList) { // List<string> urls = hs.getMultipleVideoUrls(vi, false); // Console.Out.Write(urls); // } SiteSettings s = new SiteSettings(); hs.Initialize(s); hs.Settings.Categories = new System.ComponentModel.BindingList<Category>(); hs.DiscoverDynamicCategories(); // live games hs.DiscoverSubCategories(hs.Settings.Categories[0]); Category game = hs.Settings.Categories[0].SubCategories[0]; List<VideoInfo> vidList = hs.GetVideos(game); // archived games hs.DiscoverSubCategories(hs.Settings.Categories[1]); List<VideoInfo> vidList2 = hs.GetVideos(hs.Settings.Categories[1].SubCategories[0]); List<string> vidList3 = hs.GetMultipleVideoUrls(vidList2[0], false); }
public VideoViewModel(VideoInfo videoInfo, Category category, SiteSettings siteSettings, bool isDetailsVideo) : base(Consts.KEY_NAME, isDetailsVideo ? ((DetailVideoInfo)videoInfo).Title2 : videoInfo.Title) { SiteSettings = siteSettings; VideoInfo = videoInfo; Category = category; SiteName = siteSettings.Name; SiteUtilName = siteSettings.UtilName; IsDetailsVideo = isDetailsVideo; _titleProperty = new WProperty(typeof(string), videoInfo.Title); _title2Property = new WProperty(typeof(string), isDetailsVideo ? ((DetailVideoInfo)videoInfo).Title2 : string.Empty); _descriptionProperty = new WProperty(typeof(string), videoInfo.Description); _lengthProperty = new WProperty(typeof(string), videoInfo.Length); _airdateProperty = new WProperty(typeof(string), videoInfo.Airdate); _thumbnailImageProperty = new WProperty(typeof(string), videoInfo.ThumbnailImage); _contextMenuEntriesProperty = new WProperty(typeof(ItemsList), null); _eventDelegator = OnlineVideosAppDomain.Domain.CreateInstanceAndUnwrap(typeof(PropertyChangedDelegator).Assembly.FullName, typeof(PropertyChangedDelegator).FullName) as PropertyChangedDelegator; _eventDelegator.InvokeTarget = new PropertyChangedExecutor { InvokeHandler = (s, e) => { if (e.PropertyName == "ThumbnailImage") ThumbnailImage = (s as VideoInfo).ThumbnailImage; else if (e.PropertyName == "Length") Length = (s as VideoInfo).Length; } }; VideoInfo.PropertyChanged += _eventDelegator.EventDelegate; }
public PublishSiteWindow(SiteSettings site) { Site = site; PublishCommand = new RelayCommand(Publish, CanPublish); RegisterCommand = new RelayCommand(Register, CanRegister); DataContext = this; InitializeComponent(); }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); regEx_SubSubCategory = regEx_dynamicSubCategories; regEx_SubCategory = regEx_dynamicCategories; regEx_dynamicCategories = null; regEx_Generos = new Regex(generosRegEx, defaultRegexOptions); }
public static SiteSettings Load() { var settings = new SiteSettings(); settings.Value = new Repository("").Load(FileName); settings.Value = SiteEngine.RunHook("get_site_settings", settings.Value); //Log.Enabled = ((ExpandoObject)settings.Value).HasProperty("EnableLog", "on"); return settings; }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); regEx_Shows = new Regex(showsRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); regEx_Playlist = new Regex(playlistRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); regEx_Videolist = new Regex(videolistRegEx, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture); }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); URL_regEx = @"//user\strack\svariables.*?var\sut_section_id\s=\s""(?<ut_section_id>[^""]+).*?var\smedia_id\s=\s""(?<media_id>[^""]+).*?var\ssite_id\s=\s""(?<site_id>[^""]+).*?var\ssection_id\s=\s'(?<section_id>[^']+)"; URLFile_regEx = @"\<item\stype="".+?src=""(?<FileUrl>[^""]+)"".+?server=""(?<FileServer>[^""]+)"".+?(?:mimetype=""(?<FileType>[^""]+)"")?"; regEx_URL = new Regex(URL_regEx, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline); regEx_URLFile = new Regex(URLFile_regEx, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline); }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); RegexOptions defaultRegexOptions = RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace | RegexOptions.ExplicitCapture; if (!string.IsNullOrEmpty(dynamicSubSubCategoriesRegEx)) regEx_dynamicSubSubCategories = new Regex(dynamicSubSubCategoriesRegEx, defaultRegexOptions); if (!string.IsNullOrEmpty(dynamicSubSubCategoriesNextPageRegEx)) regEx_dynamicSubSubCategoriesNextPage = new Regex(dynamicSubSubCategoriesNextPageRegEx, defaultRegexOptions); }
public AdminLoginModule(ILoginService loginService, IDocumentStore store) : base("/admin") { this.RequiresInstallerDisabled(() => store.OpenSession()); this.RequiresHttpsOrXProto(); Get["/login"] = parameters => { using (IDocumentSession session = store.OpenSession()) { SiteSettings site = session.GetSiteSettings(); if (site == null) { site = new SiteSettings { Title = "Admin", SubTitle = "Go to Site -> Settings" }; } return View["admin/login", new { site.Title, SubTitle = "Login" }]; } }; Get["/logout"] = parameters => { // Called when the user clicks the sign out button in the application. Should // perform one of the Logout actions (see below) return View["admin/logout"]; }; Post["/login"] = parameters => { // Called when the user submits the contents of the login form. Should // validate the user based on the posted form data, and perform one of the // Login actions (see below) var loginParameters = this.Bind<LoginParameters>(); User user; if (!loginService.Login(loginParameters.UserName, loginParameters.Password, out user)) { return global::System.Net.HttpStatusCode.Unauthorized; } return this.LoginAndRedirect( user.Identifier, fallbackRedirectUrl: "/admin", cookieExpiry: DateTime.Now.AddHours(1)); }; }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); base._title = "BFM Business"; base._img = "bfmbusiness"; base._urlToken = "http://api.nextradiotv.com/bfmbusiness-iphone/3/"; base._urlMenu = "http://api.nextradiotv.com/bfmbusiness-iphone/3/{0}/getMainMenu"; base._urlVideoList = "http://api.nextradiotv.com/bfmbusiness-iphone/3/{0}/getVideosList?count=40&page=1&category={1}"; base._urlVideo = "http://api.nextradiotv.com/bfmbusiness-iphone/3/{0}/getVideo?idVideo={1}&quality=2"; }
public OnlineSiteViewModel(OnlineVideosWebservice.Site site, SiteSettings localSite) : base(Consts.KEY_NAME, site.Name) { _lastUpdatedProperty = new WProperty(typeof(DateTime), default(DateTime)); Site = site; LocalSite = localSite; Owner = !string.IsNullOrEmpty(site.Owner_FK) ? site.Owner_FK.Substring(0, site.Owner_FK.IndexOf('@')) : string.Empty; LastUpdated = site.LastUpdated.ToLocalTime(); }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); regex_Genres = new Regex(genresRegEx, defaultRegexOptions); regex_AZSubCategories = new Regex(aZSubCategoriesRegEx, defaultRegexOptions); regex_SeriesSubCategories = new Regex(seriesSubCategoriesRegEx, defaultRegexOptions); regex_SeasonCategories = new Regex(seasonCategoriesRegEx, defaultRegexOptions); regex_ShowVideoList = new Regex(showVideoListRegEx, defaultRegexOptions); regex_MoviesVideoList = new Regex(moviesVideoListRegEx, defaultRegexOptions); }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); base._title = "RMC Sport"; base._img = "rmcsport"; base._urlToken = "http://api.nextradiotv.com/rmcsport-android/3/"; base._urlMenu = "http://api.nextradiotv.com/rmcsport-android/3/{0}/getMainMenu"; base._urlVideoList = "http://api.nextradiotv.com/rmcsport-android/3/{0}/getVideosList?count=40&page=1&category={1}"; base._urlVideo = "http://api.nextradiotv.com/rmcsport-android/3/{0}/getVideo?idVideo={1}&quality=2"; }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); // Populate list of video items to skip (invalid video urls etc..) // No longer required however if issues pop-popup we can get new entries her. //videosToSkip.Add("gt/live"); //videosToSkip.Add("gt time"); videosToSkip.Add("comic-con"); videosToSkip.Add("e3 " + DateTime.Now.Year); }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); videoUrlRegex[0] = @"<embed.*?src=""(?<url>[^""]+)"""; videoUrlRegex[1] = @"<a\shref=""(?<url>[^""]+)"""; videoUrlRegex[2] = @"param\sname=""src""\s*value=""(?<url>[^""]+)"""; for (int i = 0; i < videoUrlRegex.Length; i++) regEx_VideoUrl[i] = new Regex(videoUrlRegex[i], RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline); }
private static void InitSiteSettings(DataContext context) { var siteSettings = context.SiteSettings.FirstOrDefault(); if (siteSettings != null) { return; } siteSettings = new SiteSettings { SearchIndex = true }; context.SiteSettings.Add(siteSettings); }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); mediaAccess = new MpExtendedService.MediaAccessService(); mediaAccess.Url = String.Format("http://{0}:{1}/MPExtended/MediaAccessService/", mServer, mPort); mediaAccess.Credentials = new NetworkCredential(mUsername, mPassword); tvAccess = new MpExtendedTvService.TVAccessService(); tvAccess.Url = String.Format("http://{0}:{1}/MPExtended/TvAccessService/", mServer, mPort); tvAccess.Credentials = new NetworkCredential(mUsername, mPassword); mediaStreaming = new MpExtendedStreamingService.SoapEndpoint(); mediaStreaming.Url = String.Format("http://{0}:{1}/MPExtended/StreamingService/soap", mServer, mPort); mediaStreaming.Credentials = new NetworkCredential(mUsername, mPassword); }
protected void Button4_Click(object sender, EventArgs e) { SiteSettings site = new SiteSettings(); site.SiteName = SiteName.Text; site.SiteLogo=SiteLogo.Text; site.SiteBanner=SiteBanner.Text; site.SiteBottomAd=SiteBottomAd.Text; site.WatermarkType = (WatermarkType)Enum.Parse(typeof(WatermarkType),WatermarkList.SelectedValue); site.WatermarkText = WatermarkText.Text; site.WatermarkFileName=WatermarkFileName.Text ; site.TgNum = int.Parse(TgNumTxt.Text); site.ServiceTxt=ServiceTxt.Text ; site.SiteBottomDec=SiteBottomDec.Text; SiteSetting.SaveSiteSettings(site); dataConfig(); }
private void GetStatistics(SiteSettings siteSettings, DateTime today) { if (siteSettings != null) { siteID = siteSettings.SiteId; siteName = siteSettings.SiteName; totalUsers = SiteUser.UserCount(siteID); SiteUser newestSiteUser = SiteUser.GetNewestUser(siteSettings); newestUser = newestSiteUser.Name; //DateTime today = DateTime.Today.ToUniversalTime().AddHours(DateTimeHelper.GetPreferredGMTOffset()); newUsersToday = SiteUser.CountUsersByRegistrationDateRange(siteID, today, today.AddDays(1)); newUsersYesterday = SiteUser.CountUsersByRegistrationDateRange(siteID, today.AddDays(-1), today); } }
protected override void Load(ContainerBuilder builder) { SiteSettings siteSettings = new SiteSettings() { DefaultAreaName = "Default", Login = new Link("Login", null, "User", "Login", null), Views = new Views() { AccessDenied = "AccessDenied", Error = "Error", NotFound = "NotFound" } }; SettingsFunctions(siteSettings); // Custom Types builder.RegisterInstance<SiteSettings>(siteSettings).SingleInstance(); }
// GET: Admin/SiteSettings/Edit public ActionResult Edit() { ViewBag.CVList = db.CVs.Select(m => new SelectListItem { Text = m.Id + " - " + m.Person.FirstName + " " + m.Person.LastName, Value = m.Id.ToString() }); SiteSettings siteSettings = db.SiteSettings.FirstOrDefault(); if (siteSettings == null) { siteSettings = new SiteSettings(); db.SiteSettings.Add(siteSettings); db.SaveChanges(); } ViewBag.CVId = new SelectList(db.CVs, "Id", "Id", siteSettings.CVId); ViewBag.PersonId = new SelectList(db.People, "Id", "FirstName", siteSettings.PersonId); ViewBag.ThemeId = new SelectList(db.Themes, "Id", "Name", siteSettings.ThemeId); return View(siteSettings); }
public override void Initialize(SiteSettings siteSettings) { regexNewMovies = new Regex(@"(?<!class=""title_h"".*)((<div[^>]*>\s*<div\sclass=""pic""><a\shref=""(?<VideoUrl>[^""]*)""[^>]*><img\ssrc=""(?<ImageUrl>[^""]*)""[^>]*></a></div>\s*<div\sclass=""show""><a[^>]*>(?<Title>[^<]*)</a> <font\scolor=""\#FF6600""><sup></sup></font></div>)|(<li><a\shref=""(?<VideoUrl>[^""]*)""[^>]*?title=""(?<Title>[^""]*)""[^>]*?>[^<]*?\((?<Airdate>[^\)]*)\)</a>(?: )?<font\scolor=""\#FF6600""><sup>.*?</sup></font></li>))", defaultRegexOptions); regexHotMovies = new Regex(@"(?<=class=""title_h"".*)((<div[^>]*>\s*<div\sclass=""pic""><a\shref=""(?<VideoUrl>[^""]*)""[^>]*><img\ssrc=""(?<ImageUrl>[^""]*)""[^>]*></a></div>\s*<div\sclass=""show""><a[^>]*>(?<Title>[^<]*)</a> <font\scolor=""\#FF6600""><sup></sup></font></div>)|(<li><a\shref=""(?<VideoUrl>[^""]*)""[^>]*?title=""(?<Title>[^""]*)""[^>]*?>[^<]*?\((?<Airdate>[^\)]*)\)</a>(?: )?<font\scolor=""\#FF6600""><sup>.*?</sup></font></li>))", defaultRegexOptions); regexDefaultVideoList = new Regex(@"<li><a\shref=""(?<VideoUrl>[^""]*)""\stitle=""[^>]*>(?<Title>[^<]*)</a>\s*?\((?<Airdate>[^\)]*)\)\s*?</a> <font\scolor=""\#FF6600""><sup></sup></font></li>", defaultRegexOptions); regexMovieGenres = new Regex(@"<td\s[^>]*>(?: )?\s<a\shref=""(?<url>[^""]*)"">(?<title>[^<]*)</a></td>", defaultRegexOptions); regexTvShowGenres = new Regex(@"<td\s[^>]*>(?: )?\s<a\shref=""(?<url>[^""]*)"">(?<title>[^<]*)</a></td>", defaultRegexOptions); regexMoviesAlph = new Regex(@"<a\shref='(?<url>[^']*)'>(?<title>[^<]*)</a>", defaultRegexOptions); regexTvShowsAlph = new Regex(@"<a\shref='(?<url>[^']*)'>(?<title>[^<]*)</a>", defaultRegexOptions); regexTvShowList = new Regex(@"<li><a\shref=""(?<url>[^""]*)""\stitle=""[^""]*"">(?<title>[^<]*)</a>\s*(?:</a>)?</li>", defaultRegexOptions); regexNewTvShows = new Regex(@"(?<!class=""title_h"".*)((<div[^>]*>\s*<div\sclass=""pic""><a\shref=""(?<url>[^""]*)""\stitle=""[^""]*""><img\ssrc=""(?<thumb>[^""]*)""[^>]*></a></div>\s*<div\sclass=""show""><a[^>]*>(?<title>[^<]*)</a></div>\s*</div>\s*)|(<li><a\shref=""(?<url>[^""]*)""\stitle=""[^""]*"">(?<title>[^<]*)</a></li>))", defaultRegexOptions); regexBestTvShows = new Regex(@"(?<=class=""title_h"".*)((<div[^>]*>\s*<div\sclass=""pic""><a\shref=""(?<url>[^""]*)""\stitle=""[^""]*""><img\ssrc=""(?<thumb>[^""]*)""[^>]*></a></div>\s*<div\sclass=""show""><a[^>]*>(?<title>[^<]*)</a></div>\s*</div>\s*)|(<li><a\shref=""(?<url>[^""]*)""\stitle=""[^""]*"">(?<title>[^<]*)</a></li>))", defaultRegexOptions); regexTvShowDataThumb = new Regex(@"<div\sclass=""left"">\s*?<img src=""(?<Thumb>[^""]*)""\s*?(width=""[^""]*"")?\s*?(height=""[^""]*"")?\s*?/>\s*?</div>", defaultDataRegexOptions); regexTvShowDataPlot = new Regex(@"<div\sclass=""plot"">\s*([Pp]lot)?:?\s*(?<Plot>.*?)\s*?</div>", defaultDataRegexOptions); regexTvShowDataAirdate = new Regex(@"<div>[Dd]ate:\s*?(?<Year>\d\d\d\d)\s*?</div>", defaultDataRegexOptions); base.Initialize(siteSettings); }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); regEx_Categories = new Regex(categoryRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline); regEx_MainCategories = new Regex(mainCategoryRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); regEx_SubCategories = new Regex(subCategoryRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline); regEx_LiveFurther = new Regex(liveRegexFurther, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); regEx_LiveUpcoming = new Regex(liveRegexUpcoming, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); regEx_LiveStreamRunning = new Regex(liveRegexStreamRunning, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); regEx_LiveNoStreamRunning = new Regex(liveRegexNoStreamRunning, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); regEx_LiveUrl = new Regex(liveUrlRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant); regEx_Videolist = new Regex(videolistRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); regEx_Videolist2 = new Regex(videolistRegex2, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); regEx_Videolist3 = new Regex(videolistRegex3, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline); regEx_Videolist4 = new Regex(videolistRegex4, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Multiline); regEx_Playlist = new Regex(playlistRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); regEx_VideoAlternativeSources = new Regex(videoAlternativeSourcesRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); regEx_VideoAlternativeFormats = new Regex(videoAlternativeFormatsRegex, RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); }
/// <summary> /// 保存分销站点设置 /// </summary> /// <param name="siteUrl"></param> /// <returns></returns> public override void SaveDistributorSettings(SiteSettings settings) { DbCommand sqlStringCommand = database.GetSqlStringCommand("UPDATE distro_Settings SET SiteUrl=@SiteUrl, RecordCode=@RecordCode, LogoUrl=@LogoUrl, SiteDescription=@SiteDescription, SiteName=@SiteName, Theme=@Theme, Footer=@Footer, SearchMetaKeywords=@SearchMetaKeywords, SearchMetaDescription=@SearchMetaDescription,DecimalLength=@DecimalLength, YourPriceName=@YourPriceName, Disabled=@Disabled, ReferralDeduct = @ReferralDeduct, SiteUrl2=@SiteUrl2, RecordCode2=@RecordCode2, DefaultProductImage=@DefaultProductImage, PointsRate=@PointsRate,IsShowGroupBuy=@IsShowGroupBuy,IsShowCountDown=@IsShowCountDown, IsShowOnlineGift=@IsShowOnlineGift, OrderShowDays=@OrderShowDays, HtmlOnlineServiceCode=@HtmlOnlineServiceCode,EmailSender=@EmailSender, EmailSettings=@EmailSettings, SMSSender=@SMSSender, SMSSettings=@SMSSettings, Topkey=@Topkey,TopSecret=@TopSecret WHERE UserId=@UserId"); #region 存储过程参数 database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, settings.UserId); database.AddInParameter(sqlStringCommand, "SiteUrl", DbType.String, settings.SiteUrl); database.AddInParameter(sqlStringCommand, "RecordCode", DbType.String, settings.RecordCode); database.AddInParameter(sqlStringCommand, "SiteUrl2", DbType.String, settings.SiteUrl2); database.AddInParameter(sqlStringCommand, "RecordCode2", DbType.String, settings.RecordCode2); database.AddInParameter(sqlStringCommand, "LogoUrl", DbType.String, settings.LogoUrl); database.AddInParameter(sqlStringCommand, "SiteDescription", DbType.String, settings.SiteDescription); database.AddInParameter(sqlStringCommand, "SiteName", DbType.String, settings.SiteName); database.AddInParameter(sqlStringCommand, "Theme", DbType.String, settings.Theme); database.AddInParameter(sqlStringCommand, "Footer", DbType.String, settings.Footer); database.AddInParameter(sqlStringCommand, "SearchMetaKeywords", DbType.String, settings.SearchMetaKeywords); database.AddInParameter(sqlStringCommand, "SearchMetaDescription", DbType.String, settings.SearchMetaDescription); database.AddInParameter(sqlStringCommand, "DecimalLength", DbType.Int32, settings.DecimalLength); database.AddInParameter(sqlStringCommand, "YourPriceName", DbType.String, settings.YourPriceName); database.AddInParameter(sqlStringCommand, "Disabled", DbType.Boolean, settings.Disabled); database.AddInParameter(sqlStringCommand, "ReferralDeduct", DbType.Int32, settings.ReferralDeduct); database.AddInParameter(sqlStringCommand, "DefaultProductImage", DbType.String, settings.DefaultProductImage); database.AddInParameter(sqlStringCommand, "PointsRate", DbType.Decimal, settings.PointsRate); database.AddInParameter(sqlStringCommand, "IsShowGroupBuy", DbType.Boolean, settings.IsShowGroupBuy); database.AddInParameter(sqlStringCommand, "IsShowCountDown", DbType.Boolean, settings.IsShowCountDown); database.AddInParameter(sqlStringCommand, "IsShowOnlineGift", DbType.Boolean, settings.IsShowOnlineGift); database.AddInParameter(sqlStringCommand, "OrderShowDays", DbType.Int32, settings.OrderShowDays); database.AddInParameter(sqlStringCommand, "HtmlOnlineServiceCode", DbType.String, settings.HtmlOnlineServiceCode); database.AddInParameter(sqlStringCommand, "EmailSender", DbType.String, settings.EmailSender); database.AddInParameter(sqlStringCommand, "EmailSettings", DbType.String, settings.EmailSettings); database.AddInParameter(sqlStringCommand, "SMSSender", DbType.String, settings.SMSSender); database.AddInParameter(sqlStringCommand, "SMSSettings", DbType.String, settings.SMSSettings); database.AddInParameter(sqlStringCommand, "Topkey", DbType.String, settings.Topkey); database.AddInParameter(sqlStringCommand, "TopSecret", DbType.String, settings.TopSecret); #endregion database.ExecuteNonQuery(sqlStringCommand); }
public AdminModule(Func<IDocumentSession> sessionFactory) : base("/admin") { this.RequiresInstallerDisabled(sessionFactory); this.RequiresHttpsOrXProto(); this.RequiresAuthentication(); Get["/"] = parameters => { using (IDocumentSession session = sessionFactory()) { SiteSettings site = session.GetSiteSettings(); if (site == null) site = new SiteSettings { SubTitle = "Go to site -> settings" }; return View["home", new {site.Title, site.SubTitle}]; } }; }
public SiteSettingsApi(Func<IDocumentSession> sessionFactory) : base("api/settings") { this.RequiresHttpsOrXProto(); this.RequiresAuthentication(); this.RequiresClaims(new[] {SystemRoles.Administrators}); Get["/"] = parameters => { using (IDocumentSession session = sessionFactory()) { SiteSettings settings = session.GetSiteSettings(); if (settings == null) { settings = new SiteSettings(); } return settings; } }; Put["/"] = parameters => { using (IDocumentSession session = sessionFactory()) { this.RequiresAuthentication(); this.RequiresClaims(new[] {SystemRoles.Administrators}); var settings = this.BindAndValidate<SiteSettings>(); session.StoreSiteSettings(settings); session.SaveChanges(); return global::System.Net.HttpStatusCode.OK; } }; }
/// <summary> /// You should always call this implementation, even when overriding it. It is called after the instance has been created /// in order to configure settings from the xml for this util. /// </summary> /// <param name="siteSettings"></param> public virtual void Initialize(SiteSettings siteSettings) { Settings = siteSettings; // apply custom settings foreach (FieldInfo field in this.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) { object[] attrs = field.GetCustomAttributes(typeof(CategoryAttribute), false); if (attrs.Length > 0) { if (((CategoryAttribute)attrs[0]).Category == "OnlineVideosConfiguration" && siteSettings != null && siteSettings.Configuration != null && siteSettings.Configuration.ContainsKey(field.Name)) { try { if (field.FieldType.IsEnum) { field.SetValue(this, Enum.Parse(field.FieldType, siteSettings.Configuration[field.Name])); } else { field.SetValue(this, Convert.ChangeType(siteSettings.Configuration[field.Name], field.FieldType)); } } catch (Exception ex) { Log.Warn("{0} - could not set Configuration Value: {1}. Error: {2}", siteSettings.Name, field.Name, ex.Message); } } else SetUserConfigurationValue(field, attrs[0] as CategoryAttribute); } } }
protected int SkipWeixinOpenId(string openId, string weixinNickName, string unionId, string headimgurl, string ReferralUserId, bool isSubscribe) { int num = 1; MemberInfo memberInfo = MemberProcessor.GetMemberByOpenId("hishop.plugins.openid.weixin", openId); bool flag = false; if (memberInfo == null) { memberInfo = MemberProcessor.GetMemberByUnionId(unionId); flag = true; } SiteSettings masterSettings = SettingsManager.GetMasterSettings(); ShoppingCartInfo cookieShoppingCart = ShoppingCartProcessor.GetCookieShoppingCart(); bool flag2 = false; if (memberInfo != null) { num = 2; if (memberInfo.IsSubscribe != isSubscribe) { memberInfo.IsSubscribe = isSubscribe; flag2 = true; } bool flag3 = MemberProcessor.IsBindedWeixin(memberInfo.UserId, "hishop.plugins.openid.weixin"); memberInfo.Picture = headimgurl; if (!string.IsNullOrEmpty(unionId) && memberInfo.UnionId != unionId && !flag) { memberInfo.UnionId = unionId; flag2 = true; } if (flag) { if (!flag3) { MemberOpenIdInfo memberOpenIdInfo = new MemberOpenIdInfo(); memberOpenIdInfo.UserId = memberInfo.UserId; memberOpenIdInfo.OpenIdType = "hishop.plugins.openid.weixin"; memberOpenIdInfo.OpenId = openId; MemberProcessor.AddMemberOpenId(memberOpenIdInfo); memberInfo.IsQuickLogin = true; flag2 = true; } else { MemberOpenIdInfo memberOpenIdInfo2 = new MemberOpenIdInfo(); memberOpenIdInfo2.UserId = memberInfo.UserId; memberOpenIdInfo2.OpenIdType = "hishop.plugins.openid.weixin"; memberOpenIdInfo2.OpenId = openId; MemberProcessor.UpdateMemberOpenId(memberOpenIdInfo2); } } if (flag2) { MemberProcessor.UpdateMember(memberInfo); } Users.SetCurrentUser(memberInfo.UserId, 30, true, false); HiContext.Current.User = memberInfo; if (cookieShoppingCart != null) { ShoppingCartProcessor.ConvertShoppingCartToDataBase(cookieShoppingCart); ShoppingCartProcessor.ClearCookieShoppingCart(); } if (!string.IsNullOrEmpty(openId)) { HttpCookie httpCookie = new HttpCookie("openId"); httpCookie.HttpOnly = true; httpCookie.Value = openId; httpCookie.Expires = DateTime.MaxValue; HttpContext.Current.Response.Cookies.Add(httpCookie); } lock (this.lockCopyRedEnvelope) { this.CopyRedEnvelope(openId, memberInfo); } return(num); } memberInfo = new MemberInfo(); memberInfo.Picture = headimgurl; memberInfo.IsSubscribe = isSubscribe; int num2 = 0; if (ReferralUserId.ToInt(0) > 0) { memberInfo.ReferralUserId = ReferralUserId.ToInt(0); } MemberWXReferralInfo wXReferral = VShopHelper.GetWXReferral(openId.Trim()); if (wXReferral != null) { VShopHelper.DeleteWXReferral(openId.Trim()); } memberInfo.GradeId = MemberProcessor.GetDefaultMemberGrade(); if (!string.IsNullOrEmpty(weixinNickName)) { MemberInfo memberInfo2 = memberInfo; MemberInfo memberInfo3 = memberInfo; string text3 = memberInfo2.UserName = (memberInfo3.NickName = HttpUtility.UrlDecode(weixinNickName)); } if (string.IsNullOrEmpty(memberInfo.UserName)) { memberInfo.UserName = "******" + this.GenerateUsername(8); } if (MemberProcessor.FindMemberByUsername(memberInfo.UserName) != null) { memberInfo.UserName = "******" + this.GenerateUsername(9); if (MemberProcessor.FindMemberByUsername(memberInfo.UserName) != null) { memberInfo.UserName = this.GenerateUsername(); if (MemberProcessor.FindMemberByUsername(memberInfo.UserName) != null) { num = -1; } } } if (num == 1) { string text4 = this.GeneratePassword(); string text5 = "Open"; string text6 = text4; text4 = (memberInfo.Password = Users.EncodePassword(text4, text5)); memberInfo.PasswordSalt = text5; memberInfo.RegisteredSource = 3; memberInfo.CreateDate = DateTime.Now; memberInfo.IsQuickLogin = true; memberInfo.IsLogined = true; memberInfo.UnionId = unionId; num2 = MemberProcessor.CreateMember(memberInfo); if (num2 <= 0) { num = -1; } } if (num == 1) { memberInfo.UserId = num2; memberInfo.UserName = MemberHelper.GetUserName(memberInfo.UserId); MemberHelper.Update(memberInfo, true); Users.SetCurrentUser(memberInfo.UserId, 30, false, false); HiContext.Current.User = memberInfo; if (cookieShoppingCart != null) { ShoppingCartProcessor.ConvertShoppingCartToDataBase(cookieShoppingCart); ShoppingCartProcessor.ClearCookieShoppingCart(); } if (!string.IsNullOrEmpty(openId)) { MemberOpenIdInfo memberOpenIdInfo3 = new MemberOpenIdInfo(); memberOpenIdInfo3.UserId = memberInfo.UserId; memberOpenIdInfo3.OpenIdType = "hishop.plugins.openid.weixin"; memberOpenIdInfo3.OpenId = openId; if (MemberProcessor.GetMemberByOpenId(memberOpenIdInfo3.OpenIdType, openId) == null) { MemberProcessor.AddMemberOpenId(memberOpenIdInfo3); } if (!string.IsNullOrEmpty(openId)) { HttpCookie httpCookie2 = new HttpCookie("openId"); httpCookie2.HttpOnly = true; httpCookie2.Value = openId; httpCookie2.Expires = DateTime.MaxValue; HttpContext.Current.Response.Cookies.Add(httpCookie2); } lock (this.lockCopyRedEnvelope) { this.CopyRedEnvelope(openId, memberInfo); } } } return(num); }
public static void AddElmah(this IServiceCollection services, IConfiguration configuration, SiteSettings siteSetting) { services.AddElmah <SqlErrorLog>(options => { options.Path = siteSetting.ElmahPath; options.ConnectionString = configuration.GetConnectionString("Elmah"); //options.CheckPermissionAction = httpContext => //{ // return httpContext.User.Identity.IsAuthenticated; //}; }); }
public override Stream Open() { SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings(); PageSettings currentPage = CacheHelper.GetCurrentPage(); bool reset = false; if (siteSettings != null) { if ( (currentPage != null) && (siteSettings.AllowPageSkins) && (currentPage.Skin.Length > 0) && (pathToFile.Contains("App_Themes/pageskin")) ) { pathToFile = pathToFile.Replace("App_Themes/pageskin", "Data/Sites/" + siteSettings.SiteId.ToString() + "/skins/" + currentPage.Skin); } else { reset = true; pathToFile = pathToFile.Replace("App_Themes/default", "Data/Sites/" + siteSettings.SiteId.ToString() + "/skins/" + siteSettings.Skin); } } if (reset) { try { CacheHelper.ResetThemeCache(); } catch (UnauthorizedAccessException ex) { log.Error("Error trying to reset theme cache", ex); } } String filePath = HttpContext.Current.Server.MapPath(pathToFile); try { return(File.OpenRead(filePath)); } catch (DirectoryNotFoundException ex) { log.Error("Error trying to set theme", ex); } catch (FileNotFoundException ex) { log.Error("Error trying to set theme", ex); } if (HttpContext.Current != null) { return(File.OpenRead(HttpContext.Current.Server.MapPath(this.VirtualPath))); } return(null); }
public GroupCollection( SiteSettings ss, string commandText, SqlParamCollection param = null) { Set(ss, Get(commandText, param)); }
private static HtmlBuilder Table( this HtmlBuilder hb, SiteSettings ss, Dictionary <string, ControlData> choicesX, Dictionary <string, ControlData> choicesY, string aggregateType, Column value, bool aggregationView, IEnumerable <KambanElement> data, long changedItemId) { var max = data.Any() ? data .GroupBy(o => o.GroupX + "," + o.GroupY) .Select(o => o.Summary(aggregateType)) .Max() : 0; return(hb.Table( css: "grid fixed", action: () => hb .THead(action: () => hb .Tr(css: "ui-widget-header", action: () => { if (choicesY != null) { hb.Th(); } choicesX.ForEach(choice => hb .Th(action: () => hb .HeaderText( ss: ss, aggregateType: aggregateType, value: value, data: data.Where(o => o.GroupX == choice.Key), choice: choice))); })) .TBody(action: () => { if (choicesY != null) { choicesY.ForEach(choiceY => { hb.Tr(css: "kamban-row", action: () => { hb.Th(action: () => hb .HeaderText( ss: ss, aggregateType: aggregateType, value: value, data: data.Where(o => o.GroupY == choiceY.Key), choice: choiceY)); choicesX.ForEach(choiceX => hb .Td(ss: ss, choiceX: choiceX.Key, choiceY: choiceY.Key, aggregateType: aggregateType, value: value, aggregationView: aggregationView, max: max, data: data, changedItemId: changedItemId)); }); }); } else { hb.Tr(css: "kamban-row", action: () => choicesX.ForEach(choiceX => hb .Td(ss: ss, choiceX: choiceX.Key, choiceY: null, aggregateType: aggregateType, value: value, aggregationView: aggregationView, max: max, data: data, changedItemId: changedItemId))); } }))); }
private static string DataTableName(SiteSettings ss, string direction) { return(ss.ReferenceType + "_" + direction + ss.SiteId); }
private void CreatePingBack(string sourceURI, string targetURI) { // Check Parameters if (string.IsNullOrEmpty(sourceURI)) { throw new XmlRpcFaultException(errorCode_SourceURIDoesNotExist, "No source URI parameter found, please try harder!"); } if (string.IsNullOrEmpty(targetURI)) { throw new XmlRpcFaultException(errorCode_TargetURIDoesNotExist, "The target URI does not exist!"); } // Retrieve referenced post Post trackedEntry = null; try { trackedEntry = GetPostFromUrl(targetURI); } catch { throw new XmlRpcFaultException(errorCode_TargetURIInvalid, "The target URI is invalid."); } if (trackedEntry == null) { throw new XmlRpcFaultException(errorCode_TargetURIInvalid, "The target URI is invalid."); } // Check if trackbacks/pingbacks are enabled if (!trackedEntry.EnableComments || !trackedEntry.EnableNewComments) { throw new XmlRpcFaultException(errorCode_AccessDenied, "Pingbacks are not enabled."); } // Check if this is a duplicate pingback (or trackback) if (!IsNewTrackBack(trackedEntry.Id, sourceURI)) { throw new XmlRpcFaultException(errorCode_DuplicatePingBack, "A pingback for this source URI already exists."); } // Retrieve the source document and check if it actually contains a link to the target string pageTitle = null; if (!LinkParser.SourceContainsTarget(sourceURI, new Macros().FullUrl(trackedEntry.Url), out pageTitle)) { throw new XmlRpcFaultException(errorCode_SourceDoesNotContainTarget, "Sorry couldn't find a relevant link in " + sourceURI); } if (string.IsNullOrEmpty(pageTitle)) { throw new XmlRpcFaultException(errorCode_SourceDoesNotContainTarget, "Could not find a readable HTML title in the remote page at " + sourceURI); } // Create the Trackback item Comment comment = new Comment(); comment.IsTrackback = true; comment.PostId = trackedEntry.Id; comment.Name = pageTitle; comment.WebSite = sourceURI; comment.Body = "Pingback from " + pageTitle; comment.IPAddress = Context.Request.UserHostAddress; comment.Published = DateTime.Now.AddHours(SiteSettings.Get().TimeZoneOffSet); comment.Save(); // Log success message to EventLog string message = String.Format("Pingback request received from {0} and saved to post {1}.", sourceURI, trackedEntry.Title); Log.Info("Pingback Received", message); }
/// <summary> /// 是否具有创建BarPost的权限 /// </summary> /// <param name="sectionId">所属帖吧Id</param> /// <returns></returns> public static bool BarPost_Create(this Authorizer authorizer, long sectionId, out string errorMessage) { IUser currentUser = UserContext.CurrentUser; errorMessage = "没有权限回帖"; BarSectionService barSectionService = new BarSectionService(); var barSection = barSectionService.Get(sectionId); if (barSection == null) { return(false); } if (barSection.AuditStatus != AuditStatus.Success) { errorMessage = "由于贴吧未经过审核,所以不允许发帖"; return(false); } if (!authorizer.AuthorizationService.Check(currentUser, PermissionItemKeys.Instance().Bar_CreatePost())) { if (currentUser != null && currentUser.IsModerated) { errorMessage = Resources.Resource.Description_ModeratedUser_CreateBarPostDenied; } return(false); } if (barSection.TenantTypeId == TenantTypeIds.Instance().Bar()) { //检查是否需要是关注用户才能发帖 IBarSettingsManager barSettingsManager = DIContainer.Resolve <IBarSettingsManager>(); BarSettings barSetting = barSettingsManager.Get(); if (barSetting.OnlyFollowerCreatePost) { if (currentUser == null) { errorMessage = "您需要先登录并关注此帖吧,才能回帖"; return(false); } SubscribeService subscribeService = new SubscribeService(TenantTypeIds.Instance().BarSection()); bool isSubscribed = subscribeService.IsSubscribed(sectionId, currentUser.UserId); if (!isSubscribed) { errorMessage = "您需要先关注此帖吧,才能回帖"; } return(isSubscribed); } } else { if (authorizer.BarSection_Manage(barSection)) { return(true); } bool isTenantMember = authorizer.AuthorizationService.IsTenantMember(currentUser, barSection.TenantTypeId, barSection.SectionId); if (!isTenantMember) { errorMessage = "您需要先加入,才能回帖"; } return(isTenantMember); } //站点设置是否启用了匿名发帖 ISiteSettingsManager siteSettingsManager = DIContainer.Resolve <ISiteSettingsManager>(); SiteSettings siteSettings = siteSettingsManager.Get(); if (siteSettings.EnableAnonymousPosting) { return(true); } if (currentUser == null) { errorMessage = "您必须先登录,才能回帖"; return(false); } return(true); }
private static HtmlBuilder Columns(this HtmlBuilder hb, SiteSettings ss, View view) { ss.GetFilterColumns(checkPermission: true).ForEach(column => { switch (column.TypeName.CsTypeSummary()) { case Types.CsBool: hb.CheckBox( column: column, ss: ss, view: view); break; case Types.CsNumeric: hb.DropDown( ss: ss, column: column, view: view, optionCollection: column.HasChoices() ? column.EditChoices(addNotSet: true) : column.NumFilterOptions()); break; case Types.CsDateTime: hb.DropDown( ss: ss, column: column, view: view, optionCollection: column.DateFilterOptions()); break; case Types.CsString: if (column.HasChoices()) { if (view.ColumnFilterHash?.ContainsKey(column.ColumnName) == true && column.UseSearch == true && ss.Links?.Any(o => o.ColumnName == column.ColumnName) == true) { ss.SetChoiceHash( columnName: column?.ColumnName, selectedValues: view.ColumnFilter(column.ColumnName) .Select(o => o.ToString())); } hb.DropDown( ss: ss, column: column, view: view, optionCollection: column.EditChoices(addNotSet: true)); } else if (ss.EditorColumns.Contains(column.ColumnName)) { hb.FieldTextBox( controlId: "ViewFilters_" + column.Id, fieldCss: "field-auto-thin", controlCss: " auto-postback", labelText: Displays.Get(column.GridLabelText), text: view.ColumnFilter(column.ColumnName), method: "post"); } break; default: break; } }); return(hb); }
private static bool Visible(SiteSettings ss, string columnName) { return (ss.GridColumns.Contains(columnName) || ss.EditorColumns.Contains(columnName)); }
/// <summary> /// 注册路由 /// </summary> /// <param name="context"></param> public override void RegisterArea(AreaRegistrationContext context) { //对于IIS6.0默认配置不支持无扩展名的url string extensionForOldIIS = ".aspx"; int iisVersion = 0; if (!int.TryParse(ConfigurationManager.AppSettings["IISVersion"], out iisVersion)) { iisVersion = 7; } if (iisVersion >= 7) { extensionForOldIIS = string.Empty; } ISiteSettingsManager siteSettingsManager = DIContainer.Resolve <ISiteSettingsManager>(); SiteSettings siteSettings = siteSettingsManager.Get(); #region Channel context.MapRoute( "Channel_SiteHome", // Route name "", // URL with parameters new { controller = "Channel", action = siteSettings.EnableSimpleHome ? "SimpleHome" : "Home" } // Parameter defaults ); context.MapRoute( "Channel_Home", // Route name "Home" + extensionForOldIIS, // URL with parameters new { controller = "Channel", action = "Home", CurrentNavigationId = "1000001" } // Parameter defaults ); context.MapRoute( "Channel_SimpleHome", // Route name "SimpleHome" + extensionForOldIIS, // URL with parameters new { controller = "Channel", action = "SimpleHome" } // Parameter defaults ); context.MapRoute( "Channel_ShortUrl", "{alias}", new { controller = "Channel", action = "RedirectUrl" }, new { alias = @"([0-9a-zA-Z]{6})|(\{\d+\})" } ); context.MapRoute( "Channel_AnnouncementDetail", // Route name "Announcement/s-{announcementId}" + extensionForOldIIS, // URL with parameters new { controller = "Channel", action = "AnnouncementDetail" }, // Parameter defaults new { announcementId = @"(\d+)|(\{\d+\})" } ); context.MapRoute( "Channel_Account_Comon", // Route name "Account/{action}" + extensionForOldIIS, // URL with parameters new { controller = "Account", action = "Login" } // Parameter defaults ); context.MapRoute( "Channel_Common", // Route name "Channel/{action}" + extensionForOldIIS, // URL with parameters new { controller = "Channel" } // Parameter defaults ); context.MapRoute( "Channel_FindUser_Ranking", // Route name "FindUser/s-{sortBy}-{pageIndex}" + extensionForOldIIS, // URL with parameters new { controller = "FindUser", action = "Ranking" }, // Parameter defaults new { sortBy = @"(\w+)|(\{\w+\})", pageIndex = @"(\d+)|(\{\d+\})" } ); context.MapRoute( "Channel_FindUser", // Route name "FindUser/{action}" + extensionForOldIIS, // URL with parameters new { controller = "FindUser" } // Parameter defaults ); #endregion Channel #region UserSpace context.MapRoute( string.Format("ActivityDetail_{0}_FollowUser", TenantTypeIds.Instance().User()), // Route name "follow/activity/{ActivityId}" + extensionForOldIIS, // URL with parameters new { controller = "Channel", action = "_FollowUserActivity" } // Parameter defaults ); context.MapRoute( "UserSpace_SpaceHome", // Route name "u/{SpaceKey}" + extensionForOldIIS, // URL with parameters new { controller = "UserSpace", action = "SpaceHome", CurrentNavigationId = "11000102" } // Parameter defaults ); context.MapRoute( "UserSpace_MyHome", // Route name "u/{SpaceKey}/MyHome" + extensionForOldIIS, // URL with parameters new { controller = "UserSpace", action = "MyHome", CurrentNavigationId = "11000101" } // Parameter defaults ); context.MapRoute( "UserSpace_Profile", // Route name "u/{spaceKey}/Profile" + extensionForOldIIS, // URL with parameters new { controller = "UserSpace", action = "PersonalInformation", CurrentNavigationId = "11000103" } // Parameter defaults ); context.MapRoute( "UserSpace_InviteFriend", // Route name "u/{spaceKey}/InviteFriend" + extensionForOldIIS, // URL with parameters new { controller = "Follow", action = "InviteFriend" } // Parameter defaults ); context.MapRoute( "UserSpace_IdentificationResult", // Route name "u/{spaceKey}/MyIdentifications" + extensionForOldIIS, // URL with parameters new { controller = "UserSpace", action = "IdentificationResult" } // Parameter defaults ); context.MapRoute( "UserSpace_EditIdentification", // Route name "u/{spaceKey}/ApplyIdentification" + extensionForOldIIS, // URL with parameters new { controller = "UserSpace", action = "EditIdentification" } // Parameter defaults ); context.MapRoute( "UserSpace_Follow_Common", // Route name "u/{spaceKey}/Follow/{action}" + extensionForOldIIS, // URL with parameters new { controller = "Follow" } // Parameter defaults ); context.MapRoute( "UserSpace_MessageCenter_Common", // Route name "u/{SpaceKey}/MessageCenter/{action}" + extensionForOldIIS, // URL with parameters new { controller = "MessageCenter", action = "ListMessageSessions" } // Parameter defaults ); context.MapRoute( "UserSpace_Settings_EditUserProfile", // Route name "u/{SpaceKey}/Settings/EditUserProfile" + extensionForOldIIS, // URL with parameters new { controller = "UserSpaceSettings", action = "EditUserProfile" } // Parameter defaults ); context.MapRoute( "UserSpace_Settings_ManageApplications", // Route name "u/{SpaceKey}/Settings/ManageApplications" + extensionForOldIIS, // URL with parameters new { controller = "UserSpaceSettings", action = "ManageApplications" } // Parameter defaults ); context.MapRoute( "UserSpace_Settings_Common", // Route name "u/{SpaceKey}/Settings/{action}" + extensionForOldIIS, // URL with parameters new { controller = "UserSpaceSettings", action = "EditUserProfile" } // Parameter defaults ); context.MapRoute( "UserSpace_Honour_PointRecords", // Route name "u/{SpaceKey}/Honour/PointRecords" + extensionForOldIIS, // URL with parameters new { controller = "Honour", action = "ListPointRecords" } // Parameter defaults ); context.MapRoute( "UserSpace_Honour_PointRule", // Route name "u/{SpaceKey}/Honour/MyRank" + extensionForOldIIS, // URL with parameters new { controller = "Honour", action = "MyRank" } // Parameter defaults ); context.MapRoute( "UserSpace_Honour_Common", // Route name "u/{SpaceKey}/Honour/{action}" + extensionForOldIIS, // URL with parameters new { controller = "Honour", action = "MyRank" } // Parameter defaults ); context.MapRoute( "UserSpace_Common", // Route name "u/common/{spaceKey}/{action}" + extensionForOldIIS, // URL with parameters new { controller = "UserSpace" } // Parameter defaults ); #endregion UserSpace #region ControlPanel context.MapRoute( "ControlPanel_Home", // Route name "ControlPanel/Home" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanel", action = "Home", CurrentNavigationId = "20000000" } // Parameter defaults ); #region 运营 context.MapRoute( "ControlPanel_Operation_Home", // Route name "ControlPanel/Operation" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "Home", CurrentNavigationId = "20000030" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManageRecommendItems", // Route name "ControlPanel/Operation/ManageRecommendItems" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManageRecommendItems", CurrentNavigationId = "20000032" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManageRecommendUsers", // Route name "ControlPanel/Operation/ManageRecommendUsers" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManageRecommendUsers", CurrentNavigationId = "20000033" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManageLinks", // Route name "ControlPanel/Operation/ManageLinks" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManageLinks", CurrentNavigationId = "20000034" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManageAdvertisings", // Route name "ControlPanel/Operation/ManageAdvertisings" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManageAdvertisings", CurrentNavigationId = "20000035" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManageAnnouncements", // Route name "ControlPanel/Operation/ManageAnnouncements" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManageAnnouncements", CurrentNavigationId = "20000036" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManageAccountTypes", // Route name "ControlPanel/Operation/ManageAccountTypes" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManageAccountTypes", CurrentNavigationId = "20000037" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManagePointRecords", // Route name "ControlPanel/Operation/ManagePointRecords" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManagePointRecords", CurrentNavigationId = "20000038" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManageSearchedTerms", // Route name "ControlPanel/Operation/ManageSearchedTerms" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManageSearchedTerms", CurrentNavigationId = "20000039" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManageImpeachReports", // Route name "ControlPanel/Operation/ManageImpeachReports" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManageImpeachReports", CurrentNavigationId = "20000040" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManageOperationLogs", // Route name "ControlPanel/Operation/ManageOperationLogs" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManageOperationLogs", CurrentNavigationId = "20000041" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_ManageCustomMessage", // Route name "ControlPanel/Operation/ManageCustomMessage" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManageCustomMessage", CurrentNavigationId = "20000075" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_MassMessages", // Route name "ControlPanel/Operation/MassMessages" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "MassMessages", CurrentNavigationId = "20000076" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_Statistics", // Route name "ControlPanel/Operation/Statistics" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "CNZZStatistics", CurrentNavigationId = "20000077" } // Parameter defaults ); context.MapRoute( "ControlPanel_Operation_Common", // Route name "ControlPanel/Operation/{action}" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelOperation", action = "ManagePointRecords" } // Parameter defaults ); #endregion #region 内容 context.MapRoute( "ControlPanel_Content_Home", // Route name "ControlPanel/Content" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelContent", action = "Home", CurrentNavigationId = "20000010" } // Parameter defaults ); context.MapRoute( "ControlPanel_Content_ManageTags", // Route name "ControlPanel/Content/ManageTags" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelContent", action = "ManageTags", CurrentNavigationId = "20000014" } // Parameter defaults ); context.MapRoute( "ControlPanel_Content_ManageSiteCategories", // Route name "ControlPanel/Content/ManageSiteCategories" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelContent", action = "ManageSiteCategories", CurrentNavigationId = "20000015" } // Parameter defaults ); context.MapRoute( "ControlPanel_Content_ManageUserCategories", // Route name "ControlPanel/Content/ManageUserCategories" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelContent", action = "ManageUserCategories", CurrentNavigationId = "20000016" } // Parameter defaults ); context.MapRoute( "ControlPanel_Content_ManageComments", // Route name "ControlPanel/Content/ManageComments" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelContent", action = "ManageComments", CurrentNavigationId = "20000017" } // Parameter defaults ); context.MapRoute( "ControlPanel_Content_Common", // Route name "ControlPanel/Content/{action}" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelContent" } // Parameter defaults ); #endregion #region 用户 context.MapRoute( "ControlPanel_User_Home", // Route name "ControlPanel/Users" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelUser", action = "Home", CurrentNavigationId = "20000020" } // Parameter defaults ); context.MapRoute( "ControlPanel_User_ManageUser", // Route name "ControlPanel/User/ManageUser" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelUser", action = "ManageUsers", CurrentNavigationId = "20000022" } // Parameter defaults ); context.MapRoute( "ControlPanel_User_ManageUserRoles", // Route name "ControlPanel/User/ManageUserRoles" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelUser", action = "ManageUserRoles", CurrentNavigationId = "20000023" } // Parameter defaults ); context.MapRoute( "ControlPanel_User_ManageRanks", // Route name "ControlPanel/User/ManageRanks" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelUser", action = "ManageRanks", CurrentNavigationId = "20000024" } // Parameter defaults ); context.MapRoute( "ControlPanel_User_ManageIdentifications", // Route name "ControlPanel/User/ManageIdentifications" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelUser", action = "ManageIdentifications", CurrentNavigationId = "20000025" } // Parameter defaults ); context.MapRoute( "ControlPanel_User_Common", // Route name "ControlPanel/User/{action}" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelUser", action = "ManageUsers" } // Parameter defaults ); #endregion #region 工具 context.MapRoute( "ControlPanel_Tool_Home", // Route name "ControlPanel/Tool" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelTool", action = "Home", CurrentNavigationId = "20000042" } // Parameter defaults ); context.MapRoute( "ControlPanel_Tool_ManageTask", // Route name "ControlPanel/Tool/ManageTasks" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelTool", action = "ManageTasks", CurrentNavigationId = "20000046" } // Parameter defaults ); context.MapRoute( "ControlPanel_Tool_UnloadAppDomain", // Route name "ControlPanel/Tool/UnloadAppDomain" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelTool", action = "UnloadAppDomain", CurrentNavigationId = "20000047" } // Parameter defaults ); context.MapRoute( "ControlPanel_Tool_ManageIndex", // Route name "ControlPanel/Tool/ManageIndex" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelTool", action = "ManageIndex", CurrentNavigationId = "20000044" } // Parameter defaults ); context.MapRoute( "ControlPanel_Tool_ResetCache", // Route name "ControlPanel/Tool/ResetCache" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelTool", action = "ResetCache", CurrentNavigationId = "20000045" } // Parameter defaults ); context.MapRoute( "ControlPanel_Tool_RebuildingThumbnails", // Route name "ControlPanel/Tool/RebuildingThumbnails" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelTool", action = "RebuildingThumbnails", CurrentNavigationId = "20000048" } // Parameter defaults ); context.MapRoute( "ControlPanel_Tool_Common", // Route name "ControlPanel/Tool/{action}" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelTool" } // Parameter defaults ); #endregion #region 设置 context.MapRoute( "ControlPanel_Settings_Home", // Route name "ControlPanel/Settings" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "SiteSettings", CurrentNavigationId = "20000050" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManagePointItems", // Route name "ControlPanel/Settings/ManagePointItems" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManagePointItems", CurrentNavigationId = "20000052" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManagePermissionItems", // Route name "ControlPanel/Settings/ManagePermissionItems" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManagePermissionItems", CurrentNavigationId = "20000053" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManagePrivacyItems", // Route name "ControlPanel/Settings/ManagePrivacyItems" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManagePrivacyItems", CurrentNavigationId = "20000054" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManageAuditItems", // Route name "ControlPanel/Settings/ManageAuditItems" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManageAuditItems", CurrentNavigationId = "20000055" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_SiteSettings", // Route name "ControlPanel/Settings/SiteSettings" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "SiteSettings", CurrentNavigationId = "20000057" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_UserSettings", // Route name "ControlPanel/Settings/UserSettings" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "UserSettings", CurrentNavigationId = "20000058" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_AttachmentSettings", // Route name "ControlPanel/Settings/AttachmentSettings" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "AttachmentSettings", CurrentNavigationId = "20000059" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManageEmails", // Route name "ControlPanel/Settings/ManageEmails" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ListOutbox", CurrentNavigationId = "20000060" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManageEmailOtherSettings", // Route name "ControlPanel/Settings/ManageEmailOtherSettings" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManageEmailOtherSettings", CurrentNavigationId = "20000060" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_MessagesSettings", // Route name "ControlPanel/Settings/MessagesSettings" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "MessagesSettings", CurrentNavigationId = "20000061" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ReminderSettings", // Route name "ControlPanel/Settings/ReminderSettings" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ReminderSettings", CurrentNavigationId = "20000062" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_PauseSiteSettings", // Route name "ControlPanel/Settings/PauseSiteSettings" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "PauseSiteSettings", CurrentNavigationId = "20000063" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManageApplications", // Route name "ControlPanel/Settings/ManageApplications" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManageApplications", CurrentNavigationId = "20000065" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManageNavigations", // Route name "ControlPanel/Settings/ManageNavigations" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManageNavigations", CurrentNavigationId = "20000066" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManageThemes", // Route name "ControlPanel/Settings/ManageThemes" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManageThemes", CurrentNavigationId = "20000067" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManageAreas", // Route name "ControlPanel/Settings/ManageAreas" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManageAreas", CurrentNavigationId = "20000071" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManageSchools", // Route name "ControlPanel/Settings/ManageSchools" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManageSchools", CurrentNavigationId = "20000072" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManageEmotionCategories", // Route name "ControlPanel/Settings/ManageEmotionCategories" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManageEmotionCategories", CurrentNavigationId = "20000073" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_ManageSensitiveWords", // Route name "ControlPanel/Settings/ManageSensitiveWords" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManageSensitiveWords", CurrentNavigationId = "20000074" } // Parameter defaults ); context.MapRoute( "ControlPanel_Settings_Common", // Route name "ControlPanel/Settings/{action}" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanelSettings", action = "ManagePointItems", CurrentNavigationId = "20000050" } // Parameter defaults ); #endregion context.MapRoute( "ControlPanel_Common", // Route name "ControlPanel/{action}" + extensionForOldIIS, // URL with parameters new { controller = "ControlPanel", action = "Home" } // Parameter defaults ); #endregion ControlPanel #region Handler context.Routes.MapHttpHandler <CaptchaHttpHandler>("Captcha", "Handlers/CaptchaImage.ashx"); context.Routes.MapHttpHandler <AttachmentAuthorizeHandler>("AttachmentAuthorize", "Handlers/AttachmentAuthorize.ashx"); context.Routes.MapHttpHandler <AttachmentDownloadHandler>("Attachment", "Handlers/Attachment.ashx"); context.Routes.MapHttpHandler <CustomStyleHandler>("CustomStyle", "Handlers/CustomStyle.ashx"); //context.Routes.MapHttpHandler<UserAvatarHandler>("UserAvatar", "Handlers/UserAvatar.ashx"); //context.Routes.MapHttpHandler<ImageHandler>("Image", "Handlers/Image.ashx"); //context.Routes.MapHttpHandler<LogoHandler>("Logo", "Handlers/Logo.ashx"); #endregion Handler }
private static string Selector(SiteSettings ss, string columnName) { return("#ViewFilters__" + columnName); }
public static HtmlBuilder MainCommands( this HtmlBuilder hb, Context context, SiteSettings ss, long siteId, Versions.VerTypes verType, long referenceId = 0, bool backButton = true, bool updateButton = false, bool copyButton = false, bool moveButton = false, bool mailButton = false, bool deleteButton = false, Action extensions = null) { return(hb.Div(id: "MainCommandsContainer", action: () => hb .Div(id: "MainCommands", action: () => { if (backButton) { hb.Button( controlId: "GoBack", text: Displays.GoBack(context: context), controlCss: "button-icon", accessKey: "q", onClick: "$p.back();", icon: "ui-icon-circle-arrow-w"); } if (context.Action == "new") { hb.Button( text: Displays.Create(context: context), controlCss: "button-icon validate", accessKey: "s", onClick: "$p.send($(this));", icon: "ui-icon-disk", action: "Create", method: "post"); } else if (context.CanRead(ss: ss) && verType == Versions.VerTypes.Latest) { hb .Button( text: Displays.Update(context: context), controlCss: "button-icon validate", accessKey: "s", onClick: "$p.send($(this));", icon: "ui-icon-disk", action: "Update", method: "put", _using: updateButton && context.CanUpdate(ss: ss)) .Button( text: Displays.Copy(context: context), controlCss: "button-icon open-dialog", accessKey: "c", onClick: "$p.openDialog($(this));", icon: "ui-icon-copy", selector: "#CopyDialog", _using: copyButton && context.CanCreate(ss: ss)) .Button( text: Displays.Move(context: context), controlCss: "button-icon open-dialog", accessKey: "o", onClick: "$p.moveTargets($(this));", icon: "ui-icon-transferthick-e-w", selector: "#MoveDialog", action: "MoveTargets", method: "get", _using: moveButton && context.CanUpdate(ss: ss)) .Button( controlId: "EditOutgoingMail", text: Displays.Mail(context: context), controlCss: "button-icon", onClick: "$p.openOutgoingMailDialog($(this));", icon: "ui-icon-mail-closed", action: "Edit", method: "put", accessKey: "m", _using: mailButton && context.CanSendMail(ss: ss)) .Button( text: Displays.Delete(context: context), controlCss: "button-icon", accessKey: "r", onClick: "$p.send($(this));", icon: "ui-icon-trash", action: "Delete", method: "delete", confirm: "ConfirmDelete", _using: deleteButton && context.CanDelete(ss: ss) && !ss.IsSite(context: context)) .Button( text: Displays.DeleteSite(context: context), controlCss: "button-icon", accessKey: "r", onClick: "$p.openDeleteSiteDialog($(this));", icon: "ui-icon-trash", _using: deleteButton && context.CanDelete(ss: ss) && ss.IsSite(context: context)); if (context.Controller == "items" && ss.ReferenceType != "Sites") { switch (context.Action) { case "index": hb .Button( text: Displays.BulkMove(context: context), controlCss: "button-icon open-dialog", accessKey: "o", onClick: "$p.moveTargets($(this));", icon: "ui-icon-transferthick-e-w", selector: "#MoveDialog", action: "MoveTargets", method: "get", _using: context.CanUpdate(ss: ss)) .Button( text: Displays.BulkDelete(context: context), controlCss: "button-icon", accessKey: "r", onClick: "$p.send($(this));", icon: "ui-icon-trash", action: "BulkDelete", method: "delete", confirm: "ConfirmDelete", _using: context.CanDelete(ss: ss)) .Button( controlId: "EditImportSettings", text: Displays.Import(context: context), controlCss: "button-icon", accessKey: "w", onClick: "$p.openImportSettingsDialog($(this));", icon: "ui-icon-arrowreturnthick-1-e", selector: "#ImportSettingsDialog", _using: context.CanImport(ss: ss)) .Button( text: Displays.Export(context: context), controlCss: "button-icon", accessKey: "x", onClick: "$p.openExportSelectorDialog($(this));", icon: "ui-icon-arrowreturnthick-1-w", action: "OpenExportSelectorDialog", method: "post", _using: context.CanExport(ss: ss)); break; case "crosstab": hb.Button( text: Displays.Export(context: context), controlCss: "button-icon", accessKey: "x", onClick: "$p.exportCrosstab();", icon: "ui-icon-arrowreturnthick-1-w", _using: context.CanExport(ss: ss)); break; } } } extensions?.Invoke(); }))); }
public void ProcessRequest(HttpContext context) { Macros macros = new Macros(); context.Response.ContentType = "text/xml"; int postId = 0; try { postId = int.Parse(context.Request.QueryString["id"]); } catch { } if (postId <= 0) { TrackbackResponse(context, "PostId is invalid or missing"); } if (context.Request.HttpMethod == "POST") { string title = SafeParam(context, "title"); string excerpt = SafeParam(context, "excerpt"); string url = SafeParam(context, "url"); string blog_name = SafeParam(context, "blog_name"); try { // Check if params are valid if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(title) || string.IsNullOrEmpty(blog_name) || string.IsNullOrEmpty(excerpt)) { TrackbackResponse(context, "One or more parameters are invalid or missing"); } Post trackedEntry = Post.GetCachedPost(postId); if (trackedEntry == null) { TrackbackResponse(context, "The link does not exist"); return; } if (!trackedEntry.EnableComments || !trackedEntry.EnableNewComments) { TrackbackResponse(context, "Trackbacks are not enabled"); return; } if (!IsNewTrackBack(trackedEntry.Id, url)) { TrackbackResponse(context, "Trackbacks already exists"); return; } string pageTitle = null; if (!LinkParser.SourceContainsTarget(url, macros.FullUrl(trackedEntry.Url), out pageTitle)) { TrackbackResponse(context, "Sorry couldn't find a relevant link in " + url); } if (string.IsNullOrEmpty(pageTitle)) { TrackbackResponse(context, "Could not find a readable HTML title in the remote page at " + url); return; } if (!string.IsNullOrEmpty(excerpt)) { excerpt = Util.RemoveHtml(excerpt, 250); } // Create the Trackback item Comment comment = new Comment(); comment.IsTrackback = true; comment.PostId = trackedEntry.Id; comment.Name = title; comment.WebSite = url; comment.Body = excerpt; comment.IPAddress = context.Request.UserHostAddress; comment.Published = DateTime.Now.AddHours(SiteSettings.Get().TimeZoneOffSet); comment.Save(); // Log success message to EventLog string message = String.Format("Trackback request received from {0} and saved to post {1}.", url, trackedEntry.Title); Log.Info("Trackback Received", message); context.Response.Write(successResponseXML); context.Response.End(); } catch (System.Threading.ThreadAbortException) { } catch (System.Exception ex) { if (ex.Message != null) { TrackbackResponse(context, string.Format("Error occurred while processing Trackback: {0}", ex.Message)); } else { TrackbackResponse(context, "Unknown error occurred while processing Trackback."); } } } }
public static ResponseCollection Links( this ResponseCollection res, Context context, SiteSettings ss, long id, BaseModel.MethodTypes?methodType) { var dataSet = DataSet( context: context, ss: ss, id: id); var links = HtmlLinkCreations.Links( context: context, ss: ss); new[] { ss.TabName(0) } .Concat(ss.Tabs?.Select(tab => ss.TabName(tab.Id)) ?? new List <string>()) .Select((tabName, tabIndex) => new { tabName, tabIndex }) .ForEach(data => { ss.EditorColumnHash?.Get(data.tabName)?.ForEach(columnName => { var linkId = ss.LinkId(columnName); if (linkId > 0) { new[] { new { Ss = TargetSiteSettings( links: ss.Destinations, linkId: linkId), Direction = "Destination" }, new { Ss = TargetSiteSettings( links: ss.Sources, linkId: linkId), Direction = "Source" } }.Where(target => target.Ss != null).ForEach(target => { var targetSs = ss.JoinedSsHash.Get(linkId); if (targetSs != null) { var dataTableName = DataTableName( ss: targetSs, direction: target.Direction); res.Html("#" + dataTableName + "Field", new HtmlBuilder() .Link( context: context, ss: ss, id: id, linkId: linkId, direction: target.Direction, targetSs: targetSs, links: links, dataSet: dataSet, methodType: methodType, tabIndex: data.tabIndex)); } }); } }); }); return(res); }
private string ChildrenToString(SiteSettings ss) { return(Children.Select(o => o.ToString(ss, child: true)).Join(string.Empty)); }
public override void OnLoad(HttpContext context) { base.OnLoad(context); if (context.Request["flag"] == "GetStoreUsersStatistics") { Pagination page = new Pagination(); int shoppingGuiderId = 0; int pageIndex = context.Request["PageIndex"].ToInt(); if (pageIndex < 1) { pageIndex = 1; } int pageSize = context.Request["PageSize"].ToInt(); if (pageSize < 1) { pageSize = 10; } int GroupId = context.Request["GroupId"].ToInt(); if (GroupId != 1 && GroupId != 2 && GroupId != 3 && GroupId != 0) { GroupId = 0; } int TimeScope = context.Request["TimeScope"].ToInt(); if (TimeScope != 1 && TimeScope != 3 && TimeScope != 6 && TimeScope != 9 && TimeScope != 12) { TimeScope = 1; } if (GroupId == 2 && TimeScope != 1 && TimeScope != 3 && TimeScope != 6) { TimeScope = 1; } page.PageIndex = pageIndex; page.PageSize = pageSize; page.SortBy = "PayDate"; page.SortOrder = SortAction.Desc; Int32 storeId = CurrentManager.StoreId; string keyword = Globals.StripAllTags(context.Request["Keyword"].ToNullString()); StoreMemberStatisticsQuery query = new StoreMemberStatisticsQuery(); query.Keyword = keyword; query.GroupId = GroupId; query.PageIndex = pageIndex; query.PageSize = pageSize; query.ShoppingGuiderId = shoppingGuiderId; query.StoreId = storeId; query.TimeScope = TimeScope; query.SortBy = "UserId"; query.SortOrder = SortAction.Desc; SiteSettings setting = HiContext.Current.SiteSettings; PageModel <StoreMemberStatisticsModel> data = MemberProcessor.GetStoreMemberStatisticsList(query, setting.ConsumeTimesInOneMonth, setting.ConsumeTimesInThreeMonth, setting.ConsumeTimesInSixMonth); var json = JsonConvert.SerializeObject(new { Result = new { RecordCount = data.Total, List = data.Models.Select(u => new { u.UserId, NickName = string.IsNullOrEmpty(u.NickName) ? (string.IsNullOrEmpty(u.RealName) ? u.UserName : u.RealName) : u.NickName, u.UserName, LastConsumeDate = u.LastConsumeDate.HasValue ? u.LastConsumeDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", u.ConsumeTimes, ConsumeTotal = u.ConsumeTotal.F2ToString("f2").ToDecimal(), HeadImage = string.IsNullOrEmpty(u.HeadImage.ToNullString()) ? Globals.FullPath("/templates/common/images/headerimg.png") : Globals.FullPath(u.HeadImage.ToNullString()), }) } }); context.Response.Write(json); context.Response.End(); } }
public GroupCollection(SiteSettings ss, EnumerableRowCollection <DataRow> dataRows) { Set(ss, dataRows); }
private static HtmlBuilder LinkTable( this HtmlBuilder hb, Context context, SiteSettings ss, View view, EnumerableRowCollection <DataRow> dataRows, string direction, string dataTableName, int tabIndex = 0) { ss.SetChoiceHash(dataRows: dataRows); return(hb.Table( id: dataTableName, css: "grid", attributes: new HtmlAttributes() .DataId(ss.SiteId.ToString()) .DataName(direction) .DataValue("back") .DataAction("LinkTable") .DataMethod("post") .Add( name: "from-tab-index", value: tabIndex.ToString()), action: () => { var siteMenu = SiteInfo.TenantCaches.Get(context.TenantId)?.SiteMenu; if (dataRows != null && dataRows.Any()) { ss.SetColumnAccessControls(context: context); var columns = ss.GetLinkTableColumns( context: context, view: view, checkPermission: true); switch (ss.ReferenceType) { case "Issues": var issueCollection = new IssueCollection( context: context, ss: ss, dataRows: dataRows); issueCollection.SetLinks(context: context, ss: ss); hb .Caption( action: () => hb .Span( css: "caption-direction", action: () => hb .Text(text: "{0} : ".Params(Caption( context: context, direction: direction)))) .Span( css: "caption-title", action: () => hb .Text(text: "{0}".Params(siteMenu.Breadcrumb( context: context, siteId: ss.SiteId) .Select(o => o.Title) .Join(" > ")))) .Span( css: "caption-quantity", action: () => hb .Text(text: " - {0} ".Params( Displays.Quantity(context: context)))) .Span( css: "caption-count", action: () => hb .Text(text: "{0}".Params(dataRows.Count())))) .THead(action: () => hb .GridHeader( context: context, ss: ss, columns: columns, view: view, sort: true, checkRow: false, action: "LinkTable")) .TBody(action: () => issueCollection .ForEach(issueModel => { ss.SetColumnAccessControls( context: context, mine: issueModel.Mine(context: context)); hb.Tr( attributes: new HtmlAttributes() .Class("grid-row") .DataId(issueModel.IssueId.ToString()), action: () => columns .ForEach(column => hb .TdValue( context: context, ss: ss, column: column, issueModel: issueModel, tabIndex: tabIndex))); })); break; case "Results": var resultCollection = new ResultCollection( context: context, ss: ss, dataRows: dataRows); resultCollection.SetLinks(context: context, ss: ss); hb .Caption( action: () => hb .Span( css: "caption-direction", action: () => hb .Text(text: "{0} : ".Params(Caption( context: context, direction: direction)))) .Span( css: "caption-title", action: () => hb .Text(text: "{0}".Params(siteMenu.Breadcrumb( context: context, siteId: ss.SiteId) .Select(o => o.Title) .Join(" > ")))) .Span( css: "caption-quantity", action: () => hb .Text(text: " - {0} ".Params( Displays.Quantity(context: context)))) .Span( css: "caption-count", action: () => hb .Text(text: "{0}".Params(dataRows.Count())))) .THead(action: () => hb .GridHeader( context: context, ss: ss, columns: columns, view: view, sort: true, checkRow: false, action: "LinkTable")) .TBody(action: () => resultCollection .ForEach(resultModel => { ss.SetColumnAccessControls( context: context, mine: resultModel.Mine(context: context)); hb.Tr( attributes: new HtmlAttributes() .Class("grid-row") .DataId(resultModel.ResultId.ToString()), action: () => columns .ForEach(column => hb .TdValue( context: context, ss: ss, column: column, resultModel: resultModel, tabIndex: tabIndex))); })); break; } } })); }
public static SendStatus SendMail(string subject, string body, string[] cc, string[] bcc, SiteSettings settings, out string msg) { msg = ""; if (((string.IsNullOrEmpty(subject) || string.IsNullOrEmpty(body)) || ((subject.Trim().Length == 0) || (body.Trim().Length == 0))) || (((cc == null) || (cc.Length == 0)) && ((bcc == null) || (bcc.Length == 0)))) { return(SendStatus.RequireMsg); } if (!((settings != null) && settings.EmailEnabled)) { return(SendStatus.NoProvider); } EmailSender sender = CreateEmailSender(settings, out msg); if (sender == null) { return(SendStatus.ConfigError); } MailMessage message2 = new MailMessage(); message2.IsBodyHtml = true; message2.Priority = MailPriority.High; message2.Body = body.Trim(); message2.Subject = subject.Trim(); MailMessage email = message2; if ((cc != null) && (cc.Length > 0)) { foreach (string str in cc) { email.CC.Add(str); } } if ((bcc != null) && (bcc.Length > 0)) { foreach (string str in bcc) { email.Bcc.Add(str); } } return(SendMail(email, sender, out msg) ? SendStatus.Success : SendStatus.Fail); }
public LanguageContentHandler(SiteSettings siteSettings) { this.siteSettings = siteSettings; }
internal static SMSSender CreateSMSSender(SiteSettings settings) { string str; return(CreateSMSSender(settings, out str)); }
public static HtmlBuilder Kamban( this HtmlBuilder hb, SiteSettings ss, View view, Column groupByX, Column groupByY, string aggregateType, string value, int?columns, bool aggregationView, IEnumerable <KambanElement> data, bool inRange) { return(hb.Div(id: "Kamban", css: "both", action: () => { hb .FieldDropDown( controlId: "KambanGroupByX", fieldCss: "field-auto-thin", controlCss: " auto-postback", labelText: Displays.GroupByX(), optionCollection: ss.KambanGroupByOptions(), selectedValue: groupByX.ColumnName, method: "post") .FieldDropDown( controlId: "KambanGroupByY", fieldCss: "field-auto-thin", controlCss: " auto-postback", labelText: Displays.GroupByY(), optionCollection: ss.KambanGroupByOptions(), selectedValue: groupByY.ColumnName, insertBlank: true, method: "post") .FieldDropDown( controlId: "KambanAggregateType", fieldCss: "field-auto-thin", controlCss: " auto-postback", labelText: Displays.AggregationType(), optionCollection: ss.KambanAggregationTypeOptions(), selectedValue: aggregateType, method: "post") .FieldDropDown( fieldId: "KambanValueField", controlId: "KambanValue", fieldCss: "field-auto-thin", controlCss: " auto-postback", labelText: Displays.AggregationTarget(), optionCollection: ss.KambanValueOptions(), selectedValue: value, method: "post") .FieldDropDown( controlId: "KambanColumns", fieldCss: "field-auto-thin", controlCss: " auto-postback", labelText: Displays.MaxColumns(), optionCollection: Enumerable.Range( Parameters.General.KambanMinColumns, Parameters.General.KambanMaxColumns) .ToDictionary(o => o.ToString(), o => o.ToString()), selectedValue: columns?.ToString(), method: "post") .FieldCheckBox( controlId: "KambanAggregationView", fieldCss: "field-auto-thin", controlCss: " auto-postback", labelText: Displays.AggregationView(), _checked: aggregationView, method: "post") .KambanBody( ss: ss, view: view, groupByX: groupByX, groupByY: groupByY, aggregateType: aggregateType, value: ss.GetColumn(value), columns: columns, aggregationView: aggregationView, data: data, inRange: inRange); })); }
public static IServiceCollection AddConfiguredInMemoryDbContext(this IServiceCollection services, SiteSettings siteSettings) { services.AddScoped <IUnitOfWork>(serviceProvider => serviceProvider.GetRequiredService <ApplicationDbContext>()); services.AddEntityFrameworkInMemoryDatabase(); // It's added to access services from the dbcontext, remove it if you are using the normal `AddDbContext` and normal constructor dependency injection. services.AddDbContextPool <ApplicationDbContext, InMemoryDatabaseContext>( (serviceProvider, optionsBuilder) => optionsBuilder.UseConfiguredInMemoryDatabase(siteSettings, serviceProvider)); return(services); }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); sh = new SubtitleHandler(subtitleSource == SubtitleSource.None ? "" : subtitleSource.ToString(), subtitleLanguage.ToString()); }
public override void Initialize(SiteSettings siteSettings) { base.Initialize(siteSettings); }
public void Init(SiteSettings ss) { SiteId = ss.SiteId; SiteTitle = ss.Title; Column = ss.GetColumn(ColumnName); }
public async Task <ActionResult> NewSite(SiteBasicSettingsViewModel model) { ViewData["Title"] = "Create New Site"; if (!ModelState.IsValid) { return(View(model)); } bool addHostName = false; if (multiTenantOptions.Mode == MultiTenantMode.FolderName) { if (string.IsNullOrEmpty(model.SiteFolderName)) { ModelState.AddModelError("foldererror", "Folder name is required."); return(View(model)); } ISiteFolder folder = await siteManager.GetSiteFolder(model.SiteFolderName); if (folder != null) { ModelState.AddModelError("foldererror", "The selected folder name is already in use on another site."); return(View(model)); } } else { ISiteHost host; if (!string.IsNullOrEmpty(model.HostName)) { model.HostName = model.HostName.Replace("https://", string.Empty).Replace("http://", string.Empty); host = await siteManager.GetSiteHost(model.HostName); if (host != null) { ModelState.AddModelError("hosterror", "The selected host/domain name is already in use on another site."); return(View(model)); } addHostName = true; } } SiteSettings newSite = new SiteSettings(); // only the first site created by setup page should be a server admin site newSite.IsServerAdminSite = false; newSite.SiteName = model.SiteName; if (multiTenantOptions.Mode == MultiTenantMode.FolderName) { newSite.SiteFolderName = model.SiteFolderName; } else if (addHostName) { newSite.PreferredHostName = model.HostName; } newSite.SiteIsClosed = model.IsClosed; newSite.SiteIsClosedMessage = model.ClosedMessage; //Site.SiteRepository.Save(newSite); bool result = await siteManager.CreateNewSite(newSite); result = await siteManager.CreateRequiredRolesAndAdminUser(newSite); if ((result) && (multiTenantOptions.Mode == MultiTenantMode.FolderName)) { bool folderResult = await siteManager.EnsureSiteFolder(newSite); // for folder sites we need routes that match the folder // which are normally created during app startup // can we add routes here? or do we need to force the app to recycle? // this seems to work, but we really do need to restart // so that the per folder authentication gets setup too //cloudscribe.Web.Routing.RouteRegistrar.AddDefaultRouteForNewSiteFolder(folder.FolderName); //startup.TriggerStartup(); //http://stackoverflow.com/questions/31339896/replacement-httpruntime-unloadappdomain-in-asp-net-5 } if (result && addHostName) { bool hostResult = await siteManager.AddHost( newSite.SiteGuid, newSite.SiteId, model.HostName); } if (result) { this.AlertSuccess(string.Format("Basic site settings for <b>{0}</b> were successfully created.", newSite.SiteName), true); } return(RedirectToAction("SiteList", new { pageNumber = model.ReturnPageNumber })); }
/// <summary> /// 获取拥有者当前选中的皮肤 /// </summary> /// <param name="ownerId">拥有者Id(如:用户Id、群组Id)</param> /// <returns></returns> public string GetThemeAppearance(long ownerId) { SiteSettings siteSettings = DIContainer.Resolve <ISettingsManager <SiteSettings> >().Get(); return(siteSettings.SiteTheme + "," + siteSettings.SiteThemeAppearance); }
protected override void AttachChildControls() { string a = this.Page.Request.QueryString["again"]; string text = this.Page.Request.QueryString["ReferralUserId"]; if (a == "1" || text.ToInt(0) == 0) { MemberInfo user = HiContext.Current.User; if (user != null && user.UserId > 0) { this.Page.Response.Redirect($"/{HiContext.Current.GetClientPath}/ReferralRegisterAgreement.aspx"); } this.litReferralRegisterAgreement = (Literal)this.FindControl("litReferralRegisterAgreement"); PageTitle.AddSiteNameTitle("我要成为分销员"); this.litReferralRegisterAgreement.Text = HiContext.Current.SiteSettings.ReferralIntroduction; } else if (base.ClientType == ClientType.AliOH) { this.Page.Response.Redirect("/AliOH/Login.aspx?action=register&ReferralUserId=" + text); } else if (base.ClientType == ClientType.App) { this.Page.Response.Redirect("/Appshop/Login.aspx?action=register&ReferralUserId=" + text); } else if (base.ClientType == ClientType.VShop) { if (base.site.OpenVstore == 1 && !string.IsNullOrEmpty(base.site.WeixinAppId) && !string.IsNullOrEmpty(base.site.WeixinAppSecret)) { OAuthUserInfo oAuthUserInfo = base.GetOAuthUserInfo(true); string text2 = oAuthUserInfo.OpenId.ToNullString(); string text3 = oAuthUserInfo.NickName.ToNullString(); string text4 = oAuthUserInfo.unionId.ToNullString(); string text5 = oAuthUserInfo.HeadImageUrl.ToNullString(); if (string.IsNullOrEmpty(text2) && string.IsNullOrEmpty(text4)) { IDictionary <string, string> dictionary = new Dictionary <string, string>(); dictionary.Add("openid", text2); dictionary.Add("weixinNickName", text3); dictionary.Add("unionId", text4); dictionary.Add("headimgurl", text5); Globals.AppendLog(dictionary, oAuthUserInfo.ErrMsg, "", "", "ReferralAutoRegister"); this.Page.Response.Redirect("/wapshop/Login.aspx?action=register&ReferralUserId=" + text); } int num = this.SkipWeixinOpenId(text2, text3, text4, text5, text, oAuthUserInfo.IsAttention); if (num == 1) { Globals.AppendLog("status:" + num, "", "", ""); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings.IsOpenGiftCoupons) { int num2 = 0; string[] array = masterSettings.GiftCouponList.Split(','); foreach (string obj in array) { if (obj.ToInt(0) > 0 && CouponHelper.AddCouponItemInfo(HiContext.Current.User, obj.ToInt(0)) == CouponActionStatus.Success) { num2++; } } } } this.Page.Response.Redirect("/VShop/Default"); } else { this.Page.Response.Redirect("/wapshop/Login.aspx?action=register&ReferralUserId=" + text); } } else if (base.ClientType == ClientType.WAP) { this.Page.Response.Redirect("/wapshop/Login.aspx?action=register&ReferralUserId=" + text); } }