⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sitesettingsadmin.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
📖 第 1 页 / 共 3 页
字号:
			this.save.Click += new EventHandler(Save_Click);

		}

		#endregion

		#region Command Handlers

		private void Save_Click(object sender, EventArgs e) {
			SiteSettings settings = CSContext.Current.SiteSettings;

			// First, see if any of the apps have been enabled/disabled
			if((settings.ForumsDisabled != forumsDisabled.SelectedValue)
				|| (settings.BlogsDisabled != blogsDisabled.SelectedValue)
				|| (settings.GalleriesDisabled != galleriesDisabled.SelectedValue)
                || (settings.GuestBookDisabled != guestbookDisabled.SelectedValue))
				enabledAppChanged = true;

			SaveSettings( settings );

			Label statusLabel = (Label)FindControl( "StatusLabel" );

			if(Page.IsValid)
			{
				// Refresh the SiteUrl data to remove the links to the disabled apps
				if(enabledAppChanged)
				{
					SiteUrls.ForceRefresh();
					CSCache.RemoveByPattern("TabUrls-");

					// Remove the context for the NavigationMenu and have it redatabind
					// For some reason, the first separator still shows.
					Context.Items.Remove("CommunityServer.Controls.NavigationMenu");
					Page.DataBind();
				}

				statusLabel.Text = ResourceManager.GetString( "Admin_SiteSettings_StatusSuccess" );
				statusLabel.ForeColor = Color.Green;
				DataBind();
			}
			else
			{
				statusLabel.Text = ResourceManager.GetString( "Admin_SiteSettings_StatusFailed" );
				statusLabel.ForeColor = Color.Red;
			}
			statusLabel.Visible = true;
		}

		private void Reset_Click(object sender, EventArgs e) {
			SiteSettings settings = new SiteSettings();
			ResetSettings( settings );
			FindControl( "StatusLabel" ).Visible = false;
			DataBind();
		}

		#endregion

		#region Command Implementations

		protected virtual void SaveSettings( SiteSettings settings ) {

			settings.ForumsDisabled = forumsDisabled.SelectedValue;
			settings.BlogsDisabled = blogsDisabled.SelectedValue;
			settings.GalleriesDisabled = galleriesDisabled.SelectedValue;
            settings.GuestBookDisabled = guestbookDisabled.SelectedValue;

			settings.SiteName = siteName.Text;
			settings.SiteDescription = siteDescription.Text;
			settings.TimezoneOffset = Int32.Parse( timezone.SelectedValue );
			
			try { 
				settings.ThreadsPerPage = Int32.Parse( threadsPerPage.Text ); 
				if(settings.ThreadsPerPage < 1)
					((RequiredFieldValidator)FindControl( "ThreadsPerPageValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "ThreadsPerPageValidator" )).IsValid = false; }
			
			try { 
				settings.PostsPerPage = Int32.Parse( postsPerPage.Text ); 
				if(settings.PostsPerPage < 1)
					((RequiredFieldValidator)FindControl( "PostsPerPageValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "PostsPerPageValidator" )).IsValid = false; }

			try { 
				settings.SearchPostsPerPage = Int32.Parse( searchPostsPerPage.Text ); 
				if(settings.SearchPostsPerPage < 1)
					((RequiredFieldValidator)FindControl( "SearchPerPageValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "SearchPerPageValidator" )).IsValid = false; }

			settings.EnablePostPreviewPopup = enablePostPreviewPopup.SelectedValue;
			settings.StripDomainName = stripDomainName.SelectedValue;
			settings.EmailDomain = emailDomain.Text;
			settings.AdminEmailAddress = adminEmailAddress.Text;
			settings.CompanyName = companyName.Text;
			settings.EnableCollapsingPanels = enableCollapsingPanels.SelectedValue;
			settings.SearchMetaDescription = this.searchMetaDescription.Text;
			settings.SearchMetaKeywords = this.searchMetaKeywords.Text;
			settings.Copyright = this.copyright.Text;

			settings.CompanyContactUs = companyEmailAddress.Text;
			settings.CompanyFaxNumber = companyFaxNumber.Text;
			settings.CompanyAddress = companyAddress.Text;
			settings.EnableForumDescription = displayForumDescription.SelectedValue;
			settings.EnableCurrentTime = displayCurrentTime.SelectedValue;
			settings.EnableWhoIsOnline = displayWhoIsOnline.SelectedValue;
			settings.EnableSiteStatistics = displayStatistics.SelectedValue;
			settings.EnableRSS = enableForumRSS.SelectedValue;

			settings.HomePageContent = homePageContent.Text;

			try { 
				settings.RssDefaultThreadsPerFeed = Int32.Parse( rssDefaultThreadsPerFeed.Text ); 
				if(settings.RssDefaultThreadsPerFeed < 1)
					((RequiredFieldValidator)FindControl( "RSSDefaultThreadsPerFeedValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "RSSDefaultThreadsPerFeedValidator" )).IsValid = false; }

			try { 
				settings.RssMaxThreadsPerFeed = Int32.Parse( rssMaxThreadsPerFeed.Text );
				if(settings.RssMaxThreadsPerFeed < 1)
					((RequiredFieldValidator)FindControl( "RSSMaxThreadsPerFeedValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "RSSMaxThreadsPerFeedValidator" )).IsValid = false; }

			try { 
				settings.RssCacheWindowInMinutes = Int32.Parse( rssCacheWindowInMinutes.Text ); 
				if(settings.RssCacheWindowInMinutes < 1)
					((RequiredFieldValidator)FindControl( "RssCacheWindowInMinutesValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "RssCacheWindowInMinutesValidator" )).IsValid = false; }

			settings.EnablePublicMemberList = publicMemberList.SelectedValue;
			settings.EnablePublicAdvancedMemberSearch = memberListAdvancedSearch.SelectedValue;
			
			try { 
				settings.MembersPerPage = Int32.Parse( memberListPageSize.Text ); 
				if(Int32.Parse( memberListPageSize.Text ) < 1)
					((RequiredFieldValidator)FindControl( "MemberListPageSizeValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "MemberListPageSizeValidator" )).IsValid = false; }

			try { 
				settings.MaxTopPostersToDisplay = Int32.Parse( memberListTopPostersToDisplay.Text ); 
				if(Int32.Parse( memberListTopPostersToDisplay.Text ) < 1)
					((RequiredFieldValidator)FindControl( "MemberListTopPostersToDisplayValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "MemberListTopPostersToDisplayValidator" )).IsValid = false; }

			settings.EnableDuplicatePosts = allowDuplicatePosts.SelectedValue;
			settings.RequireEditNotes = requireEditNotes.SelectedValue;
            settings.PostingActivityDisplay = postingActivityDisplay.SelectedValue;
            settings.DisplayUserRankAsPicture = displayUserRankAsPicture.SelectedValue;
            settings.EnableUserPostingAsAnonymous = userPostingAsAnonymous.SelectedValue;
            settings.EnableThreadStatus = enableThreadStatus.SelectedValue;

			try { 
				settings.DuplicatePostIntervalInMinutes = Int32.Parse( duplicatePostIntervalInMinutes.Text ); 
				if(Int32.Parse( duplicatePostIntervalInMinutes.Text ) < 1)
					((RequiredFieldValidator)FindControl( "DuplicatePostIntervalInMinutesValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "DuplicatePostIntervalInMinutesValidator" )).IsValid = false; }

			settings.EnableEmoticons = enableEmoticons.SelectedValue;
			
			try { 
				settings.PopularPostLevelPosts = Int32.Parse( popularPostThresholdPosts.Text ); 

				if(Int32.Parse( popularPostThresholdPosts.Text ) < 1)
					((RequiredFieldValidator)FindControl( "PopularPostThresholdPostsValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "PopularPostThresholdPostsValidator" )).IsValid = false; }

			try { 
				settings.PopularPostLevelViews = Int32.Parse( popularPostThresholdViews.Text ); 

				if(Int32.Parse( popularPostThresholdViews.Text ) < 1)
					((RequiredFieldValidator)FindControl( "PopularPostThresholdViewsValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "PopularPostThresholdViewsValidator" )).IsValid = false; }

			try { 
				settings.PopularPostLevelDays = Int32.Parse( popularPostThresholdDays.Text ); 
				
				if(Int32.Parse( popularPostThresholdDays.Text ) < 1)
					((RequiredFieldValidator)FindControl( "PopularPostThresholdDaysValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "PopularPostThresholdDaysValidator" )).IsValid = false; }

			settings.EnableAutoPostDelete = autoPostDelete.SelectedValue;
			settings.EnableAutoUserDelete = autoUserDelete.SelectedValue;
			settings.EnableAttachments = enableAttachments.SelectedValue;
			settings.AllowedAttachmentTypes = allowedAttachmentTypes.Text;
			
			try { 
				settings.MaxAttachmentSize = Int32.Parse( maxAttachmentSize.Text ); 
				if(Int32.Parse( maxAttachmentSize.Text ) < 1)
					((RequiredFieldValidator)FindControl( "MaxAttachmentSizeValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "MaxAttachmentSizeValidator" )).IsValid = false; }

			settings.DisplayEditNotesInPost = displayEditNotes.SelectedValue;
			
			try { 
				settings.PostEditBodyAgeInMinutes = Int32.Parse( postEditBodyAgeInMinutes.Text ); 
				if(Int32.Parse( postEditBodyAgeInMinutes.Text ) < 0)
					((RequiredFieldValidator)FindControl( "PostEditBodyAgeInMinutesValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "PostEditBodyAgeInMinutesValidator" )).IsValid = false; }

			settings.EnableFloodIntervalChecking = enableFloodInterval.SelectedValue;

			try { 
				settings.PostInterval = Int32.Parse( postInterval.Text ); 
				if(Int32.Parse( postInterval.Text ) < 1)
					((RequiredFieldValidator)FindControl( "PostIntervalValidator" )).IsValid = false;
			}
			catch { ((RequiredFieldValidator)FindControl( "PostIntervalValidator" )).IsValid = false; }

			settings.EnableTrackPostsByIP = enableTrackPostsByIP.SelectedValue;
			settings.DisplayPostIP = displayPostIP.SelectedValue;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -