Пример #1
0
        public void Navigate(SiteSection page)
        {
            CustomersHL.CssClass = HomeHL.CssClass = StudiosHL.CssClass = AcademyHL.CssClass = GalleryHL.CssClass = ContactHL.CssClass = DownloadsHL.CssClass = "navLink";

            switch (page)
            {
                case SiteSection.Home:
                    HomeHL.CssClass = "navLinkInactive";
                    break;
                case SiteSection.Studio:
                    StudiosHL.CssClass = "navLinkInactive";
                    break;
                case SiteSection.Academy:
                    AcademyHL.CssClass = "navLinkInactive";
                    break;
                case SiteSection.Customers:
                    CustomersHL.CssClass = "navLinkInactive";
                    break;
                case SiteSection.Gallery:
                    GalleryHL.CssClass = "navLinkInactive";
                    break;
                case SiteSection.Contact:
                    ContactHL.CssClass = "navLinkInactive";
                    break;
                case SiteSection.Downloads:
                    DownloadsHL.CssClass = "navLinkInactive";
                    break;
            }
        }
Пример #2
0
        internal void ConfigurePage(
            SiteSection section,
            Pages page,
            PageTitle title,
            PageSubTitle subTitle,
            PageDescription description,
            NavControlPath controlPath,
            Banner banner,
            bool showMap,
            PageKeyWords keyWords)
        {
            SetBanner(banner);
            Page.Title = title.Value;
            subTitleText.Text = subTitle.Value;
            SetMetaData(description, keyWords);
            ShowMap(showMap);

            if (controlPath.Value != string.Empty)
            {
                Control navControl = LoadControl(controlPath.Value);
                navControl.ID = "navBar";
                SidePanel1.AddControl(navControl);
            }

            SetNavBars(section, page);
        }
Пример #3
0
        static Settings()
        {
            //PagesSection ps = (PagesSection)WebConfigurationManager.GetSection("system.web/pages");
            //List<string> ns = new List<string>(ps.Namespaces.Count);
            //foreach (NamespaceInfo n in ps.Namespaces)
            //    ns.Add(n.Namespace);
            CompilationSection   cs = (CompilationSection)WebConfigurationManager.GetSection("system.web/compilation");
            GlobalizationSection gs = (GlobalizationSection)WebConfigurationManager.GetSection("system.web/globalization");
            SiteSection          ss = SiteSection.GetSection();

            _configSettings          = new Settings();
            _configSettings._rootUrl = HttpContext.Current.Request.ApplicationPath;
            if (!_configSettings._rootUrl.EndsWith("/"))
            {
                _configSettings._rootUrl = string.Concat(_configSettings._rootUrl, "/");
            }
            //_configSettings._controllerNamespaces = ns.ToArray();
            _configSettings._theme            = ss.Theme;
            _configSettings._themePath        = GetTempPath(_configSettings._theme);
            _configSettings._themeUrl         = string.Concat(_configSettings._rootUrl, "themes/", _configSettings._theme, "/");
            _configSettings._debug            = cs.Debug;
            _configSettings._responseEncoding = gs.ResponseEncoding;
            _configSettings._fileEncoding     = gs.FileEncoding;
            _configSettings._urlMode          = ss.UrlMode;
            //_configSettings._urlExt = ss.UrlExt;
            _configSettings._management    = ss.Management;
            _configSettings._wapDomain     = ss.WapDomain;
            _configSettings._subDomain     = ss.SubDomain;
            _configSettings._dataProvider  = ss.DataProvider;
            _configSettings._cacheMode     = ss.CacheMode;
            _configSettings._cacheProvider = ss.CacheProvider;
            _configSettings._resources     = ss.ResourcesUrl;
            _configSettings._passport      = ss.PassportUrl;
            _configSettings._wapPassport   = ss.WapPassportUrl;
        }
Пример #4
0
        public LoggedInModel(User aPanelForUser, User aLoggedInUser, SiteSection aSection)
        {
            theIsMyProfile = aPanelForUser.Id == aLoggedInUser.Id;

            NavigationModel = new NavigationModel(aPanelForUser, aSection, theIsMyProfile);

            if(PrivacyHelper.IsAllowed(aPanelForUser, PrivacyAction.DisplayProfile)) {
                BuildMenu(aPanelForUser, aLoggedInUser);
            }
        }
Пример #5
0
        public List <SiteSection> GetAll()
        {
            SiteSectionDAC     _siteSectionComponent = new SiteSectionDAC();
            IDataReader        reader           = _siteSectionComponent.GetAllSiteSection().CreateDataReader();
            List <SiteSection> _siteSectionList = new List <SiteSection>();

            while (reader.Read())
            {
                if (_siteSectionList == null)
                {
                    _siteSectionList = new List <SiteSection>();
                }
                SiteSection _siteSection = new SiteSection();
                if (reader["SiteSectionId"] != DBNull.Value)
                {
                    _siteSection.SiteSectionId = Convert.ToInt32(reader["SiteSectionId"]);
                }
                if (reader["Name"] != DBNull.Value)
                {
                    _siteSection.Name = Convert.ToString(reader["Name"]);
                }
                if (reader["SiteSectionParentId"] != DBNull.Value)
                {
                    _siteSection.SiteSectionParentId = Convert.ToInt32(reader["SiteSectionParentId"]);
                }
                if (reader["SectionStatusId"] != DBNull.Value)
                {
                    _siteSection.SectionStatusId = Convert.ToInt32(reader["SectionStatusId"]);
                }
                if (reader["SiteId"] != DBNull.Value)
                {
                    _siteSection.SiteId = Convert.ToInt32(reader["SiteId"]);
                }
                if (reader["PersonId"] != DBNull.Value)
                {
                    _siteSection.PersonId = Convert.ToInt32(reader["PersonId"]);
                }
                if (reader["SecurityAccessTypeId"] != DBNull.Value)
                {
                    _siteSection.SecurityAccessTypeId = Convert.ToInt32(reader["SecurityAccessTypeId"]);
                }
                if (reader["RowGuid"] != DBNull.Value)
                {
                    _siteSection.RowGuid = new Guid(reader["RowGuid"].ToString());
                }
                if (reader["ModifiedDate"] != DBNull.Value)
                {
                    _siteSection.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
                }
                _siteSection.NewRecord = false;
                _siteSectionList.Add(_siteSection);
            }
            reader.Close();
            return(_siteSectionList);
        }
Пример #6
0
        public async Task <ActionResult <SiteSection> > AddSiteSectionAsync(SiteSection siteSection)
        {
            if (siteSection is null)
            {
                return(BadRequest());
            }

            _db.SiteSections.Add(siteSection);
            await _db.SaveChangesAsync();

            return(Ok(siteSection));
        }
Пример #7
0
        public async Task <ActionResult> PutSiteSectionAsync(int siteSectionId, SiteSection siteSection)
        {
            if (siteSectionId == siteSection.SiteSectionId)
            {
                _db.Attach(siteSection).State = EntityState.Modified;
                await _db.SaveChangesAsync();

                return(Ok(siteSection));
            }

            return(BadRequest());
        }
Пример #8
0
 internal void ConfigurePage(
     SiteSection section,
     Pages page,
     PageTitle title,
     PageSubTitle subTitle,
     PageDescription description,
     NavControlPath controlPath,
     Banner banner,
     bool showMap)
 {
     ConfigurePage(section, page, title, subTitle, description, controlPath, banner, showMap,
         new PageKeyWords("Recording Rehearsal Blackpool Lancashire Fylde Studio Rooms Drum School Academy Music"));
 }
Пример #9
0
 internal void ConfigurePage(
     SiteSection section,
     Pages page,
     PageTitle title,
     PageSubTitle subTitle,
     PageDescription description,
     NavControlPath controlPath,
     Banner banner,
     bool showMap)
 {
     Default master = this.Master as Default;
     master.ConfigurePage(section, page, title, subTitle, description, controlPath, banner, showMap);
 }
Пример #10
0
        public static string UserNavigation(SiteSection aSiteSection, IEnumerable<UserNavigationMenuModel> aMenuItems, User aTargetUser)
        {
            bool myIsMyself = false;

            IEnumerator<UserNavigationMenuModel> myMenuEnumerator = aMenuItems.GetEnumerator();

            UserInformationModel<User> myUserInfo = HAVUserInformationFactory.GetUserInformation();
            if (myUserInfo != null && myUserInfo.Details.Id == aTargetUser.Id) {
                myIsMyself = true;
            }

            var myUlTag = new TagBuilder("ul");
            int myItemCount = 0;
            while (myMenuEnumerator.MoveNext()) {
                var myLiTag = new TagBuilder("li");
                UserNavigationMenuModel myMenuItem = myMenuEnumerator.Current;

                if (myMenuItem.SiteSection == aSiteSection) {
                    if (myItemCount == 0) {
                        myLiTag.MergeAttribute("class", "first active");
                    } else if (myItemCount == (aMenuItems.Count() - 1)) {
                        myLiTag.MergeAttribute("class", "last active");
                    } else {
                        myLiTag.MergeAttribute("class", "active");
                    }

                }

                myLiTag.MergeAttribute("name", myMenuItem.AltText);
                string myUrl = myMenuItem.Url;
                if (!myIsMyself && !myUrl.Equals("#")) {
                    if (myMenuItem.SiteSection == SiteSection.Home) {
                        myUrl = LinkHelper.Profile(aTargetUser);
                    } else {
                        myUrl += "/" + aTargetUser.Id;
                    }
                }

                if (myUrl.Equals("#")) {
                    myUrl = LinkHelper.Profile(aTargetUser);
                }

                myLiTag.InnerHtml += String.Format("<a class=\"{0}\" href=\"{1}\" title=\"{2}\">{2}</a>", myMenuItem.CssClass, myUrl, myMenuItem.AltText);

                myUlTag.InnerHtml += myLiTag.ToString();
                myItemCount++;
            }

            return myUlTag.ToString();
        }
Пример #11
0
        public SiteSection GetByID(int _siteSectionId)
        {
            SiteSectionDAC _siteSectionComponent = new SiteSectionDAC();
            IDataReader    reader       = _siteSectionComponent.GetByIDSiteSection(_siteSectionId);
            SiteSection    _siteSection = null;

            while (reader.Read())
            {
                _siteSection = new SiteSection();
                if (reader["SiteSectionId"] != DBNull.Value)
                {
                    _siteSection.SiteSectionId = Convert.ToInt32(reader["SiteSectionId"]);
                }
                if (reader["Name"] != DBNull.Value)
                {
                    _siteSection.Name = Convert.ToString(reader["Name"]);
                }
                if (reader["SiteSectionParentId"] != DBNull.Value)
                {
                    _siteSection.SiteSectionParentId = Convert.ToInt32(reader["SiteSectionParentId"]);
                }
                if (reader["SectionStatusId"] != DBNull.Value)
                {
                    _siteSection.SectionStatusId = Convert.ToInt32(reader["SectionStatusId"]);
                }
                if (reader["SiteId"] != DBNull.Value)
                {
                    _siteSection.SiteId = Convert.ToInt32(reader["SiteId"]);
                }
                if (reader["PersonId"] != DBNull.Value)
                {
                    _siteSection.PersonId = Convert.ToInt32(reader["PersonId"]);
                }
                if (reader["SecurityAccessTypeId"] != DBNull.Value)
                {
                    _siteSection.SecurityAccessTypeId = Convert.ToInt32(reader["SecurityAccessTypeId"]);
                }
                if (reader["RowGuid"] != DBNull.Value)
                {
                    _siteSection.RowGuid = new Guid(reader["RowGuid"].ToString());
                }
                if (reader["ModifiedDate"] != DBNull.Value)
                {
                    _siteSection.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
                }
                _siteSection.NewRecord = false;
            }
            reader.Close();
            return(_siteSection);
        }
Пример #12
0
 private static bool IsAProfilePage(SiteSection aSection)
 {
     return aSection == SiteSection.Profile;
 }
Пример #13
0
        public static string IssueInformationDiv(Issue anIssue, bool anIsAnonymous, string anIssueInfoCssClass, string anEditAndStanceCssClass, string aReportCssClass, string anAgreeCssClass,
                                                 string aDisagreeCssClass, string aDeleteCssClass, string anEditCssClass, string anAlternateStanceDeleteCssClass, string anAlternateStanceEditCssClass, bool aUseAlternate,
                                                 SiteSection aSiteSection, int aSourceId)
        {
            string myAgreeCssClass = anAgreeCssClass;
            string myDisagreeCssClass = aDisagreeCssClass;
            string myDeleteCssClass = aDeleteCssClass;
            string myEditCssClass = anEditCssClass;
            UserInformationModel<User> myUserInfo = HAVUserInformationFactory.GetUserInformation();
            bool myHasStance = GetHasStance(anIssue, myUserInfo);

            if (aUseAlternate && (myHasStance || myUserInfo == null)) {
                myAgreeCssClass = string.Empty;
                myDisagreeCssClass = string.Empty;
                myDeleteCssClass = anAlternateStanceDeleteCssClass;
                myEditCssClass = anAlternateStanceEditCssClass;
            }
            return IssueInformationDiv(anIssue, anIsAnonymous, myUserInfo, myHasStance, anIssueInfoCssClass, anEditAndStanceCssClass, aReportCssClass, myAgreeCssClass,
                myDisagreeCssClass, myDeleteCssClass, myEditCssClass, aSiteSection, aSourceId);
        }
Пример #14
0
        private static string IssueInformationDiv(Issue anIssue, bool anAnonymous, UserInformationModel<User> aUserInfoModel, bool aHasStance, string anIssueInfoCssClass, string anEditAndStanceCssClass, string aReportCssClass, string anAgreeCssClass,
                                                 string aDisagreeCssClass, string anDeleteCssClass, string anEditCssClass, SiteSection aSiteSection, int aSourceId)
        {
            var myIssueInfoDiv = new TagBuilder("div");
            myIssueInfoDiv.AddCssClass(anIssueInfoCssClass);

            var myIssueInfoPadding = new TagBuilder("div");
            myIssueInfoPadding.AddCssClass("p-a10");
            myIssueInfoPadding.InnerHtml += SharedStyleHelper.InfoSpeakSpan("speak-lft");

            var myHeadTitle = new TagBuilder("h1");
            var myIssueLink = new TagBuilder("a");
            myIssueLink.MergeAttribute("href", LinkHelper.IssueUrl(anIssue.Title));
            myIssueLink.InnerHtml = anIssue.Title;
            myHeadTitle.InnerHtml += myIssueLink.ToString();

            string myName = NameHelper.FullName(anIssue.User);
            string myProfileLink = LinkHelper.Profile(anIssue.User);
            if (anAnonymous) {
                myName = HAVConstants.ANONYMOUS;
                myProfileLink = "#";
            }

            var myNameLink = new TagBuilder("a");
            myNameLink.AddCssClass("name-2");
            myNameLink.MergeAttribute("href", myProfileLink);
            myNameLink.InnerHtml = myName;

            var myLocationSpan = new TagBuilder("span");
            myLocationSpan.AddCssClass("loc c-white");
            myLocationSpan.InnerHtml = anIssue.City + ", " + anIssue.State;

            string myUserType = GetUserTypeForIssue(anIssue);
            var myIconSpan = new TagBuilder("span");
            myIconSpan.AddCssClass(myUserType);
            myIconSpan.MergeAttribute("title", myUserType);
            myIconSpan.InnerHtml = "&nbsp;";

            myIssueInfoPadding.InnerHtml += myHeadTitle.ToString();
            myIssueInfoPadding.InnerHtml += myNameLink.ToString();
            myIssueInfoPadding.InnerHtml += "&nbsp;";
            myIssueInfoPadding.InnerHtml += myLocationSpan.ToString();
            myIssueInfoPadding.InnerHtml += "&nbsp;";
            myIssueInfoPadding.InnerHtml += myIconSpan.ToString();
            myIssueInfoPadding.InnerHtml += new TagBuilder("br").ToString();
            myIssueInfoPadding.InnerHtml += PresentationHelper.ReplaceCarriageReturnWithBR(anIssue.Description);

            myIssueInfoPadding.InnerHtml += SharedStyleHelper.ClearDiv();

            var myEditAndStanceDiv = new TagBuilder("div");
            myEditAndStanceDiv.AddCssClass(anEditAndStanceCssClass);
            myEditAndStanceDiv.InnerHtml += SharedStyleHelper.StyledHtmlDiv(aReportCssClass, ComplaintHelper.IssueLink(anIssue.Id)).ToString();
            myEditAndStanceDiv.InnerHtml += DeleteDiv(aUserInfoModel, anIssue, anDeleteCssClass);
            myEditAndStanceDiv.InnerHtml += EditDiv(aUserInfoModel, anIssue, anEditCssClass);
            if (anAgreeCssClass != string.Empty) {
                myEditAndStanceDiv.InnerHtml += AgreeDiv(aUserInfoModel, anIssue, anAgreeCssClass, aSiteSection, aSourceId);
            }
            if (aDisagreeCssClass != string.Empty) {
                myEditAndStanceDiv.InnerHtml += DisagreeDiv(aUserInfoModel, anIssue, aDisagreeCssClass, aSiteSection, aSourceId);
            }
            myEditAndStanceDiv.InnerHtml += SharedStyleHelper.ClearDiv();

            myIssueInfoPadding.InnerHtml += myEditAndStanceDiv.ToString();

            myIssueInfoDiv.InnerHtml += myIssueInfoPadding.ToString();
            return myIssueInfoDiv.ToString();
        }
Пример #15
0
 private static TagBuilder DisagreeDiv(UserInformationModel<User> aUserInformation, Issue anIssue, string aCssClass, SiteSection aSource, int aSourceId)
 {
     bool myHasDisposition = GetHasStance(anIssue, aUserInformation);
     bool myIsLoggedIn = aUserInformation != null;
     int myTotalDisagrees = GetTotalStance(anIssue, Disposition.Dislike);
     return SharedContentStyleHelper.DisagreeStanceDiv(aCssClass, myHasDisposition, myIsLoggedIn, myTotalDisagrees, LinkHelper.DisagreeIssue(anIssue.Id, aSource, aSourceId));
 }
Пример #16
0
 public static string AgreeIssue(int anIssueId, SiteSection aSection, int aSourceId)
 {
     return "/Issue/Disposition?issueId=" + anIssueId + "&disposition=" + Disposition.Like + "&section=" + aSection + "&sourceId=" + aSourceId;
 }
Пример #17
0
        public bool Update(SiteSection sitesection, int old_siteSectionId)
        {
            SiteSectionDAC sitesectionComponent = new SiteSectionDAC();

            return(sitesectionComponent.UpdateSiteSection(sitesection.SiteSectionId, sitesection.Name, sitesection.SiteSectionParentId, sitesection.SectionStatusId, sitesection.SiteId, sitesection.PersonId, sitesection.SecurityAccessTypeId, sitesection.RowGuid, sitesection.ModifiedDate, old_siteSectionId));
        }
Пример #18
0
        public bool Insert(SiteSection sitesection)
        {
            SiteSectionDAC sitesectionComponent = new SiteSectionDAC();

            return(sitesectionComponent.InsertNewSiteSection(sitesection.SiteSectionId, sitesection.Name, sitesection.SiteSectionParentId, sitesection.SectionStatusId, sitesection.SiteId, sitesection.PersonId, sitesection.SecurityAccessTypeId, sitesection.RowGuid, sitesection.ModifiedDate));
        }
Пример #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SiteSections"/> class.
 /// </summary>
 /// <param name="site">The site.</param>
 public SiteSections( Site site )
 {
     using(SqlConnection cn = Site.CreateConnection(true, true)) {
         cn.Open();
         using(SqlCommand cmd = new SqlCommand(@"select s.siteSectionId, siteSectionDetailId,
     name, s.description, URL, data, addDate, active, unique_siteId, s.name, sd.description
     from siteSections s with (nolock)
     inner join siteSectionsDetail sd with (nolock) on s.siteSectionId = sd.siteSectionId
     where unique_siteId = @siteId order by s.siteSectionId, addDate", cn)) {
             ;
             cmd.Parameters.Add("@siteId", SqlDbType.UniqueIdentifier).Value = new Guid(Site.Id.ToString());
             using(SqlDataReader d = cmd.ExecuteReader()) {
                 if(d.HasRows) {
                     Guid currentId = Guid.Empty;
                     SiteSection section = null;
                     while(d.Read()) {
                         if(currentId != d.GetGuid(0)) {
                             currentId = d.GetGuid(0);
                             section = new SiteSection(
                                 d.GetGuid(0),
                                 d.GetString(2),
                                 d.GetString(3),
                                 d.GetString(4)
                             );
                             List.Add(section);
                             /* if this isn't a category add it to the list of URLs to rewrite */
                             section.isCategory = Main.Site.Categories.List.Exists(delegate(Commerce.Category cat) {
                                 return cat.Id == section.Id;
                             });
                         }
                         SiteSectionEntry e = new SiteSectionEntry(
                             d.GetGuid(1),
                             d.GetGuid(0),
                             d.GetString(5),
                             d.GetDateTime(6),
                             d.GetBoolean(7),
                             d.GetString(9),
                             d.GetString(10)
                         );
                         if(section != null) {
                             section.Entries.Add(e);
                         }
                         Entries.Add(e);
                     }
                 }
             }
         }
     }
     return;
 }
        public ActionResult Disposition(int id, int issueId, Disposition disposition, SiteSection section, int sourceId)
        {
            if (!IsLoggedIn()) {
                return RedirectToLogin();
            }
            User aUser = GetUserInformaton();
            try {
                bool myResult = theIssueReplyService.AddIssueReplyStance(aUser, id, (int)disposition);
                if (!myResult) {
                    return SendToErrorPage("You can only provide a disposition towards a person's reply to an issue once.");
                }
                TempData["Message"] += MessageHelper.SuccessMessage(DISPOSITION_SUCCESS);
            } catch (Exception e) {
                LogError(e, DISPOSITION_ERROR);
                TempData["Message"] += MessageHelper.ErrorMessage(DISPOSITION_ERROR);
                return SendToErrorPage(DISPOSITION_ERROR);
            }

            if (section == SiteSection.Profile) {
                return RedirectToAction("Show", "Profile", new { id = sourceId });
            } else if (section == SiteSection.MyProfile) {
                return RedirectToAction("Show", "Profile");
            } else if (section == SiteSection.IssueActivity) {
                return RedirectToAction("IssueActivity", "Profile", new { id = sourceId });
            } else if (section == SiteSection.MyIssueActivity) {
                return RedirectToAction("IssueActivity", "Profile");
            } else if (section == SiteSection.IssueReply) {
                return RedirectToAction("Details", new { id = sourceId });
            } else {
                return RedirectToAction("RedirectToDetails", "Issue", new { id = issueId });
            }
        }
Пример #21
0
        public void System(string type)
        {
            if (CheckRight())
            {
                if (CheckPost(string.Concat("system_", type), new Action(() =>
                {
                    switch (type)
                    {
                    case "config":
                        this["Config"] = new
                        {
                            Theme = Application.Settings.Theme,
                            UrlMode = Application.Settings.UrlMode.ToString(),
                            Management = Application.Settings.Management,
                            Themes = Application.Settings.GetThemes(),
                            WapDomain = Application.Settings.WapDomain,
                            SubDomain = Application.Settings.SubDomain,
                            DataProvider = Application.Settings.DataProvider,
                            CacheMode = Application.Settings.CacheMode,
                            CacheProvider = Application.Settings.CacheProvider,
                            ResourcesUrl = Application.Settings.ResourcesUrl,
                            PassportUrl = Application.Settings.PassportUrl
                        };
                        this["Conns"] = WebConfigurationManager.ConnectionStrings;
                        break;

                    case "passport":
                        this["Config"] = PassportSection.GetSection();
                        this["Conns"] = WebConfigurationManager.ConnectionStrings;
                        break;

                    case "captcha":
                        this["Config"] = CaptchaSection.GetSection();
                        break;

                    case "smscaptcha":
                        this["Config"] = SMSCaptchaSection.GetSection();
                        break;

                    case "filesystem":
                        this["Config"] = FileSystemSection.GetSection();
                        break;

                    case "email":
                        this["Config"] = (SmtpSection)WebConfigurationManager.GetSection("system.net/mailSettings/smtp");
                        break;

                    case "friendlink":
                        this["Config"] = FriendLinkSection.GetSection();
                        break;

                    case "robots":
                        {
                            string content = string.Empty;
                            try
                            {
                                string file = Server.MapPath("~/robots.txt");
                                content = Encoding.UTF8.GetString(File.ReadAllBytes(file));
                            }
                            catch (Exception) { }
                            this["Robots"] = content;
                        }
                        break;

                    case "sitemap":
                        break;
                    }
                })))
                {
                    switch (type)
                    {
                    case "site":
                    {
                        int           i  = 0;
                        StringBuilder sb = new StringBuilder();
                        foreach (string key in Request.Form.Keys)
                        {
                            if (i++ > 0)
                            {
                                sb.Append(',');
                            }
                            sb.Append(string.Concat("\"", key, "\"=\"", HttpUtility.HtmlEncode(Request.Form[key]), "\""));
                        }
                        try
                        {
                            File.WriteAllText(Server.MapPath(string.Concat(Utility.ConfigDir, "site.config")), string.Concat("$set(Site=array(", sb.ToString(), "))"));
                            SetResult(() =>
                                {
                                    WritePostLog("MOD");
                                });
                        }
                        catch (Exception ex)
                        {
                            SetResult(false, ex.Message);
                        }
                    }
                    break;

                    case "config":
                    {
                        try
                        {
                            System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
                            SiteSection ss = SiteSection.GetSection(config);
                            ss.Theme = Request.Form["Theme"];
                            try { ss.UrlMode = (SiteUrlMode)int.Parse(Request.Form["UrlMode"]); }
                            catch (Exception) { ss.UrlMode = SiteUrlMode.Rewrite; }
                            ss.Management   = Request.Form["Management"];
                            ss.WapDomain    = Request.Form["WapDomain"];
                            ss.SubDomain    = Request.Form["SubDomain"];
                            ss.DataProvider = Request.Form["DataProvider"];
                            try { ss.CacheMode = (CacheMode)int.Parse(Request.Form["CacheMode"]); }
                            catch (Exception) { ss.CacheMode = CacheMode.Application; }
                            ss.CacheProvider  = Request.Form["CacheProvider"];
                            ss.ResourcesUrl   = Request.Form["ResourcesUrl"];
                            ss.PassportUrl    = Request.Form["PassportUrl"];
                            ss.WapPassportUrl = Request.Form["WapPassportUrl"];
                            config.Save();
                            SetResult(() =>
                                {
                                    WritePostLog("MOD");
                                });
                        }
                        catch (Exception ex)
                        {
                            SetResult(false, ex.Message);
                        }
                    }
                    break;

                    case "passport":
                    {
                        try
                        {
                            System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
                            PassportSection section = PassportSection.GetSection(config);
                            section.CookieName   = Request.Form["CookieName"];
                            section.CookieDomain = Request.Form["CookieDomain"];
                            section.CookieIV     = Request.Form["CookieIV"];
                            section.CookieKey    = Request.Form["CookieKey"];
                            section.MaxInvalidPasswordAttempts           = GetInt32Value(Request.Form["MaxInvalidPasswordAttempts"], Utility.PassportMaxInvalidPasswordAttempts);
                            section.PasswordAnswerAttemptLockoutDuration = GetInt32Value(Request.Form["PasswordAnswerAttemptLockoutDuration"], Utility.PassportPasswordAnswerAttemptLockoutDuration);
                            try { section.Level = (PassportLevel)int.Parse(Request.Form["Level"]); }
                            catch (Exception) { section.Level = PassportLevel.Low; }
                            section.VerifyMail          = GetBooleanValue(Request.Form["VerifyMail"]);
                            section.VerifyMobile        = GetBooleanValue(Request.Form["VerifyMobile"]);
                            section.LoginWithCaptcha    = GetBooleanValue(Request.Form["LoginWithCaptcha"]);
                            section.RegisterWithCaptcha = GetBooleanValue(Request.Form["RegisterWithCaptcha"]);
                            section.DefaultApproved     = GetBooleanValue(Request.Form["DefaultApproved"]);
                            section.DataProvider        = Request.Form["DataProvider"];
                            config.Save();
                            SetResult(() =>
                                {
                                    WritePostLog("MOD");
                                });
                        }
                        catch (Exception ex)
                        {
                            SetResult(false, ex.Message);
                        }
                    }
                    break;

                    case "cache":
                        CacheProvider.Current.Clear();
                        SetResult(() =>
                        {
                            WriteLog("CLEAR CACHE");
                        });
                        break;

                    case "captcha":
                    {
                        try
                        {
                            System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
                            CaptchaSection section = CaptchaSection.GetSection(config);
                            section.Chars         = Request.Form["Chars"];
                            section.CookiePrefix  = Request.Form["CookiePrefix"];
                            section.CookieDomain  = Request.Form["CookieDomain"];
                            section.DefaultWidth  = GetInt32Value(Request.Form["DefaultWidth"], Utility.CaptchaDefaultWidth);
                            section.DefaultHeight = GetInt32Value(Request.Form["DefaultHeight"], Utility.CaptchaDefaultHeight);
                            section.DefaultCount  = GetInt32Value(Request.Form["DefaultCount"], Utility.CaptchaDefaultCount);
                            section.Expiration    = GetInt32Value(Request.Form["Expiration"], Utility.CaptchaExpiration);
                            config.Save();
                            SetResult(() =>
                                {
                                    WritePostLog("MOD");
                                });
                        }
                        catch (Exception ex)
                        {
                            SetResult(false, ex.Message);
                        }
                    }
                    break;

                    case "smscaptcha":
                    {
                        try
                        {
                            System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
                            SMSCaptchaSection section = SMSCaptchaSection.GetSection(config);
                            section.Chars        = Request.Form["Chars"];
                            section.DefaultCount = GetInt32Value(Request.Form["DefaultCount"], Utility.SMSCaptchaDefaultCount);
                            section.TimeSpan     = GetInt32Value(Request.Form["TimeSpan"], Utility.SMSCaptchaTimeSpan);
                            section.Expiration   = GetInt32Value(Request.Form["Expiration"], Utility.SMSCaptchaExpiration);
                            config.Save();
                            SetResult(() =>
                                {
                                    WritePostLog("MOD");
                                });
                        }
                        catch (Exception ex)
                        {
                            SetResult(false, ex.Message);
                        }
                    }
                    break;

                    case "filesystem":
                    {
                        try
                        {
                            System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
                            FileSystemSection section = FileSystemSection.GetSection(config);
                            section.Enable = Types.GetBooleanFromString(Request.Form["Enable"]);
                            section.Path   = Request.Form["Path"];
                            section.Url    = Request.Form["Url"];
                            try { section.Mark = (ImageMarkType)int.Parse(Request.Form["Mark"]); }
                            catch (Exception) { section.Mark = ImageMarkType.None; }
                            section.Text   = Request.Form["Text"];
                            section.Region = (ImageMarkRegion)int.Parse(Request.Form["Region"]);
                            try { section.Width = int.Parse(Request.Form["Width"]); }
                            catch (Exception) { section.Width = 0; }
                            try { section.Height = int.Parse(Request.Form["Height"]); }
                            catch (Exception) { section.Height = 0; }
                            config.Save();
                            SetResult(() =>
                                {
                                    WritePostLog("MOD");
                                });
                        }
                        catch (Exception ex)
                        {
                            SetResult(false, ex.Message);
                        }
                    }
                    break;

                    case "email":
                        try
                        {
                            System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
                            SmtpSection section = (SmtpSection)config.GetSection("system.net/mailSettings/smtp");
                            section.From              = Request.Form["UserName"];
                            section.Network.Host      = Request.Form["Host"];
                            section.Network.Port      = GetInt32Value(Request.Form["Port"], 25);
                            section.Network.UserName  = Request.Form["UserName"];
                            section.Network.Password  = Request.Form["Password"];
                            section.Network.EnableSsl = GetBooleanValue(Request.Form["EnableSsl"]);
                            config.Save();
                            SetResult(() =>
                            {
                                WritePostLog("MOD");
                            });
                        }
                        catch (Exception ex)
                        {
                            SetResult(false, ex.Message);
                        }
                        break;

                    case "friendlink":
                    {
                        try
                        {
                            System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
                            FriendLinkSection section = FriendLinkSection.GetSection(config);
                            section.Enable   = Types.GetBooleanFromString(Request.Form["Enable"]);
                            section.Approved = Types.GetBooleanFromString(Request.Form["Approved"]);
                            try { section.Mode = (FriendLinkMode)int.Parse(Request.Form["Mode"]); }
                            catch (Exception) { section.Mode = FriendLinkMode.Text; }
                            config.Save();
                            SetResult(() =>
                                {
                                    WritePostLog("MOD");
                                });
                        }
                        catch (Exception ex)
                        {
                            SetResult(false, ex.Message);
                        }
                    }
                    break;

                    case "robots":
                        try
                        {
                            string file = Server.MapPath("~/robots.txt");
                            File.WriteAllBytes(file, Encoding.UTF8.GetBytes(Request.Form["Robots"]));
                            SetResult(() =>
                            {
                                WritePostLog("SUB");
                            });
                        }
                        catch (Exception ex)
                        {
                            SetResult(false, ex.Message);
                        }
                        break;

                    case "sitemap":
                        break;
                    }
                }
            }
        }
Пример #22
0
 private void SetNavBars(SiteSection section, Pages page)
 {
     BrandingNavBar1.Navigate(section);
     SidePanel1.Navigate(page);
 }
Пример #23
0
 public static string DisagreeIssueReply(int anIssueReplyId, int anIssueId, SiteSection aSection, int aSourceId)
 {
     return "/IssueReply/Disposition/" + anIssueReplyId + "?issueId=" + anIssueId + "&disposition=" + Disposition.Dislike + "&section=" + aSection + "&sourceId=" + aSourceId;
 }
Пример #24
0
        public override object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            ISiteSection model = null;

            if (section != null)
            {
                model = new SiteSection();

                XmlNode node = null;

                #region

                if (GetSingleNodeValue(section, "/SiteSection", out node))
                {
                    model.Html.SiteName        = GetSingleNodeAttributeValue(node, "item[@key=\"SiteName\"]", "value");
                    model.Html.SiteTitle       = GetSingleNodeAttributeValue(node, "item[@key=\"SiteTitle\"]", "value");
                    model.Html.FeeName         = GetSingleNodeAttributeValue(node, "item[@key=\"FeeName\"]", "value");
                    model.Html.MetaKeywords    = GetSingleNodeAttributeValue(node, "item[@key=\"MetaKeywords\"]", "value");
                    model.Html.MetaDescription = GetSingleNodeAttributeValue(node, "item[@key=\"MetaDescription\"]", "value");
                }
                if (GetSingleNodeValue(section, "/SiteSection/Service", out node))
                {
                    model.Service.WorkHour    = GetSingleNodeAttributeValue(node, "item[@key=\"WorkHour\"]", "value");
                    model.Service.Phone       = GetSingleNodeAttributeValue(node, "item[@key=\"Phone\"]", "value");
                    model.Service.Email       = GetSingleNodeAttributeValue(node, "item[@key=\"Email\"]", "value");
                    model.Service.QQ          = GetSingleNodeAttributeValue(node, "item[@key=\"QQ\"]", "value");
                    model.Service.WeChat      = GetSingleNodeAttributeValue(node, "item[@key=\"WeChat\"]", "value");
                    model.Service.WeChatPubId = GetSingleNodeAttributeValue(node, "item[@key=\"WeChatPubId\"]", "value");
                }
                if (GetSingleNodeValue(section, "/SiteSection/Auth/QQ", out node))
                {
                    model.Auth.IsShowQQ = GetSingleNodeAttributeValue(node, "item[@key=\"IsShow\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Auth/Weibo", out node))
                {
                    model.Auth.IsShowWeibo = GetSingleNodeAttributeValue(node, "item[@key=\"IsShow\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Auth/WeChat", out node))
                {
                    model.Auth.IsShowWeChat = GetSingleNodeAttributeValue(node, "item[@key=\"IsShow\"]", "value").ToBool();
                    model.Auth.IsAutoLoginInMicroMessenger = GetSingleNodeAttributeValue(node, "item[@key=\"IsAutoLoginInMicroMessenger\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Pay", out node))
                {
                    model.Pay.IsShowFailTip = GetSingleNodeAttributeValue(node, "item[@key=\"IsShowFailTip\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Pay/WxPay", out node))
                {
                    model.Pay.WxPayResultFailUrl = GetSingleNodeAttributeValue(node, "item[@key=\"ResultFailUrl\"]", "value");
                }
                if (GetSingleNodeValue(section, "/SiteSection/CP", out node))
                {
                    model.CP.IsShowAllNovel   = GetSingleNodeAttributeValue(node, "item[@key=\"IsShowAllNovel\"]", "value").ToBool();
                    model.CP.IsShowAllAudio   = GetSingleNodeAttributeValue(node, "item[@key=\"IsShowAllAudio\"]", "value").ToBool();
                    model.CP.IsShowAllCartoon = GetSingleNodeAttributeValue(node, "item[@key=\"IsShowAllCartoon\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Class/SpeType", out node))
                {
                    model.Class.IsShowMale   = GetSingleNodeAttributeValue(node, "item[@key=\"IsShowMale\"]", "value").ToBool();
                    model.Class.IsShowFemale = GetSingleNodeAttributeValue(node, "item[@key=\"IsShowFemale\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Class/Audio", out node))
                {
                    model.Class.IsShowAudio = GetSingleNodeAttributeValue(node, "item[@key=\"IsShow\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Class/Cartoon", out node))
                {
                    model.Class.IsShowCartoon = GetSingleNodeAttributeValue(node, "item[@key=\"IsShow\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Novel", out node))
                {
                    model.Novel.ChapterWordSizeFee = GetSingleNodeAttributeValue(node, "item[@key=\"ChapterWordSizeFee\"]", "value").ToInt();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Audio", out node))
                {
                    model.Audio.AllPackageFee = GetSingleNodeAttributeValue(node, "item[@key=\"AllPackageFee\"]", "value").ToInt();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Chapter", out node))
                {
                    model.Chapter.IsRedirectWeChat = GetSingleNodeAttributeValue(node, "item[@key=\"IsRedirectWechat\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Comment", out node))
                {
                    model.Comment.IsOpen        = GetSingleNodeAttributeValue(node, "item[@key=\"IsOpen\"]", "value").ToBool();
                    model.Comment.IsReverseSort = GetSingleNodeAttributeValue(node, "item[@key=\"IsReverseSort\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Download/App", out node))
                {
                    model.Download.IsShowApp = GetSingleNodeAttributeValue(node, "item[@key=\"IsShow\"]", "value").ToBool();
                }
                if (GetSingleNodeValue(section, "/SiteSection/Filter/Book", out node))
                {
                    model.Filter.BookCPID = GetSingleNodeAttributeValue(node, "item[@key=\"CPID\"]", "value").ToInt();
                }

                #endregion
            }

            return(model);
        }