Beispiel #1
0
        private void CreateTitle(string _pageKey)
        {
            var current = SueetieContext.Current;

            if (current != null && (current.IsNonApplicationPage || current.ContentPage != null))
            {
                var _title = string.Empty;
                if (_pageKey != null)
                {
                    _title = SueetieLocalizer.GetPageTitle(_pageKey);
                }
                else if (current.ContentPage != null)
                {
                    _title = HttpUtility.HtmlDecode(current.ContentPage.PageTitle);
                }

                var settings = SiteSettings.Instance;
                if (settings != null && !string.IsNullOrEmpty(settings.SitePageTitleLead))
                {
                    _title = settings.SitePageTitleLead + " " + _title;
                }

                this.Title = _title;
            }
        }
        public static string DisplayDateRange(int _daySpan)
        {
            string _displayedDateRange = SueetieLocalizer.GetString("dayspan_na");

            switch (_daySpan)
            {
            case (int)SueetieDaySpan.Day:
                _displayedDateRange = SueetieLocalizer.GetString("dayspan_day");
                break;

            case (int)SueetieDaySpan.Week:
                _displayedDateRange = SueetieLocalizer.GetString("dayspan_week");
                break;

            case (int)SueetieDaySpan.Month:
                _displayedDateRange = SueetieLocalizer.GetString("dayspan_month");
                break;

            case (int)SueetieDaySpan.Quarter:
                _displayedDateRange = SueetieLocalizer.GetString("dayspan_quarter");
                break;

            case (int)SueetieDaySpan.Year:
                _displayedDateRange = SueetieLocalizer.GetString("dayspan_year");
                break;

            default:
                break;
            }
            return(_displayedDateRange);
        }
        public static void PopulateTimeZoneList(DropDownList list, string selectedTimeZone)
        {
            List <SueetieResource> sueetieResources = SueetieLocalizer.GetTimeZones();

            foreach (SueetieResource sueetieResource in sueetieResources)
            {
                //list.Items.Add(new ListItem(sueetieResource.Value, Convert.ToString(GetHourOffsetFromNode(sueetieResource.Key) * 60)));
                list.Items.Add(new ListItem(sueetieResource.Value, Convert.ToInt32(GetHourOffsetFromNode(sueetieResource.Key) * 60).ToString()));
            }

            if (!list.Page.IsPostBack && list.Items.FindByValue(selectedTimeZone) != null)
            {
                list.SelectedValue = selectedTimeZone;
            }
        }
Beispiel #4
0
        public static string TagUrls(string _pipedTags)
        {
            if (string.IsNullOrEmpty(_pipedTags))
            {
                return(SueetieLocalizer.GetString("no_tags"));
            }

            var sb        = new StringBuilder();
            var firstItem = true;

            foreach (var _tag in _pipedTags.Split('|'))
            {
                if (!firstItem)
                {
                    sb.Append(", ");
                }
                sb.Append(string.Format("<a href=\"/search/default.aspx?srch=Tags:{0}\">{1}</a>", _tag.Replace(" ", "+"), _tag));
                firstItem = false;
            }
            return(sb.ToString());
        }
Beispiel #5
0
        public static string CategoryUrls(SueetieBlogPost post)
        {
            if (string.IsNullOrEmpty(post.Categories))
            {
                return(SueetieLocalizer.GetString("no_categories"));
            }

            var sb        = new StringBuilder();
            var firstItem = true;

            foreach (var category in post.Categories.Split('|'))
            {
                if (!firstItem)
                {
                    sb.Append(", ");
                }
                sb.Append(string.Format("<a href=\"/{0}/category/{1}.aspx\">{2}</a>", post.ApplicationKey, DataHelper.PrepCategoryLink(category), category));
                firstItem = false;
            }
            return(sb.ToString());
        }
Beispiel #6
0
        public static string TagUrls(int _contentID)
        {
            var _sueetieTagMasterList = GetSueetieTagMasterList(_contentID);

            if (_sueetieTagMasterList.Count == 0)
            {
                return(SueetieLocalizer.GetString("no_tags"));
            }

            var sb        = new StringBuilder();
            var firstItem = true;

            foreach (var _sueetieTagMaster in _sueetieTagMasterList)
            {
                if (!firstItem)
                {
                    sb.Append(", ");
                }
                sb.Append(string.Format("<a href=\"/util/handlers/taghandler.ashx?tagid={0}\">{1}</a>", _sueetieTagMaster.TagID, _sueetieTagMaster.Tag));
                firstItem = false;
            }
            return(sb.ToString());
        }
        public string ProcessTags(int _itemID, int _contentID, int _contentTypeID, string _tags)
        {
            if (string.IsNullOrEmpty(_tags))
            {
                return(SueetieLocalizer.GetString("no_tags_entered"));
            }
            string pipedTags = SueetieTags.PipedTags(_tags);

            if (_contentTypeID == (int)SueetieContentType.CMSPage)
            {
                SueetieTagEntry sueetieTagEntry = new SueetieTagEntry
                {
                    ItemID        = _itemID,
                    ContentID     = _contentID,
                    ContentTypeID = _contentTypeID,
                    UserID        = SueetieContext.Current.User.UserID,
                    Tags          = pipedTags
                };
                SueetieContentParts.EnterContentPageTags(sueetieTagEntry);
            }

            return(SueetieTags.TagUrls(pipedTags));
        }
Beispiel #8
0
        private static UserLogActivity FormatUserLogRow(UserLogActivity _u)
        {
            _u.ActivityClass = _u.ApplicationPath;

            var _profileUrl   = SueetieUrls.Instance.MyProfile(_u.UserID).Url;
            var _toProfileUrl = SueetieUrls.Instance.MasterProfile(SueetieUsers.GetThinSueetieUser(_u.ToUserID).ForumUserID).Url;

            if (SueetieConfiguration.Get().Core.UseForumProfile)
            {
                var thinUser = SueetieUsers.GetThinSueetieUser(_u.UserID);
                if (thinUser != null)
                {
                    var masterProfile = SueetieUrls.Instance.MasterProfile(thinUser.ForumUserID);
                    if (masterProfile != null)
                    {
                        _profileUrl = masterProfile.Url;
                    }
                }
            }
            var username   = string.Format("<a href='" + _profileUrl + "' class='ActivityUser'>{0}</a> ", _u.DisplayName);
            var toUsername = string.Format("<a href='" + _profileUrl + "' class='ActivityUser'>{0}</a> ", _u.ToUserDisplayName);

            _u.Activity = string.Empty;

            switch (_u.UserLogCategoryID)
            {
            case (int)UserLogCategoryType.Following:
                var _toUserProfileUrl = SueetieUrls.Instance.MyProfile(_u.ToUserID).Url;
                if (SueetieConfiguration.Get().Core.UseForumProfile)
                {
                    _toUserProfileUrl = SueetieUrls.Instance.MasterProfile(SueetieUsers.GetThinSueetieUser(_u.ToUserID).ForumUserID).Url;
                }
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_is_now_following"),
                    username,
                    string.Format(
                        "<a href='" + _toUserProfileUrl + "' class='ActivitySource'>{0}</a>",
                        _u.ToUserDisplayName));
                break;

            case (int)UserLogCategoryType.BlogPost:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_blogged"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));

                break;

            case (int)UserLogCategoryType.BlogComment:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_commented_on"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceParentDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                _u.ActivityClass = "blogcomment";
                break;

            case (int)UserLogCategoryType.ForumTopic:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_posted"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.ForumMessage:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_replied_to"),
                    username,
                    string.Format(
                        "<a href='{0}'>{1}</a>", _u.Permalink, _u.SourceParentDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.ForumAnswer:
                var _answerBy = SueetieLocalizer.GetString("activity_by") + " " + toUsername;
                if (_u.UserID == _u.ToUserID)
                {
                    _answerBy = string.Empty;
                }
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_marked_as_answer"),
                    username,
                    string.Format(
                        "<a href='{0}'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    _answerBy,
                    SueetieLocalizer.GetString("activity_as_an_answer"),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                // {0} marked {1} {2} {3} {4} {5} {6}
                break;

            case (int)UserLogCategoryType.NewWikiPage:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_created"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.NewWikiMessage:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_new_wiki_message"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, SueetieLocalizer.GetString("activity_a_new_message")),
                    SueetieLocalizer.GetString("activity_to"),
                    string.Format(
                        "<a href='{0}' class='ActivitySourceParent'>{1}</a>",
                        _u.SourceParentPermalink,
                        _u.SourceParentDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format("<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                                  _u.ApplicationPath,
                                  _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.WikiPageUpdated:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_updated"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));

                break;

            case (int)UserLogCategoryType.DocumentAlbum:
            case (int)UserLogCategoryType.AudioAlbum:
            case (int)UserLogCategoryType.ImageAlbum:
            case (int)UserLogCategoryType.UserMediaAlbum:
            case (int)UserLogCategoryType.MultipurposeAlbum:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_created_a_new"),
                    username,
                    _u.SourceDescription.ToLower(),
                    SueetieLocalizer.GetString("activity_named"),
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceParentDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='{0}' class='ActivitySourceParent'>{1}</a>",
                        _u.SourceParentPermalink,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.AudioUploaded:
            case (int)UserLogCategoryType.DocumentUploaded:
            case (int)UserLogCategoryType.ImageUploaded:
            case (int)UserLogCategoryType.OtherMediaUploaded:
            case (int)UserLogCategoryType.VideoUploaded:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_added_new"),
                    username,
                    _u.SourceDescription.ToLower(),
                    SueetieLocalizer.GetString("activity_to"),
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceParentDescription),
                    SueetieLocalizer.GetString("activity_in"),
                    string.Format(
                        "<a href='{0}' class='ActivitySourceParent'>{1}</a>",
                        _u.SourceParentPermalink,
                        _u.ApplicationName));
                _u.ActivityClass = "mediaupload";
                break;

            case (int)UserLogCategoryType.MarketplaceProduct:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_added_a_new_product_item"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.CMSPageUpdated:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_updated_a_cms_page"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.CMSPageCreated:
                _u.Activity += string.Format(
                    SueetieLocalizer.GetString("activity_created_a_cms_page"),
                    username,
                    string.Format(
                        "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                    SueetieLocalizer.GetString("activity_in_the"),
                    string.Format(
                        "<a href='/{0}/default.aspx' class='ActivitySourceParent'>{1}</a>",
                        _u.ApplicationPath,
                        _u.ApplicationName));
                break;

            case (int)UserLogCategoryType.CalendarEvent:
                if (_u.Permalink == "na")
                {
                    _u.Activity += string.Format(
                        SueetieLocalizer.GetString("activity_new_calendar_event"),
                        username,
                        string.Format("<span) class='ActivitySpan'>{0}</span>", _u.SourceDescription),
                        SueetieLocalizer.GetString("activity_in_the"),
                        string.Format(
                            "<a href='{0}' class='ActivitySourceParent'>{1}</a>",
                            _u.SourceParentPermalink,
                            _u.SourceParentDescription));
                }
                else
                {
                    _u.Activity += string.Format(
                        SueetieLocalizer.GetString("activity_new_calendar_event"),
                        username,
                        string.Format(
                            "<a href='{0}' class='ActivitySource'>{1}</a>", _u.Permalink, _u.SourceDescription),
                        SueetieLocalizer.GetString("activity_in_the"),
                        string.Format(
                            "<a href='{0}' class='ActivitySourceParent'>{1}</a>",
                            _u.SourceParentPermalink,
                            _u.SourceParentDescription));
                }

                _u.ActivityClass = "calendarevent";
                break;

            case (int)UserLogCategoryType.JoinedCommunity:
                _u.Activity      = string.Format(SueetieLocalizer.GetString("activity_became_a_new_member"), username);
                _u.ActivityClass = "newuser";
                break;

            case (int)UserLogCategoryType.Registered:
                _u.Activity      = string.Format(SueetieLocalizer.GetString("activity_user_registered"), username);
                _u.ActivityClass = "newuser";
                break;

            case (int)UserLogCategoryType.LoggedIn:
                _u.Activity      = string.Format(SueetieLocalizer.GetString("activity_user_loggedin"), username);
                _u.ActivityClass = "newuser";
                break;

            default:
                _u.Activity = _u.UserLogCategoryID + " - " + _u.UserLogID + " - " + _u.ApplicationName;
                break;
            }
            return(_u);
        }