void AccountForumMemberManage_Edit(object sender, ModuleModeEventArgs e) { SetTemplate("account_forum_member_edit"); long id = core.Functions.RequestLong("id", 0); ForumMember member = null; /* Signature TextBox */ TextBox signatureTextBox = new TextBox("signature"); signatureTextBox.IsFormatted = true; //signatureTextBox.IsDisabled = true; signatureTextBox.Lines = 7; /* Ranks SelectBox */ SelectBox ranksSelectBox = new SelectBox("ranks"); try { member = new ForumMember(core, Owner, id, UserLoadOptions.All); } catch (InvalidForumMemberException) { core.Functions.Generate404(); } catch (InvalidUserException) { core.Functions.Generate404(); } ranksSelectBox.Add(new SelectBoxItem("0", "None")); Dictionary<long, ForumMemberRank> ranks = ForumMemberRank.GetRanks(core, Owner); foreach (ForumMemberRank rank in ranks.Values) { ranksSelectBox.Add(new SelectBoxItem(rank.Id.ToString(), rank.RankTitleText)); } if (ranksSelectBox.ContainsKey(member.ForumRankId.ToString())) { ranksSelectBox.SelectedKey = member.ForumRankId.ToString(); } signatureTextBox.Value = member.ForumSignature; /* Parse the form fields */ template.Parse("S_USERNAME", member.UserName); template.Parse("S_RANK", ranksSelectBox); template.Parse("S_SIGNATURE", signatureTextBox); template.Parse("S_ID", id.ToString()); }
void AccountEnterpriseResourcePlanningDocumentTemplates_Edit(object sender, ModuleModeEventArgs e) { SetTemplate("account_erp_document_templates_edit"); SaveMode(AccountEnterpriseResourcePlanningDocumentTemplates_Edit_Save); TextBox titleTextBox = new TextBox("title"); TextBox descriptionTextBox = new TextBox("description"); descriptionTextBox.Lines = 5; switch (e.Mode) { case "add": break; case "edit": long templateId = core.Functions.FormLong("id", core.Functions.RequestLong("id", 0)); DocumentTemplate documentTemplate = null; try { documentTemplate = new DocumentTemplate(core, templateId); } catch { core.Functions.Generate404(); return; } if (documentTemplate != null) { if (!documentTemplate.Owner.Equals(Owner)) { core.Functions.Generate403(); } titleTextBox.Value = documentTemplate.Title; descriptionTextBox.Value = documentTemplate.Description; template.Parse("S_ID", documentTemplate.Id); } break; } template.Parse("S_TITLE", titleTextBox); template.Parse("S_DESCRIPTION", descriptionTextBox); }
void AccountForumRanks_Add(object sender, ModuleModeEventArgs e) { SetTemplate("account_forum_rank_edit"); /* Title TextBox */ TextBox titleTextBox = new TextBox("rank-title"); /* Minimum Posts (to attain rank) TextBox */ TextBox minPostsTextBox = new TextBox("min-posts"); /* Special Rank TextBox */ CheckBox specialCheckBox = new CheckBox("special"); if (e.Mode == "edit") { template.Parse("EDIT", "TRUE"); long id = core.Functions.RequestLong("id", 0); if (id == 0) { core.Functions.Generate404(); return; } try { ForumMemberRank fmr = new ForumMemberRank(core, id); titleTextBox.Value = fmr.RankTitleText; minPostsTextBox.Value = fmr.RankPosts.ToString(); specialCheckBox.IsChecked = fmr.RankSpecial; template.Parse("S_ID", fmr.RankId.ToString()); } catch (InvalidForumMemberRankException) { core.Functions.Generate404(); return; } } /* Parse the form fields */ template.Parse("S_TITLE", titleTextBox); template.Parse("S_MINIMUM_POSTS", minPostsTextBox); template.Parse("S_SPECIAL", specialCheckBox); }
void AccountProfileManage_Show(object sender, EventArgs e) { SetTemplate("account_profile"); Musician musician = (Musician)Owner; /* */ TextBox biographyTextBox = new TextBox("biography"); biographyTextBox.IsFormatted = true; biographyTextBox.Lines = 7; /* */ TextBox homepageTextBox = new TextBox("homepage"); homepageTextBox.MaxLength = 1024; /* */ TextBox nameTextBox = new TextBox("name"); nameTextBox.IsDisabled = true; nameTextBox.MaxLength = 63; /* */ SelectBox genreSelectBox = new SelectBox("genre"); /* */ SelectBox musicianTypeSelectBox = new SelectBox("musician-type"); List<MusicGenre> genres = MusicGenre.GetGenres(core); foreach (MusicGenre genre in genres) { genreSelectBox.Add(new SelectBoxItem(genre.Id.ToString(), genre.Name)); } musicianTypeSelectBox.Add(new SelectBoxItem(((byte)MusicianType.Musician).ToString(), "Musician")); musicianTypeSelectBox.Add(new SelectBoxItem(((byte)MusicianType.Duo).ToString(), "Duo")); musicianTypeSelectBox.Add(new SelectBoxItem(((byte)MusicianType.Trio).ToString(), "Trio")); musicianTypeSelectBox.Add(new SelectBoxItem(((byte)MusicianType.Quartet).ToString(), "Quartet")); musicianTypeSelectBox.Add(new SelectBoxItem(((byte)MusicianType.Quintet).ToString(), "Quintet")); musicianTypeSelectBox.Add(new SelectBoxItem(((byte)MusicianType.Band).ToString(), "Band")); musicianTypeSelectBox.Add(new SelectBoxItem(((byte)MusicianType.Group).ToString(), "Group")); musicianTypeSelectBox.Add(new SelectBoxItem(((byte)MusicianType.Orchestra).ToString(), "Orchestra")); musicianTypeSelectBox.Add(new SelectBoxItem(((byte)MusicianType.Choir).ToString(), "Choir")); biographyTextBox.Value = musician.Biography; homepageTextBox.Value = musician.Homepage; nameTextBox.Value = musician.TitleName; musicianTypeSelectBox.SelectedKey = ((byte)musician.MusicianType).ToString(); template.Parse("S_BIOGRAPHY", biographyTextBox); template.Parse("S_HOMEPAGE", homepageTextBox); template.Parse("S_NAME", nameTextBox); template.Parse("S_GENRE", genreSelectBox); template.Parse("S_MUSICIAN_TYPE", musicianTypeSelectBox); Save(AccountProfileManage_Save); }
void PostContent(HookEventArgs e) { VariableCollection styleSheetVariableCollection = core.Template.CreateChild("javascript_list"); styleSheetVariableCollection.Parse("URI", @"/scripts/load-image.min.js"); styleSheetVariableCollection = core.Template.CreateChild("javascript_list"); styleSheetVariableCollection.Parse("URI", @"/scripts/canvas-to-blob.min.js"); styleSheetVariableCollection = core.Template.CreateChild("javascript_list"); styleSheetVariableCollection.Parse("URI", @"/scripts/jquery.iframe-transport.js"); styleSheetVariableCollection = core.Template.CreateChild("javascript_list"); styleSheetVariableCollection.Parse("URI", @"/scripts/jquery.fileupload.js"); styleSheetVariableCollection = core.Template.CreateChild("javascript_list"); styleSheetVariableCollection.Parse("URI", @"/scripts/jquery.fileupload-process.js"); styleSheetVariableCollection = core.Template.CreateChild("javascript_list"); styleSheetVariableCollection.Parse("URI", @"/scripts/jquery.fileupload-image.js"); if (e.core.IsMobile) { return; } Template template = new Template(Assembly.GetExecutingAssembly(), "postphoto"); template.Medium = core.Template.Medium; template.SetProse(core.Prose); string formSubmitUri = core.Hyperlink.AppendSid(e.Owner.AccountUriStub, true); template.Parse("U_ACCOUNT", formSubmitUri); template.Parse("S_ACCOUNT", formSubmitUri); template.Parse("USER_DISPLAY_NAME", e.Owner.DisplayName); CheckBox publishToFeedCheckBox = new CheckBox("publish-feed"); publishToFeedCheckBox.IsChecked = true; CheckBox highQualityCheckBox = new CheckBox("high-quality"); highQualityCheckBox.IsChecked = false; core.Display.ParseLicensingBox(template, "S_GALLERY_LICENSE", 0); template.Parse("S_PUBLISH_FEED", publishToFeedCheckBox); template.Parse("S_HIGH_QUALITY", highQualityCheckBox); core.Display.ParseClassification(template, "S_PHOTO_CLASSIFICATION", Classifications.Everyone); PermissionGroupSelectBox permissionSelectBox = new PermissionGroupSelectBox(core, "permissions", e.Owner.ItemKey); HiddenField aclModeField = new HiddenField("aclmode"); aclModeField.Value = "simple"; template.Parse("S_PERMISSIONS", permissionSelectBox); template.Parse("S_ACLMODE", aclModeField); //GallerySettings settings = new GallerySettings(core, e.Owner); Gallery rootGallery = new Gallery(core, e.Owner); List<Gallery> galleries = rootGallery.GetGalleries(); SelectBox galleriesSelectBox = new SelectBox("gallery-id"); foreach (Gallery gallery in galleries) { galleriesSelectBox.Add(new SelectBoxItem(gallery.Id.ToString(), gallery.GalleryTitle)); } template.Parse("S_GALLERIES", galleriesSelectBox); /* Title TextBox */ TextBox galleryTitleTextBox = new TextBox("gallery-title"); galleryTitleTextBox.MaxLength = 127; template.Parse("S_GALLERY_TITLE", galleryTitleTextBox); CheckBoxArray shareCheckBoxArray = new CheckBoxArray("share-radio"); shareCheckBoxArray.Layout = Layout.Horizontal; CheckBox twitterSyndicateCheckBox = null; CheckBox tumblrSyndicateCheckBox = null; CheckBox facebookSyndicateCheckBox = null; if (e.Owner is User) { User user = (User)e.Owner; if (user.UserInfo.TwitterAuthenticated) { twitterSyndicateCheckBox = new CheckBox("photo-share-twitter"); twitterSyndicateCheckBox.Caption = "Twitter"; twitterSyndicateCheckBox.Icon = "https://g.twimg.com/twitter-bird-16x16.png"; twitterSyndicateCheckBox.IsChecked = user.UserInfo.TwitterSyndicate; twitterSyndicateCheckBox.Width.Length = 0; shareCheckBoxArray.Add(twitterSyndicateCheckBox); } if (user.UserInfo.TumblrAuthenticated) { tumblrSyndicateCheckBox = new CheckBox("photo-share-tumblr"); tumblrSyndicateCheckBox.Caption = "Tumblr"; tumblrSyndicateCheckBox.Icon = "https://platform.tumblr.com/v1/share_4.png"; tumblrSyndicateCheckBox.IsChecked = user.UserInfo.TumblrSyndicate; tumblrSyndicateCheckBox.Width.Length = 0; shareCheckBoxArray.Add(tumblrSyndicateCheckBox); } if (user.UserInfo.FacebookAuthenticated) { facebookSyndicateCheckBox = new CheckBox("photo-share-facebook"); facebookSyndicateCheckBox.Caption = "Facebook"; facebookSyndicateCheckBox.Icon = "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yU/r/fWK1wxX-qQn.png"; facebookSyndicateCheckBox.IsChecked = user.UserInfo.FacebookSyndicate; facebookSyndicateCheckBox.Width.Length = 0; shareCheckBoxArray.Add(facebookSyndicateCheckBox); } } if (shareCheckBoxArray.Count > 0) { template.Parse("S_SHARE", "TRUE"); } if (twitterSyndicateCheckBox != null) { template.Parse("S_SHARE_TWITTER", twitterSyndicateCheckBox); } if (tumblrSyndicateCheckBox != null) { template.Parse("S_SHARE_TUMBLR", tumblrSyndicateCheckBox); } if (facebookSyndicateCheckBox != null) { template.Parse("S_SHARE_FACEBOOK", facebookSyndicateCheckBox); } e.core.AddPostPanel(e.core.Prose.GetString("PHOTO"), template); }
public Template GetPostTemplate(Core core, Primitive owner) { Template template = new Template(Assembly.GetExecutingAssembly(), "postblog"); template.Medium = core.Template.Medium; template.SetProse(core.Prose); string formSubmitUri = core.Hyperlink.AppendSid(owner.AccountUriStub, true); template.Parse("U_ACCOUNT", formSubmitUri); template.Parse("S_ACCOUNT", formSubmitUri); template.Parse("USER_DISPLAY_NAME", owner.DisplayName); Blog blog = null; try { blog = new Blog(core, (User)owner); } catch (InvalidBlogException) { if (owner.ItemKey.Equals(core.LoggedInMemberItemKey)) { blog = Blog.Create(core); } else { return null; } } /* Title TextBox */ TextBox titleTextBox = new TextBox("title"); titleTextBox.MaxLength = 127; /* Post TextBox */ TextBox postTextBox = new TextBox("post"); postTextBox.IsFormatted = true; postTextBox.Lines = 15; /* Tags TextBox */ TagSelectBox tagsTextBox = new TagSelectBox(core, "tags"); //tagsTextBox.MaxLength = 127; CheckBox publishToFeedCheckBox = new CheckBox("publish-feed"); publishToFeedCheckBox.IsChecked = true; PermissionGroupSelectBox permissionSelectBox = new PermissionGroupSelectBox(core, "permissions", blog.ItemKey); HiddenField aclModeField = new HiddenField("aclmode"); aclModeField.Value = "simple"; template.Parse("S_PERMISSIONS", permissionSelectBox); template.Parse("S_ACLMODE", aclModeField); DateTime postTime = DateTime.Now; SelectBox postYearsSelectBox = new SelectBox("post-year"); for (int i = DateTime.Now.AddYears(-7).Year; i <= DateTime.Now.Year; i++) { postYearsSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } postYearsSelectBox.SelectedKey = postTime.Year.ToString(); SelectBox postMonthsSelectBox = new SelectBox("post-month"); for (int i = 1; i < 13; i++) { postMonthsSelectBox.Add(new SelectBoxItem(i.ToString(), core.Functions.IntToMonth(i))); } postMonthsSelectBox.SelectedKey = postTime.Month.ToString(); SelectBox postDaysSelectBox = new SelectBox("post-day"); for (int i = 1; i < 32; i++) { postDaysSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } postDaysSelectBox.SelectedKey = postTime.Day.ToString(); template.Parse("S_POST_YEAR", postYearsSelectBox); template.Parse("S_POST_MONTH", postMonthsSelectBox); template.Parse("S_POST_DAY", postDaysSelectBox); template.Parse("S_POST_HOUR", postTime.Hour.ToString()); template.Parse("S_POST_MINUTE", postTime.Minute.ToString()); SelectBox licensesSelectBox = new SelectBox("license"); System.Data.Common.DbDataReader licensesReader = core.Db.ReaderQuery(ContentLicense.GetSelectQueryStub(core, typeof(ContentLicense))); licensesSelectBox.Add(new SelectBoxItem("0", "Default License")); while(licensesReader.Read()) { ContentLicense li = new ContentLicense(core, licensesReader); licensesSelectBox.Add(new SelectBoxItem(li.Id.ToString(), li.Title)); } licensesReader.Close(); licensesReader.Dispose(); SelectBox categoriesSelectBox = new SelectBox("category"); SelectQuery query = Category.GetSelectQueryStub(core, typeof(Category)); query.AddSort(SortOrder.Ascending, "category_title"); System.Data.Common.DbDataReader categoriesReader = core.Db.ReaderQuery(query); while (categoriesReader.Read()) { Category cat = new Category(core, categoriesReader); categoriesSelectBox.Add(new SelectBoxItem(cat.Id.ToString(), cat.Title)); } categoriesReader.Close(); categoriesReader.Dispose(); categoriesSelectBox.SelectedKey = 1.ToString(); /* Parse the form fields */ template.Parse("S_TITLE", titleTextBox); template.Parse("S_BLOG_TEXT", postTextBox); template.Parse("S_TAGS", tagsTextBox); template.Parse("S_BLOG_LICENSE", licensesSelectBox); template.Parse("S_BLOG_CATEGORY", categoriesSelectBox); template.Parse("S_PUBLISH_FEED", publishToFeedCheckBox); return template; }
protected void Page_Load(object sender, EventArgs e) { string redirect = (Request.Form["redirect"] != null) ? Request.Form["redirect"] : Request.QueryString["redirect"]; string domain = (Request.Form["domain"] != null) ? Request.Form["domain"] : Request.QueryString["domain"]; DnsRecord record = null; template.Parse("IS_CONTENT", "FALSE"); template.Parse("S_POST", core.Hyperlink.AppendSid("/sign-in/", true)); if (!string.IsNullOrEmpty(domain)) { try { if (domain != Hyperlink.Domain) { record = new DnsRecord(core, domain); } if (core.Http["mode"] == "sign-out") { if (record != null) { session.SessionEnd(Request.QueryString["sid"], loggedInMember.UserId, record); } else { session.SessionEnd(Request.QueryString["sid"], loggedInMember.UserId); } if (!string.IsNullOrEmpty(redirect)) { Response.Redirect(core.Hyperlink.AppendSid("http://" + record.Domain + "/" + redirect.TrimStart(new char[] { '/' }), true)); } else { Response.Redirect(core.Hyperlink.AppendSid("http://" + record.Domain + "/", true)); } } else if (core.LoggedInMemberId > 0) { string sessionId = Request.QueryString["sid"]; if (!string.IsNullOrEmpty(sessionId)) { core.Session.SessionEnd(sessionId, 0, record); } sessionId = core.Session.SessionBegin(core.LoggedInMemberId, false, false, false, record, null); Response.Redirect(core.Hyperlink.AppendSid("http://" + record.Domain + "/" + redirect.TrimStart(new char[] { '/' }), true)); } } catch (InvalidDnsRecordException) { core.Display.ShowMessage("Error", "Error starting remote session"); return; } } if (core.Http["mode"] == "sign-out") { string sessionId = Request.QueryString["sid"]; if (!string.IsNullOrEmpty(sessionId)) { core.Session.SessionEnd(sessionId, loggedInMember.UserId); } if (!string.IsNullOrEmpty(redirect)) { Response.Redirect(redirect, true); } else { Response.Redirect("/", true); } return; } if (Request.Form["submit"] != null) { if (core.Http["mode"] == "reset-password") { string email = Request.Form["email"]; if (string.IsNullOrEmpty(email)) { core.Display.ShowMessage("Error", "An error occured"); return; } else { try { UserEmail userEmail = new UserEmail(core, email); if (userEmail.IsActivated) { string newPassword = BoxSocial.Internals.User.GenerateRandomPassword(); string activateCode = BoxSocial.Internals.User.GenerateActivationSecurityToken(); db.UpdateQuery(string.Format("UPDATE user_info SET user_new_password = '******', user_activate_code = '{1}' WHERE user_id = {2}", Mysql.Escape(newPassword), Mysql.Escape(activateCode), userEmail.Owner.Id)); string activateUri = string.Format(core.Hyperlink.Uri + "register/?mode=activate-password&id={0}&key={1}", userEmail.Owner.Id, activateCode); // send the e-mail Template emailTemplate = new Template(core.Http.TemplateEmailPath, "new_password.html"); emailTemplate.Parse("SITE_TITLE", core.Settings.SiteTitle); emailTemplate.Parse("U_SITE", core.Hyperlink.StripSid(core.Hyperlink.AppendAbsoluteSid(core.Hyperlink.BuildHomeUri()))); emailTemplate.Parse("TO_NAME", userEmail.Owner.DisplayName); emailTemplate.Parse("U_ACTIVATE", activateUri); emailTemplate.Parse("USERNAME", userEmail.Owner.UserName); // TODO: do not send a new password in plain text emailTemplate.Parse("PASSWORD", newPassword); core.Email.SendEmail(userEmail.Email, core.Settings.SiteTitle + " Password Reset", emailTemplate); core.Display.ShowMessage("Password reset", "You have been sent an e-mail to the address you entered with your new password. You will need to click the confirmation link before you can sign in"); return; } else { core.Display.ShowMessage("E-mail not verified", "The e-mail you have entered has not been verified, you need to enter an e-mail address you have verified to reset your password."); return; } } catch (InvalidUserEmailException) { core.Display.ShowMessage("No e-mail registered", "The e-mail you have entered is not associated with a user account."); return; } } } else if (core.Http.Form["mode"] == "verify") { Authenticator authenticator = new Authenticator(); if (authenticator.CheckCode(core.Session.CandidateMember.UserInfo.TwoFactorAuthKey, core.Http.Form["verify"])) { if (Request.Form["remember"] == "true") { session.SessionBegin(core.Session.CandidateMember.UserId, false, true, true); } else { session.SessionBegin(core.Session.CandidateMember.UserId, false, false, true); } if ((!string.IsNullOrEmpty(domain)) && (record != null)) { string sessionId = core.Session.SessionBegin(core.Session.CandidateMember.UserId, false, false, true, record, null); core.Hyperlink.Sid = sessionId; if (!string.IsNullOrEmpty(redirect)) { Response.Redirect(core.Hyperlink.AppendSid("http://" + record.Domain + "/" + redirect.TrimStart(new char[] { '/' }), true)); } else { Response.Redirect(core.Hyperlink.AppendSid("http://" + record.Domain + "/", true)); } return; } if (!string.IsNullOrEmpty(redirect)) { if (redirect.StartsWith("/account", StringComparison.Ordinal)) { redirect = core.Hyperlink.AppendSid(core.Hyperlink.StripSid(redirect), true); } else { redirect = core.Hyperlink.AppendSid(redirect); } Response.Redirect(redirect, true); } else { Response.Redirect(core.Hyperlink.AppendSid("/"), true); } return; /* stop processing the display of this page */ } else { core.Session.SessionEnd(core.Session.SessionId, core.Session.CandidateMember.UserId); template.Parse("ERROR", "Bad log in credentials were given, you could not be logged in. Try again."); } } else { string userName = Request.Form["username"]; string password = BoxSocial.Internals.User.HashPassword(Request.Form["password"]); DataTable userTable = db.Query(string.Format("SELECT uk.user_name, uk.user_id, ui.user_password, ui.user_two_factor_auth_key, ui.user_two_factor_auth_verified FROM user_keys uk INNER JOIN user_info ui ON uk.user_id = ui.user_id WHERE uk.user_name = '{0}';", userName)); if (userTable.Rows.Count == 1) { DataRow userRow = userTable.Rows[0]; bool authenticated = false; string dbPassword = (string)userRow["user_password"]; // old phpBB passwords if (dbPassword.Length == 32) { // phpBB2 passwords if (SessionState.SessionMd5(Request.Form["password"]) == dbPassword.ToLower()) { authenticated = true; } } else if (dbPassword.Length == 34) { // phpBB3 passwords string itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; if (SessionState.phpBB3Hash(Request.Form["password"], dbPassword, ref itoa64) == dbPassword) { authenticated = true; } } else { if (dbPassword == password) { authenticated = true; } } if (authenticated) { if ((byte)userRow["user_two_factor_auth_verified"] > 0) { template.SetTemplate("login_two_factor_verify.html"); HiddenField rememberHiddenField = new HiddenField("remember"); rememberHiddenField.Value = core.Http.Form["remember"]; TextBox verifyTextBox = new Forms.TextBox("verify"); template.Parse("S_REMEMBER", rememberHiddenField); template.Parse("S_VERIFY", verifyTextBox); if (Request.Form["remember"] == "true") { session.SessionBegin((long)userRow["user_id"], false, true, false); } else { session.SessionBegin((long)userRow["user_id"], false, false, false); } } else { if (Request.Form["remember"] == "true") { session.SessionBegin((long)userRow["user_id"], false, true); } else { session.SessionBegin((long)userRow["user_id"], false, false); } if ((!string.IsNullOrEmpty(domain)) && (record != null)) { string sessionId = core.Session.SessionBegin((long)userRow["user_id"], false, false, false, record, null); core.Hyperlink.Sid = sessionId; if (!string.IsNullOrEmpty(redirect)) { Response.Redirect(core.Hyperlink.AppendSid("http://" + record.Domain + "/" + redirect.TrimStart(new char[] { '/' }), true)); } else { Response.Redirect(core.Hyperlink.AppendSid("http://" + record.Domain + "/", true)); } return; } if (!string.IsNullOrEmpty(redirect)) { if (redirect.StartsWith("/account", StringComparison.Ordinal)) { redirect = core.Hyperlink.AppendSid(core.Hyperlink.StripSid(redirect), true); } else { redirect = core.Hyperlink.AppendSid(redirect); } Response.Redirect(redirect, true); } else { Response.Redirect(core.Hyperlink.AppendSid("/"), true); } return; /* stop processing the display of this page */ } } else { template.Parse("ERROR", "Bad log in credentials were given, you could not be logged in. Try again."); } } else { template.Parse("ERROR", "Bad log in credentials were given, you could not be logged in. Try again."); } } } if (core.Http["mode"] == "reset-password") { template.Parse("S_POST", core.Hyperlink.AppendSid("/sign-in/?mode=reset-password", true)); template.SetTemplate("password_reset.html"); EndResponse(); return; } else { template.Parse("U_FORGOT_PASSWORD", core.Hyperlink.AppendSid("/sign-in/?mode=reset-password")); } template.Parse("DOMAIN", domain); template.Parse("REDIRECT", redirect); EndResponse(); }
public override string ToString(Forms.DisplayMedium medium) { // This will be a complicated mishmash of javascript HiddenField modeHiddenField = new HiddenField(name + "--mode"); modeHiddenField.Class = "date-mode"; modeHiddenField.Value = "forms"; TextBox dateExpressionTextBox = new TextBox(name + "--expression"); //dateExpressionTextBox.IsVisible = false; dateExpressionTextBox.Script.OnChange = "ParseDatePicker('" + name + "--expression" + "', " + (int)medium + ")"; dateExpressionTextBox.Width.Length = Width.Length * 0.4F; dateExpressionTextBox.Width.Unit = Width.Unit; if (medium == DisplayMedium.Mobile) { dateExpressionTextBox.Type = InputType.Date; } TextBox timeExpressionTextBox = new TextBox(name + "--time"); //timeExpressionTextBox.IsVisible = false; timeExpressionTextBox.Script.OnChange = "ParseTimePicker('" + name + "--time" + "')"; timeExpressionTextBox.Width.Length = Width.Length * 0.4F; timeExpressionTextBox.Width.Unit = Width.Unit; if (medium == DisplayMedium.Mobile) { timeExpressionTextBox.Type = InputType.Time; } SelectBox dateYearsSelectBox = new SelectBox(name + "--date-year"); SelectBox dateMonthsSelectBox = new SelectBox(name + "--date-month"); SelectBox dateDaysSelectBox = new SelectBox(name + "--date-day"); SelectBox dateHoursSelectBox = new SelectBox(name + "--date-hour"); SelectBox dateMinutesSelectBox = new SelectBox(name + "--date-minute"); SelectBox dateSecondsSelectBox = new SelectBox(name + "--date-second"); for (int i = DateTime.Now.AddYears(-30).Year; i < DateTime.Now.AddYears(5).Year; i++) { dateYearsSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } for (int i = 1; i < 13; i++) { dateMonthsSelectBox.Add(new SelectBoxItem(i.ToString(), core.Functions.IntToMonth(i))); dateMonthsSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } for (int i = 1; i < 32; i++) { dateDaysSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } for (int i = 0; i < 24; i++) { dateHoursSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } for (int i = 0; i < 60; i++) { dateMinutesSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } for (int i = 0; i < 60; i++) { dateSecondsSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } dateYearsSelectBox.SelectedKey = value.Year.ToString(); dateMonthsSelectBox.SelectedKey = value.Month.ToString(); dateDaysSelectBox.SelectedKey = value.Day.ToString(); if (medium == DisplayMedium.Mobile) { dateExpressionTextBox.Value = value.ToString("yyyy-MM-dd"); } else { dateExpressionTextBox.Value = value.ToString("dd/MM/yyyy"); } timeExpressionTextBox.Value = value.ToString("HH:mm:ss"); /* Build display */ StringBuilder sb = new StringBuilder(); if (medium == DisplayMedium.Mobile) { sb.AppendLine("<div class=\"date-field\">"); sb.AppendLine(modeHiddenField.ToString()); sb.AppendLine("<p id=\"" + name + "[date-field]\" class=\"date-exp\" style=\"display: none;\">"); sb.Append(core.Prose.GetString("DATE") + ": "); sb.Append(dateExpressionTextBox.ToString()); if (ShowTime) { sb.Append(" " + core.Prose.GetString("TIME") + ": "); sb.Append(timeExpressionTextBox.ToString()); } sb.Append("</p>"); sb.AppendLine("</div>"); } else { sb.AppendLine("<div class=\"date-field\">"); sb.AppendLine(modeHiddenField.ToString()); sb.AppendLine("<p id=\"" + name + "[date-drop]\" class=\"date-drop\">"); sb.Append(core.Prose.GetString("YEAR") + ": "); sb.AppendLine(dateYearsSelectBox.ToString()); sb.AppendLine(" " + core.Prose.GetString("MONTH") + ": "); sb.AppendLine(dateMonthsSelectBox.ToString()); sb.AppendLine(" " + core.Prose.GetString("DAY") + ": "); sb.AppendLine(dateDaysSelectBox.ToString()); if (showTime) { sb.AppendLine(" " + core.Prose.GetString("HOUR") + ": "); sb.AppendLine(dateHoursSelectBox.ToString()); sb.AppendLine(" " + core.Prose.GetString("MINUTE") + ": "); sb.AppendLine(dateMinutesSelectBox.ToString()); if (showSeconds) { sb.AppendLine(" " + core.Prose.GetString("SECOND") + ": "); sb.AppendLine(dateSecondsSelectBox.ToString()); } } sb.Append("</p>"); sb.AppendLine("<p id=\"" + name + "[date-field]\" class=\"date-exp\" style=\"display: none;\">"); sb.Append(core.Prose.GetString("DATE") + ": "); sb.Append(dateExpressionTextBox.ToString()); if (ShowTime) { sb.Append(" " + core.Prose.GetString("TIME") + ": "); sb.Append(timeExpressionTextBox.ToString()); } sb.Append("</p>"); sb.AppendLine("</div>"); sb.AppendLine("<script type=\"text/javascript\">//<![CDATA["); sb.AppendLine("dtp.push(Array(\"" + name + "[date-drop]\",\"" + name + "[date-field]\"));"); sb.AppendLine("EnableDateTimePickers();"); sb.AppendLine("//]]></script>"); } return sb.ToString(); }
private void OAuthAuthorize(bool fail) { bool forceLogin = (core.Http.Query["force_login"] == "true"); string oauthToken = core.Http["oauth_token"]; try { OAuthToken token = new OAuthToken(core, oauthToken); ApplicationEntry ae = token.Application; TextBox usernameTextBox = new TextBox("username"); TextBox passwordTextBox = new TextBox("password", InputType.Password); HiddenField oauthTokenHiddenField = new HiddenField("oauth_token"); oauthTokenHiddenField.Value = oauthToken; SubmitButton submitButton = new SubmitButton("submit", core.Prose.GetString("AUTHORISE")); Button cancelButton = new Button("cancel", core.Prose.GetString("CANCEL"), "cancel"); cancelButton.Script.OnClick = "window.external.notify('cancel'); return false;"; if (token.TokenExpired) { core.Functions.Generate403(); EndResponse(); return; } template.SetTemplate("oauth_authorize.html"); template.Parse("U_POST", core.Hyperlink.AppendSid("/oauth/approve", true)); template.Parse("REQUIRE_LOGIN", ((forceLogin || (!core.Session.SignedIn)) ? "TRUE" : "FALSE")); template.Parse("AUTHORISE_APPLICATION", string.Format(core.Prose.GetString("AUTHORISE_APPLICATION"), ae.Title)); template.Parse("APPLICATION_ICON", ae.Icon); template.Parse("S_USERNAME", usernameTextBox); template.Parse("S_PASSWORD", passwordTextBox); template.Parse("S_OAUTH_TOKEN", oauthTokenHiddenField); template.Parse("S_SUBMIT", submitButton); template.Parse("S_CANCEL", cancelButton); } catch (InvalidOAuthTokenException) { core.Functions.Generate403(); } catch (InvalidApplicationException) { core.Functions.Generate403(); } EndResponse(); }
void AccountTourManage_Edit(object sender, ModuleModeEventArgs e) { SetTemplate("account_tour_edit"); Tour tour = null; /* */ TextBox titleTextBox = new TextBox("title"); titleTextBox.MaxLength = 127; /* */ SelectBox yearSelectBox = new SelectBox("year"); /* */ TextBox abstractTextBox = new TextBox("abstract"); abstractTextBox.Lines = 5; abstractTextBox.IsFormatted = true; for (int i = 1980; i < DateTime.UtcNow.Year + 5; i++) { yearSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } switch (e.Mode) { case "add": yearSelectBox.SelectedKey = core.Tz.Now.Year.ToString(); break; case "edit": long tourId = core.Functions.FormLong("id", core.Functions.RequestLong("id", 0)); try { tour = new Tour(core, tourId); } catch (InvalidTourException) { return; } titleTextBox.Value = tour.Title; abstractTextBox.Value = tour.TourAbstract; if (yearSelectBox.ContainsKey(tour.StartYear.ToString())) { yearSelectBox.SelectedKey = tour.StartYear.ToString(); } if (core.Http.Form["title"] != null) { titleTextBox.Value = core.Http.Form["title"]; } yearSelectBox.SelectedKey = core.Functions.FormShort("year", short.Parse(yearSelectBox.SelectedKey)).ToString(); template.Parse("S_ID", tour.Id.ToString()); template.Parse("EDIT", "TRUE"); break; } template.Parse("S_TITLE", titleTextBox); template.Parse("S_ABSTRACT", abstractTextBox); template.Parse("S_YEAR", yearSelectBox); SaveItemMode(AccountTourManage_EditSave, tour); }
void AccountContactManage_VerifyPhone(object sender, ModuleModeEventArgs e) { AuthoriseRequestSid(); SetTemplate("account_phone_verify"); UserPhoneNumber phoneNumber = new UserPhoneNumber(core, core.Functions.RequestLong("id", 0)); if (phoneNumber.UserId == LoggedInMember.Id) { if (!phoneNumber.Validated) { string activateKey = User.GeneratePhoneActivationToken(); UpdateQuery query = new UpdateQuery(typeof(UserPhoneNumber)); query.AddField("phone_activate_code", activateKey); query.AddCondition("phone_id", phoneNumber.Id); core.Db.Query(query); core.Sms.SendSms(phoneNumber.PhoneNumber, string.Format("Your {0} security code is {1}.", core.Settings.SiteTitle, activateKey)); TextBox verifyTextBox = new TextBox("verify-code"); verifyTextBox.Type = InputType.Telephone; template.Parse("S_ID", phoneNumber.Id.ToString()); template.Parse("PHONE_NUMBER", phoneNumber.PhoneNumber); template.Parse("S_VERIFY_CODE", verifyTextBox); } else { SetRedirectUri(BuildUri()); core.Display.ShowMessage("Already verified", "You have already verified your phone number."); } } else { SetRedirectUri(BuildUri()); core.Display.ShowMessage("Error", "An error has occured."); } }
void AccountContactManage_AddLink(object sender, ModuleModeEventArgs e) { SetTemplate("account_link_edit"); /**/ TextBox linkAddressTextBox = new TextBox("link-address"); /* */ TextBox linkTitleTextBox = new TextBox("link-title"); switch (e.Mode) { case "add-link": break; case "edit-link": long linkId = core.Functions.FormLong("id", core.Functions.RequestLong("id", 0)); UserLink link = null; if (linkId > 0) { try { link = new UserLink(core, linkId); //phoneNumberTextBox.IsDisabled = true; linkAddressTextBox.Value = link.LinkAddress; linkAddressTextBox.IsDisabled = true; linkTitleTextBox.Value = link.Title; template.Parse("S_ID", link.Id.ToString()); } catch (InvalidUserLinkException) { } } template.Parse("EDIT", "TRUE"); break; } template.Parse("S_LINK", linkAddressTextBox); template.Parse("S_TITLE", linkTitleTextBox); }
void AccountSubGroupsManage_Create(object sender, ModuleModeEventArgs e) { SetTemplate("account_group_subgroup_create"); TextBox titleTextBox = new TextBox("title"); titleTextBox.MaxLength = 64; titleTextBox.Script.OnChange = "UpdateSlug()"; Form.AddFormField(titleTextBox); TextBox slugTextBox = new TextBox("slug"); slugTextBox.MaxLength = 64; Form.AddFormField(slugTextBox); TextBox descriptionTextBox = new TextBox("description"); descriptionTextBox.IsFormatted = true; descriptionTextBox.Lines = 4; Form.AddFormField(descriptionTextBox); RadioList groupTypeRadioList = new RadioList("group-type"); groupTypeRadioList.Add(new RadioListItem(groupTypeRadioList.Name, "open", "Open Group")); groupTypeRadioList.Add(new RadioListItem(groupTypeRadioList.Name, "request", "Request Group")); groupTypeRadioList.Add(new RadioListItem(groupTypeRadioList.Name, "closed", "Closed Group")); groupTypeRadioList.Add(new RadioListItem(groupTypeRadioList.Name, "private", "Private Group")); Form.AddFormField(groupTypeRadioList); switch (e.Mode) { case "create": break; case "edit": long id = core.Functions.FormLong("id", core.Functions.RequestLong("id", 0)); if (id > 0) { try { subUserGroup = new SubUserGroup(core, id); } catch (InvalidSubGroupException) { return; } } else { return; } if (subUserGroup.Parent.Owner.Id != Owner.Id) { core.Functions.Generate403(); return; } if (!Form.IsFormSubmission) { titleTextBox.Script.OnChange = string.Empty; titleTextBox.Value = subUserGroup.DisplayName; descriptionTextBox.Value = subUserGroup.Description; switch (subUserGroup.SubGroupType) { case "OPEN": groupTypeRadioList.SelectedKey = "open"; break; case "REQUEST": groupTypeRadioList.SelectedKey = "request"; break; case "CLOSED": groupTypeRadioList.SelectedKey = "closed"; break; case "PRIVATE": groupTypeRadioList.SelectedKey = "private"; break; } } slugTextBox.Value = subUserGroup.Key; slugTextBox.IsDisabled = true; template.Parse("S_GROUP_ID", subUserGroup.Id.ToString()); template.Parse("EDIT", "TRUE"); break; } template.Parse("S_TITLE", titleTextBox); template.Parse("S_SLUG", slugTextBox); template.Parse("S_DESCRIPTION", descriptionTextBox); template.Parse("S_TYPE_OPEN", groupTypeRadioList["open"]); template.Parse("S_TYPE_REQUEST", groupTypeRadioList["request"]); template.Parse("S_TYPE_CLOSED", groupTypeRadioList["closed"]); template.Parse("S_TYPE_PRIVATE", groupTypeRadioList["private"]); SaveMode(new ModuleModeHandler(AccountSubGroupsManage_Save)); }
void AccountPreferences_Show(object sender, EventArgs e) { Save(new EventHandler(AccountPreferences_Save)); //User loggedInMember = (User)loggedInMember; template.SetTemplate("account_preferences.html"); TextBox customDomainTextBox = new TextBox("custom-domain"); customDomainTextBox.Value = LoggedInMember.UserDomain; TextBox analyticsCodeTextBox = new TextBox("analytics-code"); analyticsCodeTextBox.Value = LoggedInMember.UserInfo.AnalyticsCode; TextBox twitterUserNameTextBox = new TextBox("twitter-user-name"); twitterUserNameTextBox.Value = LoggedInMember.UserInfo.TwitterUserName; CheckBox twitterSyndicateCheckBox = new CheckBox("twitter-syndicate"); twitterSyndicateCheckBox.IsChecked = LoggedInMember.UserInfo.TwitterSyndicate; twitterSyndicateCheckBox.Width.Length = 0; CheckBox tumblrSyndicateCheckBox = new CheckBox("tumblr-syndicate"); tumblrSyndicateCheckBox.IsChecked = LoggedInMember.UserInfo.TumblrSyndicate; tumblrSyndicateCheckBox.Width.Length = 0; CheckBox facebookSyndicateCheckBox = new CheckBox("facebook-syndicate"); facebookSyndicateCheckBox.IsChecked = LoggedInMember.UserInfo.FacebookSyndicate; facebookSyndicateCheckBox.Width.Length = 0; SelectBox facebookSharePermissionSelectBox = new SelectBox("facebook-share-permissions"); facebookSharePermissionSelectBox.Add(new SelectBoxItem("", core.Prose.GetString("TIMELINE_DEFAULT"))); facebookSharePermissionSelectBox.Add(new SelectBoxItem("EVERYONE", core.Prose.GetString("PUBLIC"))); facebookSharePermissionSelectBox.Add(new SelectBoxItem("FRIENDS_OF_FRIENDS", core.Prose.GetString("FRIENDS_OF_FACEBOOK_FRIENDS"))); facebookSharePermissionSelectBox.Add(new SelectBoxItem("ALL_FRIENDS", core.Prose.GetString("FACEBOOK_FRIENDS"))); SelectBox tumblrBlogsSelectBox = new SelectBox("tumblr-blogs"); if (LoggedInMember.UserInfo.TumblrAuthenticated) { Tumblr t = new Tumblr(core.Settings.TumblrApiKey, core.Settings.TumblrApiSecret); List<Dictionary<string, string>> blogs = t.GetUserInfo(new TumblrAccessToken(LoggedInMember.UserInfo.TumblrToken, LoggedInMember.UserInfo.TumblrTokenSecret)).Blogs; foreach (Dictionary<string, string> blog in blogs) { string hostname = (new Uri(blog["url"])).Host; tumblrBlogsSelectBox.Add(new SelectBoxItem(hostname, blog["title"])); if (hostname == LoggedInMember.UserInfo.TumblrHostname) { tumblrBlogsSelectBox.SelectedKey = LoggedInMember.UserInfo.TumblrHostname; } } } if (LoggedInMember.UserInfo.FacebookSharePermissions != null) { facebookSharePermissionSelectBox.SelectedKey = LoggedInMember.UserInfo.FacebookSharePermissions; } string radioChecked = " checked=\"checked\""; if (LoggedInMember.UserInfo.EmailNotifications) { template.Parse("S_EMAIL_NOTIFICATIONS_YES", radioChecked); } else { template.Parse("S_EMAIL_NOTIFICATIONS_NO", radioChecked); } if (LoggedInMember.UserInfo.ShowCustomStyles) { template.Parse("S_SHOW_STYLES_YES", radioChecked); } else { template.Parse("S_SHOW_STYLES_NO", radioChecked); } if (LoggedInMember.UserInfo.BbcodeShowImages) { template.Parse("S_DISPLAY_IMAGES_YES", radioChecked); } else { template.Parse("S_DISPLAY_IMAGES_NO", radioChecked); } if (LoggedInMember.UserInfo.BbcodeShowFlash) { template.Parse("S_DISPLAY_FLASH_YES", radioChecked); } else { template.Parse("S_DISPLAY_FLASH_NO", radioChecked); } if (LoggedInMember.UserInfo.BbcodeShowVideos) { template.Parse("S_DISPLAY_VIDEOS_YES", radioChecked); } else { template.Parse("S_DISPLAY_VIDEOS_NO", radioChecked); } template.Parse("S_CUSTOM_DOMAIN", customDomainTextBox); template.Parse("S_ANALYTICS_CODE", analyticsCodeTextBox); if (!string.IsNullOrEmpty(core.Settings.TwitterApiKey)) { template.Parse("S_TWITTER_INTEGRATION", "TRUE"); } if (!string.IsNullOrEmpty(core.Settings.TumblrApiKey)) { template.Parse("S_TUMBLR_INTEGRATION", "TRUE"); } if (core.Settings.FacebookEnabled || ((!string.IsNullOrEmpty(core.Settings.FacebookApiAppid)) && LoggedInMember.UserInfo.FacebookAuthenticated)) { template.Parse("S_FACEBOOK_INTEGRATION", "TRUE"); } if (string.IsNullOrEmpty(LoggedInMember.UserInfo.TwitterUserName)) { template.Parse("S_TWITTER_USER_NAME", twitterUserNameTextBox); } else { template.Parse("TWITTER_USER_NAME", LoggedInMember.UserInfo.TwitterUserName); template.Parse("S_SYDNDICATE_TWITTER", twitterSyndicateCheckBox); template.Parse("U_UNLINK_TWITTER", core.Hyperlink.AppendSid(BuildUri("preferences", "unlink-twitter"), true)); } if (string.IsNullOrEmpty(LoggedInMember.UserInfo.TumblrUserName)) { template.Parse("U_LINK_TUMBLR", core.Hyperlink.AppendSid(BuildUri("preferences", "link-tumblr"), true)); } else { /* TODO: get list of tumblr blogs */ template.Parse("TUMBLR_USER_NAME", LoggedInMember.UserInfo.TumblrUserName); template.Parse("S_TUMBLR_BLOGS", tumblrBlogsSelectBox); template.Parse("S_SYDNDICATE_TUMBLR", tumblrSyndicateCheckBox); template.Parse("U_UNLINK_TUMBLR", core.Hyperlink.AppendSid(BuildUri("preferences", "unlink-tumblr"), true)); } if (string.IsNullOrEmpty(LoggedInMember.UserInfo.FacebookUserId)) { string appId = core.Settings.FacebookApiAppid; string redirectTo = (core.Settings.UseSecureCookies ? "https://" : "http://") + Hyperlink.Domain + "/api/facebook/callback"; template.Parse("U_LINK_FACEBOOK", string.Format("https://www.facebook.com/dialog/oauth?client_id={0}&redirect_uri={1}&scope={2}", appId, System.Web.HttpUtility.UrlEncode(redirectTo), "publish_actions")); } else { template.Parse("S_SYDNDICATE_FACEBOOK", facebookSyndicateCheckBox); template.Parse("S_FACEBOOK_SHARE_PERMISSIONS", facebookSharePermissionSelectBox); template.Parse("U_UNLINK_FACEBOOK", core.Hyperlink.AppendSid(BuildUri("preferences", "unlink-facebook"), true)); } DataTable pagesTable = db.Query(string.Format("SELECT page_id, page_slug, page_parent_path FROM user_pages WHERE page_item_id = {0} AND page_item_type_id = {1} ORDER BY page_order ASC;", LoggedInMember.UserId, ItemKey.GetTypeId(core, typeof(User)))); SelectBox pagesSelectBox = new SelectBox("homepage"); foreach (DataRow pageRow in pagesTable.Rows) { if (string.IsNullOrEmpty((string)pageRow["page_parent_path"])) { pagesSelectBox.Add(new SelectBoxItem("/" + (string)pageRow["page_slug"], "/" + (string)pageRow["page_slug"])); } else { pagesSelectBox.Add(new SelectBoxItem("/" + (string)pageRow["page_parent_path"] + "/" + (string)pageRow["page_slug"], "/" + (string)pageRow["page_parent_path"] + "/" + (string)pageRow["page_slug"])); } } SelectBox timezoneSelectBox = UnixTime.BuildTimeZoneSelectBox("timezone"); timezoneSelectBox.SelectedKey = LoggedInMember.UserInfo.TimeZoneCode.ToString(); pagesSelectBox.SelectedKey = LoggedInMember.UserInfo.ProfileHomepage; template.Parse("S_HOMEPAGE", pagesSelectBox); template.Parse("S_TIMEZONE", timezoneSelectBox); //core.Display.ParseTimeZoneBox(template, "S_TIMEZONE", LoggedInMember.TimeZoneCode.ToString()); if (core.Http.Query["status"] == "facebook-auth-failed") { DisplayError("Failed to link your Facebook profile"); } }
protected void Page_Load(object sender, EventArgs e) { bool isAjax = false; long itemId; long itemTypeId; ItemKey itemKey = null; IShareableItem item = null; if (Request["ajax"] == "true") { isAjax = true; } if (!core.Session.IsLoggedIn) { core.Response.ShowMessage("notLoggedIn", "Not Logged In", "Sign in to share this item."); } string mode = Request.QueryString["mode"]; if (mode == "post") { template.SetTemplate("pane.share.post.html"); try { itemId = long.Parse((string)core.Http.Query["item"]); itemTypeId = long.Parse((string)core.Http.Query["type"]); itemKey = new ItemKey(itemId, itemTypeId); item = (IShareableItem)NumberedItem.Reflect(core, itemKey); TextBox messageTextBox = new TextBox("share-message"); PermissionGroupSelectBox permissionSelectBox = new PermissionGroupSelectBox(core, "share-permissions", core.Session.LoggedInMember.ItemKey); template.Parse("S_SHARE_MESSAGE", messageTextBox); template.Parse("S_SHARE_PERMISSIONS", permissionSelectBox); template.Parse("S_SHARED_URI", item.Info.ShareUri); core.Display.ParseBbcode(template, "S_SHARED_STRING", core.Functions.Tldr("[share=\"[iurl=\"" + item.Uri + "\"]" + item.Owner.DisplayName + "[/iurl]\"]" + item.ShareString + "[/share]"), item.Owner); } catch { core.Response.SendRawText("errorFetchingItem", ""); return; } core.Response.SendRawText("sharingForm", template.ToString()); return; } // Save the Share try { itemId = long.Parse((string)core.Http.Form["item"]); itemTypeId = long.Parse((string)core.Http.Form["type"]); } catch { core.Response.SendRawText("errorFetchingItem", ""); return; } itemKey = new ItemKey(itemId, itemTypeId); item = (IShareableItem)NumberedItem.Reflect(core, itemKey); if (item is IPermissibleItem) { IPermissibleItem pitem = (IPermissibleItem)item; if (!pitem.Access.IsPublic()) { core.Response.ShowMessage("cannotShare", "Cannot Share", "You can only share public items."); return; } } string message = (string)core.Http.Form["share-message"] + "\n\n" + core.Functions.Tldr("[share=\"[iurl=\"" + item.Uri + "\"]" + item.Owner.DisplayName + "[/iurl]\"]" + item.ShareString + "[/share]"); StatusMessage newStatus = StatusMessage.Create(core, core.Session.LoggedInMember, message); AccessControlLists acl = new AccessControlLists(core, newStatus); acl.SaveNewItemPermissions("share-permissions"); core.Search.Index(newStatus); ApplicationEntry ae = core.GetApplication("Profile"); ae.PublishToFeed(core, core.Session.LoggedInMember, newStatus, Functions.SingleLine(core.Bbcode.Flatten(newStatus.Message))); Share.ShareItem(core, itemKey); if (Request.Form["ajax"] == "true") { Template template = new Template("pane.statusmessage.html"); template.Medium = core.Template.Medium; template.SetProse(core.Prose); VariableCollection statusMessageVariableCollection = template.CreateChild("status_messages"); core.Display.ParseBbcode(statusMessageVariableCollection, "STATUS_MESSAGE", core.Bbcode.FromStatusCode(newStatus.Message), core.Session.LoggedInMember, true, string.Empty, string.Empty); statusMessageVariableCollection.Parse("STATUS_UPDATED", core.Tz.DateTimeToString(newStatus.GetTime(core.Tz))); statusMessageVariableCollection.Parse("ID", newStatus.Id.ToString()); statusMessageVariableCollection.Parse("TYPE_ID", newStatus.ItemKey.TypeId.ToString()); statusMessageVariableCollection.Parse("USERNAME", newStatus.Poster.DisplayName); statusMessageVariableCollection.Parse("U_PROFILE", newStatus.Poster.ProfileUri); statusMessageVariableCollection.Parse("U_QUOTE", string.Empty /*core.Hyperlink.BuildCommentQuoteUri(newStatus.Id)*/); statusMessageVariableCollection.Parse("U_REPORT", string.Empty /*core.Hyperlink.BuildCommentReportUri(newStatus.Id)*/); statusMessageVariableCollection.Parse("U_DELETE", string.Empty /*core.Hyperlink.BuildCommentDeleteUri(newStatus.Id)*/); statusMessageVariableCollection.Parse("U_PERMISSIONS", newStatus.Access.AclUri); statusMessageVariableCollection.Parse("USER_TILE", newStatus.Poster.Tile); statusMessageVariableCollection.Parse("USER_ICON", newStatus.Poster.Icon); statusMessageVariableCollection.Parse("URI", newStatus.Uri); statusMessageVariableCollection.Parse("IS_OWNER", "TRUE"); if (newStatus.Access.IsPublic()) { statusMessageVariableCollection.Parse("IS_PUBLIC", "TRUE"); statusMessageVariableCollection.Parse("SHAREABLE", "TRUE"); statusMessageVariableCollection.Parse("U_SHARE", newStatus.ShareUri); } Dictionary<string, string> returnValues = new Dictionary<string, string>(StringComparer.Ordinal); returnValues.Add("update", item.OwnerKey.Equals(newStatus.Owner.ItemKey) ? "true" : "false"); returnValues.Add("message", message); returnValues.Add("template", template.ToString()); core.Response.SendDictionary("statusPosted", returnValues); return; } else { string redirect = Request["redirect"]; if (!string.IsNullOrEmpty(redirect)) { template.Parse("REDIRECT_URI", redirect); } core.Display.ShowMessage("Shared", "You have shared this item to your status feed."); } }
void AccountProfileInfo_Show(object sender, EventArgs e) { SetTemplate("account_profile"); RadioList genderRadioList = new RadioList("gender"); genderRadioList.Add(new RadioListItem(genderRadioList.Name, ((byte)Gender.Undefined).ToString(), core.Prose.GetString("NONE_SPECIFIED"))); genderRadioList.Add(new RadioListItem(genderRadioList.Name, ((byte)Gender.Male).ToString(), core.Prose.GetString("MALE"))); genderRadioList.Add(new RadioListItem(genderRadioList.Name, ((byte)Gender.Female).ToString(), core.Prose.GetString("FEMALE"))); genderRadioList.Add(new RadioListItem(genderRadioList.Name, ((byte)Gender.Intersex).ToString(), core.Prose.GetString("INTERSEX"))); genderRadioList.SelectedKey = ((byte)LoggedInMember.Profile.GenderRaw).ToString(); genderRadioList.Layout = Layout.Horizontal; TextBox heightTextBox = new TextBox("height"); heightTextBox.MaxLength = 3; heightTextBox.Width = new StyleLength(3F, LengthUnits.Em); heightTextBox.Value = LoggedInMember.Profile.Height.ToString(); SelectBox dobYearsSelectBox = new SelectBox("dob-year"); for (int i = DateTime.Now.AddYears(-110).Year; i < DateTime.Now.AddYears(-13).Year; i++) { dobYearsSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } if (LoggedInMember.Profile.DateOfBirth != null) { dobYearsSelectBox.SelectedKey = LoggedInMember.Profile.DateOfBirth.Year.ToString(); } SelectBox dobMonthsSelectBox = new SelectBox("dob-month"); for (int i = 1; i < 13; i++) { dobMonthsSelectBox.Add(new SelectBoxItem(i.ToString(), core.Functions.IntToMonth(i))); } if (LoggedInMember.Profile.DateOfBirth != null) { dobMonthsSelectBox.SelectedKey = LoggedInMember.Profile.DateOfBirth.Month.ToString(); } SelectBox dobDaysSelectBox = new SelectBox("dob-day"); for (int i = 1; i < 32; i++) { dobDaysSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } if (LoggedInMember.Profile.DateOfBirth != null) { dobDaysSelectBox.SelectedKey = LoggedInMember.Profile.DateOfBirth.Day.ToString(); } SelectBox countriesSelectBox = new SelectBox("country"); SelectQuery query = new SelectQuery("countries"); query.AddFields("*"); query.AddSort(SortOrder.Ascending, "country_name"); System.Data.Common.DbDataReader countriesReader = db.ReaderQuery(query); countriesSelectBox.Add(new SelectBoxItem("", "Unspecified")); while (countriesReader.Read()) { countriesSelectBox.Add(new SelectBoxItem((string)countriesReader["country_iso"], (string)countriesReader["country_name"])); } countriesReader.Close(); countriesReader.Dispose(); if (LoggedInMember.Profile.CountryIso != null) { countriesSelectBox.SelectedKey = LoggedInMember.Profile.CountryIso; } template.Parse("S_GENDER", genderRadioList); template.Parse("S_DOB_YEAR", dobYearsSelectBox); template.Parse("S_DOB_MONTH", dobMonthsSelectBox); template.Parse("S_DOB_DAY", dobDaysSelectBox); template.Parse("S_COUNTRY", countriesSelectBox); template.Parse("S_HEIGHT", heightTextBox); template.Parse("S_AUTO_BIOGRAPHY", LoggedInMember.Profile.Autobiography); Save(new EventHandler(AccountProfileInfo_Save)); }
private void showVerificationForm(ApplicationEntry ae, string oauthToken, string sessionId) { TextBox verifyTextBox = new TextBox("verify"); HiddenField oauthTokenHiddenField = new HiddenField("oauth_token"); oauthTokenHiddenField.Value = oauthToken; HiddenField modeHiddenField = new HiddenField("mode"); modeHiddenField.Value = "verify"; SubmitButton submitButton = new SubmitButton("submit", core.Prose.GetString("AUTHORISE")); Button cancelButton = new Button("cancel", core.Prose.GetString("CANCEL"), "cancel"); cancelButton.Script.OnClick = "window.external.notify('cancel'); return false;"; template.SetTemplate("oauth_authorize.html"); template.Parse("U_POST", core.Hyperlink.AppendSid("/oauth/approve", true, sessionId)); template.Parse("VERIFY", "TRUE"); template.Parse("AUTHORISE_APPLICATION", string.Format(core.Prose.GetString("AUTHORISE_APPLICATION"), ae.Title)); template.Parse("APPLICATION_ICON", ae.Icon); template.Parse("S_VERIFY", verifyTextBox); template.Parse("S_OAUTH_TOKEN", oauthTokenHiddenField); template.Parse("S_MODE", modeHiddenField); template.Parse("S_SUBMIT", submitButton); template.Parse("S_CANCEL", cancelButton); EndResponse(); }
void AccountContactManage_EditAddress(object sender, ModuleModeEventArgs e) { SetTemplate("account_address_edit"); User user = LoggedInMember; /* */ TextBox addressLine1TextBox = new TextBox("address-1"); addressLine1TextBox.Value = user.Profile.AddressLine1; /* */ TextBox addressLine2TextBox = new TextBox("address-2"); addressLine2TextBox.Value = user.Profile.AddressLine2; /* */ TextBox townTextBox = new TextBox("town"); townTextBox.Value = user.Profile.AddressTown; /* */ TextBox stateTextBox = new TextBox("state"); stateTextBox.Value = user.Profile.AddressState; /* */ TextBox postCodeTextBox = new TextBox("post-code"); postCodeTextBox.MaxLength = 5; postCodeTextBox.Value = user.Profile.AddressPostCode; /* */ SelectBox countrySelectBox = new SelectBox("country"); List<Country> countries = new List<Country>(); SelectQuery query = Item.GetSelectQueryStub(core, typeof(Country)); query.AddSort(SortOrder.Ascending, "country_name"); DataTable countryDataTable = db.Query(query); foreach (DataRow dr in countryDataTable.Rows) { countries.Add(new Country(core, dr)); } foreach (Country country in countries) { countrySelectBox.Add(new SelectBoxItem(country.Iso, country.Name)); } if (user.Profile.CountryIso != null) { countrySelectBox.SelectedKey = user.Profile.CountryIso; } template.Parse("S_ADDRESS_LINE_1", addressLine1TextBox); template.Parse("S_ADDRESS_LINE_2", addressLine2TextBox); template.Parse("S_TOWN", townTextBox); template.Parse("S_STATE", stateTextBox); template.Parse("S_POST_CODE", postCodeTextBox); template.Parse("S_COUNTRY", countrySelectBox); }
void AccountForumManage_New(object sender, ModuleModeEventArgs e) { SetTemplate("account_forum_edit"); long id = core.Functions.RequestLong("id", 0); /* Forum Types SelectBox */ SelectBox forumTypesSelectBox = new SelectBox("type"); Dictionary<string, string> forumTypes = new Dictionary<string, string>(); forumTypesSelectBox.Add(new SelectBoxItem("FORUM", "Forum")); forumTypesSelectBox.Add(new SelectBoxItem("CAT", "Category")); //forumTypes.Add("LINK", "Link"); /* Forum Types SelectBox */ SelectBox forumParentSelectBox = new SelectBox("parent"); /* Title TextBox */ TextBox titleTextBox = new TextBox("title"); titleTextBox.MaxLength = 127; /* Description TextBox */ TextBox descriptionTextBox = new TextBox("description"); descriptionTextBox.IsFormatted = true; descriptionTextBox.Lines = 6; /* Rules TextBox */ TextBox rulesTextBox = new TextBox("rules"); rulesTextBox.IsFormatted = true; rulesTextBox.Lines = 6; ForumSettings settings = new ForumSettings(core, Owner); List<Forum> forums = settings.GetForums(); forumParentSelectBox.Add(new SelectBoxItem("0", "")); foreach (Forum forum in forums) { string levelString = string.Empty; for (int i = 0; i < forum.Level; i++) { levelString += "--"; } SelectBoxItem item = new SelectBoxItem(forum.Id.ToString(), levelString + " " + forum.Title); if (forum.Id == id && e.Mode == "edit") { item.Selectable = false; } forumParentSelectBox.Add(item); } switch (e.Mode) { case "new": forumTypesSelectBox.SelectedKey = "FORUM"; template.Parse("S_ID", id.ToString()); forumParentSelectBox.SelectedKey = id.ToString(); break; case "edit": try { Forum forum = new Forum(core, id); string type = "FORUM"; if (forum.IsCategory) { type = "CAT"; } titleTextBox.Value = forum.Title; forumParentSelectBox.SelectedKey = forum.ParentId.ToString(); descriptionTextBox.Value = forum.Description; rulesTextBox.Value = forum.Rules; template.Parse("S_ID", forum.Id.ToString()); List<string> disabledItems = new List<string>(); forumTypesSelectBox["FORUM"].Selectable = false; forumTypesSelectBox["CAT"].Selectable = false; //forumTypesSelectBox["LINK"].Selectable = false; forumTypesSelectBox.SelectedKey = type; template.Parse("EDIT", "TRUE"); } catch (InvalidForumException) { DisplayGenericError(); } break; } /* Parse the form fields */ template.Parse("S_TITLE", titleTextBox); template.Parse("S_DESCRIPTION", descriptionTextBox); template.Parse("S_RULES", rulesTextBox); template.Parse("S_FORUM_TYPE", forumTypesSelectBox); template.Parse("S_FORUM_PARENT", forumParentSelectBox); }
void AccountMemberProfile_Show(object sender, EventArgs e) { SetTemplate("account_member_profile"); MusicianMember member = null; /* */ TextBox stageNameTextBox = new TextBox("stage-name"); stageNameTextBox.MaxLength = 63; /* */ TextBox biographyTextBox = new TextBox("biography"); biographyTextBox.IsFormatted = true; biographyTextBox.Lines = 7; try { member = new MusicianMember(core, (Musician)Owner, LoggedInMember); stageNameTextBox.Value = member.StageName; biographyTextBox.Value = member.Biography; } catch (InvalidMusicianMemberException) { return; } template.Parse("S_STAGENAME", stageNameTextBox); template.Parse("S_BIOGRAPHY", biographyTextBox); Save(new EventHandler(AccountMemberProfile_Save)); }
void AccountCompose_Show(object sender, EventArgs e) { SetTemplate("account_compose"); /*List<MailFolder> folders = MailFolder.GetFolders(core, core.Session.LoggedInMember); foreach (MailFolder f in folders) { if (f.FolderType == FolderTypes.Inbox) continue; VariableCollection modulesVariableCollection = core.Template.CreateChild("account_links"); ParentModulesVariableCollection.CreateChild("account_links", modulesVariableCollection); Dictionary<string, string> args = new Dictionary<string, string>(); args.Add("folder", f.FolderName); switch (f.FolderType) { case FolderTypes.Draft: modulesVariableCollection.Parse("TITLE", core.Prose.GetString("DRAFTS")); break; case FolderTypes.Outbox: modulesVariableCollection.Parse("TITLE", core.Prose.GetString("OUTBOX")); break; case FolderTypes.SentItems: modulesVariableCollection.Parse("TITLE", core.Prose.GetString("SENT_ITEMS")); break; default: modulesVariableCollection.Parse("TITLE", f.FolderName); break; } modulesVariableCollection.Parse("SUB", Key); modulesVariableCollection.Parse("MODULE", ModuleKey); modulesVariableCollection.Parse("URI", BuildUri(args)); }*/ long messageId = core.Functions.FormLong("id", 0); bool edit = false; UserSelectBox toUserSelectBox = new UserSelectBox(core, "to"); UserSelectBox ccUserSelectBox = new UserSelectBox(core, "cc"); TextBox subjectTextBox = new TextBox("subject"); TextBox messageTextBox = new TextBox("message"); messageTextBox.IsFormatted = true; Message message = null; try { message = new Message(core, messageId); if (message.SenderId == core.Session.LoggedInMember.Id) { edit = true; } else { core.Functions.Generate403(); } } catch (InvalidMessageException) { } if (edit) { subjectTextBox.Value = message.Subject; messageTextBox.Value = message.Text; List<MessageRecipient> recipients = message.GetRecipients(); foreach (MessageRecipient recipient in recipients) { switch (recipient.RecipientType) { case RecipientType.To: toUserSelectBox.AddUserId(recipient.UserId); break; case RecipientType.Cc: ccUserSelectBox.AddUserId(recipient.UserId); break; } } if (message.Draft) { template.Parse("SAVE_DRAFT", "TRUE"); } else { template.Parse("SAVE_DRAFT", "FALSE"); } } else { template.Parse("SAVE_DRAFT", "TRUE"); } template.Parse("S_TO", toUserSelectBox); template.Parse("S_CC", ccUserSelectBox); template.Parse("S_SUBJECT", subjectTextBox); template.Parse("S_MESSAGE", messageTextBox); if (core.Http.Form["save"] != null) { AccountCompose_Save(this, new EventArgs()); } if (core.Http.Form["send"] != null) { AccountCompose_Send(this, new EventArgs()); } }
/// <summary> /// Default show procedure for account sub module. /// </summary> /// <param name="sender">Object calling load event</param> /// <param name="e">Load EventArgs</param> void AccountBlogWrite_Show(object sender, EventArgs e) { SetTemplate("account_post"); VariableCollection javaScriptVariableCollection = core.Template.CreateChild("javascript_list"); javaScriptVariableCollection.Parse("URI", @"/scripts/jquery.sceditor.bbcode.min.js"); VariableCollection styleSheetVariableCollection = core.Template.CreateChild("style_sheet_list"); styleSheetVariableCollection.Parse("URI", @"/styles/jquery.sceditor.theme.default.min.css"); core.Template.Parse("OWNER_STUB", Owner.UriStubAbsolute); Blog blog = new Blog(core, (User)Owner); /* Title TextBox */ TextBox titleTextBox = new TextBox("title"); titleTextBox.MaxLength = 127; /* Post TextBox */ TextBox postTextBox = new TextBox("post"); postTextBox.IsFormatted = true; postTextBox.Lines = 15; /* Tags TextBox */ TagSelectBox tagsTextBox = new TagSelectBox(core, "tags"); //tagsTextBox.MaxLength = 127; CheckBox publishToFeedCheckBox = new CheckBox("publish-feed"); publishToFeedCheckBox.IsChecked = true; long postId = core.Functions.RequestLong("id", 0); byte licenseId = (byte)0; short categoryId = (short)1; DateTime postTime = core.Tz.Now; SelectBox postYearsSelectBox = new SelectBox("post-year"); for (int i = core.Tz.Now.AddYears(-7).Year; i <= core.Tz.Now.Year; i++) { postYearsSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } postYearsSelectBox.SelectedKey = postTime.Year.ToString(); SelectBox postMonthsSelectBox = new SelectBox("post-month"); for (int i = 1; i < 13; i++) { postMonthsSelectBox.Add(new SelectBoxItem(i.ToString(), core.Functions.IntToMonth(i))); } postMonthsSelectBox.SelectedKey = postTime.Month.ToString(); SelectBox postDaysSelectBox = new SelectBox("post-day"); for (int i = 1; i < 32; i++) { postDaysSelectBox.Add(new SelectBoxItem(i.ToString(), i.ToString())); } postDaysSelectBox.SelectedKey = postTime.Day.ToString(); if (postId > 0 && core.Http.Query["mode"] == "edit") { try { BlogEntry be = new BlogEntry(core, postId); titleTextBox.Value = be.Title; postTextBox.Value = be.Body; licenseId = be.License; categoryId = be.Category; postTime = be.GetPublishedDate(tz); List<Tag> tags = Tag.GetTags(core, be); //string tagList = string.Empty; foreach (Tag tag in tags) { /*if (tagList != string.Empty) { tagList += ", "; } tagList += tag.TagText;*/ tagsTextBox.AddTag(tag); } //tagsTextBox.Value = tagList; if (be.OwnerId != core.LoggedInMemberId) { DisplayError("You must be the owner of the blog entry to modify it."); return; } } catch (InvalidBlogEntryException) { DisplayError(core.Prose.GetString("Blog", "BLOG_ENTRY_DOES_NOT_EXIST")); return; } } else { template.Parse("IS_NEW", "TRUE"); PermissionGroupSelectBox permissionSelectBox = new PermissionGroupSelectBox(core, "permissions", blog.ItemKey); HiddenField aclModeField = new HiddenField("aclmode"); aclModeField.Value = "simple"; template.Parse("S_PERMISSIONS", permissionSelectBox); template.Parse("S_ACLMODE", aclModeField); } template.Parse("S_POST_YEAR", postYearsSelectBox); template.Parse("S_POST_MONTH", postMonthsSelectBox); template.Parse("S_POST_DAY", postDaysSelectBox); template.Parse("S_POST_HOUR", postTime.Hour.ToString()); template.Parse("S_POST_MINUTE", postTime.Minute.ToString()); SelectBox licensesSelectBox = new SelectBox("license"); DataTable licensesTable = db.Query(ContentLicense.GetSelectQueryStub(core, typeof(ContentLicense))); licensesSelectBox.Add(new SelectBoxItem("0", "Default License")); foreach (DataRow licenseRow in licensesTable.Rows) { ContentLicense li = new ContentLicense(core, licenseRow); licensesSelectBox.Add(new SelectBoxItem(li.Id.ToString(), li.Title)); } licensesSelectBox.SelectedKey = licenseId.ToString(); SelectBox categoriesSelectBox = new SelectBox("category"); SelectQuery query = Category.GetSelectQueryStub(core, typeof(Category)); query.AddSort(SortOrder.Ascending, "category_title"); DataTable categoriesTable = db.Query(query); foreach (DataRow categoryRow in categoriesTable.Rows) { Category cat = new Category(core, categoryRow); categoriesSelectBox.Add(new SelectBoxItem(cat.Id.ToString(), cat.Title)); } categoriesSelectBox.SelectedKey = categoryId.ToString(); /* Parse the form fields */ template.Parse("S_TITLE", titleTextBox); template.Parse("S_BLOG_TEXT", postTextBox); template.Parse("S_TAGS", tagsTextBox); template.Parse("S_BLOG_LICENSE", licensesSelectBox); template.Parse("S_BLOG_CATEGORY", categoriesSelectBox); template.Parse("S_PUBLISH_FEED", publishToFeedCheckBox); template.Parse("S_ID", postId.ToString()); foreach (Emoticon emoticon in core.Emoticons) { if (emoticon.Category == "modifier") continue; if (emoticon.Category == "people" && emoticon.Code.Length < 3) { VariableCollection emoticonVariableCollection = template.CreateChild("emoticon_list"); emoticonVariableCollection.Parse("CODE", emoticon.Code); emoticonVariableCollection.Parse("URI", emoticon.File); } else { VariableCollection emoticonVariableCollection = template.CreateChild("emoticon_hidden_list"); emoticonVariableCollection.Parse("CODE", emoticon.Code); emoticonVariableCollection.Parse("URI", emoticon.File); } } Save(new EventHandler(AccountBlogWrite_Save)); if (core.Http.Form["publish"] != null) { AccountBlogWrite_Save(this, new EventArgs()); } }
void AccountDiscographyManage_Edit(object sender, ModuleModeEventArgs e) { SetTemplate("account_discography_album_edit"); /* */ TextBox titleTextBox = new TextBox("title"); titleTextBox.MaxLength = 63; /* */ SelectBox releaseTypeSelectBox = new SelectBox("release-type"); releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.Demo).ToString(), "Demo")); releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.Single).ToString(), "Single")); releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.Album).ToString(), "Album")); releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.EP).ToString(), "EP")); releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.DVD).ToString(), "DVD")); releaseTypeSelectBox.Add(new SelectBoxItem(((byte)ReleaseType.Compilation).ToString(), "Compilation")); switch (e.Mode) { case "add": releaseTypeSelectBox.SelectedKey = ((byte)ReleaseType.Demo).ToString(); break; case "edit": long releaseId = core.Functions.FormLong("id", core.Functions.RequestLong("id", 0)); Release release = null; try { release = new Release(core, releaseId); titleTextBox.Value = release.Title; releaseTypeSelectBox.SelectedKey = ((byte)release.ReleaseType).ToString(); } catch (InvalidReleaseException) { return; } break; } template.Parse("S_TITLE", titleTextBox); SaveMode(AccountDiscographyManage_EditSave); }