Esempio n. 1
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. 2
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. 3
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);
        }