diff --git a/App_LocalResources/ucSubmitNews.ascx.resx b/App_LocalResources/ucSubmitNews.ascx.resx
index 1ce9ccc..1cfc461 100755
--- a/App_LocalResources/ucSubmitNews.ascx.resx
+++ b/App_LocalResources/ucSubmitNews.ascx.resx
@@ -459,4 +459,10 @@
Upload Folder:
+
+ Select all desired tags and add to Article Tags list.
+
+
+ Re-order article tags for display, and remove existing article tags.
+
\ No newline at end of file
diff --git a/App_LocalResources/ucViewOptions.ascx.resx b/App_LocalResources/ucViewOptions.ascx.resx
index 5873c8c..69c8176 100755
--- a/App_LocalResources/ucViewOptions.ascx.resx
+++ b/App_LocalResources/ucViewOptions.ascx.resx
@@ -546,6 +546,9 @@
Category Settings
+
+ Tag Settings
+
Check categories to auto-select them on the create article screen.
@@ -1134,6 +1137,12 @@
Filter Category Submit
+
+ Use Static Tags List
+
+
+ Check to only allow existing tags to be used on submit article screen, otherwise allow article authors to create new tags while authoring an article. When checked, a list box will be used to select existing tags (similar to categories), rather then the text box used when unchecked.
+
-- All Groups --
diff --git a/Components/ArticleSettings.vb b/Components/ArticleSettings.vb
index e0ee676..3b7a832 100755
--- a/Components/ArticleSettings.vb
+++ b/Components/ArticleSettings.vb
@@ -244,6 +244,16 @@ Namespace Ventrian.NewsArticles
End Get
End Property
+ Public ReadOnly Property UseStaticTagsList() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.USE_STATIC_TAGS_LIST_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.USE_STATIC_TAGS_LIST_SETTING).ToString())
+ Else
+ Return ArticleConstants.USE_STATIC_TAGS_LIST_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
Public ReadOnly Property IncludeInPageName() As Boolean
Get
If (Settings.Contains(ArticleConstants.CATEGORY_NAME_SETTING)) Then
@@ -355,7 +365,7 @@ Namespace Ventrian.NewsArticles
End If
End Get
End Property
-
+
Public ReadOnly Property EnablePortalFiles() As Boolean
Get
If (Settings.Contains(ArticleConstants.ENABLE_PORTAL_FILES_SETTING)) Then
diff --git a/Components/Common/ArticleConstants.vb b/Components/Common/ArticleConstants.vb
index 14f3048..a7274f6 100755
--- a/Components/Common/ArticleConstants.vb
+++ b/Components/Common/ArticleConstants.vb
@@ -113,6 +113,9 @@ Namespace Ventrian.NewsArticles
Public Const CATEGORY_FILTER_SUBMIT_SETTING_DEFAULT As Boolean = False
Public Const CATEGORY_SORT_SETTING As String = "CategorySortType"
Public Const CATEGORY_SORT_SETTING_DEFAULT As CategorySortType = CategorySortType.SortOrder
+ Public Const USE_STATIC_TAGS_LIST_SETTING As String = "UseStaticTagsList"
+ Public Const USE_STATIC_TAGS_LIST_SETTING_DEFAULT As Boolean = False
+
' Category Security Settings
Public Const PERMISSION_CATEGORY_VIEW_SETTING As String = "PermissionCategoryView"
diff --git a/Components/TagController.vb b/Components/TagController.vb
index 5e24869..d6f1776 100755
--- a/Components/TagController.vb
+++ b/Components/TagController.vb
@@ -98,10 +98,10 @@ Namespace Ventrian.NewsArticles
End Sub
- Public Sub Add(ByVal articleID As Integer, ByVal tagID As Integer)
+ Public Sub Add(ByVal articleID As Integer, ByVal tagID As Integer, Optional ByVal displayOrder As Integer = 0)
RemoveCache(tagID)
- DataProvider.Instance().AddArticleTag(articleID, tagID)
+ DataProvider.Instance().AddArticleTag(articleID, tagID, displayOrder)
End Sub
diff --git a/LatestArticlesOptions.ascx b/LatestArticlesOptions.ascx
index de26251..bbbd0e6 100755
--- a/LatestArticlesOptions.ascx
+++ b/LatestArticlesOptions.ascx
@@ -218,6 +218,7 @@
+
|
diff --git a/LatestArticlesOptions.ascx.designer.vb b/LatestArticlesOptions.ascx.designer.vb
index 548c617..f4aa150 100755
--- a/LatestArticlesOptions.ascx.designer.vb
+++ b/LatestArticlesOptions.ascx.designer.vb
@@ -806,6 +806,15 @@ Namespace Ventrian.NewsArticles
'''
Protected WithEvents txtTags As Global.System.Web.UI.WebControls.TextBox
+ '''
+ '''lstTags control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lstTags As Global.System.Web.UI.WebControls.ListBox
+
'''
'''lblTags control.
'''
diff --git a/LatestArticlesOptions.ascx.vb b/LatestArticlesOptions.ascx.vb
index 5332545..00a7d88 100755
--- a/LatestArticlesOptions.ascx.vb
+++ b/LatestArticlesOptions.ascx.vb
@@ -153,6 +153,7 @@ Namespace Ventrian.NewsArticles
End If
If (drpModuleID.Items.Count > 0) Then
+ BindTags()
BindCategories()
BindCustomFields()
End If
@@ -174,12 +175,95 @@ Namespace Ventrian.NewsArticles
End Sub
+ Private Function UseStaticTagsList() As Boolean
+
+ If Not (drpModuleID.Items.Count > 0) Then
+ Return ArticleConstants.USE_STATIC_TAGS_LIST_SETTING_DEFAULT
+ End If
+
+ Dim selectedModuleValues As String() = drpModuleID.SelectedValue.Split(Convert.ToChar("-"))
+ Dim objModuleController As New ModuleController
+ Dim selectedArticlesModule As ModuleInfo = objModuleController.GetModule(Convert.ToInt32(selectedModuleValues(1)), Convert.ToInt32(selectedModuleValues(0)), False)
+
+ If Not selectedArticlesModule.ModuleSettings.Contains(ArticleConstants.USE_STATIC_TAGS_LIST_SETTING) Then
+ Return ArticleConstants.USE_STATIC_TAGS_LIST_SETTING_DEFAULT
+ End If
+
+ Return Convert.ToBoolean(selectedArticlesModule.ModuleSettings(ArticleConstants.USE_STATIC_TAGS_LIST_SETTING).ToString())
+
+ End Function
+
+ Private Sub SelectAllTags(ByVal tagIdList As String)
+
+ Dim objTagController As New TagController
+ For Each tagId As String In tagIdList.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries)
+ Dim objTag As TagInfo = objTagController.Get(Convert.ToInt32(tagId))
+
+ If objTag IsNot Nothing Then
+ Dim li As ListItem = lstTags.Items.FindByValue(objTag.Name)
+ If li IsNot Nothing Then
+ li.Selected = True
+ End If
+ End If
+ Next
+
+ End Sub
+
+ Private Sub BindTags()
+ If UseStaticTagsList() Then
+ lblTags.Visible = False
+ txtTags.Visible = False
+
+ lstTags.Visible = True
+ FillTagsList()
+ Else
+ lstTags.Visible = False
+
+ lblTags.Visible = True
+ txtTags.Visible = True
+ End If
+
+ If (Settings.Contains(ArticleConstants.LATEST_ARTICLES_TAGS)) Then
+ Dim tags As String = Settings(ArticleConstants.LATEST_ARTICLES_TAGS).ToString()
+ If (tags <> "" And drpModuleID.Items.Count > 0) Then
+ If UseStaticTagsList() Then
+ SelectAllTags(tags)
+ Else
+ Dim objTagController As New TagController()
+ For Each tag As String In tags.Split(","c)
+ Dim objTag As TagInfo = objTagController.Get(Convert.ToInt32(tag))
+ If (objTag IsNot Nothing) Then
+ If (txtTags.Text <> "") Then
+ txtTags.Text = txtTags.Text + "," + objTag.Name
+ Else
+ txtTags.Text = objTag.Name
+ End If
+ End If
+ Next
+ End If
+ End If
+ End If
+ End Sub
+
+ Private Sub FillTagsList()
+ If (drpModuleID.Items.Count > 0) Then
+ Dim objTagController As New TagController
+ Dim objTags As ArrayList = objTagController.List(Convert.ToInt32(drpModuleID.SelectedValue.Split("-"c)(1)), Null.NullInteger)
+
+ objTags.Sort()
+ lstTags.DataSource = objTags
+ lstTags.DataBind()
+ End If
+ End Sub
+
Private Sub BindSettings()
If (Settings.Contains(ArticleConstants.LATEST_ARTICLES_MODULE_ID) And Settings.Contains(ArticleConstants.LATEST_ARTICLES_TAB_ID)) Then
If Not (drpModuleID.Items.FindByValue(Settings(ArticleConstants.LATEST_ARTICLES_TAB_ID).ToString() & "-" & Settings(ArticleConstants.LATEST_ARTICLES_MODULE_ID).ToString()) Is Nothing) Then
drpModuleID.SelectedValue = Settings(ArticleConstants.LATEST_ARTICLES_TAB_ID).ToString() & "-" & Settings(ArticleConstants.LATEST_ARTICLES_MODULE_ID).ToString()
End If
+
+ BindTags()
BindCategories()
BindCustomFields()
End If
@@ -241,23 +325,6 @@ Namespace Ventrian.NewsArticles
End If
End If
- If (Settings.Contains(ArticleConstants.LATEST_ARTICLES_TAGS)) Then
- Dim objTagController As New TagController()
- Dim tags As String = Settings(ArticleConstants.LATEST_ARTICLES_TAGS).ToString()
- If (tags <> "" And drpModuleID.Items.Count > 0) Then
- For Each tag As String In tags.Split(","c)
- Dim objTag As TagInfo = objTagController.Get(Convert.ToInt32(tag))
- If (objTag IsNot Nothing) Then
- If (txtTags.Text <> "") Then
- txtTags.Text = txtTags.Text + "," + objTag.Name
- Else
- txtTags.Text = objTag.Name
- End If
- End If
- Next
- End If
- End If
-
If (rdoTagsMatchOperator.Items.Count > 0) Then
rdoTagsMatchOperator.Items(0).Selected = True
End If
@@ -599,31 +666,47 @@ Namespace Ventrian.NewsArticles
Dim tags As String = ""
If (drpModuleID.Items.Count > 0) Then
- For Each tag As String In txtTags.Text.Split(","c)
- If (tag <> "") Then
- Dim objTagController As New TagController()
- Dim objTag As TagInfo = objTagController.Get(Convert.ToInt32(drpModuleID.SelectedValue.Split("-"c)(1)), tag.ToLower())
- If (objTag IsNot Nothing) Then
- If (tags = "") Then
- tags = objTag.TagID.ToString()
- Else
- tags = tags & "," & objTag.TagID.ToString()
+ Dim objTagController As New TagController()
+
+ If UseStaticTagsList() Then
+ For Each li As ListItem In lstTags.Items
+ If li.Selected Then
+ Dim objTag As TagInfo = objTagController.Get(Convert.ToInt32(drpModuleID.SelectedValue.Split("-"c)(1)), li.Value.ToLower())
+ If (objTag IsNot Nothing) Then
+ If (tags = "") Then
+ tags = objTag.TagID.ToString()
+ Else
+ tags = tags & "," & objTag.TagID.ToString()
+ End If
End If
- Else
- objTag = New TagInfo()
- objTag.ModuleID = Convert.ToInt32(drpModuleID.SelectedValue.Split("-"c)(1))
- objTag.Name = tag
- objTag.NameLowered = tag.ToLower()
- objTag.Usages = 0
- objTag.TagID = objTagController.Add(objTag)
- If (tags = "") Then
- tags = objTag.TagID.ToString()
+ End If
+ Next
+ Else
+ For Each tag As String In txtTags.Text.Split(","c)
+ If (tag <> "") Then
+ Dim objTag As TagInfo = objTagController.Get(Convert.ToInt32(drpModuleID.SelectedValue.Split("-"c)(1)), tag.ToLower())
+ If (objTag IsNot Nothing) Then
+ If (tags = "") Then
+ tags = objTag.TagID.ToString()
+ Else
+ tags = tags & "," & objTag.TagID.ToString()
+ End If
Else
- tags = tags & "," & objTag.TagID.ToString()
+ objTag = New TagInfo()
+ objTag.ModuleID = Convert.ToInt32(drpModuleID.SelectedValue.Split("-"c)(1))
+ objTag.Name = tag
+ objTag.NameLowered = tag.ToLower()
+ objTag.Usages = 0
+ objTag.TagID = objTagController.Add(objTag)
+ If (tags = "") Then
+ tags = objTag.TagID.ToString()
+ Else
+ tags = tags & "," & objTag.TagID.ToString()
+ End If
End If
End If
- End If
- Next
+ Next
+ End If
End If
objModuleController.UpdateModuleSetting(ModuleId, ArticleConstants.LATEST_ARTICLES_TAGS, tags)
objModuleController.UpdateModuleSetting(Me.ModuleId, ArticleConstants.LATEST_ARTICLES_TAGS_MATCH_OPERATOR, rdoTagsMatchOperator.SelectedValue)
@@ -714,6 +797,7 @@ Namespace Ventrian.NewsArticles
Private Sub drpModuleID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpModuleID.SelectedIndexChanged
Try
+ BindTags()
BindCategories()
BindCustomFields()
Catch exc As Exception 'Module failed to load
diff --git a/Providers/DataProvider/DataProvider.vb b/Providers/DataProvider/DataProvider.vb
index fb898fe..2691d58 100755
--- a/Providers/DataProvider/DataProvider.vb
+++ b/Providers/DataProvider/DataProvider.vb
@@ -133,7 +133,7 @@ Namespace Ventrian.NewsArticles
Public MustOverride Sub UpdateTag(ByVal tagID As Integer, ByVal moduleID As Integer, ByVal name As String, ByVal nameLowered As String, ByVal usages As Integer)
Public MustOverride Sub DeleteTag(ByVal tagID As Integer)
- Public MustOverride Sub AddArticleTag(ByVal articleID As Integer, ByVal tagID As Integer)
+ Public MustOverride Sub AddArticleTag(ByVal articleID As Integer, ByVal tagID As Integer, Optional ByVal displayOrder As Integer = 0)
Public MustOverride Sub DeleteArticleTag(ByVal articleID As Integer)
Public MustOverride Sub DeleteArticleTagByTag(ByVal tagID As Integer)
diff --git a/Providers/DataProvider/SqlDataProvider/SqlDataProvider.vb b/Providers/DataProvider/SqlDataProvider/SqlDataProvider.vb
index 16049d2..242ca2a 100755
--- a/Providers/DataProvider/SqlDataProvider/SqlDataProvider.vb
+++ b/Providers/DataProvider/SqlDataProvider/SqlDataProvider.vb
@@ -564,8 +564,8 @@ Namespace Ventrian.NewsArticles
SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_TagDelete", tagID)
End Sub
- Public Overrides Sub AddArticleTag(ByVal articleID As Integer, ByVal tagID As Integer)
- SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_ArticleTagAdd", articleID, tagID)
+ Public Overrides Sub AddArticleTag(ByVal articleID As Integer, ByVal tagID As Integer, Optional ByVal displayOrder As Integer = 0)
+ SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DnnForge_NewsArticles_ArticleTagAdd", articleID, tagID, displayOrder)
End Sub
Public Overrides Sub DeleteArticleTag(ByVal articleID As Integer)
diff --git a/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.vbproj b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.vbproj
index c6f3839..9d20d77 100755
--- a/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.vbproj
+++ b/Providers/DataProvider/SqlDataProvider/Ventrian.NewsArticles.SqlDataProvider.vbproj
@@ -231,6 +231,7 @@
+
diff --git a/Providers/DataProvider/SqlDataProvider/VersionMe.SqlDataProvider b/Providers/DataProvider/SqlDataProvider/VersionMe.SqlDataProvider
new file mode 100644
index 0000000..20a9772
--- /dev/null
+++ b/Providers/DataProvider/SqlDataProvider/VersionMe.SqlDataProvider
@@ -0,0 +1,62 @@
+-- Add SortOrder column to DnnForge_NewsArticles_ArticleTag
+IF (SELECT TOP 1 c.column_id
+ FROM sys.tables t
+ JOIN sys.all_columns c ON t.object_id = c.object_id
+ WHERE t.name = 'DnnForge_NewsArticles_ArticleTag' AND c.name = 'DisplayOrder') IS NULL
+BEGIN
+
+ ALTER TABLE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag
+ ADD DisplayOrder INT
+
+ -- Backfill existing article tags
+ UPDATE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag
+ SET DisplayOrder = 0
+
+END
+GO
+
+-- Add DisplayOrder param to DnnForge_NewsArticles_ArticleTagAdd store procedure
+ALTER PROCEDURE {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTagAdd
+ @ArticleID int,
+ @TagID int,
+ @DisplayOrder int
+AS
+IF( (SELECT COUNT(*) FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag WHERE ArticleID = @ArticleID and TagID = @TagID) = 0 )
+BEGIN
+ INSERT INTO
+ {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag(ArticleID, TagID, DisplayOrder)
+ VALUES(@ArticleID, @TagID, @DisplayOrder)
+
+ UPDATE
+ {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag
+ SET
+ Usages = (select count(*) from {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag pt where pt.TagID = @TagID)
+ WHERE
+ TagID = @TagID
+END
+GO
+
+-- Alter Ventrian_NewsArticles_SplitTags function to order article tags by DisplayOrder field
+ALTER FUNCTION {databaseOwner}{objectQualifier}Ventrian_NewsArticles_SplitTags
+(@ArticleID int)
+RETURNS nvarchar(2000)
+AS
+ BEGIN
+
+ DECLARE @p_str nvarchar(2000)
+ SET @p_str = ''
+
+ SELECT @p_str = @p_str + ',' + CAST(t.[Name] AS NVARCHAR(50))
+ FROM {databaseOwner}{objectQualifier}DnnForge_NewsArticles_Tag t, {databaseOwner}{objectQualifier}DnnForge_NewsArticles_ArticleTag at
+ WHERE t.TagID = at.TagID and at.ArticleID = @ArticleID
+ ORDER BY at.DisplayOrder
+
+ IF( LEN(@p_str) > 0 )
+ BEGIN
+ SELECT @p_str = SUBSTRING(@p_str, 2, (LEN(@p_str)-1))
+ END
+
+ RETURN LTRIM(@p_str)
+
+END
+GO
\ No newline at end of file
diff --git a/ucEditTags.ascx.vb b/ucEditTags.ascx.vb
index 5f67871..f33ba90 100755
--- a/ucEditTags.ascx.vb
+++ b/ucEditTags.ascx.vb
@@ -17,7 +17,10 @@ Namespace Ventrian.NewsArticles
Localization.LocalizeDataGrid(grdTags, Me.LocalResourceFile)
- grdTags.DataSource = objTagController.List(Me.ModuleId, Null.NullInteger)
+ Dim objTags As ArrayList = objTagController.List(Me.ModuleId, Null.NullInteger)
+
+ objTags.Sort()
+ grdTags.DataSource = objTags
grdTags.DataBind()
If (grdTags.Items.Count > 0) Then
diff --git a/ucSubmitNews.ascx b/ucSubmitNews.ascx
index 148802b..1312e51 100755
--- a/ucSubmitNews.ascx
+++ b/ucSubmitNews.ascx
@@ -224,12 +224,31 @@
Display="None" ErrorMessage="Category is Required." Enabled="False" ResourceKey="valCategoriesRequired.ErrorMessage" SetFocusOnError="true" />
+
+
+
+ |
+
- |
-
-
+ | |
+
+
|
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+
+ |
diff --git a/ucSubmitNews.ascx.designer.vb b/ucSubmitNews.ascx.designer.vb
index bee8470..f83e413 100755
--- a/ucSubmitNews.ascx.designer.vb
+++ b/ucSubmitNews.ascx.designer.vb
@@ -662,6 +662,15 @@ Namespace Ventrian.NewsArticles
'''
Protected WithEvents trTags As Global.System.Web.UI.HtmlControls.HtmlTableRow
+ '''
+ '''tdTxtTagsTitle control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tdTxtTagsTitle As Global.System.Web.UI.HtmlControls.HtmlTableCell
+
'''
'''plTags control.
'''
@@ -671,6 +680,15 @@ Namespace Ventrian.NewsArticles
'''
Protected WithEvents plTags As Global.System.Web.UI.UserControl
+ '''
+ '''tdTxtTags control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tdTxtTags As Global.System.Web.UI.HtmlControls.HtmlTableCell
+
'''
'''txtTags control.
'''
@@ -689,6 +707,114 @@ Namespace Ventrian.NewsArticles
'''
Protected WithEvents lblTags As Global.System.Web.UI.WebControls.Label
+ '''
+ '''tdAllTagsTitle control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tdAllTagsTitle As Global.System.Web.UI.HtmlControls.HtmlTableCell
+
+ '''
+ '''plAllTags control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents plAllTags As Global.System.Web.UI.UserControl
+
+ '''
+ '''tdAllTagsList control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tdAllTagsList As Global.System.Web.UI.HtmlControls.HtmlTableCell
+
+ '''
+ '''lstTags control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lstTags As Global.System.Web.UI.WebControls.ListBox
+
+ '''
+ '''addTags control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents addTags As Global.System.Web.UI.WebControls.ImageButton
+
+ '''
+ '''replaceTags control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents replaceTags As Global.System.Web.UI.WebControls.ImageButton
+
+ '''
+ '''tdStaticTagsList control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tdStaticTagsList As Global.System.Web.UI.HtmlControls.HtmlTableCell
+
+ '''
+ '''plArticleTags control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents plArticleTags As Global.System.Web.UI.UserControl
+
+ '''
+ '''lstFinalTags control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lstFinalTags As Global.System.Web.UI.WebControls.ListBox
+
+ '''
+ '''cmdUp control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents cmdUp As Global.System.Web.UI.WebControls.ImageButton
+
+ '''
+ '''cmdDown control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents cmdDown As Global.System.Web.UI.WebControls.ImageButton
+
+ '''
+ '''cmdDeleteTag control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents cmdDeleteTag As Global.System.Web.UI.WebControls.ImageButton
+
'''
'''phPublish control.
'''
diff --git a/ucSubmitNews.ascx.vb b/ucSubmitNews.ascx.vb
index 48f9f88..c780a80 100755
--- a/ucSubmitNews.ascx.vb
+++ b/ucSubmitNews.ascx.vb
@@ -191,7 +191,14 @@ Namespace Ventrian.NewsArticles
li.Selected = True
End If
Next
- txtTags.Text = objArticle.Tags
+
+ If ArticleSettings.UseStaticTagsList Then
+ SelectAllTags(objArticle.Tags)
+ CreateFinalTags(objArticle.Tags)
+ Else
+ txtTags.Text = objArticle.Tags
+ End If
+
Dim objPageController As New PageController
Dim pages As ArrayList = objPageController.GetPageList(_articleID)
@@ -336,6 +343,60 @@ Namespace Ventrian.NewsArticles
End Sub
+ Private Sub BindTags()
+
+ If ArticleSettings.UseStaticTagsList Then
+ tdTxtTagsTitle.Visible = False
+ tdTxtTags.Visible = False
+ FillTagsList()
+ Else
+ tdAllTagsTitle.Visible = False
+ tdAllTagsList.Visible = False
+ tdStaticTagsList.Visible = False
+ End If
+
+ End Sub
+
+ Private Sub FillTagsList()
+
+ Dim objTagController As New TagController
+ Dim objTags As ArrayList = objTagController.List(ModuleId, Null.NullInteger)
+
+ objTags.Sort()
+ lstTags.DataSource = objTags
+ lstTags.DataBind()
+
+ End Sub
+
+ Private Sub SelectAllTags(ByVal tagList As String)
+
+ Dim objTagController As New TagController
+ For Each tag As String In tagList.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries)
+ Dim objTag As TagInfo = objTagController.Get(ModuleId, tag)
+
+ If objTag IsNot Nothing Then
+ Dim li As ListItem = lstTags.Items.FindByValue(objTag.Name)
+ If li IsNot Nothing Then
+ li.Selected = True
+ End If
+ End If
+ Next
+
+ End Sub
+
+ Private Sub CreateFinalTags(ByVal tagList As String)
+
+ Dim objTagController As New TagController
+ For Each tag As String In tagList.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries)
+ Dim objTag As TagInfo = objTagController.Get(ModuleId, tag)
+
+ If objTag IsNot Nothing Then
+ lstFinalTags.Items.Add(objTag.Name)
+ End If
+ Next
+
+ End Sub
+
Private Sub BindCustomFields()
Dim objCustomFieldController As New CustomFieldController()
@@ -372,7 +433,7 @@ Namespace Ventrian.NewsArticles
Public Function GetAuthorList(ByVal moduleID As Integer) As ArrayList
- Dim moduleSettings As Hashtable = Common.GetModuleSettings(moduleId)
+ Dim moduleSettings As Hashtable = Common.GetModuleSettings(moduleID)
Dim distributionList As String = ""
Dim userList As New ArrayList
@@ -1145,30 +1206,49 @@ Namespace Ventrian.NewsArticles
Dim objLinkedArticle As ArticleInfo = objArticleController.GetArticle(Convert.ToInt32(drpMirrorArticle.SelectedValue))
If (objLinkedArticle IsNot Nothing) Then
- txtTags.Text = objLinkedArticle.Tags
+ If ArticleSettings.UseStaticTagsList Then
+ SelectAllTags(objLinkedArticle.Tags)
+ CreateFinalTags(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.UseStaticTagsList Then
+ Dim order As Integer = 0
+
+ For Each li As ListItem In lstFinalTags.Items
+ order = order + 1
+
+ Dim objTag As TagInfo = objTagController.Get(ModuleId, li.Value)
- objTagController.Add(articleID, objTag.TagID)
+ If objTag IsNot Nothing Then
+ objTagController.Add(articleID, objTag.TagID, order)
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 +1597,7 @@ Namespace Ventrian.NewsArticles
BindStatus()
BindCategories()
+ BindTags()
SetVisibility()
BindArticle()
SetValidationGroup()
@@ -1927,6 +2008,95 @@ Namespace Ventrian.NewsArticles
End Sub
+ Private Sub replaceTags_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles replaceTags.Click
+
+ If lstTags.Items.Count > 0 Then
+ lstFinalTags.Items.Clear()
+ End If
+
+ For Each li As ListItem In lstTags.Items
+ If (li.Selected) Then
+ li.Selected = False
+ lstFinalTags.Items.Add(li)
+ End If
+ Next
+
+ End Sub
+
+ Private Sub addTags_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addTags.Click
+
+ For Each li As ListItem In lstTags.Items
+ If (li.Selected) Then
+
+ li.Selected = False
+ If Not lstFinalTags.Items.Contains(li) Then
+
+ lstFinalTags.Items.Add(li)
+
+ End If
+
+ End If
+ Next
+
+ End Sub
+
+
+ Private Sub cmdUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdUp.Click
+
+ moveListItem(-1)
+
+ End Sub
+
+ Private Sub cmdDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDown.Click
+
+ moveListItem(1)
+
+ End Sub
+
+ Private Sub moveListItem(direction As Integer)
+
+ Try
+ With Me.lstFinalTags
+ Dim selectedIndex As Integer = .SelectedIndex
+ Dim selectedItem As ListItem = .SelectedItem
+ Dim totalItems As Integer = .Items.Count
+
+ ' No selected item
+ If (selectedItem Is Nothing Or selectedIndex < 0) Then
+ Return
+ End If
+
+ ' Calculate New index using direction
+ Dim newIndex As Integer = selectedIndex + direction
+
+ ' New Index out of range
+ If (newIndex < 0 Or newIndex >= totalItems) Then
+ Return
+ End If
+
+ ' Remove old element
+ .Items.Remove(selectedItem)
+
+ ' Insert into New position
+ .Items.Insert(newIndex, selectedItem)
+
+ ' Restore selection
+ .SelectedIndex = newIndex
+ End With
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Private Sub cmdDeleteTag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDeleteTag.Click
+
+ If lstFinalTags.SelectedItem IsNot Nothing Then
+ lstFinalTags.Items.Remove(lstFinalTags.SelectedItem)
+ End If
+
+ End Sub
+
Private Sub cmdSaveArticle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSaveArticle.Click
Try
diff --git a/ucViewOptions.ascx b/ucViewOptions.ascx
index 63205e8..525abb4 100755
--- a/ucViewOptions.ascx
+++ b/ucViewOptions.ascx
@@ -177,6 +177,16 @@
+
+
+