• 修改CommunityServer的头尾



    修改CommunityServer的尾部信息,如下图片所示。



    代码文件位置
    CommunityServerControls/Utility/Footer.cs

    下面列出了代码,原理很简单。
    Footer.cs类从WebControl类继承,private bool IsLicensed()方法返回是否经过Licensed。
    protected override void Render(HtmlTextWriter writer)方法对控件的呈观方法进行重写,已达到自定义输入信息的目的。

     1//------------------------------------------------------------------------------
     2// <copyright company="Telligent Systems">
     3//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
     4// </copyright> 
     5//------------------------------------------------------------------------------
     6
     7using System;
     8using System.Web.Caching;
     9using System.Web.UI;
    10using System.Web.UI.WebControls;
    11using CommunityServer.Components;
    12
    13namespace CommunityServer.Controls 
    14{
    15    public class Footer : WebControl 
    16    {
    17        private bool IsLicensed()
    18        {
    19            object obj= CSCache.Get("LicenseValidator");
    20
    21            if(obj == null)
    22            {
    23                bool isValid  = false;
    24                string path = CSContext.Current.MapPath(Globals.ApplicationPath + "/bin/license.xml");
    25
    26                try
    27                {
    28                    Type t = Type.GetType("Telligent.CommunityServer.Registration.LicenseValidator, Telligent.CommunityServer.Registration");
    29
    30                    if(t != null)
    31                    {
    32                        try
    33                        {
    34                            Activator.CreateInstance(t, new object[]{path});
    35                            isValid = true;
    36                        }

    37                        catch { } // nothing to do
    38                    }

    39                }

    40                catch { }
    41
    42                CSCache.Max("LicenseValidator", isValid, new CacheDependency(path));
    43                return isValid;
    44            }

    45            else
    46                return (bool)obj;
    47        }

    48
    49        protected override void Render(HtmlTextWriter writer)
    50        {
    51            writer.WriteLine("<div class=\"copyright\">" + CSContext.Current.SiteSettings.Copyright + "</div>");
    52
    53            if(!IsLicensed())
    54            {
    55                // Removal of copywrite is available also with support options at
    56                // http://www.telligentsystems.com/Solutions/Forums/
    57                //
    58                writer.Write("<p align=\"center\" class=\"txt4\">");
    59                writer.Write( "<a target=\"_blank\" href=\"http://www.communityserver.org/\"><img alt=\"" + string.Format(ResourceManager.GetString("Footer_PoweredBy"), "Community Server") + "\" border=\"0\" src=\"" + Globals.ApplicationPath + "/utility/CSEULA.GIF" + "\"></a>");
    60                writer.Write( "&nbsp;<a target=\"_blank\" href=\"http://www.communityserver.cn/\"><img alt=\"" + string.Format(ResourceManager.GetString("Footer_PoweredBy"), "CnForums.Net") + "\" border=\"0\" src=\"" + Globals.ApplicationPath + "/utility/EULA.GIF" + "\"></a>");
    61                writer.Write( "<a href=\"mailto:" + CSContext.Current.SiteSettings.AdminEmailAddress + "\">" + ResourceManager.GetString("Footer_QuestionsProblems"+ "</a> | <a href=\"" + Globals.GetSiteUrls().TermsOfUse +"\">" + ResourceManager.GetString("Footer_TermsOfUse"+ "</a>");
    62                writer.Write("</p>");
    63            }

    64        }

    65    }

    66}

    在修改Footer.cs文件时,请尽量保留原软件的版权信息。
  • 相关阅读:
    javascript获取客户端网卡MAC地址和IP地址和计算机名
    Spring 架包功能详解
    MyEclipse安装插件的另一种方法
    (转载)Struts Spring Hibernate (SSH) 整合实例
    jsp 输出流写中文出现乱码的解决办法
    通过Ssh协议连接到服务器执行执行的指令
    贝叶斯过滤算法
    IntelliJ IDEA 9.0.3配置tomcat5
    (spring+hibernate)java.lang.NoSuchMethodError
    struts1.2总结
  • 原文地址:https://www.cnblogs.com/baddot/p/219162.html
Copyright © 2020-2023  润新知