Example #1
0
        public static WeightedTagList GetOrInsertTags(string tagString, bool isAdministrator)
        {
            List<string> rawTags = TagHelper.DistillTagInput(tagString, isAdministrator);

            WeightedTagList tags = new WeightedTagList();
            TagCollection newTags = new TagCollection();
            foreach (string tagIdentifier in rawTags) {
                //TODO: GJ: get from cache
                Tag tag = Tag.FetchTagByIdentifier(tagIdentifier);

                if (tag == null) {
                    tag = new Tag();
                    tag.TagIdentifier = tagIdentifier;
                    newTags.Add(tag);
                } else {
                    tags.Add(new WeightedTag(tag.TagID, tag.TagIdentifier, 1));
                }
            }

            // newTags.BatchSave(); //TODO: GJ: does BatchSave update identity colums after save?

            foreach (Tag newTag in newTags) {
                newTag.Save(); //TODO: GJ: does BatchSave update identity colums after save?
                tags.Add(new WeightedTag(newTag.TagID, newTag.TagIdentifier, 1));
            }

            return tags;
        }
        public WeightedTagList ToWeightedTagList()
        {
            WeightedTagList weightedTagList = new WeightedTagList();
            foreach (Tag tag in this)
                weightedTagList.AddWeightedTag(new WeightedTag(tag.TagID, tag.TagIdentifier, 1));

            return weightedTagList;
        }
Example #3
0
 public void DataBind(WeightedTagList tags, int storyID)
 {
     this._tags = tags;
     this._storyID = storyID;
 }
 public void DataBind(WeightedTagList tags, int storyID, string username)
 {
     this._tags = tags;
     this._storyID = storyID;
     this._username = username;
 }
Example #5
0
 public void DataBind(WeightedTagList tags, int storyID, bool showTagIt)
 {
     this._tags = tags;
     this._storyID = storyID;
     this._showTagIt = showTagIt;
 }
Example #6
0
 public void DataBind(WeightedTagList tags, int storyID)
 {
     this.DataBind(tags, storyID, true);
 }
Example #7
0
        public static UserAction RecordTag(int hostID, User user, Story story, WeightedTagList tags)
        {
            UserAction userAction = Create(hostID, user.UserID, story.StoryID, ActionType.Tag);

            if (tags.Count > 0) {
                TagCommaList tagList = new TagCommaList();
                tagList.DataBind(tags, story.StoryID, false);

                userAction.Message = String.Format("tagged {0} with {1}", GetStoryLink(story), ControlHelper.RenderControl(tagList));
                userAction.Save();
            }
            return userAction;
        }
Example #8
0
 /// <summary>
 /// Binds this tag cloud control to a list of weighted tags.
 /// </summary>
 /// <remarks>Callers can use the TagCache to retrieve a current list of tags for the current host:
 /// <code>this.TagCloud.DataBind(TagCache.GetHostTags(this.HostProfile.HohstID));</code></remarks>
 /// <param name="tags">The <seealso cref="WeightedTagList"/> to bind to.</param>
 public void DataBind(WeightedTagList tags)
 {
     this._tags = tags;
 }