Esempio n. 1
0
        void AccountGalleriesUpload_Show(object sender, EventArgs e)
        {
            long galleryId = core.Functions.RequestLong("gallery-id", 0);

            List<string[]> breadCrumbParts = new List<string[]>();
            breadCrumbParts.Add(new string[] { "gallery", core.Prose.GetString("GALLERY") });

            if (galleryId == 0)
            {
                // Invalid gallery
                core.Display.ShowMessage("An error occured", "An error occured");
                return;
            }

            try
            {
                Gallery gallery = new Gallery(core, Owner, galleryId);

                if (!gallery.Access.Can("CREATE_ITEMS"))
                {
                    core.Functions.Generate403();
                    return;
                }

                breadCrumbParts.Add(new string[] { "!" + gallery.Uri, gallery.GalleryTitle });

                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);
                template.Parse("S_GALLERY_ID", galleryId.ToString());

                core.Display.ParseClassification(template, "S_PHOTO_CLASSIFICATION", Classifications.Everyone);

                breadCrumbParts.Add(new string[] { "upload?gallery-id=" + galleryId.ToString(), core.Prose.GetString("UPLOAD_PHOTO") });

                page.Owner.ParseBreadCrumbs(breadCrumbParts);
            }
            catch (InvalidGalleryException)
            {
                core.Display.ShowMessage("An error occured", "An error occured");
                return;
            }

            if (core.Http.Form["save"] != null)
            {
                AccountGalleriesUpload_Save(sender, e);
            }
        }
Esempio n. 2
0
        /// <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());
            }
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public void Add(CheckBox item)
 {
     if (!itemKeys.ContainsKey(item.Name))
     {
         items.Add(item);
         itemKeys.Add(item.Name, item);
     }
 }
        void AccountForumSettings_Show(object sender, EventArgs e)
        {
            SetTemplate("account_forum_settings");

            Save(new EventHandler(AccountForumSettings_Save));

            ForumSettings settings;
            try
            {
                settings = new ForumSettings(core, Owner);
            }
            catch (InvalidForumSettingsException)
            {
                ForumSettings.Create(core, Owner);
                settings = new ForumSettings(core, Owner);
            }

            CheckBox rootTopicsCheckBox = new CheckBox("root-topics");
            rootTopicsCheckBox.IsChecked = settings.AllowTopicsAtRoot;

            template.Parse("S_TOPICS_PER_PAGE", settings.TopicsPerPage.ToString());
            template.Parse("S_POSTS_PER_PAGE", settings.PostsPerPage.ToString());
            template.Parse("S_ROOT_TOPICS", rootTopicsCheckBox);
        }
        void AccountSubGroupsManage_Members(object sender, ModuleModeEventArgs e)
        {
            SetTemplate("account_group_subgroup_members");

            long id = core.Functions.RequestLong("id", 0);

            if (id <= 0)
            {
                return;
            }

            try
            {
                subUserGroup = new SubUserGroup(core, id);
            }
            catch (InvalidSubGroupException)
            {
                return;
            }

            if (subUserGroup.CanEditItem())
            {
                List<SubGroupMember> leaders = subUserGroup.GetLeaders();
                List<SubGroupMember> awaiting = subUserGroup.GetMembersWaitingApproval();
                List<SubGroupMember> members = subUserGroup.GetMembers(core.TopLevelPageNumber, 25);

                UserSelectBox newUserSelectBox = new UserSelectBox(core, "usernames");
                newUserSelectBox.SelectMultiple = false;
                //Form.AddFormField(newUserSelectBox);

                YesNoList makeLeaderYesNoList = new YesNoList(core, "make-leader");
                makeLeaderYesNoList.SelectedKey = "no";
                //Form.AddFormField(makeLeaderYesNoList);

                YesNoList makeDefaultYesNoList = new YesNoList(core, "make-default");
                makeDefaultYesNoList.SelectedKey = "no";
                //Form.AddFormField(makeDefaultYesNoList);

                template.Parse("SUBGROUP_DISPLAY_NAME", subUserGroup.DisplayName);
                template.Parse("S_USERNAMES", newUserSelectBox);
                template.Parse("S_MAKE_LEADER", makeLeaderYesNoList);
                template.Parse("S_MAKE_DEFAULT_GROUP", makeDefaultYesNoList);
                template.Parse("S_GROUP_ID", subUserGroup.Id.ToString());

                foreach (SubGroupMember member in leaders)
                {
                    CheckBox memberCheckBox = new CheckBox("check[" + member.Id.ToString() + "]");

                    VariableCollection memberVariableCollection = template.CreateChild("leader_list");
                    memberVariableCollection.Parse("DISPLAY_NAME", member.DisplayName);
                    memberVariableCollection.Parse("JOINED_DATE", core.Tz.DateTimeToDateString(member.GetJoinedDate(core.Tz)));
                    memberVariableCollection.Parse("S_MARK", memberCheckBox);

                    if (member.IsDefaultGroup)
                    {
                        memberVariableCollection.Parse("DEFAULT_GROUP", core.Prose.GetString("YES"));
                    }
                    else
                    {
                        memberVariableCollection.Parse("DEFAULT_GROUP", core.Prose.GetString("NO"));
                    }
                }

                foreach (SubGroupMember member in awaiting)
                {
                    CheckBox memberCheckBox = new CheckBox("check[" + member.Id.ToString() + "]");

                    VariableCollection memberVariableCollection = template.CreateChild("awaiting_list");
                    memberVariableCollection.Parse("DISPLAY_NAME", member.DisplayName);
                    memberVariableCollection.Parse("JOINED_DATE", core.Tz.DateTimeToDateString(member.GetJoinedDate(core.Tz)));
                    memberVariableCollection.Parse("S_MARK", memberCheckBox);

                    if (member.IsDefaultGroup)
                    {
                        memberVariableCollection.Parse("DEFAULT_GROUP", core.Prose.GetString("YES"));
                    }
                    else
                    {
                        memberVariableCollection.Parse("DEFAULT_GROUP", core.Prose.GetString("NO"));
                    }
                }

                foreach (SubGroupMember member in members)
                {
                    CheckBox memberCheckBox = new CheckBox("check[" + member.Id.ToString() + "]");

                    VariableCollection memberVariableCollection = template.CreateChild("member_list");
                    memberVariableCollection.Parse("DISPLAY_NAME", member.DisplayName);
                    memberVariableCollection.Parse("JOINED_DATE", core.Tz.DateTimeToDateString(member.GetJoinedDate(core.Tz)));
                    memberVariableCollection.Parse("S_MARK", memberCheckBox);

                    if (member.IsDefaultGroup)
                    {
                        memberVariableCollection.Parse("DEFAULT_GROUP", core.Prose.GetString("YES"));
                    }
                    else
                    {
                        memberVariableCollection.Parse("DEFAULT_GROUP", core.Prose.GetString("NO"));
                    }
                }

            }
            else
            {
                return;
            }

            Save(AccountSubGroupsManage_Members_AddNew);
        }
Esempio n. 8
0
        void McpMain_Show(object sender, EventArgs e)
        {
            //AuthoriseRequestSid();
            SetTemplate("mcp_main");

            /* */
            SubmitButton submitButton = new SubmitButton("submit", "Submit");

            /* */
            SelectBox actionsSelectBox = new SelectBox("mode");

            long forumId = core.Functions.RequestLong("f", 0);
            Forum thisForum = null;
            ForumSettings settings = null;

            try
            {
                settings = new ForumSettings(core, Owner);
                if (forumId > 0)
                {
                    thisForum = new Forum(core, settings, forumId);
                }
                else
                {
                    thisForum = new Forum(core, settings);
                }
            }
            catch (InvalidForumSettingsException)
            {
                core.Functions.Generate404();
            }
            catch (InvalidForumException)
            {
                core.Functions.Generate404();
            }

            if (thisForum.Access.Can("LOCK_TOPICS"))
            {
                actionsSelectBox.Add(new SelectBoxItem("lock", "Lock"));
                actionsSelectBox.Add(new SelectBoxItem("unlock", "Unlock"));
            }
            if (thisForum.Access.Can("MOVE_TOPICS"))
            {
                actionsSelectBox.Add(new SelectBoxItem("move", "Move"));
            }
            if (thisForum.Access.Can("DELETE_TOPICS"))
            {
                actionsSelectBox.Add(new SelectBoxItem("delete", "Delete"));
            }

            List<ForumTopic> announcements = thisForum.GetAnnouncements();
            List<ForumTopic> topics = thisForum.GetTopics(core.TopLevelPageNumber, settings.TopicsPerPage);
            List<ForumTopic> allTopics = new List<ForumTopic>();
            allTopics.AddRange(announcements);
            allTopics.AddRange(topics);

            Dictionary<long, TopicPost> topicLastPosts;

            topicLastPosts = TopicPost.GetTopicLastPosts(core, allTopics);

            foreach (ForumTopic topic in allTopics)
            {
                core.LoadUserProfile(topic.PosterId);
            }

            foreach (ForumTopic topic in allTopics)
            {
                VariableCollection topicVariableCollection = template.CreateChild("topic_list");

                CheckBox checkBox = new CheckBox("checkbox[" + topic.Id.ToString() + "]");

                topicVariableCollection.Parse("TITLE", topic.Title);
                topicVariableCollection.Parse("URI", topic.Uri);
                topicVariableCollection.Parse("VIEWS", topic.Views.ToString());
                topicVariableCollection.Parse("REPLIES", topic.Posts.ToString());
                topicVariableCollection.Parse("DATE", core.Tz.DateTimeToString(topic.GetCreatedDate(core.Tz)));
                topicVariableCollection.Parse("USERNAME", core.PrimitiveCache[topic.PosterId].DisplayName);
                topicVariableCollection.Parse("U_POSTER", core.PrimitiveCache[topic.PosterId].Uri);
                topicVariableCollection.Parse("S_CHECK", checkBox);

                if (topicLastPosts.ContainsKey(topic.LastPostId))
                {
                    core.Display.ParseBbcode(topicVariableCollection, "LAST_POST", string.Format("[iurl={0}]{1}[/iurl]\n{2}",
                        topicLastPosts[topic.LastPostId].Uri, Functions.TrimStringToWord(topicLastPosts[topic.LastPostId].Title, 20), core.Tz.DateTimeToString(topicLastPosts[topic.LastPostId].GetCreatedDate(core.Tz))));
                }
                else
                {
                    topicVariableCollection.Parse("LAST_POST", "No posts");
                }

                switch (topic.Status)
                {
                    case TopicStates.Normal:
                        if (topic.IsRead)
                        {
                            if (topic.IsLocked)
                            {
                                topicVariableCollection.Parse("IS_NORMAL_READ_LOCKED", "TRUE");
                            }
                            else
                            {
                                topicVariableCollection.Parse("IS_NORMAL_READ_UNLOCKED", "TRUE");
                            }
                        }
                        else
                        {
                            if (topic.IsLocked)
                            {
                                topicVariableCollection.Parse("IS_NORMAL_UNREAD_LOCKED", "TRUE");
                            }
                            else
                            {
                                topicVariableCollection.Parse("IS_NORMAL_UNREAD_UNLOCKED", "TRUE");
                            }
                        }
                        break;
                    case TopicStates.Sticky:
                        if (topic.IsRead)
                        {
                            if (topic.IsLocked)
                            {
                                topicVariableCollection.Parse("IS_STICKY_READ_LOCKED", "TRUE");
                            }
                            else
                            {
                                topicVariableCollection.Parse("IS_STICKY_READ_UNLOCKED", "TRUE");
                            }
                        }
                        else
                        {
                            if (topic.IsLocked)
                            {
                                topicVariableCollection.Parse("IS_STICKY_UNREAD_LOCKED", "TRUE");
                            }
                            else
                            {
                                topicVariableCollection.Parse("IS_STICKY_UNREAD_UNLOCKED", "TRUE");
                            }
                        }

                        break;
                    case TopicStates.Announcement:
                    case TopicStates.Global:
                        if (topic.IsRead)
                        {
                            if (topic.IsLocked)
                            {
                                topicVariableCollection.Parse("IS_ANNOUNCEMENT_READ_LOCKED", "TRUE");
                            }
                            else
                            {
                                topicVariableCollection.Parse("IS_ANNOUNCEMENT_READ_UNLOCKED", "TRUE");
                            }
                        }
                        else
                        {
                            if (topic.IsLocked)
                            {
                                topicVariableCollection.Parse("IS_ANNOUNCEMENT_UNREAD_LOCKED", "TRUE");
                            }
                            else
                            {
                                topicVariableCollection.Parse("IS_ANNOUNCEMENT_UNREAD_UNLOCKED", "TRUE");
                            }
                        }

                        break;
                }
            }

            template.Parse("TOPICS", allTopics.Count.ToString());
            template.Parse("S_ACTIONS", actionsSelectBox);
            template.Parse("S_SUBMIT", submitButton);
        }
Esempio n. 9
0
        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");
            }
        }
Esempio n. 10
0
        void AccountLifestyle_Show(object sender, EventArgs e)
        {
            if (core.ResponseFormat != ResponseFormats.Html)
            {
                AccountLifestyle_SaveParameter(sender, e);
                return;
            }

            Save(new EventHandler(AccountLifestyle_Save));

            SetTemplate("account_lifestyle");

            SelectBox maritialStatusesSelectBox = new SelectBox("maritial-status");
            maritialStatusesSelectBox.Add(new SelectBoxItem(((byte)MaritialStatus.Undefined).ToString(), core.Prose.GetString("NO_ANSWER")));
            maritialStatusesSelectBox.Add(new SelectBoxItem(((byte)MaritialStatus.Single).ToString(), core.Prose.GetString("SINGLE")));
            maritialStatusesSelectBox.Add(new SelectBoxItem(((byte)MaritialStatus.MonogomousRelationship).ToString(), core.Prose.GetString("IN_A_RELATIONSHIP")));
            maritialStatusesSelectBox.Add(new SelectBoxItem(((byte)MaritialStatus.OpenRelationship).ToString(), core.Prose.GetString("IN_A_OPEN_RELATIONSHIP")));
            maritialStatusesSelectBox.Add(new SelectBoxItem(((byte)MaritialStatus.Engaged).ToString(), core.Prose.GetString("ENGAGED")));
            maritialStatusesSelectBox.Add(new SelectBoxItem(((byte)MaritialStatus.Married).ToString(), core.Prose.GetString("MARRIED")));
            maritialStatusesSelectBox.Add(new SelectBoxItem(((byte)MaritialStatus.Separated).ToString(), core.Prose.GetString("SEPARATED")));
            maritialStatusesSelectBox.Add(new SelectBoxItem(((byte)MaritialStatus.Divorced).ToString(), core.Prose.GetString("DIVORCED")));
            maritialStatusesSelectBox.Add(new SelectBoxItem(((byte)MaritialStatus.Widowed).ToString(), core.Prose.GetString("WIDOWED")));
            maritialStatusesSelectBox.SelectedKey = ((byte)LoggedInMember.Profile.MaritialStatusRaw).ToString();

            SelectBox religionsSelectBox = new SelectBox("religion");
            religionsSelectBox.Add(new SelectBoxItem("0", core.Prose.GetString("NO_ANSWER")));

            // TODO: Fix this
            DataTable religionsTable = db.Query("SELECT * FROM religions ORDER BY religion_title ASC");

            foreach (DataRow religionRow in religionsTable.Rows)
            {
                religionsSelectBox.Add(new SelectBoxItem(((short)religionRow["religion_id"]).ToString(), (string)religionRow["religion_title"]));
            }

            religionsSelectBox.SelectedKey = LoggedInMember.Profile.ReligionId.ToString();
            religionsSelectBox.Script.OnChange = "SaveParameter('profile', 'lifestyle', '" + religionsSelectBox.Name + "');";

            SelectBox sexualitiesSelectBox = new SelectBox("sexuality");
            sexualitiesSelectBox.Add(new SelectBoxItem(((byte)Sexuality.Undefined).ToString(), core.Prose.GetString("NO_ANSWER")));
            sexualitiesSelectBox.Add(new SelectBoxItem(((byte)Sexuality.Unsure).ToString(), core.Prose.GetString("NOT_SURE")));
            sexualitiesSelectBox.Add(new SelectBoxItem(((byte)Sexuality.Asexual).ToString(), core.Prose.GetString("ASEXUAL")));
            sexualitiesSelectBox.Add(new SelectBoxItem(((byte)Sexuality.Hetrosexual).ToString(), core.Prose.GetString("STRAIGHT")));
            sexualitiesSelectBox.Add(new SelectBoxItem(((byte)Sexuality.Homosexual).ToString(), LoggedInMember.Profile.GenderRaw == Gender.Female ? core.Prose.GetString("LESBIAN") : core.Prose.GetString("GAY")));
            sexualitiesSelectBox.Add(new SelectBoxItem(((byte)Sexuality.Bisexual).ToString(), core.Prose.GetString("BISEXUAL")));
            sexualitiesSelectBox.Add(new SelectBoxItem(((byte)Sexuality.Pansexual).ToString(), core.Prose.GetString("PANSEXUAL")));
            sexualitiesSelectBox.Add(new SelectBoxItem(((byte)Sexuality.Polysexual).ToString(), core.Prose.GetString("POLYSEXUAL")));
            sexualitiesSelectBox.SelectedKey = ((byte)LoggedInMember.Profile.SexualityRaw).ToString();
            sexualitiesSelectBox.Script.OnChange = "SaveParameter('profile', 'lifestyle', '" + sexualitiesSelectBox.Name + "');";

            CheckBoxArray interestedInCheckBoxes = new CheckBoxArray("interested-in");
            interestedInCheckBoxes.Layout = Layout.Horizontal;

            CheckBox interestedInMenCheckBox = new CheckBox("interested-in-men");
            interestedInMenCheckBox.Caption = core.Prose.GetString("MEN");
            interestedInMenCheckBox.IsChecked = LoggedInMember.Profile.InterestedInMen;
            interestedInMenCheckBox.Width = new StyleLength();
            interestedInMenCheckBox.Script.OnChange = "SaveParameter('profile', 'lifestyle', '" + interestedInMenCheckBox.Name + "');";

            CheckBox interestedInWomenCheckBox = new CheckBox("interested-in-women");
            interestedInWomenCheckBox.Caption = core.Prose.GetString("WOMEN");
            interestedInWomenCheckBox.IsChecked = LoggedInMember.Profile.InterestedInWomen;
            interestedInWomenCheckBox.Width = new StyleLength();
            interestedInWomenCheckBox.Script.OnChange = "SaveParameter('profile', 'lifestyle', '" + interestedInWomenCheckBox.Name + "');";

            interestedInCheckBoxes.Add(interestedInMenCheckBox);
            interestedInCheckBoxes.Add(interestedInWomenCheckBox);

            UserSelectBox relationUserSelectBox = new UserSelectBox(core, "relation");
            relationUserSelectBox.Width = new StyleLength();
            relationUserSelectBox.SelectMultiple = false;
            relationUserSelectBox.IsVisible = false;
            relationUserSelectBox.Script.OnChange = "SaveParameter('profile', 'lifestyle', '" + relationUserSelectBox.Name + "');";

            maritialStatusesSelectBox.Script.OnChange = "SaveParameter('profile', 'lifestyle', '" + maritialStatusesSelectBox.Name + "'); CheckRelationship('" + maritialStatusesSelectBox.Name + "', '" + relationUserSelectBox.Name + "');";

            template.Parse("S_MARITIAL_STATUS", maritialStatusesSelectBox);
            template.Parse("S_RELIGION", religionsSelectBox);
            template.Parse("S_SEXUALITY", sexualitiesSelectBox);
            template.Parse("S_INTERESTED_IN", interestedInCheckBoxes);

            switch (LoggedInMember.Profile.MaritialStatusRaw)
            {
                case MaritialStatus.MonogomousRelationship:
                case MaritialStatus.OpenRelationship:
                case MaritialStatus.Engaged:
                case MaritialStatus.Married:
                    relationUserSelectBox.IsVisible = true;
                    break;
            }

            if (LoggedInMember.Profile.MaritialWithConfirmed && LoggedInMember.Profile.MaritialWithId > 0)
            {
                relationUserSelectBox.Invitees = new List<long>(new long[] { LoggedInMember.Profile.MaritialWithId });
                core.LoadUserProfile(LoggedInMember.Profile.MaritialWithId);

                template.Parse("S_RELATIONSHIP_WITH", core.PrimitiveCache[LoggedInMember.Profile.MaritialWithId].UserName);
            }

            template.Parse("S_RELATION", relationUserSelectBox);
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        void PostContent(HookEventArgs e)
        {
            Template template = new Template(Assembly.GetExecutingAssembly(), "poststatusmessage");
            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);

            PermissionGroupSelectBox permissionSelectBox = new PermissionGroupSelectBox(core, "permissions", e.Owner.ItemKey);
            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("status-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("status-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("status-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);
                }

            }

            template.Parse("S_STATUS_PERMISSIONS", permissionSelectBox);

            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("STATUS"), template);
        }
        /// <summary>
        /// Default show procedure for account sub module.
        /// </summary>
        /// <param name="sender">Object calling load event</param>
        /// <param name="e">Load EventArgs</param>
        void AccountGalleriesUpload_Show(object sender, EventArgs e)
        {
            SetTemplate("account_galleries_upload");

            long galleryId = core.Functions.RequestLong("gallery-id", 0);

            if (galleryId == 0)
            {
                // Invalid gallery
                DisplayGenericError();
                return;
            }

            try
            {
                Gallery gallery = new Gallery(core, Owner, galleryId);

                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);
                template.Parse("S_GALLERY_ID", galleryId.ToString());

                core.Display.ParseClassification(template, "S_PHOTO_CLASSIFICATION", Classifications.Everyone);
            }
            catch (InvalidGalleryException)
            {
                DisplayGenericError();
                return;
            }

            Save(new EventHandler(AccountGalleriesUpload_Save));
        }