Exemplo n.º 1
0
 public static List <string> GetOptionTypes()
 {
     return(CacheRecord.GetInstance <List <string> >("GetOptionTypes", (f) =>
     {
         List <string> list = new List <string>();
         XmlNodeList nodes = XmlHelper.GetXmlNodeList(f[0], "//type");
         foreach (XmlElement xe in nodes)
         {
             list.Add(xe.GetAttribute("name"));
         }
         return list;
     }, We7Utils.GetMapPath("~/Config/CategoryOptions.config")));
 }
Exemplo n.º 2
0
 public static List <CategoryOption> GetOptions(string type)
 {
     return(CacheRecord.GetInstance <List <CategoryOption> >("GetOptions", (f) =>
     {
         List <CategoryOption> list = new List <CategoryOption>();
         XmlNodeList nodes = XmlHelper.GetXmlNodeList(f[0], "//type[@name='" + type + "']/option");
         if (nodes != null)
         {
             foreach (XmlElement xe in nodes)
             {
                 CategoryOption op = new CategoryOption();
                 op.Name = xe.GetAttribute("name");
                 op.Value = xe.GetAttribute("value");
                 list.Add(op);
             }
         }
         return list;
     }, We7Utils.GetMapPath("~/Config/CategoryOptions.config")));
 }
Exemplo n.º 3
0
        void Init()
        {
            string path = We7Utils.GetMapPath("/Config/Cache.config");

            if (File.Exists(path))
            {
                XmlNodeList list = XmlHelper.GetXmlNodeList(path, "//item");
                if (list != null)
                {
                    foreach (XmlElement xe in list)
                    {
                        string key = (xe.GetAttribute("name") ?? String.Empty).ToLower();
                        int    val;
                        Int32.TryParse(xe.GetAttribute("value"), out val);
                        Items.Add(key, val);
                        Labels.Add(key, xe.GetAttribute("label"));
                    }
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 初始化需要传递给编辑器的文件存放路径
        /// </summary>
        void InitEditorParameter()
        {
            Session["ARTICLEDETAIL_CHANNELFILEPATH"] = ThisArticle.AttachmentUrlPath;
            Session["WorkPlace"] = "articleedit";

            string path = Server.MapPath("~/Config/general.config");

            if (!File.Exists(path))
            {
                ArticleHelper.Write(path);
                //记录日志
                string content = string.Format("创建了内容模型文件“{0}”", "general.config");
                AddLog("创建内容模型文件", content);
            }
            GeneralConfigInfo config = GeneralConfigs.Deserialize(We7Utils.GetMapPath("~/Config/general.config"));

            if (config.CutToMaxWidthOfUploadedImg == 1)
            {
                Session["GENERALCONFIGINFO_CMAXWIDTHOFUPLOADEDIMG"] = config.MaxWidthOfUploadedImg;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 从Config/Departs.xml取得部门ID值
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetDepartIds(string key)
        {
            XmlNode node = XmlHelper.GetXmlNode(We7Utils.GetMapPath("/Config/Departs.xml"), "//item[@key='" + key + "']");

            return(node != null ? node.InnerText : null);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 向广告页面传递所需参数
        /// </summary>
        protected void TransferParameterToAD()
        {
            //获取当前系统参数
            //SystemInformation si = CDHelper.GetSystemInformation();
            SiteConfigInfo si    = SiteConfigs.GetConfig();
            string         adUrl = "";

            if (si.ADUrl != null && si.ADUrl != "")
            {
                adUrl = "http://" + si.ADUrl;
            }
            else
            {
                adUrl = "http://" + Request.Url.Host + ":" + Request.Url.Port.ToString() + "/Plugins/ADPlugin/UI/";
            }
            SiteIDText.Text = si.SiteID;
            string rootRrl = "";

            if (si.RootUrl != null && si.RootUrl != "")
            {
                rootRrl = si.RootUrl;
            }
            else
            {
                rootRrl = "http://" + Request.Url.Host + ":" + Request.Url.Port.ToString();
            }
            if (!rootRrl.EndsWith("/"))
            {
                rootRrl = rootRrl + "/";
            }
            SiteUrlTextBox.Text  = rootRrl;
            SiteNameText.Text    = si.CompanyName;
            AccountIDText.Text   = AccountID;
            AccountNameText.Text = AccountHelper.GetAccount(AccountID, new string[] { "LoginName" }).LoginName;

            ADObjectText.Text = ADObjectName;
            if (!adUrl.EndsWith("/"))
            {
                adUrl = adUrl + "/";
            }
            ADUrlText.Text = adUrl;

            //为了跨域问题,将此处理转至后台
            //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>DataReadyAndSend();</script>");

            string aid   = AccountID.Substring(1, AccountID.Length - 2);
            string sid   = si.SiteID;
            string sname = si.CompanyName;
            string surl  = rootRrl;

            //此方法用于站群广告过滤,如果是总站值为1不过滤,看到所有的广告,分站值为0,值看到自己的广告
            string path = Server.MapPath("~/Config/general.config");

            if (!File.Exists(path))
            {
                ArticleHelper.Write(path);
            }
            GeneralConfigInfo config   = GeneralConfigs.Deserialize(We7Utils.GetMapPath("~/Config/general.config"));
            string            adVisble = config.ADVisbleToSite.ToString();

            //向请求页面发送数据
            //Encoding myEncoding = Encoding.GetEncoding("UTF-8");
            string address = adUrl + "CertificationResponse.aspx?AID=" + aid + "&SID="
                             + sid + "&SNAME=" + Server.UrlEncode(sname) + "&SURL=" + surl + "&ADObject=" + ADObjectName + "&ADVisble=" + adVisble;

            //HttpWebRequest req = WebRequest.Create(address) as HttpWebRequest;
            //req.Headers.Add("P3P", "CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR");
            //req.CookieContainer = new CookieContainer();
            //req.Method = "GET";

            //读取请求结果,检查Cookie是否创建成功
            //using (HttpWebResponse res = (HttpWebResponse)req.GetResponse())
            //{ }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>RedirectToAD('" + address + "');</script>");

            //string returnUrl = "";
            //switch (ADObjectName)
            //{
            //    case "ADRes":
            //        returnUrl = adUrl + "ADResource/ADResourceManage.aspx";
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "AID", aid);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SID", sid);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SNAME", sname);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SURL", surl);
            //        break;

            //    case "ADZone":
            //        returnUrl = adUrl + "ADZones/ADZoneManage.aspx";
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "AID", aid);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SID", sid);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SNAME", sname);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SURL", surl);
            //        break;

            //    case "ADPublish":
            //        returnUrl = adUrl + "ADPublishes/ADPublishManage.aspx";
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "AID", aid);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SID", sid);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SNAME", sname);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SURL", surl);
            //        break;

            //    case "ADSetting":
            //        returnUrl = adUrl + "ADSetting.aspx";
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "AID", aid);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SID", sid);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SNAME", sname);
            //        returnUrl = Helper.AddParamToUrl(returnUrl, "SURL", surl);
            //        break;

            //    default:
            //        break;
            //}

            //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>RedirectToAD('" + returnUrl + "');</script>");
        }