-
Notifications
You must be signed in to change notification settings - Fork 24
Static Tags List #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static Tags List #60
Changes from 4 commits
d609bd9
b3ce070
e6b572c
0a740ae
0f641a8
de8c205
6ae9893
89e0f16
a8a1eef
30da239
fc8772b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,7 +191,13 @@ Namespace Ventrian.NewsArticles | |
li.Selected = True | ||
End If | ||
Next | ||
txtTags.Text = objArticle.Tags | ||
|
||
If (ArticleSettings.UseStaticTagsListSubmit) Then | ||
SelectTags(objArticle.Tags) | ||
Else | ||
txtTags.Text = objArticle.Tags | ||
End If | ||
|
||
|
||
Dim objPageController As New PageController | ||
Dim pages As ArrayList = objPageController.GetPageList(_articleID) | ||
|
@@ -336,6 +342,38 @@ Namespace Ventrian.NewsArticles | |
|
||
End Sub | ||
|
||
Private Sub BindTags() | ||
If (ArticleSettings.UseStaticTagsListSubmit) Then | ||
txtTags.Visible = False | ||
lblTags.Visible = False | ||
|
||
Dim objTagController As New TagController | ||
Dim objTags As ArrayList = objTagController.List(ModuleId, Null.NullInteger) | ||
|
||
objTags.Sort() | ||
lstTags.DataSource = objTags | ||
lstTags.DataBind() | ||
Else | ||
lstTags.Visible = False | ||
End If | ||
End Sub | ||
|
||
Private Sub SelectTags(ByVal tagList As String) | ||
Dim objTagController As New TagController | ||
For Each tag As String In tagList.Split(","c) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to check for the case when Also, consider using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, And good call 👍 |
||
If (tag <> "") Then | ||
Dim objTag As TagInfo = objTagController.Get(ModuleId, tag) | ||
|
||
If Not (objTag Is Nothing) Then | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
Dim li As ListItem = lstTags.Items.FindByValue(objTag.Name) | ||
If Not (li Is Nothing) Then | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
li.Selected = True | ||
End If | ||
End If | ||
End If | ||
Next | ||
End Sub | ||
|
||
Private Sub BindCustomFields() | ||
|
||
Dim objCustomFieldController As New CustomFieldController() | ||
|
@@ -1145,30 +1183,46 @@ Namespace Ventrian.NewsArticles | |
Dim objLinkedArticle As ArticleInfo = objArticleController.GetArticle(Convert.ToInt32(drpMirrorArticle.SelectedValue)) | ||
|
||
If (objLinkedArticle IsNot Nothing) Then | ||
txtTags.Text = objLinkedArticle.Tags | ||
If (ArticleSettings.UseStaticTagsListSubmit) Then | ||
SelectTags(objLinkedArticle.Tags) | ||
Else | ||
txtTags.Text = objLinkedArticle.Tags | ||
End If | ||
End If | ||
End If | ||
|
||
Dim objTagController As New TagController | ||
objTagController.DeleteArticleTag(articleID) | ||
|
||
If (txtTags.Text <> "") Then | ||
Dim tags As String() = txtTags.Text.Split(","c) | ||
For Each tag As String In tags | ||
If (tag <> "") Then | ||
Dim objTag As TagInfo = objTagController.Get(ModuleId, tag) | ||
|
||
If (objTag Is Nothing) Then | ||
objTag = New TagInfo | ||
objTag.Name = tag | ||
objTag.NameLowered = tag.ToLower() | ||
objTag.ModuleID = ModuleId | ||
objTag.TagID = objTagController.Add(objTag) | ||
End If | ||
If (ArticleSettings.UseStaticTagsListSubmit) Then | ||
For Each li As ListItem In lstTags.Items | ||
If (li.Selected) Then | ||
Dim objTag As TagInfo = objTagController.Get(ModuleId, li.Value) | ||
|
||
objTagController.Add(articleID, objTag.TagID) | ||
If Not (objTag Is Nothing) Then | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
objTagController.Add(articleID, objTag.TagID) | ||
End If | ||
End If | ||
Next | ||
Else | ||
If (txtTags.Text <> "") Then | ||
Dim tags As String() = txtTags.Text.Split(","c) | ||
For Each tag As String In tags | ||
If (tag <> "") Then | ||
Dim objTag As TagInfo = objTagController.Get(ModuleId, tag) | ||
|
||
If (objTag Is Nothing) Then | ||
objTag = New TagInfo | ||
objTag.Name = tag | ||
objTag.NameLowered = tag.ToLower() | ||
objTag.ModuleID = ModuleId | ||
objTag.TagID = objTagController.Add(objTag) | ||
End If | ||
|
||
objTagController.Add(articleID, objTag.TagID) | ||
End If | ||
Next | ||
End If | ||
End If | ||
|
||
End Sub | ||
|
@@ -1517,6 +1571,7 @@ Namespace Ventrian.NewsArticles | |
|
||
BindStatus() | ||
BindCategories() | ||
BindTags() | ||
SetVisibility() | ||
BindArticle() | ||
SetValidationGroup() | ||
|
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.